Maggi-Chen / Inspector

A tool for evaluating long-read de novo assembly results
MIT License
24 stars 9 forks source link

Inspector error while collecting info from contigs #23

Closed jsoghigian closed 1 year ago

jsoghigian commented 1 year ago

Hi,

We've been using inspector without trouble for a few months now. When running on one of our genomes, we're getting the following error (previous few lines included):

Collect info from ctg005350
Collect info from ctg005510
Collect info from ctg005670
Collect info from ctg005850
Collect info from ctg006080
Collect info from ctg006310
Collect info from ctg006510
Traceback (most recent call last):
  File "/work/soghigian_lab/apps/conda/envs/ins/Inspector/inspector.py", line 149, in <module>
    debreak_cluster.genotype(cov,denovo_args.outpath)
  File "/work/soghigian_lab/apps/conda/envs/ins/Inspector/debreak_merge_clustering.py", line 314, in genotype
    leftcov=samfile.count(chrom,max(start-100,0),start,read_callback='all')
  File "pysam/calignmentfile.pyx", line 1081, in pysam.calignmentfile.AlignmentFile.count (pysam/calignmentfile.c:12699)
TypeError: count() got an unexpected keyword argument 'read_callback'

Any idea how to resolve this?

jsoghigian commented 1 year ago

Note: This error only occurs for one user - we've tried separate installs (we are working in a cluster environment) and can't figure out what is causing the error.

Further testing indicates this error is after collecting info from contigs. The file "assembly_errors.bed" is created, which is one of the last things done before the crash. Hard to tell much more than that. If the flag "--skip_structural_error" is used, then inspector completes, but we're interested in the structural errors.

Maggi-Chen commented 1 year ago

Hi,

Based on the error log, it seems your pysam has a different version. Could you try installing pysam=0.16.0.1 and try again? Thanks!

Best, Maggie

jsoghigian commented 1 year ago

Hi Maggie,

Thanks... Something was very wonky with my environment... When I activate the appropriate inspector environment (installed with dependencies specified on the readme page), and do conda list, I got this:

# packages in environment at /work/soghigian_lab/apps/conda/envs/ins:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                 conda_forge    conda-forge
_openmp_mutex             4.5                       2_gnu    conda-forge
bzip2                     1.0.8                h7f98852_4    conda-forge
c-ares                    1.18.1               h7f98852_0    conda-forge
ca-certificates           2022.5.18.1          ha878542_0    conda-forge
certifi                   2020.6.20          pyhd3eb1b0_3    anaconda
curl                      7.76.1               h979ede3_1    conda-forge
flye                      2.8.3            py27h6a42192_1    bioconda
htslib                    1.9                  h4da6232_3    bioconda
intel-openmp              2022.0.1          h06a4308_3633    anaconda
krb5                      1.17.2               h926e7f8_0    conda-forge
ld_impl_linux-64          2.36.1               hea4e1c9_2    conda-forge
libcurl                   7.76.1               hc4aaa36_1    conda-forge
libdeflate                1.7                  h7f98852_5    conda-forge
libedit                   3.1.20191231         h46ee950_2    conda-forge
libev                     4.33                 h516909a_1    conda-forge
libffi                    3.2.1             he1b5a44_1007    conda-forge
libgcc-ng                 12.1.0              h8d9b700_16    conda-forge
libgfortran-ng            7.5.0               ha8ba4b0_17    anaconda
libgfortran4              7.5.0               ha8ba4b0_17    anaconda
libgomp                   12.1.0              h8d9b700_16    conda-forge
libnghttp2                1.47.0               h727a467_0    conda-forge
libssh2                   1.10.0               ha56f1ee_2    conda-forge
libstdcxx-ng              12.1.0              ha89aaad_16    conda-forge
libzlib                   1.2.12               h166bdaf_0    conda-forge
minimap2                  2.15                 h84994c4_1    bioconda
mkl                       2022.0.1           h06a4308_117    anaconda
ncurses                   6.1               hf484d3e_1002    conda-forge
numpy                     1.14.2           py27hdbf6ddf_0    anaconda
openssl                   1.1.1o               h166bdaf_0    conda-forge
pandas                    0.24.2           py27he6710b0_0    anaconda
patsy                     0.5.1                    py27_0    anaconda
pip                       20.1.1             pyh9f0ad1d_0    conda-forge
**pysam                     0.16.0.1         py27hc729bab_3    bioconda**
python                    2.7.15          h5a48372_1011_cpython    conda-forge
python-dateutil           2.8.2              pyhd3eb1b0_0    anaconda
python_abi                2.7                    1_cp27mu    conda-forge
pytz                      2021.3             pyhd3eb1b0_0    anaconda
readline                  8.0                  h46ee950_1    conda-forge
samtools                  1.9                 h10a08f8_12    bioconda
scipy                     1.1.0            py27hfc37229_0    anaconda
setuptools                44.0.0                   py27_0    conda-forge
six                       1.16.0             pyhd3eb1b0_1    anaconda
sqlite                    3.32.3               hcee41ef_1    conda-forge
statsmodels               0.10.1           py27hdd07704_0    anaconda
tk                        8.6.12               h27826a3_0    conda-forge
wheel                     0.37.1             pyhd8ed1ab_0    conda-forge
xz                        5.2.5                h516909a_1    conda-forge
zlib                      1.2.12               h166bdaf_0    conda-forge

But, when I entered python (correct version of 2.7.15 was showing), and printed the pysam version, I got this:

>>> print(pysam.__version__)
0.8.4

This ... confused me, to say the least. I then installed the correct pysam version via pip within python, and Inspector has passed the point where it normally fails.

I've never encountered python accessing a different package than what was installed into the environment. Clearly, somehow Python was accessing some version of pysam in my base or other environment, but this error occurred even when I deactivated my environment before activating a new one, so I'm at a loss.

Anyway, since this seems resolved, I'll close this. Thanks for your help, Maggie, and for a very useful piece of software :)