cauyrd / transIndel

Indel caller for DNA-seq or RNA-seq
GNU General Public License v3.0
14 stars 7 forks source link

pysam.csamtools.AlignedRead' object has no attribute 'has_tag' #9

Open paulhtyang opened 3 years ago

paulhtyang commented 3 years ago

Hello Dr. Yang,

We are running ScanNeo pipeline in which the transIndel command was applied below: "transIndel_build_RNA.py -r /data/genome/GRCh38/hg38.fa -g /data/genome/GRCh38/gencode3.annotation.gtf -i Adipose01_R1.HISAT2-2.1.0.aligned.sorted.bwa.bam -o Adipose01_R1.HISAT2-2.1.0.aligned.sort"

The error message was shown as well:


indel.bam' returned non-zero exit status 1 transIndel_RNA build starts running: 2020-12-09 21:49:11 Checking for 'samtools': found /data/anaconda3/envs/NeoAg/bin/samtools

Traceback (most recent call last): File "/data/tools/transIndel/transIndel_build_RNA.py", line 304, in main() File "/data/tools/transIndel/transIndel_build_RNA.py", line 296, in main softclipping_realignment(mapq_cutoff, max_del_len, input, output, ref_genome, gtf, splice_bin) File "/data/tools/transIndel/transIndel_build_RNA.py", line 170, in softclipping_realignment if read.mapq >= mapq_cutoff and not read.is_secondary and not read.has_tag('XA'): AttributeError: 'pysam.csamtools.AlignedRead' object has no attribute 'has_tag'


Just wondering about the version of Pysam package is v0.16.0.1. Could you please let me know what's going on and how to resolve it? Thank you very much, Paul

cauyrd commented 3 years ago

Dear Paul, This is very likely to be a pysam version issue. someone had a similar problem (https://github.com/hall-lab/svtyper/issues/37 ). Update to the newer version will fix this issue. Tingyou

On Thu, Dec 10, 2020 at 10:55 AM Hsih-Te (Paul) Yang < notifications@github.com> wrote:

Hello Dr. Yang,

We are running ScanNeo pipeline in which the transIndel command was applied below: "transIndel_build_RNA.py -r /data/genome/GRCh38/hg38.fa -g /data/genome/GRCh38/gencode3.annotation.gtf -i Adipose01_R1.HISAT2-2.1.0.aligned.sorted.bwa.bam -o Adipose01_R1.HISAT2-2.1.0.aligned.sort"

The error message was shown as well:

indel.bam' returned non-zero exit status 1 transIndel_RNA build starts running: 2020-12-09 21:49:11 Checking for 'samtools': found /data/anaconda3/envs/NeoAg/bin/samtools

Traceback (most recent call last): File "/data/tools/transIndel/transIndel_build_RNA.py", line 304, in main() File "/data/tools/transIndel/transIndel_build_RNA.py", line 296, in main softclipping_realignment(mapq_cutoff, max_del_len, input, output, ref_genome, gtf, splice_bin) File "/data/tools/transIndel/transIndel_build_RNA.py", line 170, in softclipping_realignment if read.mapq >= mapq_cutoff and not read.is_secondary and not read.has_tag('XA'): AttributeError: 'pysam.csamtools.AlignedRead' object has no attribute 'has_tag'

Just wondering about the version of Pysam package is v0.16.0.1. Could you please let me know what's going on and how to resolve it? Thank you very much, Paul

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/cauyrd/transIndel/issues/9, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAZQHY5MH2LWJTUOHINKNW3SUD4QDANCNFSM4UVJMWNQ .

paulhtyang commented 3 years ago

Hello Tingyou, Thanks for your kind reply. I did read this message before contacting you. However, the current version of Pysam package (v0.16.0.1) I'm using is updated. Do you have other idea? Paul

dolittle007 commented 3 years ago

The "AlignedRead" type was replaced by "AlignedSegment" after pysam 0.8.1. So you indeed have pysam 0.16.0.1 (the latest one) installed, but Python is loading an old version. I am not sure how you run transIndel programs. if ./transIndels, you'd better change the #!/usr/bin/python to #!/usr/bin/env python elif python transIndels, you can check the pysam version by typing python -c 'import pysam;print(pysam.__version__)' Hope it helps.

paulhtyang commented 3 years ago

Thanks for your information that is really helpful. When I checked the version of pysam package, it showed 0.11.2.2 (see below). Looks like the Python 2.7 limited the conda environment only to this version rather than the most updated one. $ python -c 'import pysam;print(pysam.version)' 0.11.2.2

After changing the #!/usr/bin/python to #!/usr/bin/env python in the head of python script, the error message was gone and the job was completely done. Thanks again!