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

Error running bgen file: ImportError: libbgen.so.3 #203

Open
onebeingmay opened this issue Jan 17, 2025 · 3 comments
Open

Error running bgen file: ImportError: libbgen.so.3 #203

onebeingmay opened this issue Jan 17, 2025 · 3 comments

Comments

@onebeingmay
Copy link

Hi MetaXcan team,
I am trying to run MetaXcan/software/Predict.py on UKB imputed genotypes (bgen files) but got an error. This error also happened to the example data you provided. Specifically, when I ran:

#setup environment
git clone https://github.com/hakyimlab/MetaXcan.git
conda env create -f MetaXcan/software/conda_env.yaml
conda activate imlabtools

#unpack the sample data
tar -xvpf models/predixcan_sample_data.tar --no-same-owner 
cd /home/dnanexus/data
METAXCAN=/home/dnanexus/MetaXcan/software

#bgen input
python3 $METAXCAN/Predict.py \
--model_db_path models/gtex_v8_en/en_Whole_Blood.db \
--bgen_genotypes 1000G_hg37_bgen/chr22.bgen \
--bgen_use_rsid \
--prediction_output test_outputs/bgen_1000G_hg37_en/Whole_Blood__predict.txt \
--prediction_summary_output test_outputs/bgen_1000G_hg37_en/Whole_Blood__summary.txt \
--verbosity 8 \
--throw

The output was:

INFO - Loading samples
Traceback (most recent call last):
File "/home/dnanexus/MetaXcan/software/Predict.py", line 272, in
run(args)
File "/home/dnanexus/MetaXcan/software/Predict.py", line 160, in run
samples = load_samples(args)
File "/home/dnanexus/MetaXcan/software/Predict.py", line 90, in load_samples
from metax.genotype import BGENGenotype
File "/home/dnanexus/MetaXcan/software/metax/genotype/BGENGenotype.py", line 1, in
import bgen_reader
File "/home/dnanexus/miniconda3/envs/imlabtools/lib/python3.7/site-packages/bgen_reader/init.py", line 26, in
from ._metadata import create_metafile
File "/home/dnanexus/miniconda3/envs/imlabtools/lib/python3.7/site-packages/bgen_reader/_metadata.py", line 4, in
from ._bgen import bgen_file
File "/home/dnanexus/miniconda3/envs/imlabtools/lib/python3.7/site-packages/bgen_reader/_bgen.py", line 3, in
from ._ffi import ffi, lib
ImportError: libbgen.so.3: cannot open shared object file: No such file or directory

I can run the vcf sample data without problem. Any idea?
Thank you!

@Fnyasimi
Copy link
Collaborator

Kindly ensure the bgen reader is installed properly with the correct version as defined here.

@onebeingmay
Copy link
Author

Kindly ensure the bgen reader is installed properly with the correct version as defined here.

Hi Fnyasimi,
Are you referring to

conda env create -f /path/to/this/repo/software/conda_env.yaml
conda activate imlabtools

I can confirm I ran this to set up a new environment.
Thanks

@Fnyasimi
Copy link
Collaborator

Fnyasimi commented Feb 3, 2025

Then you need to ensure this library libbgen.so.3: is available within your path

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