Closed freg1086 closed 2 years ago
Hi @freg1086, to make this easier to debug I modified the code to print a clearer error message that shows exactly which columns are supposedly missing. Can you please git pull the code and rerun this? Please let me know if this helps you figure out what's wrong, or if you still can't figure it out.
Hi Omer, thanks for the code modifications. I reran and got this as an error message :
Traceback (most recent call last):
File "/bin/polyfun/polyfun.py", line 849, in <module>
polyfun_obj.polyfun_main(args)
File "/bin/polyfun/polyfun.py", line 773, in polyfun_main
self.polyfun_h2_L2(args)
File "/bin/polyfun/polyfun.py", line 598, in polyfun_h2_L2
self.compute_snpvar(args, use_ridge=True)
File "/bin/polyfun/polyfun.py", line 353, in compute_snpvar
df_snpvar_chr = self.compute_snpvar_chr(args, chr_num, use_ridge=use_ridge)
File "/bin/polyfun/polyfun.py", line 302, in compute_snpvar_chr
df_annot_chr = self.load_annotations_file(args, chr_num, use_ridge)
File "/bin/polyfun/polyfun.py", line 287, in load_annotations_file
missing_annot = self.ref_ld_cnames[~np.isin(self.ref_ld_cnames, df_annot_chr.columns)]
TypeError: only integer scalar arrays can be converted to a scalar index
Still having trouble figuring the problem out, do you have any ideas?
Also, my annotation names contain dashes -. Could that interfere with the Polyfun reading process ?
Hi @freg1086,
Sorry, I didn't test my new code properly. I just fixed this error --- can you please git pull and retry?
Hi Omer, thanks for the corrections.
Here is the output error of my latest attempt :
raise ValueError('The following annotations have LD-scores but are not in any of the annotation files: %s'%(missing_annot)) ValueError: The following annotations have LD-scores but are not in any of the annotation files: [ 'zoonomia_mam_1_common_', 'zoonomia_mam_2_lowfreq_', 'zoonomia_mam_2_common_', 'zoonomia_mam_3_lowfreq_', 'zoonomia_ mam_3_common_', 'zoonomia_mam_4_lowfreq_', 'zoonomia_mam_4_common_', 'zoonomia_mam_5_lowfreq_', 'zoonomia_mam_5_common_', 'zoonomia_pri_1_lowfreq_', 'zoonomia_pri_1_common_', 'zoonomia_pri_2_lowfreq_', 'zoonomia_pri_2_common_', 'zoonomia_pri_3_lowfreq_', 'zoonomia_pri_3_common_', 'zoonomia_pri_4_lowfreq_', 'zoonomia_pri_4_common_', 'zoonomia_pri_5_lowfreq_', 'zoonomia_pri_5_common_']
As you can see, the issue seems to be the name of my annotation files. for some reason, Polyfun appends '_' to the end of some of my annotation names (others seem to work fine) and then proceeds to not finding them...I checked the header of these files as well as my inpt paths, nothing seems to be wrong...any ideas ?
Thank you for your help and sorry for all the trouble.
Hi @freg1086,
Great, we're making progress. If you could create a small reproducible example and send to me (oweissbrod@hsph.harvard.edu) I'll be better able to assist.
@freg1086 thanks for sending me the files. I think I found and fixed a bug that caused this. In a nutshell, this was caused by having >9 different annotation files, I guess you're the first to try that :)
Can you please try to git pull the latest code and see if it works now?
Hey Omer, it seems to work now, thank you very much for your help ! :)
Great! Can we close the issue?
Thanks Omer! Yes, I'm closing this one.
Hi Omer, I have a problem when using multiple custom annotation files.
So I try to compute polyfun priors for a sumstats file using the baselineLF2.2 combined with my custom annotations. Each custom annotation is a separate file, i.e., I have each annotation in a a separate folder with annot.gz, l2.ldscore.gz and l2.M files for every chromosome (1-22). A total of 14 custom annotations + 1 baseline.
Here is an extract from my launch code :
refld="baseline/baselineLF2.2.UKB." refld2="annotA/annotA.,annotB/annotB.,annotC/annotC. # and so on
Which gives the following output :
From what I understand, the error comes from line 287 of polyfun.py :
` #if we have more annotations that ref-ld, it might mean that some annotations were removed, so remove them from here as well
Not really sure, where the error comes from. I checked the column names and numbers and the correspondence between annot.gz and ldscore.gz files, everything seems to be ok.
Sorry for the long post, and thank you for your work.