cauyrd / transIndel

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

TypeError: string indices must be integers, not NoneType #1

Closed rrlove closed 6 years ago

rrlove commented 6 years ago

Upon running the following command:

python ~/local/bin/transIndel/transIndel_call.py \ -i ${sample_path}/${sample}_tIbuild.bam \ -o ${sample_path}/${sample}_tI \ -c 0 \ -f 0 \ -l 0

I received this error:

transIndel call starts running: 2018-05-10 17:04:35 Traceback (most recent call last): File "/local/bin/transIndel/transIndel_call.py", line 184, in main() File "/local/bin/transIndel/transIndel_call.py", line 178, in main sv_scan(input_bam, output_vcf_prefix, ao_cutoff, dp_cutoff, vaf_cutoff, indel_len_cutoff, target, mapq_cutoff) File "/local/bin/transIndel/transIndel_call.py", line 82, in sv_scan ref_seq = read.alignment.query_sequence[read.query_position] TypeError: string indices must be integers, not NoneType

Python version: 2.7.14 pysam version: 0.8.4

This appears to indicate some issue with the BAM generated in the previous step. What can I do to resolve this issue?

In addition, do you plan to update transIndel to be compatible with newer versions of pysam and/or python?

Thanks.

cauyrd commented 6 years ago

Take a look the BAM file using samtool view and see if it is truncated or has other issues. Otherwise, I will need to BAM file you are using to debug this error. We will update the version when pysam version become stable. Because pysam syntex is changed frequently, it is very hard to keep updating the tranindel code frequently. But with pysam relatively become stable, we will update the transindel as well.

On Thu, May 10, 2018 at 4:25 PM, rrlove notifications@github.com wrote:

Upon running the following command:

python ~/local/bin/transIndel/transIndel_call.py -i ${sample_path}/${sample}_tIbuild.bam -o ${sample_path}/${sample}_tI -c 0 -f 0 -l 0

I received this error:

transIndel call starts running: 2018-05-10 17:04:35 Traceback (most recent call last): File "/local/bin/transIndel/transIndel_call.py", line 184, in main() File "/local/bin/transIndel/transIndel_call.py", line 178, in main sv_scan(input_bam, output_vcf_prefix, ao_cutoff, dp_cutoff, vaf_cutoff, indel_len_cutoff, target, mapq_cutoff) File "~/local/bin/transIndel/transIndel_call.py", line 82, in sv_scan ref_seq = read.alignment.query_sequence[read.query_position] TypeError: string indices must be integers, not NoneType

Python version: 2.7.14 pysam version: 0.8.4

This appears to indicate some issue with the BAM generated in the previous step. What can I do to resolve this issue?

In addition, do you plan to update transIndel to be compatible with newer versions of pysam and/or python?

Thanks.

— 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/1, or mute the thread https://github.com/notifications/unsubscribe-auth/ADMD4x7ln5JhVRAuE2DNgFsVgVqPxHDmks5txLAygaJpZM4T6k83 .

rrlove commented 6 years ago

Thanks for the quick reply. Because I had used the "-l 0" argument, a line was written for every position, so I could see that the VCF stopped after position 6331 on arm 2L. I extracted the first 10 kb of 2L from the BAM and attempted to replicate the error. transIndel_call.py ran without error on this 10 kb subset, but did not populate the VCF past the header. I tried different sized BAMs that all included the last position in the original VCF, and even extracted the entire chromosome arm. Each time, the program ran without error but did not output any variants.

At this point, I'm not sure what generated the original error, or why attempting to replicate it with a BAM file extracted via samtools generates neither the original error nor any variants. I've attached one such BAM file, spanning the first 10 kb of arm 2L, which includes the position at which the program errored out the first time. Would you please take a look? (I had to attach ".txt" to the end so GitHub would upload it, but reverting to the original extension allows me to view it with samtools.)

Thank you.

test_2L_0_10000.bam.txt

cauyrd commented 6 years ago

I have updated the transindel_call.py program to be compatible with newer versions of pysam. Please try to see if you have any problem.

rrlove commented 6 years ago

Thanks for the update. I reran the same commands with the new version of transIndel and with pysam 0.14.1, but I still receive the same TypeError at the same position.

cauyrd commented 6 years ago

I will take a test and let you know soon.

On Mon, May 21, 2018 at 3:39 PM, rrlove notifications@github.com wrote:

I reran the same commands with the new version of transIndel and with pysam 0.14.1, but I still receive the same TypeError at the same position.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/cauyrd/transIndel/issues/1#issuecomment-390775389, or mute the thread https://github.com/notifications/unsubscribe-auth/ADMD4ynUFcuY7swOHDC6mEwoqk-ia8ywks5t0yXwgaJpZM4T6k83 .

cauyrd commented 6 years ago

Can you set -l 1 not -l 0. transindel requires at least the minimal length (-l) to be 1 base.

On Mon, May 21, 2018 at 4:24 PM, Rendong Yang cauyrd@gmail.com wrote:

I will take a test and let you know soon.

On Mon, May 21, 2018 at 3:39 PM, rrlove notifications@github.com wrote:

I reran the same commands with the new version of transIndel and with pysam 0.14.1, but I still receive the same TypeError at the same position.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/cauyrd/transIndel/issues/1#issuecomment-390775389, or mute the thread https://github.com/notifications/unsubscribe-auth/ADMD4ynUFcuY7swOHDC6mEwoqk-ia8ywks5t0yXwgaJpZM4T6k83 .

rrlove commented 6 years ago

Thank you, that solves it. transIndel runs to completion with -l 1.

Now that I have output I have a couple of other questions about options and how to interpret that output, but I'll put those in a new issue.