HISAT2: an "IndexError: index out of range"
0
0
Entering edit mode
4.7 years ago
1713307477 • 0

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 • 3.7k views
ADD COMMENT
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode

Did you download the indexes from here?

ADD REPLY
0
Entering edit mode

yes, i downloaded the indexes in this.

ADD REPLY
0
Entering edit mode

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.

ADD REPLY
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode

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).

ADD REPLY
0
Entering edit mode

Do you have empty lines in your fastq files?

ADD REPLY
0
Entering edit mode

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}
ADD REPLY
0
Entering edit mode

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
ADD REPLY
0
Entering edit mode
ADD REPLY

Login before adding your answer.

Traffic: 2932 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6