Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Index error/ list index out of range #466

Open
ruimin-1212 opened this issue Nov 18, 2024 · 3 comments
Open

Index error/ list index out of range #466

ruimin-1212 opened this issue Nov 18, 2024 · 3 comments

Comments

@ruimin-1212
Copy link

I am trying to calculate heritability and getting this error:
Call:
./ldsc.py
--h2 hearta.sumstats.gz
--ref-ld-chr aCM/Add_all.chr3
--out aCM--print-coefficients
--overlap-annot
--frqfile-chr 1000G_Phase3_frq/1000G.EUR.QC.3
--w-ld-chr 1000G_Phase3_weights_hm3_no_MHC/weights.hm3_noMHC.3

Beginning analysis at Mon Nov 18 19:47:34 2024
Reading summary statistics from hearta.sumstats.gz ...
Read summary statistics for 1151077 SNPs.
Reading reference panel LD Score from aCM/Add_all.chr3[1-22] ... (ldscore_fromlist)
Traceback (most recent call last):
File "./ldsc.py", line 644, in
sumstats.estimate_h2(args, log)
File "/home/data/t070533/hrm/New_SSC/ldsc/ldscore/sumstats.py", line 326, in estimate_h2
args, log, args.h2)
File "/home/data/t070533/hrm/New_SSC/ldsc/ldscore/sumstats.py", line 243, in _read_ld_sumstats
ref_ld = _read_ref_ld(args, log)
File "/home/data/t070533/hrm/New_SSC/ldsc/ldscore/sumstats.py", line 82, in _read_ref_ld
'reference panel LD Score', ps.ldscore_fromlist)
File "/home/data/t070533/hrm/New_SSC/ldsc/ldscore/sumstats.py", line 152, in _read_chr_split_files
out = parsefunc(_splitp(chr_arg), _N_CHR, **kwargs)
File "/home/data/t070533/hrm/New_SSC/ldsc/ldscore/parse.py", line 103, in ldscore_fromlist
y = ldscore(fh, num)
File "/home/data/t070533/hrm/New_SSC/ldsc/ldscore/parse.py", line 147, in ldscore
first_fh = sub_chr(fh, chrs[0]) + suffix
IndexError: list index out of range
Thanks for all!!

@ruimin-1212
Copy link
Author

Most interestingly, chr1 and chr2 can run the script, but it failed from the thrid chromosome,

@kylagelev
Copy link

kylagelev commented Nov 26, 2024

Hi, so I was running into the same issue, but I was able to resolve it by removing the ${chr} value. I was attempting to submit a job that would run in parallel per each chr, but it looks like the heritability estimate is one command that runs through each chromosome. e.g. in your call:

./ldsc.py
--h2 hearta.sumstats.gz
--ref-ld-chr aCM/Add_all.chr3
--out aCM--print-coefficients
--overlap-annot
--frqfile-chr 1000G_Phase3_frq/1000G.EUR.QC.3
--w-ld-chr 1000G_Phase3_weights_hm3_no_MHC/weights.hm3_noMHC.3

Don't include the 3. So run it like so:
./ldsc.py
--h2 hearta.sumstats.gz
--ref-ld-chr aCM/Add_all.chr
--out aCM--print-coefficients
--overlap-annot
--frqfile-chr 1000G_Phase3_frq/1000G.EUR.QC.
--w-ld-chr 1000G_Phase3_weights_hm3_no_MHC/weights.hm3_noMHC.

Not sure if that's what you were doing as well, but that's how I resolved the error on my end.

@ruimin-1212
Copy link
Author

ruimin-1212 commented Nov 26, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants