SEQanswers

Go Back   SEQanswers > Bioinformatics > Bioinformatics



Similar Threads
Thread Thread Starter Forum Replies Last Post
TopHat Error: Could not find Bowtie index files /bowtie-0.12.5/indexes/. rebrendi Bioinformatics 11 06-22-2016 09:55 AM
tophat 1.3.0 sam output quality string problem jameslz Bioinformatics 4 06-16-2011 05:22 PM
tophat hg19 index madsaan Bioinformatics 1 06-10-2011 09:56 PM
tophat-bowtie building index repinementer Bioinformatics 1 07-17-2010 10:53 PM
Tophat and Bowtie Index Siva Bioinformatics 1 03-09-2010 01:44 PM

Reply
 
Thread Tools
Old 01-30-2012, 09:51 AM   #1
wokai001
Member
 
Location: Düsseldorf

Join Date: Nov 2010
Posts: 20
Default tophat IndexError: string index out of range

I'm using tophat for alignment of Illumina rna-seq data. The following error emerged during one my previous runs but I've already seen this type of error several times.

[Tue Jan 17 00:17:19 2012] Beginning TopHat run (v1.4.0)
-----------------------------------------------
[Tue Jan 17 00:17:19 2012] Preparing output location top_bwa_out/
[Tue Jan 17 00:17:19 2012] Checking for Bowtie index files
[Tue Jan 17 00:17:19 2012] Checking for reference FASTA file
[Tue Jan 17 00:17:19 2012] Checking for Bowtie
Bowtie version: 0.12.7.0
[Tue Jan 17 00:17:19 2012] Checking for Samtools
Samtools Version: 0.1.17
[Tue Jan 17 00:17:19 2012] Generating SAM header for hs_grch37
Traceback (most recent call last):
File "/usr/local/bin/tophat-1.4.0.Linux_x86_64/tophat", line 3052, in <module>
sys.exit(main())
File "/usr/local/bin/tophat-1.4.0.Linux_x86_64/tophat", line 2925, in main
params.read_params = check_reads_format(params, reads_list)
File "/usr/local/bin/tophat-1.4.0.Linux_x86_64/tophat", line 1318, in check_reads_format
freader=FastxReader(zf.file, params.read_params.color, zf.fname)
File "/usr/local/bin/tophat-1.4.0.Linux_x86_64/tophat", line 1073, in __init__
while hlines>0 and self.lastline[0] not in "@>" :
IndexError: string index out of range

To me, it seems that my reference input files are ok.

Did someone else see this kind of error?

Thanks
Wolfgang
wokai001 is offline   Reply With Quote
Old 02-12-2012, 06:55 PM   #2
fongchun
Member
 
Location: Vancouver, BC

Join Date: May 2011
Posts: 55
Default

I am getting this problem too. Did you ever solve it? If you did, any advice on how you did it would be great.

Thanks,
fongchun is offline   Reply With Quote
Old 02-19-2012, 12:57 AM   #3
wokai001
Member
 
Location: Düsseldorf

Join Date: Nov 2010
Posts: 20
Default

Dear fongchun,
thank you for your answer. Unfortunately, the issue is not solved.
To me, it looks like a bug. Tophat seems to parse the ref-sequence file for the names (and lengths) of referencs sequences. Probably it reaches end of file without recognizing.

Wolfgang
wokai001 is offline   Reply With Quote
Old 02-19-2012, 11:26 PM   #4
fongchun
Member
 
Location: Vancouver, BC

Join Date: May 2011
Posts: 55
Default

Quote:
Originally Posted by wokai001 View Post
Dear fongchun,
thank you for your answer. Unfortunately, the issue is not solved.
To me, it looks like a bug. Tophat seems to parse the ref-sequence file for the names (and lengths) of referencs sequences. Probably it reaches end of file without recognizing.

Wolfgang
Hi Wolfgang,

Although we were not able to solve out problem completely, we realized that several of our fastq files were corrupt due to poor sequencing runs, and once they were removed from the analysis, the error seemed to disappear. I wonder if you could be facing a similar issue?

Fong
fongchun is offline   Reply With Quote
Old 02-24-2012, 01:55 AM   #5
wokai001
Member
 
Location: Düsseldorf

Join Date: Nov 2010
Posts: 20
Default Corrupted fastq?

Dear Fong,

unfortunately, I can't look up because I deleted the input fastq file. I first aligned my reads with bwa and then extracted unmapped reads with samtools (into a bam file):

samtools view -f 0x4 -b -S -o unmap_inh017.bam inh017.sam

The bam was then converted into fastq with bam2fastx (which is part of tophat):

bam2fastx --fastq unmap_inh017.bam > unmap_inh017.fq

The error message looks like it misses a "@" or ">" in the last line. What did your deleted reads look like? Perhaps one could build something like a format-checker (I would try when I could see some faulty reads).

Cheers
Wolfgang
wokai001 is offline   Reply With Quote
Old 05-07-2013, 05:35 AM   #6
alexbmp
Member
 
Location: Seoul, South Korea

Join Date: Oct 2011
Posts: 30
Default

I had the same error when running tophat for my fastq files.
I fixed this error; it happened only when my input fastq files were empty.

An index error occurs in
Quote:
while hlines>0 and self.lastline[0] not in "@>" :
only because self.lastline is an empty string.

This is because self.lastline is the result of file.readline in the while loop,
which is "" when the file itself is empty.

After putting in a decent input file this error disappeared.

Hope this helps
alexbmp is offline   Reply With Quote
Old 11-12-2019, 07:13 PM   #7
markaldo
Junior Member
 
Location: dubai

Join Date: Nov 2019
Posts: 1
Default

Just info: In Python, a string is a single-dimensional array of characters. The string index out of range means that the index you are trying to access does not exist. In a string, that means you're trying to get a character from the string at a given point. If that given point does not exist , then you will be trying to get a character that is not inside of the string. Indexes in Python programming start at 0. This means that the maximum index for any string will always be length-1. There are several ways to account for this. Knowing the length of your string (using len() function)could certainly help you to avoid going over the index.
markaldo is offline   Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off




All times are GMT -8. The time now is 03:09 AM.


Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Single Sign On provided by vBSSO