jgx65 / hierfstat

the hierfstat package
24 stars 14 forks source link

Cannot calculate global Fst with confidence intervals #41

Closed TharinduTS closed 3 years ago

TharinduTS commented 3 years ago

Hi, This may be an issue from my side or I did not see something simple. But I was trying to calculate global Fst with some samples for days. I tried a number of different methods and still could not obtain what I want.

I could read my files and calculate pairwise Fst with confidence intervals with something like

pairwise_all_chrs<-boot.ppfst(dat = my_samples,nboot = 100,quant=c(0.025,0.975))

I could also calculate global Fst, but without confidence intervals.

I am using the same file("my_samples" in this case) as I used for two above calculations which worked fine. Therefore I guess it is not something wrong with my file. But still cannot obtain global Fst with confidence intervals.

As an example when I try a command like following,(also tried with quant)

f_stats<-boot.vc(my_samples[,c(1)],my_samples[,-c(1)],nboot=100)

it gives

Error in solve.default(k, meansq) : system is computationally singular: reciprocal condition number = 0 Calls: boot.vc ... rbind -> varcomp -> apply -> FUN -> solve -> solve.default Execution halted

I tried changing these commands according to different instructions dozen of times with no luck.

Can you please tell me how I can calculate global Fst with confidence intervals using the same data. I can provide you with my files if it helps.

jgx65 commented 3 years ago

Hi @TharinduTS , sorry to hear this. could you post a (small) example dataset generating this behavior? Usual culprits are untyped loci for all individuals in a sample, but this should also affect boot.ppfst

jgx65 commented 3 years ago

What is the result of wc(my_samples)$sigma.loc ? (these are the values you want to bootstrap)

TharinduTS commented 3 years ago

Hi, Thanks for getting back. Please find the attached dataset which I have troubles with.

Thanks.

On Nov 11, 2020, at 3:26 AM, Jerome Goudet notifications@github.com wrote:

Hi @TharinduTS https://github.com/TharinduTS , sorry to hear this. could you post a (small) example dataset generating this behavior? Usual culprits are untyped loci for all individuals in a sample, but this should also affect boot.ppfst

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jgx65/hierfstat/issues/41#issuecomment-725280337, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANWKKRVNMEIOCQEVWNJY3B3SPJDCLANCNFSM4TROYDMA.

jgx65 commented 3 years ago

no file is attached? You mail email it to me at jerome [dot] goudet [at] unil [dot] ch if you don't feel like posting it here

jgx65 commented 3 years ago

the error came from varcomp.glob. Several of your loci (e.g. "1066") contains only NAs, and many more only a few individual typed from a single population, this is why an error is thrown. I may try to catch these in a next release, but probably a good idea to remove loci with more than 50% missing data

TharinduTS commented 3 years ago

Thanks.

On Wed, 11 Nov 2020, 4:58 pm Jerome Goudet, notifications@github.com wrote:

the error came from varcomp.glob. one of your loci ("1066") contains only NAs, this is why an error is thrown. I'll tray to catch it in a next release.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jgx65/hierfstat/issues/41#issuecomment-725684121, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANWKKRSWAJ5GLUIBTG7HY7DSPMCIXANCNFSM4TROYDMA .