Cloufield / gwaslab

A Python package for handling and visualizing GWAS summary statistics. https://cloufield.github.io/gwaslab/
GNU General Public License v3.0
164 stars 27 forks source link

Lifting error #61

Open soumickmj opened 1 year ago

soumickmj commented 1 year ago

Hi @Cloufield I'm having a weird error while performing liftover that I cannot explain.

multiprocessing.pool.RemoteTraceback: """ Traceback (most recent call last): File "src/liftover/chain_file.pyx", line 76, in liftover.chain_file.ChainFile.getitem KeyError: '12'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/scratch/soumick.chatterjee/conda_envs/BeegFSTorchHTBeta2/lib/python3.10/multiprocessing/pool.py", line 125, in worker result = (True, func(*args, *kwds)) File "/scratch/soumick.chatterjee/conda_envs/BeegFSTorchHTBeta2/lib/python3.10/multiprocessing/pool.py", line 48, in mapstar return list(map(args)) File "/scratch/soumick.chatterjee/conda_envs/BeegFSTorchHTBeta2/lib/python3.10/site-packages/gwaslab/fixdata.py", line 1163, in liftover_variant lifted = sumstats.loc[variants_on_chrom_to_convert,[pos,status]].apply(lambda x: liftover_snv(x[[pos,status]],chrom_to_convert,converter,to_build),axis=1) File "/scratch/soumick.chatterjee/conda_envs/BeegFSTorchHTBeta2/lib/python3.10/site-packages/pandas/core/frame.py", line 8848, in apply return op.apply().finalize(self, method="apply") File "/scratch/soumick.chatterjee/conda_envs/BeegFSTorchHTBeta2/lib/python3.10/site-packages/pandas/core/apply.py", line 733, in apply return self.apply_standard() File "/scratch/soumick.chatterjee/conda_envs/BeegFSTorchHTBeta2/lib/python3.10/site-packages/pandas/core/apply.py", line 857, in apply_standard results, res_index = self.apply_series_generator() File "/scratch/soumick.chatterjee/conda_envs/BeegFSTorchHTBeta2/lib/python3.10/site-packages/pandas/core/apply.py", line 873, in apply_series_generator results[i] = self.f(v) File "/scratch/soumick.chatterjee/conda_envs/BeegFSTorchHTBeta2/lib/python3.10/site-packages/gwaslab/fixdata.py", line 1163, in lifted = sumstats.loc[variants_on_chrom_to_convert,[pos,status]].apply(lambda x: liftover_snv(x[[pos,status]],chrom_to_convert,converter,to_build),axis=1) File "/scratch/soumick.chatterjee/conda_envs/BeegFSTorchHTBeta2/lib/python3.10/site-packages/gwaslab/fixdata.py", line 1141, in liftover_snv results = converter[chrom][pos_0_based] File "src/liftover/chain_file.pyx", line 78, in liftover.chain_file.ChainFile.getitem KeyError: 'chr12' """

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/center/genomics/soumick/fede/manipulate_sumstats/manipulate_sumstats.py", line 92, in manipulator.liftover(n_threads=args.n_threads) File "/center/genomics/soumick/fede/manipulate_sumstats/manipulate_sumstats.py", line 46, in liftover self.sumstats.liftover(n_cores=n_threads, File "/scratch/soumick.chatterjee/conda_envs/BeegFSTorchHTBeta2/lib/python3.10/site-packages/gwaslab/Sumstats.py", line 379, in liftover self.data = parallelizeliftovervariant(self.data,from_build=from_build, to_build=to_build, log=self.log,**args) File "/scratch/soumick.chatterjee/conda_envs/BeegFSTorchHTBeta2/lib/python3.10/site-packages/gwaslab/fixdata.py", line 1192, in parallelizeliftovervariant sumstats.loc[:,[chrom,pos,status]] = pd.concat(pool.map(partial(func,chrom=chrom,pos=pos,from_build=from_build,to_build=to_build,status=status),df_split)) File "/scratch/soumick.chatterjee/conda_envs/BeegFSTorchHTBeta2/lib/python3.10/multiprocessing/pool.py", line 367, in map return self._map_async(func, iterable, mapstar, chunksize).get() File "/scratch/soumick.chatterjee/conda_envs/BeegFSTorchHTBeta2/lib/python3.10/multiprocessing/pool.py", line 774, in get raise self._value KeyError: 'chr12'

Any idea?

Thanks :)

Cloufield commented 1 year ago

Hi, Sorry that I might need more information to pinpoint the error. Would you please provide some context (your script and sample data)? Thanks.