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
                      Beyond CRISPR/Cas9: Understand, Choose, and Use the Right Genome Editing Tool
                      by SEQadmin2



                      CRISPR/Cas9 sparked the gene editing revolution for both research and therapeutics.1 But this system still showed severe issues that limited its applications. The most prominent were the heavy reliance on PAM sequences, delivery limitations, double-stranded breaks that prompt unintended edits and cell death, and editing inefficiency (both in targeting and in knock-in reliability).

                      Despite this, “CRISPR helped turn genome editing from a specialized technique into
                      ...
                      07-31-2026, 11:01 AM
                    • SEQadmin2
                      Proteomic Platforms: How to Choose the Right Analytical Strategy to Improve Detection and Clinical Applications
                      by SEQadmin2


                      Proteomics platforms are evolving rapidly, with advances in mass spectrometry and affinity-based approaches expanding what researchers can detect and at what scale. As the field moves toward deeper proteome coverage and clinical applications, scientists face an increasingly complex landscape of tools. This article will explore how researchers are navigating these choices to find the right platform for their work.

                      The systematic characterization of the human proteome has
                      ...
                      07-20-2026, 11:48 AM

                    ad_right_rmr

                    Collapse

                    News

                    Collapse

                    Topics Statistics Last Post
                    Started by SEQadmin2, 08-06-2026, 07:41 AM
                    0 responses
                    14 views
                    0 reactions
                    Last Post SEQadmin2  
                    Started by SEQadmin2, 08-03-2026, 10:13 AM
                    0 responses
                    31 views
                    0 reactions
                    Last Post SEQadmin2  
                    Started by SEQadmin2, 07-31-2026, 02:55 AM
                    0 responses
                    40 views
                    0 reactions
                    Last Post SEQadmin2  
                    Started by SEQadmin2, 07-24-2026, 12:17 PM
                    0 responses
                    26 views
                    0 reactions
                    Last Post SEQadmin2  
                    Working...