Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gen2prot
    Member
    • Apr 2010
    • 68

    #1

    prep_reads file in Tophat run shows a different number of reads

    Hi All,

    I have a very naive question. When I use "grep" on one of my fastq files to check the number of reads I get a certain value.

    Code:
    grep "@" SRR072905.fastq | wc -l
    40042015
    However, When I check the prep_reads.log file after a tophat run I get a different number of reads

    Code:
    more prep_reads.log 
    prep_reads v1.1.4 (1709)
    ---------------------------
    4060 out of 26976249 reads have been filtered out
    40042015 are in the fastq file, but Tophat says the number is 26976249. Is the program not taking all the reads as input?

    Please help so I know if I have to run the program again.

    Thanks
    Abhijit
  • kmcarr
    Senior Member
    • May 2008
    • 1181

    #2
    Using grep "@" to count reads in a fastq file will not work the way you think it will.

    Read this thread for an explanation.

    Comment

    • gen2prot
      Member
      • Apr 2010
      • 68

      #3
      But fastq is a set of four lines. The "@" line is followed by the sequence, while the "+" line is followed by the sequence quality. Therefore, counting the "@" or the "+" sign should give you the number of reads. Am I wrong?

      Comment

      • gen2prot
        Member
        • Apr 2010
        • 68

        #4
        Ignore my previous comment kmcarr. I figured out my mistake. I have to use the "^" at the beginning of the search while using "grep". Thnaks

        Comment

        • jasonwood
          Member
          • May 2010
          • 10

          #5
          The problem is that will flag every line with the @ character in it, so if your quality strings have that character you will double count. grep ^@ instead, or just count lines and divide by 4.

          Comment

          • kmcarr
            Senior Member
            • May 2008
            • 1181

            #6
            Originally posted by gen2prot View Post
            Ignore my previous comment kmcarr. I figured out my mistake. I have to use the "^" at the beginning of the search while using "grep". Thnaks
            Even using grep ^@ will not work perfectly. As the thread linked above notes, "@" is a valid quality character in Illumina FASTQ files which may even appear at the beginning of a quality line. grep ^@ will count these as well.

            You need to use a search pattern for grep which will be absolutely unique to the header line. I typically use ^"@HW". The read IDs start with the machine names; our machine names all start with HW and "W" is not a valid quality character so the string @HW can only appear in read IDs.

            Comment

            • cram
              Member
              • Nov 2008
              • 16

              #7
              Couldn't you just do:

              Code:
              wc -l foo.fastq
              and then divide by 4?

              That should run faster too.

              Comment

              • nicolallias
                Member
                • Jan 2010
                • 23

                #8
                Originally posted by jasonwood
                just count lines and divide by 4.
                Originally posted by cram View Post
                Code:
                wc -l foo.fastq
                and then divide by 4?
                Not if the fastq is generated with line wrapping - I've seen one of the bwa tool, qualfa2fq.pl doing this on the quality.

                But you may overestimate the number of reads if the fastq is encoding quality Sanger's like (in quality line, "@" is available in Sanger's encoding ASCII+33)

                You could try to export from fastq-sanger to fastq-illumina, do count with
                Code:
                grep -c ^@ yourfile.fastq
                and then you're sure about the number of sequences.

                A shorter way could be to grep some elements of the title (flowcell name, delimitation character(s)...).
                Originally posted by kmcarr
                You need to use a search pattern for grep which will be absolutely unique to the header line.
                Can you show us the head of your fastq ?
                Last edited by nicolallias; 03-24-2011, 01:52 AM.

                Comment

                Latest Articles

                Collapse

                • 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
                • 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
                  ...
                  09-28-2026, 10:25 AM

                ad_right_rmr

                Collapse

                News

                Collapse

                Topics Statistics Last Post
                Started by SEQadmin2, 10-22-2026, 11:13 AM
                0 responses
                23 views
                0 reactions
                Last Post SEQadmin2  
                Started by SEQadmin2, 10-22-2026, 10:48 AM
                0 responses
                20 views
                0 reactions
                Last Post SEQadmin2  
                Started by SEQadmin2, 10-15-2026, 10:52 AM
                0 responses
                36 views
                0 reactions
                Last Post SEQadmin2  
                Started by SEQadmin2, 10-14-2026, 05:39 AM
                0 responses
                42 views
                0 reactions
                Last Post SEQadmin2  
                Working...