omerwe / polyfun

PolyFun (POLYgenic FUNctionally-informed fine-mapping)
MIT License
85 stars 21 forks source link

Issues with GWA fine-mapping #139

Closed mkoromina closed 1 year ago

mkoromina commented 1 year ago

Hi Omer,

I am trying to invoke a job during GWA-finemapping but an error occurs. The code is:python3 /path/to/finemapper.py --chr 21 --start 7000001 --end 10000001 --out /path/to/output.chr21.7000001_10000001.gz --method susie --sumstats /path/to/ldsc_run.21.snpvar_ridge_constrained.gz --n 101962 --geno /path/to/insampleLD_chr21 --memory 1 --max-num-causal 5 where the input is the output from running s-ldsc and the input for --geno flag corresponds to plink bfiles used as input to provide LD estimates.

The error is as follows: ......

[INFO]  Found 68 SNPs in target region. Computing LD in 1 chunks...
  0%|          | 0/1 [00:00<?, ?it/s]
Traceback (most recent call last):
  File "/path/to/finemapper.py", line 1275, in <module>
    df_finemap = finemap_obj.finemap(locus_start=args.start, locus_end=args.end, num_causal_snps=args.max_num_causal,
  File "/path/to/finemapper.py", line 739, in finemap
    ld_arr, df_ld_snps = self.get_ld_data(locus_start, locus_end, need_bcor=False, verbose=verbose)
  File "/path/to/finemapper.py", line 581, in get_ld_data
    ld_arr, df_ld_snps = self.compute_ld_plink(locus_start, locus_end, verbose=verbose)
  File "/path/to/finemapper.py", line 539, in compute_ld_plink
    ld_arr[chunk_i_start:chunk_i_end, chunk_i_start:chunk_i_end] = X_i.T.dot(X_i) / X_i.shape[0]
ValueError: could not broadcast input array from shape (67,67) into shape (68,68)

Could you please share some thoughts on what could be wrong in that instance?

omerwe commented 1 year ago

@mkoromina thanks for the bug report. I'm not sure why this happens... If you can share a reproducible example causing this error that would be great. Thanks!

mkoromina commented 1 year ago

Closing this as there was an issue with the plink file parsed through the --geno flag and everything runs smoothly after fixing this!