mroosmalen / nanosv

SV caller for nanopore data
MIT License
90 stars 22 forks source link

Got exception of object has no attribute 'infer_read_length' when running with BAM file by minimap2 with nanopore fastq files #31

Closed mullinyu closed 6 years ago

mullinyu commented 6 years ago

I'm using Nanopore to sequence long reads and then use minimap2 to align to human genome. I got the following exception when run NanoSV with BAM file generated.

Exception: Wed May 16 17:08:46 2018 Busy with calculating the coverage distribution... Wed May 16 17:32:04 2018 Busy with parsing bam file... Traceback (most recent call last): File "/home/kitsanyeung/.local/lib/python3.5/site-packages/nanosv/NanoSV.py", line 64, in main() File "/home/kitsanyeung/.local/lib/python3.5/site-packages/nanosv/NanoSV.py", line 52, in main utils.parse_bam.parse_bam() File "/nfs/home/kitsanyeung/.local/lib/python3.5/site-packages/nanosv/utils/parse_bam.py", line 46, in parse_bam read = r.Read(line.query_name, line.infer_read_length()) AttributeError: 'pysam.libcalignedsegment.AlignedSegment' object has no attribute 'infer_read_length'

I checked the pysam document: infer_read_length(self) infer read length from CIGAR alignment. This method deduces the read length from the CIGAR alignment including hard-clipped bases. Returns None if CIGAR alignment is not present.

I checked the version of pysam used. Python 3.5.1 (default, Feb 28 2017, 11:00:48) [GCC 4.6.4] on linux Type "help", "copyright", "credits" or "license" for more information.

import pysam pysam.version <module 'pysam.version' from '/software/python3.5.1/lib/python3.5/site-packages/pysam/version.py'>

Any ideas/suggestions?

mroosmalen commented 6 years ago

I can't see the version number of pysam. Could you execute the following command to check the version of pysam: pip freeze | grep pysam

jaesvi commented 6 years ago

You can also check the version with import pysam pysam.__version__ Also see #24 . Probably you have the same version problem.