Closed YonkoBigMom closed 2 weeks ago
Looks like the issue is arising when it tries to pull out the name / length of the contig the reads were aligned to. Has this bamfile been sorted and index by samtools already?
Yes
samtools bam2fq -@ 5 -T '*' my_sample.unmapped.bam | minimap2 -ax map-ont -y -t 25 ./t2t-and-subtel.fa - | samtools sort -@ 10 -m 5G -o my_sample.telomere.bam
samtools index -@20 my_sample.telomere.bam
Reinstalling runs on my machine with an example set. Can you try adding -Y and -L flags to minimap2?
I will do this and report back.
I was having the same issue and tried the suggested steps and still received the same error
minimap2 -ax map-ont -Y -L -t 28 t2t-and-subtel.fa input.fastq.gz -o output.sam
samtools view -bho output.bam output.sam
samtools sort -o output_srt.bam output.bam
samtools index output_srt.bam
telometer -b output_srt.bam -o output_telLen.tsv
Traceback (most recent call last): File "/home/usr/miniconda3/bin/telometer", line 8, in
sys.exit(calculate_telomere_length()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/usr/miniconda3/lib/python3.11/site-packages/telometer/telometer.py", line 115, in calculate_telomere_length read_data_list = [{ ^^ File "/home/usr/miniconda3/lib/python3.11/site-packages/telometer/telometer.py", line 124, in 'reference_length': bam_file.get_reference_length(read.reference_name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "pysam/libcalignmentfile.pyx", line 1919, in pysam.libcalignmentfile.AlignmentFile.get_reference_length File "pysam/libcalignmentfile.pyx", line 509, in pysam.libcalignmentfile.AlignmentHeader.get_reference_length File "pysam/libcalignmentfile.pyx", line 531, in pysam.libcalignmentfile.AlignmentHeader.get_tid TypeError: expected bytes, NoneType found
@santiago-es
It similarly looks like an issue identifying the reference contig name from the reference file.
Could both of you try running telometer on the presorted test bam in test_data
It similarly looks like an issue identifying the reference contig name from the reference file.
Could both of you try running telometer on the presorted test bam in test_data
The presorted test bam works just fine. @santiago-es
Sounds like the issue must come from the reference file then. I would try recreating t2t-and-subtel.fa with cat and faidx again, and if that doesn't work, align to the chm13 reference fa alone. May miss some subtelomere alignments but should still work. I'm away from my computer for a week but when I'm back I'll try recreating the error by rebuilding reference from scratch
Thanks, I'll give that a shot.
Sounds like the issue must come from the reference file then. I would try recreating t2t-and-subtel.fa with cat and faidx again, and if that doesn't work, align to the chm13 reference fa alone. May miss some subtelomere alignments but should still work. I'm away from my computer for a week but when I'm back I'll try recreating the error by rebuilding reference from scratch
I attempted both of the bolded solutions and still received the same error.
@santiago-es looks like the issue may be a python version compatibility issue. I noticed @YonkoBigMom and I were both using the same version of python (3.11) and having issues, while the program was generally working for your other, more recent issue submitter, but they were using version 3.8. I created a new environment in conda with python 3.8 and everything worked just fine.
Ahhh, I see. I'm surprised the python version created this error, maybe they changed the variable name for the reference contigs in pysam for the newest python version. This shouldn't be a difficult fix but for now I will add a warning to use python 3.8
I should also add that I was using telometer v0.75 instead of 0.81 (as mentioned in my other issue report) so that may also have been a contributing factor. I haven't tested telometer 0.81 in python 3.11.
FWIW @jleehan, using python 3.11 worked fine with the example bam that comes in the repo for me.
@indapa
It similarly looks like an issue identifying the reference contig name from the reference file. Could both of you try running telometer on the presorted test bam in test_data
The presorted test bam works just fine. @santiago-es
Checking back in on this, it sounds like you were able to get it to work @jleehan ?
Yes, I've done a couple runs with it so far!
great! will work on issue in other thread
I run a bam aligned by minimap2 to t2t-and-subtel.fa
telometer -b my_sample.telomere.bam -o my_sample.telometer.tsv -m 1000 -c r10
and it gave an error:
Can you let me know what is the issue here?