Question: hisat2 error index out of range
gravatar for evelyn
5 days ago by
evelyn90 wrote:


I am using hisat2 to create bam files from paired end fastq files:

hisat2-build genome.fa hisat
hisat2 -x hisat -1 R1_paired.fastq.gz -2 R2_paired.fastq.gz -S out.sam
samtools view -bS out.sam > out.bam

The .sam and .bam files are made. But the log file shows:

Traceback (most recent call last):
  File "/apps/hisat2/2.2.0/bin/", line 210, in <module>
    reads_stat(args.read_file, args.read_count)
  File "/apps/hisat2/2.2.0/bin/", line 168, in reads_stat
    for id, seq in fstream:
  File "/apps/hisat2/2.2.0/bin/", line 44, in parser_FQ
    if line[0] == '@':
IndexError: index out of range
12398067 reads; of these:
  12398067 (100.00%) were paired; of these:
    995937 (8.03%) aligned concordantly 0 times
    10948198 (88.31%) aligned concordantly exactly 1 time
    453932 (3.66%) aligned concordantly >1 times
    995937 pairs aligned concordantly 0 times; of these:
      126076 (12.66%) aligned discordantly 1 time
    869861 pairs aligned 0 times concordantly or discordantly; of these:
      1739722 mates make up the pairs; of these:
        1100705 (63.27%) aligned 0 times
        614508 (35.32%) aligned exactly 1 time
        24509 (1.41%) aligned >1 times
95.56% overall alignment rate
[bam_sort_core] merging from 12 files and 1 in-memory blocks...

How to address the error in index message here? Thank you for the help!

rna-seq • 80 views
ADD COMMENTlink written 5 days ago by evelyn90

Hi :)

You can open /apps/hisat2/2.2.0/bin/ check line 44 and see part of the script that is giving you the error.

 if line[0] == '@':

IndexError: index out of range

It means that there's no line[0], so I assume there's an empty line in your one of your fastq files. which probably won't cause any problems.

ADD REPLYlink modified 5 days ago • written 5 days ago by Fatima560

Thank you! I am using Trimmomatic output fastq files. Can Trimmomatic result in an empty line.

ADD REPLYlink written 5 days ago by evelyn90

Not sure, but you can use sed -n '/^$/=' file to find the empty lines.

ADD REPLYlink modified 5 days ago • written 5 days ago by Fatima560
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1088 users visited in the last hour