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
                16S/ITS Profiling vs. Shotgun Metagenomics: What Changes in Your Workflow?
                by SEQadmin2




                NGS has revolutionized clinical microbiology by offering new ways to identify and surveil pathogens without prior knowledge of the target. One popular approach is 16S rRNA and ITS amplicon sequencing, which targets specific microbial markers. But studies are increasingly incorporating shotgun metagenomics, a technique that sequences all DNA from a sample without targeting specific microbial markers. This approach allows more detailed taxonomic classification, detection...
                Yesterday, 06:46 AM
              • SEQadmin2
                Multiomic Liquid Biopsy: What DNA/RNA Panels Reveal That DNA Alone Can’t
                by SEQadmin2



                Tumors contain complex mixtures of cell populations that evolve in response to treatment and host-specific factors. Tissue biopsies provide only static snapshots of a tumor’s state. But what if we could follow that evolution over time using a minimally invasive technique?

                Liquid biopsies can detect tumor-derived material circulating in the bloodstream, providing a way to study treatment response, detect emerging resistance, and discover new biomarkers. Circulating
                ...
                10-14-2026, 09:55 AM

              ad_right_rmr

              Collapse

              News

              Collapse

              Topics Statistics Last Post
              Started by SEQadmin2, 10-28-2026, 09:57 AM
              0 responses
              29 views
              0 reactions
              Last Post SEQadmin2  
              Started by SEQadmin2, 10-28-2026, 09:51 AM
              0 responses
              18 views
              0 reactions
              Last Post SEQadmin2  
              Started by SEQadmin2, 10-22-2026, 11:13 AM
              0 responses
              71 views
              0 reactions
              Last Post SEQadmin2  
              Started by SEQadmin2, 10-22-2026, 10:48 AM
              0 responses
              48 views
              0 reactions
              Last Post SEQadmin2  
              Working...