@Leo thank you so much for the explanation, I see how that makes sense!
About this
One caveat that matters more than the statistics: centromeres are megabase-scale satellite repeat, and short-read mappability there is poor. Whatever difference you find is at least partly technical -- inflated by mismapping in some regions, deflated by dropout in others -- so it's worth reporting callable/covered bases per region instead of raw interval size, and using that as the denominator.
I'm aware of it, and I'm using HiFi long reads — not that it fully accounts for the problem but at least it can be mitigated; additionally, I'm not quite aligning to centromeres from a single FASTA genome but rather to centromeres' pangenomes containing both haplotypes to consider haplotype-aware variation for this sample.
In graph space reads will be aligned to the more similar centromeric sequence between the two haplotypes which, should be the most accurate way determine from which haplotype and how many variants it bears.
I hear you and, still, myself consider this highly experimental but I wanted to give it a try since, otherwise, any linear alternative would generates not only artefacts but also a huge amount of false positives/negatives coming from the mismapping and dropouts.
About this
Related, your chr4 row looks off: 145 variants over 4.13 Mb is ~1 per 28.5 kb, while every other centromere is in the 800-2900 bp range. That's a 10-30x outlier in the opposite direction from the rest. I'd check coverage and whether that region was masked or filtered before reading anything biological into the table.
The region was not masked nor filtered, I also noticed for chr4 that huge discrepancy but that is what the approach returns... the coverage is fine — actually on the high end when compared to other chromosomes after extracting centromeric-specific reads.
Off the top of my head, my first intuition is that those reads don't align quite well to the centromere graph of chr4 for many possible reasons e. g. that region isn't well resolved in the assemblies, bigger discrepancy in size between the two haplotypes, etc.
On a different note, when running your code on my df I had to restrict it only to numeric columns and then parse back the centromeres identifiers after calculating the p.adjust values; I hope this is fine. Also, more interestingly, at what level can I fit the Apologies, stupid question, I run it on the offset(log(size)), I assume during plotting?df fields for size (size_no-cent and size_cent) before using the code block you shared; however, I didn't manage to integrate the region as a predictor. Should it be something as follow:
glm(id ~ offset(log(size)), family=poisson(), data=df)
Thanks again!