TypeError: count() got an unexpected keyword argument 'contig'
Closed this issue · 6 comments
Hi,
Thanks for making ConFindr.
I'm getting the following error:
2018-10-11 15:53:11 Welcome to ConFindr 0.4.2! Beginning analysis of your sam ples...
2018-10-11 15:53:11 Beginning analysis of sample MSHR0120...
2018-10-11 15:53:11 Checking for cross-species contamination...
2018-10-11 15:54:33 Setting up genus-specific database for genus Burkholderia ...
2018-10-11 15:57:08 Extracting rMLST genes...
2018-10-11 15:57:38 Quality trimming...
2018-10-11 15:57:40 Detecting contamination...
Traceback (most recent call last):
File "/home/aaziz/bin/miniconda3/bin/confindr.py", line 889, in
base_cutoff=args.base_cutoff)
File "/home/aaziz/bin/miniconda3/bin/confindr.py", line 529, in find_contamina tion
rmlst_report=rmlst_report)
File "/home/aaziz/bin/miniconda3/bin/confindr.py", line 351, in find_rmlst_typ e
gene_alleles_to_use[gene] = [allele, bamfile.count(contig=contig)]
File "pysam/libcalignmentfile.pyx", line 1071, in pysam.libcalignmentfile.Alig nmentFile.count (pysam/libcalignmentfile.c:13063)
TypeError: count() got an unexpected keyword argument 'contig'
The command I ran:
confindr.py -i PATH -o output -t 8 -k -fid _1_sequence -rid _2_sequence -d PATH
Also ran confindr
on example dataset but received same error:
confindr.py -i example-data -o output_example -t 8 -fid _1_sequence -rid _2_sequence -d PATH
Running on:
Linux cheetah06 2.6.32-431.5.1.el6.x86_64 #1 SMP Wed Feb 12 00:41:43 UTC 2014 x8 6_64 x86_64 x86_64 GNU/Linux
It was installed using conda
as recommended. As the cluster is behind a firewall, I had to download the database manually but it seems to have been detected just fine. I've attached the log file that was created from the example dataset.
confindr_log.txt
Any help is appreciated!
I'm not at a computer today so I can't look into this in too much detail (but will tomorrow) My first guess would be that the version of pysam being used isn't correct (I may need to update the conda recipe).
What's the output of pip list
within your confindr conda environment?
Hi @lowandrew
Good call, updating pysam from version 0.11.2.2 to the latest fixed the problem and ConFindr is working!
While trying to update pysam, I ran into the issue of different versions in pip/conda. I'm not knowledge enough with Conda to figure out why ConFindr is using the pip install of pysam (which was outdated, causing the error) instead of the Conda version (which was up to date, probably updated during ConFindr installation). I had assumed programs like ConFindr that were installed with Conda (and their dependencies) should be updated from Conda.
pip
, conda
, and /confindr.py
are all located in ~/bin/miniconda3/bin/
Also, found a small bug (I think). Nucleotide position of SNVs reported in example__contamination.csv
file are off by 1, maybe due to python's indexing starting at 0?
Example:
BACT000030_569,203,T:46;G:6,52
BACT000030_569,206,G:49;T:3,52
BACT000030_569,425,C:84;A:2,86
Inspecting these SNVs manually in Tablet shows their position is actually +1.
Thanks
I'm also not sure why the incorrect version of the pysam package would be used, but I'll do some digging into it and hopefully get it sorted out.
As for the off by 1, you are correct - I'll update the positions in the next release of ConFindr. Thanks for pointing it out!
The off by 1 error has been fixed in recent releases - as for the incorrect version of pysam being used, do you have a $PYTHONPATH set? Apparently having that set may cause some issues.
That's probably the cause. You can unset $PYTHONPATH
to stop anaconda from using other python versions' packages. Unfortunately, I can't test the solution because I don't have permissions to uninstall pysam
from /usr/local/
.
Thanks for your help!
On a different note completely, I've tested ConFindr
on a small batch of libraries and it works very nicely. It found a mixture that we previously didn't know about. There were a few false positives (with default parameters), but these would probably be fixed by specifying -br
as you've suggested.