Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hamcan
    Member
    • Nov 2016
    • 19

    #1

    Number of Reads

    Hi there,
    I have Illumina HiSeq fastq output files. I want to know how I can find out the number of reads per sample before and after processing using unix.
    Any commands that you might know of?
    I'd greatly appreciate it
    Thanks!
  • mastal
    Senior Member
    • Mar 2009
    • 666

    #2
    Code:
     wc -l
    gives you the number of lines. Divide that by 4 to get the number of reads.

    Comment

    • wdecoster
      Member
      • Oct 2015
      • 97

      #3
      If the file is not compressed:
      Code:
      grep -c '^@' yourfile.fastq
      If the file is gz compressed:
      Code:
      zcat yourfile.fastq.gz | grep -c '^@'
      If the file is depressed:
      Code:
      talk to it about feelings and give chocolate

      Comment

      • jdk787
        josh kinman
        • Apr 2014
        • 72

        #4
        You can also run it through FastQC before and after processing. This will give you number of reads and a lot of other useful information.

        Josh Kinman

        Comment

        • mastal
          Senior Member
          • Mar 2009
          • 666

          #5
          The quality scores may sometimes have a value '@', so you may have some of the base quality lines also beginning with '@'.

          Comment

          • wdecoster
            Member
            • Oct 2015
            • 97

            #6
            Originally posted by mastal View Post
            The quality scores may sometimes have a value '@', so you may have some of the base quality lines also beginning with '@'.
            Right, good catch

            Comment

            • LacquerHead
              Member
              • Nov 2015
              • 31

              #7
              samtools flagstat

              Comment

              • hamcan
                Member
                • Nov 2016
                • 19

                #8
                thanks everyone!
                how about to find the number of bases?

                Comment

                • Michael.Ante
                  Senior Member
                  • Oct 2011
                  • 127

                  #9
                  It should be something like
                  Code:
                  awk 'NR%4==2{print}' in.fastq | wc
                  With the awk command, you print the nucleotides, with wc you count the output's characters.

                  Comment

                  • Brian Bushnell
                    Super Moderator
                    • Jan 2014
                    • 2709

                    #10
                    I like to use BBMap's Reformat:
                    Code:
                    reformat.sh in=100x.fq
                    
                    No output stream specified.  To write to stdout, please specify 'out=stdout.fq' or similar.
                    Input is being processed as paired
                    Input:                  	3072634 reads          	463967734 bases
                    Output:                 	3072634 reads (100.00%) 	463967734 bases (100.00%)
                    
                    Time:                         	3.317 seconds.
                    Reads Processed:       3072k 	926.30k reads/sec
                    Bases Processed:        463m 	139.87m bases/sec
                    That has the advantage of working on fasta, fastq, or sam; compressed or raw. And various other formats.

                    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-15-2026, 10:52 AM
                    0 responses
                    21 views
                    0 reactions
                    Last Post SEQadmin2  
                    Started by SEQadmin2, 10-14-2026, 05:39 AM
                    0 responses
                    26 views
                    0 reactions
                    Last Post SEQadmin2  
                    Started by SEQadmin2, 10-13-2026, 09:56 AM
                    0 responses
                    22 views
                    0 reactions
                    Last Post SEQadmin2  
                    Started by SEQadmin2, 10-09-2026, 11:14 AM
                    0 responses
                    28 views
                    0 reactions
                    Last Post SEQadmin2  
                    Working...