Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • wokai001
    Member
    • Nov 2010
    • 20

    #1

    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
  • fongchun
    Member
    • May 2011
    • 55

    #2
    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,

    Comment

    • wokai001
      Member
      • Nov 2010
      • 20

      #3
      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

      Comment

      • fongchun
        Member
        • May 2011
        • 55

        #4
        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

        Comment

        • wokai001
          Member
          • Nov 2010
          • 20

          #5
          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

          Comment

          • alexbmp
            Member
            • Oct 2011
            • 30

            #6
            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
            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

            Comment

            • markaldo
              Junior Member
              • Nov 2019
              • 1

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

              Comment

              Latest Articles

              Collapse

              • SEQadmin2
                New Genomics Technologies Take Aim at Long-Standing Limits
                by SEQadmin2


                Researchers using sequencing and genomics tools often have to make trade-offs. They can choose between speed or scale, short reads or long-range information, or targeted panels or a view of the whole transcriptome. New technologies that have been released this year are built to address those tough choices.

                We asked six companies the same four questions to learn about their latest products. The new technologies bring a lot to the table, including rethinking sequencing
                ...
                Yesterday, 10:25 AM
              • SEQadmin2
                How Immunogenomics Decodes Immunity’s Genetic Blueprint
                by SEQadmin2




                The immune system’s power comes from its genetic diversity, allowing myriad threats to be neutralized through first recognizing foreign antigens. That diversity is also what makes the immune system so difficult to study. Recent advances in sequencing technology and computational biology, however, are giving researchers new tools to understand immune responses and immune-related diseases in greater detail.

                This convergence of genetics, immunology, and computation...
                09-01-2026, 05:41 AM

              ad_right_rmr

              Collapse

              News

              Collapse

              Topics Statistics Last Post
              Started by SEQadmin2, Today, 09:51 AM
              0 responses
              7 views
              0 reactions
              Last Post SEQadmin2  
              Started by SEQadmin2, 09-25-2026, 09:06 AM
              0 responses
              31 views
              0 reactions
              Last Post SEQadmin2  
              Started by SEQadmin2, 09-23-2026, 11:05 AM
              0 responses
              26 views
              0 reactions
              Last Post SEQadmin2  
              Started by SEQadmin2, 09-18-2026, 11:37 AM
              1 response
              47 views
              0 reactions
              Last Post pekgio
              by pekgio
               
              Working...