Entering edit mode
6.7 years ago
jsneaththompson
▴
100
I'm attempting to use Connor to deduplicate some bam files in my variant calling pipeline, but so far whenever I attempt to run Connor I get the following error message:
2017-07-17 10:32:28|ERROR|An unexpected error occurred
2017-07-17 10:32:28|ERROR|Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/connor/connor.py", line 498, in main
command_validator.preflight(args, log)
File "/usr/local/lib/python2.7/dist-packages/connor/command_validator.py", line 190, in preflight
validate(args, log)
File "/usr/local/lib/python2.7/dist-packages/connor/command_validator.py", line 76, in _check_input_bam_valid
bamfile = samtools.alignment_file(args.input_bam, 'rb')
File "/usr/local/lib/python2.7/dist-packages/connor/samtools.py", line 527, in alignment_file
return pysam.AlignmentFile(filename, mode, template)
AttributeError: 'module' object has no attribute 'AlignmentFile'
I installed Connor using pip, and have since tried updating pysam (which in turn required installation of liblzma-dev via apt-get), but I'm still getting the same error.
I've also tried using sorted, indexed bam files but that doesn't help either.
If anyone has any suggestions it would be much appreciated.
What's your pysam version? It's probably that.
It's possible that Connor imports an older pysam module (while you installed the latest).
According to pip, I'm using v 0.11.2.2
Connor says it requires pysam>=0.8.4,<0.9.1, how would I go about changing the pysam version?
Do you know a bit of Python?
I managed to switch to pysam 0.8.4 with pip, but I'm still getting the same error message when I try to run Connor
That's insufficient.
Pysam made some changes (I believe around 0.10.0) which make it non-compatible to older versions.
But it's not impossible to fix.
Sooo... do you know a bit of Python?
Ah, fair enough. Yes I know some python.
Cool. Let's start with checking which version of pysam is used by connor.
Look for the import statement
import pysam
and addprint(pysam.__version__)
afterwards.Connor is using pysam 0.7.5
What a bastard. Okay - so it uses an outdated pysam.
Let's figure out where it comes from. If you just add the following:
print(pysam)
That will tell you the path it used to import from.
Also, let's have a look at your sys.path
import sys
print(sys.path)
That tells the python interpreter where it can get its modules. We'll need to hack it slightly to make sure Connor imports the correct pysam.