Closed TeresaPegan closed 1 year ago
Hi Teresa, First thank you for trying out this module, I didn't really expect someone would start to use it at this point. I'm still trying to improve it and it is a slow work in progress, I'm glad I can have some feedback!
I've encountered this kind of error before but in another context when trying to create simulated beagle files without adding uncertainty in the genotype likelihoods (1 0 0 for example).
I think the cause of the error is that in this line, the C covariance matrix sent back by pcangsd have NaNs. But I am not sure what the root cause is in pcangsd. I'll try to think how I can improve error handling so that we can get more information.
Would you be able to send me a minimal non-working example containing 2 or 3 windows?
In the meantime, it might also be interesting to run the beagle file with pcangsd directly to try to see if it gives similar issues.
Alexis
@Rosemeis would you have any lead on where I should start looking for issues of this type?
I feel like I am missing a filtering step in the data I pass to pcangsd.covariance.emPCA
but not sure where to start.
Thanks!
I have a lead, I think I simply forgot to filter for MAF, so if any fixed markers happen this should lead to errors...
Ah, that would perfectly explain why it happens when I delete a subset of individuals! Markers that were polymorphic might be fixed in the reduced subset.
let me try to fix this and get back to you
Could you try out the maf branch with your data? I've added a min_maf
argument to the pca_window
function.
I haven't found a good way to store which loci are used or not in the final result though, I'll need to come back to that later.
Yes the MAF would be my main suspect, or potentially that all individuals have missing data (all 0.333). :-)
Best, Jonas
It works on the maf branch! Thanks so much!
Great, I'll try to find a way to store the loci list info and merge this in main.
Another really small bug that's probably not worth its own issue -- on line 570 of local_pcangsd.py, the window start indices have to be ds.window_start.values, not just ds.window_start, otherwise I get this error:
File "/home/tmpegan/anaconda3/envs/local_pcangsd/lib/python3.9/site-packages/local_pcangsd/local_pcangsd.py", line 570, in get_window_center
pos_start = ds.variant_position.values[ds.window_start]
IndexError: too many indices for array: array is 1-dimensional, but 16 were indexed
The definition of pos_stop is formatted correctly as ds.variant_position.values[ds.window_stop.values - 1] , so just a typo or something. Thanks! -Teresa
I've now merged the changes into main. There are some breaking changes though:
pca_window
with other parts of the codeDon't hesitate to open a new issue if there are other problems.
Hi @alxsimon, I am going to defend my dissertation soon and I have a chapter that uses this repository (hopefully to be submitted as a paper not long after). I wanted to ask if you have a preference about how this repository is cited and whether you have any publications/preprints on it. I can at least link the repository. Thanks! -Teresa
Hi Teresa, for the time being you can just link the repository. I have some plan to publish it in some form or another (preprint, zenodo doi or final publication) but haven't put the time in it yet. Don't hesitate to fill me in on the advancement of your manuscript, this will be an incentive for me to finish things up ;)
Hi @alxsimon, I just wanted to let you know that I have a manuscript in review that references this repository. Keep me up to date if you have a preprint or forthcoming ms to watch out for! Thanks, -Teresa
Hi Teresa, unfortunately I won't have more time to publish anything on it. Referencing the zenodo archive is enough on my side. Congrats on the manuscript and happy this could be useful to someone. Best, Alexis
Hello! Thanks so much for developing this script, it has been great for me to be able to used lostruct on my low coverage data!
I am working with a bunch of different species and for some of them, I have edited their beagle files to remove certain individuals. I run into an error with local_pcangsd with these edited beagles, and I was wondering if you have any ideas! The error is triggered by pca_window() and I've been having trouble piecing apart the code to troubleshoot it because it involves the window-based zarr methods, which I am pretty unfamiliar with.
I don't get this error with my un-edited beagles, and I have not yet found any differences between the beagles that work and those that do not, other than the fact that I removed some columns (particular individuals) from the ones that don't work.
Let me know if you have any thoughts on what I could try! Thanks so much again! -Teresa
first couple lines of a beagle file that works:
first couple lines of a beagle that does not work:
local_pcangsd code up to the point where it hits the error:
The error: