bio-tombow / TelFinder

de novo detect telomeric motif sequence
5 stars 3 forks source link

Test data doesn't work: IndexError: list index out of range #1

Closed TrStans606 closed 9 months ago

TrStans606 commented 9 months ago

I am running the fastq test data exactly as described in the read me:

python3 TelFinder.py -f fq2 -1 example/fastq/DRR237583_1.fastq -2 example/fastq/DRR237583_2.fastq -ref example/fastq/AFM_genomic.fna -o example/fastq/ -s AFMfq -t 80

Error:

16300455 reads; of these:
  16300455 (100.00%) were paired; of these:
    2096179 (12.86%) aligned concordantly 0 times
    13920167 (85.40%) aligned concordantly exactly 1 time
    284109 (1.74%) aligned concordantly >1 times
    ----
    2096179 pairs aligned concordantly 0 times; of these:
      40068 (1.91%) aligned discordantly 1 time
    ----
    2056111 pairs aligned 0 times concordantly or discordantly; of these:
      4112222 mates make up the pairs; of these:
        3538223 (86.04%) aligned 0 times
        544315 (13.24%) aligned exactly 1 time
        29684 (0.72%) aligned >1 times
89.15% overall alignment rate
Traceback (most recent call last):
  File "/geode2/home/u100/trstans/Quartz/TelFinder/TelFinder.py", line 112, in <module>
    exunmapped(os.path.join(out_dir,species+'.sam'),mode,os.path.join(out_dir,species+'_unmapreads.fasta'))
  File "/geode2/home/u100/trstans/Quartz/TelFinder/FindKmer.py", line 209, in exunmapped
    if line[2] == '*':
       ~~~~^^^
IndexError: list index out of range
srun: error: c17: task 1: Exited with exit code 1
16300455 reads; of these:
  16300455 (100.00%) were paired; of these:
    2096179 (12.86%) aligned concordantly 0 times
    13920167 (85.40%) aligned concordantly exactly 1 time
    284109 (1.74%) aligned concordantly >1 times
    ----
    2096179 pairs aligned concordantly 0 times; of these:
      40068 (1.91%) aligned discordantly 1 time
    ----
    2056111 pairs aligned 0 times concordantly or discordantly; of these:
      4112222 mates make up the pairs; of these:
        3538223 (86.04%) aligned 0 times
        544315 (13.24%) aligned exactly 1 time
        29684 (0.72%) aligned >1 times
89.15% overall alignment rate
Traceback (most recent call last):
  File "/geode2/home/u100/trstans/Quartz/TelFinder/TelFinder.py", line 112, in <module>
    exunmapped(os.path.join(out_dir,species+'.sam'),mode,os.path.join(out_dir,species+'_unmapreads.fasta'))
  File "/geode2/home/u100/trstans/Quartz/TelFinder/FindKmer.py", line 209, in exunmapped
    if line[2] == '*':
       ~~~~^^^
IndexError: list index out of range
srun: error: c16: task 0: Exited with exit code 1
bio-tombow commented 9 months ago

I run the same command in our sever and some personal computers and no error reported. Could you add this line in the line 208 script "FindKmer.py" to check: print(line) you can also leave meassage in my mailbox so that i will help you with the problem in time.

TrStans606 commented 9 months ago

It seems the AFMfq.sam file had a single line where line.split('\t') had a length less then three: Changing line 209 to

if len(line) > 2 and line[2] == '*':

fixed the issue