Unconfigured Ad

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • brachysclereid
    Member
    • Feb 2011
    • 32

    Ideas on collecting quality scores per base in an illumina fastq file

    Hi,

    I am trying to make per base quality plots like fastqc because I would like to customize reporting. The summary stats reported by fastq in the text export is difficult to work with in R. Instead it would be better to have a list of the quality scores and let R do the work/stats. Does anyone know of a program that will generate a raw list of of quality scores per base from a fastq file? If not I think it should be pretty easy to write a perl script for this. I thought it would be worth asking...

    thanks
  • gringer
    David Eccles (gringer)
    • May 2011
    • 845

    #2
    Do you want something more than what fastx_quality_stats from fastx-tools can provide?
    Code:
    usage: fastx_quality_stats [-h] [-N] [-i INFILE] [-o OUTFILE]
    ...
       [-N]         = New output format (with more information per nucleotide/cycle).
    ...
    The *NEW* output format:
            cycle (previously called 'column') = cycle number
            max-count
            For each nucleotide in the cycle (ALL/A/C/G/T/N):
                    count   = number of bases found in this column.
                    min     = Lowest quality score value found in this column.
                    max     = Highest quality score value found in this column.
                    sum     = Sum of quality score values for this column.
                    mean    = Mean quality score value for this column.
                    Q1      = 1st quartile quality score.
                    med     = Median quality score.
                    Q3      = 3rd quartile quality score.
                    IQR     = Inter-Quartile range (Q3-Q1).
                    lW      = 'Left-Whisker' value (for boxplotting).
                    rW      = 'Right-Whisker' value (for boxplotting).

    Comment

    • dgtnk
      Junior Member
      • Nov 2011
      • 4

      #3
      agree with gringer

      fastx_quality_stats from Fastx_Toolkit works well. It will not give you the raw list of quality scores, but will provide you the quartile values of read quality at each read position, which you can use for boxplotting in R.

      Comment

      • Dario1984
        Senior Member
        • Jun 2011
        • 166

        #4
        Try using QualityScore in ShortRead.

        Comment

        • Blahah404
          Member
          • Dec 2011
          • 48

          #5
          You can easily extract a .qual file containing per-base quality scores from a fastq file, for example using biopython:
          Code:
          #!/usr/bin/env python
          
          """Usage: fastq2qual.py filename 
              where filename is a .fastq (without extension)
              will produce: filename.qual
          """
          
          import sys
          from Bio import SeqIO
          
          file_name = sys.argv[1]
          
          SeqIO.convert(file_name+".fastq", "fastq", file_name+".qual", "qual")
          
          sys.exit()

          Comment

          • maubp
            Peter (Biopython etc)
            • Jul 2009
            • 1544

            #6
            Originally posted by Dario1984 View Post
            Try using QualityScore in ShortRead.
            +1

            If you want to use R for the plotting and analysis, why not use R to read the FASTQ files as well?

            Comment

            • kwyattm
              Junior Member
              • Jul 2011
              • 7

              #7
              The way I handled this was to write a perl script that 1)parses qseq to fastq 2)trims for adaptor and 3)parses quality score data to a text file. The text file is subsequently imported into R and simply graphed. I even get the graphs imported into a pdf and e-mailed to me when everything is done!

              Comment

              • gringer
                David Eccles (gringer)
                • May 2011
                • 845

                #8
                qseq -> fastq is already done in CASAVA, most likely including the removal of any adaptor sequences. CASAVA 1.8+ process the intensity files directly into fastq:

                Discussion of next-gen sequencing related bioinformatics: resources, algorithms, open source efforts, etc

                Comment

                • kwyattm
                  Junior Member
                  • Jul 2011
                  • 7

                  #9
                  Yep!

                  Originally posted by gringer View Post
                  qseq -> fastq is already done in CASAVA, most likely including the removal of any adaptor sequences. CASAVA 1.8+ process the intensity files directly into fastq:

                  http://seqanswers.com/forums/showthread.php?t=13147
                  Thanks, Ginger! Yeah, I knew about this, it's just an old script. Just passing along the information I had!

                  Comment

                  • brachysclereid
                    Member
                    • Feb 2011
                    • 32

                    #10
                    Idease on q scores

                    Thanks!

                    I used the biopython suggestion and now have the .qual files. This is what I wanted.

                    kwyattm,
                    Is there a tool that will take a random sample of the .qual file in R for the purpose of plotting? I am curious about what your are using to make the plots.

                    Thanks again!

                    Comment

                    • gringer
                      David Eccles (gringer)
                      • May 2011
                      • 845

                      #11
                      I used the biopython suggestion and now have the .qual files. This is what I wanted.
                      Just as a word of caution, you need to make sure the quality base is correct. Different sequencers have in the past used different bases / ascii values to represent the same qualities.

                      Is there a tool that will take a random sample of the .qual file in R for the purpose of plotting?
                      You can randomly sample data in R by using the 'sample' function, but boxplot should be able to manage with the full dataset. There's also a fastX tool for displaying quality statistics (fastq_quality_boxplot_graph), just in case you want something that's already been made by someone else.

                      Comment

                      • Dario1984
                        Senior Member
                        • Jun 2011
                        • 166

                        #12
                        Since he is working in R, it seems much more straightforward to read it in R.

                        e.g.

                        library(ShortRead)
                        fastqs <- readFastq("/path/to/fastqs")
                        qualities <- quality(fastqs)

                        Comment

                        Latest Articles

                        Collapse

                        • 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
                        • SEQadmin2
                          Advanced Sequencing Platforms Tackle Neuroscience’s Toughest Genomics Problems
                          by SEQadmin2



                          Genomics studies in neuroscience face a special challenge due to the brain’s complexity and scarcity of samples. Mapping changes in cell type and state using conventional next-generation sequencing methods remains challenging. Advances in technologies like single-cell sequencing, spatial transcriptomics, and long-read sequencing have opened the door to deeper studies of the brain and diseases like Alzheimer’s, amyotrophic lateral sclerosis (ALS), and schizophrenia.
                          ...
                          07-09-2026, 11:10 AM
                        • SEQadmin2
                          Cancer Drug Resistance: The Lingering Barrier to Rising Survival
                          by SEQadmin2



                          Cancer survival rates have significantly increased in the last few decades in the United States, reaching a combined 70% 5-year survival rate by 2021. Behind this number, there are years of research to find new therapies, drug targets, and early detection methods. But there is one core challenge that keeps slowing down these advances, and it’s about drug resistance.

                          There is no single reason why many patients don’t respond to treatment as expected. Cancer is...
                          07-08-2026, 05:17 AM

                        ad_right_rmr

                        Collapse

                        News

                        Collapse

                        Topics Statistics Last Post
                        Started by SEQadmin2, 07-24-2026, 12:17 PM
                        0 responses
                        16 views
                        0 reactions
                        Last Post SEQadmin2  
                        Started by SEQadmin2, 07-23-2026, 11:41 AM
                        0 responses
                        18 views
                        0 reactions
                        Last Post SEQadmin2  
                        Started by SEQadmin2, 07-20-2026, 11:10 AM
                        0 responses
                        24 views
                        0 reactions
                        Last Post SEQadmin2  
                        Started by SEQadmin2, 07-13-2026, 10:26 AM
                        0 responses
                        37 views
                        0 reactions
                        Last Post SEQadmin2  
                        Working...