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

TypeError: unsupported operand type(s) for -: 'NoneType' and 'int' #10

Open
evantroendle opened this issue Aug 4, 2022 · 1 comment

Comments

@evantroendle
Copy link

Hello,

I am attempting to use cojac for a research project and have created a conda environment (conda version 4.13.0) for this, but when supplying *.bam files to test the package I have encountered an error.

First I will list my conda environment for your reference in case you notice important versioning differences (cojac and pysam in bold ):

packages in environment at /home/evan/anaconda3/envs/cojac:

Name Version Build Channel

_libgcc_mutex 0.1 conda_forge conda-forge
_openmp_mutex 4.5 2_gnu conda-forge
brotli 1.0.9 h5eee18b_7
brotli-bin 1.0.9 h5eee18b_7
brotlipy 0.7.0 py39h27cfd23_1003
bzip2 1.0.8 h7b6447c_0
c-ares 1.18.1 h7f8727e_0
ca-certificates 2022.07.19 h06a4308_0
certifi 2022.6.15 py39h06a4308_0
cffi 1.15.1 py39h74dc2b5_0
charset-normalizer 2.0.4 pyhd3eb1b0_0
cojac 0.2 hdfd78af_0 bioconda
colorama 0.4.5 py39h06a4308_0
cryptography 37.0.1 py39h9ce1e76_0
cycler 0.11.0 pyhd3eb1b0_0
dbus 1.13.18 hb2f20db_0
expat 2.4.8 h27087fc_0 conda-forge
fontconfig 2.14.0 h8e229c2_0 conda-forge
fonttools 4.25.0 pyhd3eb1b0_0
freetype 2.11.0 h70c0345_0
gettext 0.21.0 hf68c758_0
giflib 5.2.1 h7b6447c_0
glib 2.72.1 h6239696_0 conda-forge
glib-tools 2.72.1 h6239696_0 conda-forge
gst-plugins-base 1.14.0 h8213a91_2
gstreamer 1.14.0 h28cd5cc_2
icu 58.2 he6710b0_3
idna 3.3 pyhd3eb1b0_0
jpeg 9e h7f8727e_0
kiwisolver 1.4.2 py39h295c915_0
krb5 1.19.2 hac12032_0
lcms2 2.12 h3be6417_0
ld_impl_linux-64 2.38 h1181459_1
libblas 3.9.0 15_linux64_openblas conda-forge
libbrotlicommon 1.0.9 h5eee18b_7
libbrotlidec 1.0.9 h5eee18b_7
libbrotlienc 1.0.9 h5eee18b_7
libcblas 3.9.0 15_linux64_openblas conda-forge
libclang 10.0.1 default_hb85057a_2
libcurl 7.84.0 h91b91d3_0
libdeflate 1.10 h7f98852_0 conda-forge
libedit 3.1.20210910 h7f8727e_0
libev 4.33 h7f8727e_1
libevent 2.1.12 h8f2d780_0
libffi 3.4.2 h295c915_4
libgcc-ng 12.1.0 h8d9b700_16 conda-forge
libgfortran-ng 11.2.0 h00389a5_1
libgfortran5 11.2.0 h1234567_1
libglib 2.72.1 h2d90d5f_0 conda-forge
libgomp 12.1.0 h8d9b700_16 conda-forge
libiconv 1.16 h7f8727e_2
liblapack 3.9.0 15_linux64_openblas conda-forge
libllvm10 10.0.1 hbcb73fb_5
libnghttp2 1.46.0 hce63b2e_0
libnsl 2.0.0 h7f98852_0 conda-forge
libopenblas 0.3.20 h043d6bf_1
libpng 1.6.37 hbc83047_0
libpq 12.9 h16c4e8d_3
libssh2 1.10.0 h8f2d780_0
libstdcxx-ng 12.1.0 ha89aaad_16 conda-forge
libtiff 4.2.0 h2818925_1
libuuid 2.32.1 h7f98852_1000 conda-forge
libwebp 1.2.2 h55f646e_0
libwebp-base 1.2.2 h7f8727e_0
libxcb 1.15 h7f8727e_0
libxkbcommon 1.0.1 hfa300c1_0
libxml2 2.9.14 h74e7548_0
libxslt 1.1.35 h4e12654_0
libzlib 1.2.12 h166bdaf_2 conda-forge
lz4-c 1.9.3 h295c915_1
matplotlib 3.5.2 py39hf3d152e_1 conda-forge
matplotlib-base 3.5.2 py39h700656a_1 conda-forge
munkres 1.1.4 py_0
ncurses 6.3 h5eee18b_3
nspr 4.33 h295c915_0
nss 3.74 h0370c37_0
numpy 1.23.1 py39hba7629e_0 conda-forge
openssl 1.1.1q h7f8727e_0
packaging 21.3 pyhd3eb1b0_0
pandas 1.4.3 py39h1832856_0 conda-forge
pcre 8.45 h295c915_0
pillow 9.2.0 py39hace64e9_1
pip 22.1.2 py39h06a4308_0
ply 3.11 py39h06a4308_0
pycparser 2.21 pyhd3eb1b0_0
pyopenssl 22.0.0 pyhd3eb1b0_0
pyparsing 3.0.4 pyhd3eb1b0_0
pyqt 5.15.7 py39h6a678d5_1
pyqt5-sip 12.11.0 py39h6a678d5_1
pysam 0.19.1 py39h5030a8b_0 bioconda
pysocks 1.7.1 py39h06a4308_0
python 3.9.13 h9a8a25e_0_cpython conda-forge
python-dateutil 2.8.2 pyhd3eb1b0_0
python_abi 3.9 2_cp39 conda-forge
pytz 2022.1 py39h06a4308_0
pyyaml 6.0 py39hb9d737c_4 conda-forge
qt-main 5.15.2 h327a75a_6
qt-webengine 5.15.9 hd2b0992_4
qtwebkit 5.212 h4eab89a_4
readline 8.1.2 h7f8727e_1
requests 2.28.1 pyhd8ed1ab_0 conda-forge
ruamel.yaml 0.17.4 py39h3811e60_0 conda-forge
ruamel.yaml.clib 0.2.6 py39h7f8727e_0
setuptools 61.2.0 py39h06a4308_0
sip 6.6.2 py39h6a678d5_0
six 1.16.0 pyhd3eb1b0_1
sqlite 3.39.0 h5082296_0
strictyaml 1.6.1 pyhd8ed1ab_0 conda-forge
tk 8.6.12 h1ccaba5_0
toml 0.10.2 pyhd3eb1b0_0
tornado 6.1 py39h27cfd23_0
tqdm 4.64.0 pyhd8ed1ab_0 conda-forge
tzdata 2022a hda174b7_0
urllib3 1.26.11 py39h06a4308_0
wheel 0.37.1 pyhd3eb1b0_0
xz 5.2.5 h7f8727e_1
yaml 0.2.5 h7b6447c_0
zlib 1.2.12 h7f8727e_2
zstd 1.5.2 ha4553b6_0

So firstly, the command I used was:

cooc-mutbamscan -b ../SARS-CoV-2.insert.V4.txt -m ../voc/ -a NIRE-002f80_S267.sorted.bam NIRE-002f81_S268.sorted.bam -j ../out/cooc-test.json

The bams and bam indices are attached as .txt files for your testing.

NIRE-002f81_S268.sorted.bam.bai.txt
NIRE-002f81_S268.sorted.bam.txt
NIRE-002f80_S267.sorted.bam.bai.txt
NIRE-002f80_S267.sorted.bam.txt

I used the SARS-CoV-2.insert.V4.txt as from GitHub (and also tested V3 in case I was wrong about the primer version used).
The voc/ folder is mirrored from GitHub.

The output was:
insertions not supported (yet): +AACA : AACA
insertions not supported (yet): +ACT : ACT
insertions not supported (yet): +GAGCCAGAA : GAGCCAGAA
76_B16173 is identical to 76_ka
77_ga is identical to 77_be
76_de is identical to 76_AY42
92_de is identical to 92_AY42
78_BA1 is identical to 78_BA2
79_BA1 is identical to 79_BA2
82_BA1 is identical to 82_om1
88_BA1 is identical to 88_om1
94_BA1 is identical to 94_BA2
95_BA1 is identical to 95_BA2
autodecting reference as MN908947.3
amplicon_31_om2 9336 9467 {9424: 'G', 9534: 'T'} amplion: 410
Traceback (most recent call last):
File "/home/evan/anaconda3/envs/cojac/bin/cooc-mutbamscan", line 479, in
main()
File "/home/evan/anaconda3/envs/cojac/bin/cooc-mutbamscan", line 451, in main
table[sample]=scanbam(alnfname, amplicons,rq_chr)
File "/home/evan/anaconda3/envs/cojac/bin/cooc-mutbamscan", line 184, in scanbam
amp_results[amp_name] = scanamplicon(amplicon_iter, mut_dict)
File "/home/evan/anaconda3/envs/cojac/bin/cooc-mutbamscan", line 134, in scanamplicon
(t_pos, t_read) = test_read(R, mut_dict)
File "/home/evan/anaconda3/envs/cojac/bin/cooc-mutbamscan", line 82, in test_read
found_site = [p for p,m in mut_dict.items() if read.reference_start <= (p-1) <= (read.reference_end-len(m))]
File "/home/evan/anaconda3/envs/cojac/bin/cooc-mutbamscan", line 82, in
found_site = [p for p,m in mut_dict.items() if read.reference_start <= (p-1) <= (read.reference_end-len(m))]
TypeError: unsupported operand type(s) for -: 'NoneType' and 'int'

The program execution issue may be resolved by rolling back some to previous versions of some packages/using an earlier version of python, so if you could please advise me as to this, I would appreciate it. Alternatively if you can discern something about my input files that makes cojac unsuitable to analyse them, this would also be useful information.

I also get a similar output when running the V3 primer:
cooc-mutbamscan -b ../nCoV-2019.insert.V3.bed -m ../voc/ -a NIRE-002f80_S267.sorted.bam NIRE-002f81_S268.sorted.bam -j ../out/cooc-test.json
insertions not supported (yet): +AACA : AACA
insertions not supported (yet): +ACT : ACT
insertions not supported (yet): +GAGCCAGAA : GAGCCAGAA
76_B16173 is identical to 76_ka
76_ga is identical to 76_be
76_de is identical to 76_AY42
91_de is identical to 91_AY42
78_BA1 is identical to 78_BA2
93_BA1 is identical to 93_BA2
autodecting reference as MN908947.3
amplicon_31_om2 9275 9472 {9424: 'G', 9534: 'T'} amplion: 460
Traceback (most recent call last):
File "/home/evan/anaconda3/envs/cojac/bin/cooc-mutbamscan", line 479, in
main()
File "/home/evan/anaconda3/envs/cojac/bin/cooc-mutbamscan", line 451, in main
table[sample]=scanbam(alnfname, amplicons,rq_chr)
File "/home/evan/anaconda3/envs/cojac/bin/cooc-mutbamscan", line 184, in scanbam
amp_results[amp_name] = scanamplicon(amplicon_iter, mut_dict)
File "/home/evan/anaconda3/envs/cojac/bin/cooc-mutbamscan", line 134, in scanamplicon
(t_pos, t_read) = test_read(R, mut_dict)
File "/home/evan/anaconda3/envs/cojac/bin/cooc-mutbamscan", line 82, in test_read
found_site = [p for p,m in mut_dict.items() if read.reference_start <= (p-1) <= (read.reference_end-len(m))]
File "/home/evan/anaconda3/envs/cojac/bin/cooc-mutbamscan", line 82, in
found_site = [p for p,m in mut_dict.items() if read.reference_start <= (p-1) <= (read.reference_end-len(m))]
TypeError: unsupported operand type(s) for -: 'NoneType' and 'int'

All the best,
Evan

@pratibha-kadam
Copy link

@evantroendle I am encountered with the same error. Did you find any solution?

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