omerwe / polyfun

PolyFun (POLYgenic FUNctionally-informed fine-mapping)
MIT License
89 stars 22 forks source link

potential bug in compute_ldscores_from _chr function #54

Closed teresa-sansan closed 3 years ago

teresa-sansan commented 3 years ago

Hi Omer,

I encounter errors when trying to compute LD score for each SNP bin using the precomputed UKBB data when following the wiki page.

This is the code I ran. (polyfun) [tlin@pe2cc3-042 polyfun]$ python polyfun.py --compute-ldscores --output-prefix test_output/testrun --ld-ukb --ld-dir test_LD_cache --chr 1

This is the error message I got image

I assume the issue is due to the definition of compute_ldscores_chr in compute_ldscores_from_ld.py was applied wrongfully by polyfun.py.

In polyfun.py line 637, the args that compute_ldsocres_chr take are df_ldscores_chr = compute_ldscores_chr(df_bins_chr, ld_dir) While in compute_ldscores_from_ld line 190, this function is defined as def compute_ldscores_chr(args, df_annot_chr):

When I ran the code, the "args" that compute_ldscores_chr took was a pandas DataFrame with 34 columns (CHR, SNP, BP, A1, A2, snpvar_bin(1 to 29)). The non-existing "ukb" column causes the error shown above.

Also, in line 201 (compute_ldscores_from_ld.py): assert len(df_annot_chr['CHR'].unique()) == 1 With the second argument of compute_ldscores_chr in polyfun.py being a directory, there's no way that it can be treated as a DataFrame in compute_ldscores_from_ld.py.

Any feedback will be super helpful!

Thanks, Teresa

jdblischak commented 3 years ago

@teresa-sansan Looks like our day is going very similarly πŸ˜„

Check out the Issue #53 , which I just opened about 20 minutes ago. For a quick, temporary fix, you can checkout an older version of PolyFun:

cd polyfun
git checkout 5ce89e09e242fc436fb4215ab02975c40a282110
teresa-sansan commented 3 years ago

Haha it surely is.πŸ˜‚πŸ˜‚ Thanks for your suggestion! I'll check this out!

Best, Teresa :)

teresa-sansan commented 3 years ago

Thanks @jdblischak. It works smoothly now.☺️☺️☺️ I'll just close this issue because we are basically asking the same question. πŸ˜‚

omerwe commented 3 years ago

Hi,

As mentioned in the twin issue, I fixed the bug (but please reopen the issue if it's not fixed for you).

Thanks,

Omer

teresa-sansan commented 3 years ago

Thanks Omer for your quick fix! It is working now.😊😊😊

Best, Teresa