bulik / ldsc

LD Score Regression (LDSC)
GNU General Public License v3.0
652 stars 344 forks source link

Getting module parse has no attibute error #369

Open akhilpampana opened 1 year ago

akhilpampana commented 1 year ago

Hello,

I am trying to calcualate heritbaility and I am getting this issue. May I know how to resolve this?

Code: python3 dsc.py --h2 sbp_hapmap.sumstats.gz --ref-ld-chr eur_w_ld_chr/ --w-ld-chr eur_w_ld_chr/ --out sbp_h2_eur

Error: Analysis finished at Fri Feb 24 12:40:08 2023 Total time elapsed: 0.0s Traceback (most recent call last): File "ldsc.py", line 683, in sumstats.estimate_h2(args, log) File "ldscore/sumstats.py", line 326, in estimate_h2 M_annot, w_ld_cname, ref_ld_cnames, sumstats, novar_cols = _read_ld_sumstats(args, log, args.h2) File "ldscore/sumstats.py", line 243, in _read_ld_sumstats sumstats = _read_sumstats(args, log, fh, alleles=alleles, dropna=dropna) File "ldscore/sumstats.py", line 164, in _read_sumstats sumstats = ps.sumstats(fh, alleles=alleles, dropna=dropna) AttributeError: module 'parse' has no attribute 'sumstats'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "ldsc.py", line 694, in log.log( traceback.format_exc(ex) ) File "/share/apps/rc/software/Anaconda3/2022.05/lib/python3.9/traceback.py", line 167, in format_exc return "".join(format_exception(*sys.exc_info(), limit=limit, chain=chain)) File "/share/apps/rc/software/Anaconda3/2022.05/lib/python3.9/traceback.py", line 120, in format_exception return list(TracebackException( File "/share/apps/rc/software/Anaconda3/2022.05/lib/python3.9/traceback.py", line 517, in init self.stack = StackSummary.extract( File "/share/apps/rc/software/Anaconda3/2022.05/lib/python3.9/traceback.py", line 340, in extract if limit >= 0: TypeError: '>=' not supported between instances of 'AttributeError' and 'int'

I will be waiting for your response.

Regards Akhil

RXMa-Bio-software commented 4 days ago

I have the same problem, have you solved it?

akhilpampana commented 4 days ago

I have performed these steps and resolved each step/error independently after that.

  • Load anaconda2 and run the analysis
  • Convert everything to python2 and check for indentations
  • Remove print function in ldsc - Removed it as its printing null error as its printing dimension of the matrix.
  • Keep paths for reference
  • Install all packages required to run in Python –user
  • pip3 install parse –user
  • pip3 install regressions –user
  • pip3 install bitarray –user
  • pip3 install jackknife –user
  • pip3 install bitarray --user
RXMa-Bio-software commented 2 days ago

Thank you for your reply. I have installed all packages, and ldsc.py -h can print a list of all command-line options. However, when running ”python3 ldsc.py --h2 50_irnt.gwas.imputed_v3.both_sexes.tsv.bgz --w-ld-chr SNP. --overlap-annot --ref-ld-chr SNP --frqfile-chr SNP --out out“ , an error AttributeError: module 'parse' has no attribute 'sumstats' will appear; and when I run the ldsc.py command alone, it shows ModuleNotFoundError: No module named 'ldscore'. Does this mean that my ldsc installation actually failed?

akhilpampana commented 2 days ago

No, you should have an LD score folder, meaning the installation works as far as I understand.

In the ldsc.py code, do something like this

from future import division import sys import ldscore.ldscore as ld import ldscore.parse as ps import ldscore.sumstats as sumstats import ldscore.regressions as reg import numpy as np import pandas as pd from subprocess import call from itertools import product import time import sys import traceback import argparse from functools import reduce

at the import part of the code in ldsc.py.