more info on gl.test.heterozygosity?

11 views
Skip to first unread message

Jordyn Chace

unread,
Jul 22, 2026, 4:31:35 PM (14 days ago) Jul 22
to dartR
Hello,

I have been working with gl.test.heterozygosity (from dartR.base, I know this was also an issue with dartR), and I am confused about what the output plot is showing and about what is happening to produce it. 

I see in my plots (two photo examples attached) a blue line on x=0, but in the key that is labeled as observed, while the green line is labeled "Zero value". Is that an incorrect key or am I misunderstanding? 

Is the blue-gray distribution the newly generated null distribution and the green is the observed value? Does the distribution being off-center from x=0 mean anything specific here? (I would interpret it as an underlying cause like an imbalanced sample size is favoring one population over the other perhaps). 

Is the p-value generated from the plot labeled colors? I ask because for the plot generated in file dartR_test_het_2, the green line is well in the middle of the quantile lines, but it is given a p-value=0, which makes me wonder if the p-value is being calculated from the blue line (which is labeled observed, but I am not sure if it is correct).

Final question, do you know if the deltas are generated by doing pop2 - pop1? That would help me with some directionality stuff. 

Sorry for the confusion, I am so grateful for any clarity you can provide. 

Your friend in bioinformatics,
Jordyn 
dartR_test_het_2.png
dartR_test_het.png

Jose Luis Mijangos

unread,
Jul 23, 2026, 10:49:32 PM (13 days ago) Jul 23
to dartR
Hi Jordyn,

Thank you for your questions and for reporting that bug. You are right, the key was wrong. The blue line is zero and the green line is the observed difference, but the legend had their labels swapped. I have fixed this in the developing version, we also improved the documentation of the function. To get the corrected version:

1. Clear your RStudio environment (Session > Clear Workspace). This deletes all objects in your environment, so make sure you can recreate them from your script.
2. Restart your R session (Session > Restart R).
3. Run:

devtools::install_github("green-striped-gecko/dartR.base@dev")
library(dartRverse)

Confirm that the final message is * DONE (dartR.base). 

Google Groups sometimes changes the quotation marks in R code, so please check the quotes after pasting.

To your questions:

- The histogram is the bootstrap distribution of the difference in heterozygosity between the two populations, not a null distribution. The green line is the observed difference.
- The distribution being off zero means the two populations differ in heterozygosity. How far it sits from zero reflects the size of the difference, not a sample-size imbalance, as the estimate already corrects for sample size.
- The p-value is measured against the blue zero line, not the green observed line.
- The difference is pop1 minus pop2.

Also note that the updated function now lets you choose whether to bootstrap across individuals or across loci (boot.method), and it reports a confidence interval and an adjusted p-value for each pair.

Cheers,
Luis

Reply all
Reply to author
Forward
0 new messages