jodyphelan / malaria-profiler

0 stars 2 forks source link

ImportError: cannot import name 'bam_profiler' from 'pathogenprofiler' #13

Open srinkadatta opened 5 months ago

srinkadatta commented 5 months ago

I am consistently encountering an import error that states it is unable to import bam_profiler from pathogenprofiler. After examining the pathogenprofiler package, I found that there is no script or module named bam_profiler.

Could you please advise on how to resolve this issue?

jodyphelan commented 5 months ago

Hi @srinkadatta we recently did an update of pathogenprofiler so this might have rise to the error. Are you running linux or macOS?

srinkadatta commented 5 months ago

Hi @srinkadatta we recently did an update of pathogenprofiler so this might have rise to the error. Are you running linux or macOS?

I am running on linux.

jodyphelan commented 5 months ago

Try this to create a new conda environment:

wget https://raw.githubusercontent.com/jodyphelan/pathogen-profiler/dev/conda/linux-latest.txt
mamba create --name mp --file linux-latest.txt
conda activate mp
pip install --force-reinstall git+https://github.com/jodyphelan/pathogen-profiler.git@dev
pip install --force-reinstall git+https://github.com/jodyphelan/malaria-profiler.git@dev
malaria-profiler update_db

After it should hopefully work for you.

srinkadatta commented 4 months ago

Try this to create a new conda environment:

wget https://raw.githubusercontent.com/jodyphelan/pathogen-profiler/dev/conda/linux-latest.txt
mamba create --name mp --file linux-latest.txt
conda activate mp
pip install --force-reinstall git+https://github.com/jodyphelan/pathogen-profiler.git@dev
pip install --force-reinstall git+https://github.com/jodyphelan/malaria-profiler.git@dev
malaria-profiler update_db

After it should hopefully work for you.

Thank you so much for your reply. It did work fine and the tool got successfully installed, but I am encountering an error when running the commands. Here is the error message I receive after using a VCF file as an input: malaria-profiler profile -v test.ann.vcf -p p_fal -t 16 --txt --resistance_db Plasmodium_falciparum_3D7 Traceback (most recent call last): File "/home/user2/miniconda3/envs/mp/bin/malaria-profiler", line 487, in args.func(args) File "/home/user2/miniconda3/envs/mp/bin/malaria-profiler", line 104, in main_profile species_prediction = mp.get_species(args) File "/home/user2/miniconda3/envs/mp/lib/python3.10/site-packages/malaria_profiler/utils.py", line 30, in get_species return pp.set_species(args) File "/home/user2/miniconda3/envs/mp/lib/python3.10/site-packages/pathogenprofiler/cli.py", line 339, in set_species species=conf["species"] TypeError: 'NoneType' object is not subscriptable Cleaning up after failed run [12:40:42] ERROR

jodyphelan commented 4 months ago

I think there might be a typo in the name of the dabase you are giving. Try specifying _Plasmodiumfalciparum instead of _Plasmodium_falciparum3D7. So the command will be:

malaria-profiler profile -v test.ann.vcf -p p_fal -t 16 --txt --resistance_db Plasmodium_falciparum
srinkadatta commented 4 months ago

I think there might be a typo in the name of the dabase you are giving. Try specifying _Plasmodiumfalciparum instead of _Plasmodium_falciparum3D7. So the command will be:

malaria-profiler profile -v test.ann.vcf -p p_fal -t 16 --txt --resistance_db Plasmodium_falciparum

Thank you for your assistance. I am still facing an error. Here is the detailed error message: malaria-profiler profile -v test.ann.vcf.gz -p p_fal -t 16 --txt --resistance_db Plasmodium_falciparum [14:06:06] INFO Using ref file: /home/user2/miniconda3/envs/mp/share/malaria_profiler//Plasmodium_falciparum.fasta db.py:587 INFO Using gff file: /home/user2/miniconda3/envs/mp/share/malaria_profiler//Plasmodium_falciparum.gff db.py:587 INFO Using bed file: /home/user2/miniconda3/envs/mp/share/malaria_profiler//Plasmodium_falciparum.bed db.py:587 INFO Using json_db file: /home/user2/miniconda3/envs/mp/share/malaria_profiler//Plasmodium_falciparum.dr.json db.py:587 INFO Using variables file: /home/user2/miniconda3/envs/mp/share/malaria_profiler//Plasmodium_falciparum.variables.json db.py:587 INFO Using geographic_model file: /home/user2/miniconda3/envs/mp/share/malaria_profiler//Plasmodium_falciparum.geographic_model.pkl db.py:587 INFO Using ref file: /home/user2/miniconda3/envs/mp/share/malaria_profiler//Plasmodium_falciparum.fasta db.py:587 INFO Using gff file: /home/user2/miniconda3/envs/mp/share/malaria_profiler//Plasmodium_falciparum.gff db.py:587 INFO Using bed file: /home/user2/miniconda3/envs/mp/share/malaria_profiler//Plasmodium_falciparum.bed db.py:587 INFO Using json_db file: /home/user2/miniconda3/envs/mp/share/malaria_profiler//Plasmodium_falciparum.dr.json db.py:587 INFO Using variables file: /home/user2/miniconda3/envs/mp/share/malaria_profiler//Plasmodium_falciparum.variables.json db.py:587 INFO Using geographic_model file: /home/user2/miniconda3/envs/mp/share/malaria_profiler//Plasmodium_falciparum.geographic_model.pkl db.py:587 [14:06:07] INFO Running snpEff vcf.py:119 [14:06:12] INFO Loading snpEff annotations

/home/user2/.local/lib/python3.10/site-packages/sklearn/utils/init.py:17: UserWarning: A NumPy version >=1.22.4 and <1.29.0 is required for this version of SciPy (detected version 2.0.0) from scipy.sparse import issparse

A module that was compiled using NumPy 1.x cannot be run in NumPy 2.0.0 as it may crash. To support both 1.x and 2.x versions of NumPy, modules must be compiled with NumPy 2.0. Some modules may need to be rebuilt, e.g., with 'pybind11>=2.12'.

If you are a user of the module, the easiest solution will be to downgrade to 'numpy<2' or try to upgrade the affected module. We expect that some modules will need time to support NumPy 2.

Traceback (most recent call last): File "/home/user2/miniconda3/envs/mp/bin/malaria-profiler", line 487, in args.func(args) File "/home/user2/miniconda3/envs/mp/bin/malaria-profiler", line 138, in main_profile geo_classification = mp.predict_geographic_source(args) File "/home/user2/miniconda3/envs/mp/lib/python3.10/site-packages/malaria_profiler/geo_classifier.py", line 58, in predict_geographic_source gp: Geopredictor = pickle.load(open(args.conf['geographic_model'], 'rb')) File "/home/user2/.local/lib/python3.10/site-packages/sklearn/init.py", line 82, in from .base import clone File "/home/user2/.local/lib/python3.10/site-packages/sklearn/base.py", line 17, in from .utils import _IS_32BIT File "/home/user2/.local/lib/python3.10/site-packages/sklearn/utils/init.py", line 17, in from scipy.sparse import issparse File "/home/user2/miniconda3/envs/mp/lib/python3.10/site-packages/scipy/sparse/init.py", line 295, in from ._csr import * File "/home/user2/miniconda3/envs/mp/lib/python3.10/site-packages/scipy/sparse/_csr.py", line 11, in from ._sparsetools import (csr_tocsc, csr_tobsr, csr_count_blocks, ImportError: numpy.core.multiarray failed to import Cleaning up after failed run

jodyphelan commented 4 months ago

Could you send me the output of the following command?:

conda list