This is a test version of Biostars. For the public version, visit https://www.biostars.org.
HISAT2: an "IndexError: index out of range"

My operation system is Ubuntu 18.04.4 LTS, conda (Miniconda3) version is 4.8.2, and hisat2 version is 2.20. I want to run an alignment using HISAT2, though it can run, but come out an IndexError. Can anyone tell me how to figure it out.

hisat2 -t -x ~/data/rna-seq/reference/index/hg19/genome -1 ~/data/rna-seq/fq/SRR3589956_1.fastq.gz -2 ~/data/rna-seq/fq/SRR3589956_2.fastq.gz -S ~/data/rna-seq/reference/aligned/SRR3589956.sam
Traceback (most recent call last):
File "/home/guangingmai/miniconda3/bin/hisat2_read_statistics.py", line 210, in <module> reads_stat(args.read_file, args.read_count)
File "/home/guangingmai/miniconda3/bin/hisat2_read_statistics.py", line 168, in reads_stat for id, seq in fstream:
File "/home/guangingmai/miniconda3/bin/hisat2_read_statistics.py", line 44, in parser_FQ if line[0] == '@':
IndexError: index out of range
Time loading forward index: 00:00:04
Time loading reference: 00:00:02
alignment rna-seq software error rna-seq

did you make the index or downloaded a pre-built one?

I have downloaded the index from HISAT2 website, and save it to ~/data/rna-seq/reference/index/hg19.

That sounds about right, so I assume hg19 folder contains like genome.1.ht2 etc?

yes, the index file i downloaded has eight genome.*.ht2 files.

Are you running in command line or bash script? Now this shouldn't be a problem, but sometimes describing path with "~/" doesn't work for me. So I rather describe the path with "/home/user/....". Just do pwd in your index file folder and that will give you the path.

Unrelated: Also if you plan to use Stringtie afterward, you need to use --dta flag.

I run this in command line, and after it run out, I find a .sam file in the directory i specified.

Then you are good to go as long as you have data in your SAM file.

I see that this is a python run problem and not the problem with index per say. "Index error: index out of ranger" in a python script happens if you are trying to call an element in the list that doesn't exist. May be it is not able to read the fastq files? Did you run fastqc on them?

Try running the command as I suggested with full path (just for sake of it!). Also you have to mention the strandness of your reads with --rna-strandness flag (which is unrelated to the error).

Do you have empty lines in your fastq files?

Hi,

Have you resolved the issue? I have the same error message but the alignment seems ok as well.

My anaconda version is conda 4.7.12 and hisat2 version is

/home/anaconda3/envs/env_hisat2_py3/bin/hisat2-align-s version 2.2.0
64-bit
Built on fv-az86
Sat May  9 09:59:05 UTC 2020
Compiler: gcc version 7.3.0 (crosstool-NG 1.23.0.450-d54ae) 
Options: -O3 -m64 -msse2 -funroll-loops -g3 -DPOPCNT_CAPABILITY -std=c++11
Sizeof {int, long, long long, void*, size_t, off_t}: {4, 8, 8, 8, 8, 8}

same error, any updates

Traceback (most recent call last):
  File "/home/hu/anaconda3/bin/hisat2_read_statistics.py", line 210, in <module>
    reads_stat(args.read_file, args.read_count)
  File "/home/hu/anaconda3/bin/hisat2_read_statistics.py", line 168, in reads_stat
    for id, seq in fstream:
  File "/home/hu/anaconda3/bin/hisat2_read_statistics.py", line 44, in parser_FQ
    if line[0] == \'@\':
IndexError: index out of range

0 answers

No answers yet.

Log in to answer this question.