Seqanswers Leaderboard Ad

Collapse

Announcement

Collapse
No announcement yet.
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • xApple
    replied
    You're welcome ! It's just a quick hack that has the advantage to not use any memory but suffers from being extremely slow. Probably not suitable for Illumina sized data.

    Leave a comment:


  • jgibbons1
    replied
    Thanks xApple. You're right...I ended up taking the average of the quality scores.

    I will give your script a shot. Thanks!

    Leave a comment:


  • xApple
    replied
    That bioawk command doesn't compute the quality score for the entire file as per the question you originally asked. It computes it for every sequence and floods your standard output.

    Here is a program that actually does what you asked.

    Code:
    #!/usr/bin/env python
    
    """
    Compute the average quality for a given FASTQ file.
    
    Written by Lucas Sinclair.
    Kopimi.
    
    You can use this script from the shell like this:
    $ fastq_avg_qual < reads.fastq
    """
    
    # Iterative mean #
    def imean(numbers):
        count = 0
        total = 0
        for num in numbers:
            count += 1
            total += num
        return float(total)/count
    
    # Do it #
    import sys
    from Bio import SeqIO
    records = (r for r in SeqIO.parse(sys.stdin, "fastq"))
    scores = (s for r in records for s in r.letter_annotations["phred_quality"])
    print imean(scores)
    Last edited by xApple; 07-12-2013, 07:45 AM.

    Leave a comment:


  • jgibbons1
    replied
    For anyone still interested...

    For simplicity, I ended up using Bioawk (https://github.com/lh3/bioawk):

    Get the mean Phred quality score from FASTQ:
    awk -c fastx '{ print ">"$name; print meanqual($qual) }' seq.fq.gz

    Leave a comment:


  • jgibbons1
    replied
    Thanks to everyone's suggestions!

    I will try a few of these and let you know what I ended up doing.

    Leave a comment:


  • maasha
    replied
    With Biopieces (www.biopieces.org) you can do it in two steps where you first find the mean score per sequence entry and then the overall mean score:

    Code:
    read_fastq -i test.fq | mean_scores | mean_vals -k SCORES_MEAN -x

    Leave a comment:


  • JackieBadger
    replied
    You can also get the source code for any Galaxy function

    Leave a comment:


  • GenoMax
    replied
    Originally posted by jgibbons1 View Post
    Hello,

    Given a fastq file, is there software that will calculate the average quality score for the entire file?

    Thanks
    One should be careful about "average quality score" for an entire file since you could still have a subset of sequences that may be hidden outliers ("bad") in an otherwise "good" file.

    Both Fastx toolkit (http://hannonlab.cshl.edu/fastx_toolkit/) and FastQC (http://www.bioinformatics.babraham.a...ojects/fastqc/) will generate statistics you could use.

    If this is illumina data and you have access to CASAVA pipeline output then the summary file has a "mean" quality score for each sample that you could parse.

    Leave a comment:


  • jgibbons1
    replied
    I'm trying to integrate this value into a larger analysis pipeline. Automating it would be more efficient.

    Leave a comment:


  • JackieBadger
    replied
    Originally posted by jgibbons1 View Post
    Thanks @JackieBadger

    Do you know of any unix/linux based tools to do this? I'm trying to stay away from galaxy for this tidbit.
    Why do you need to avoid Galaxy?

    Leave a comment:


  • jgibbons1
    replied
    Thanks @JackieBadger

    Do you know of any unix/linux based tools to do this? I'm trying to stay away from galaxy for this tidbit.

    Leave a comment:


  • JackieBadger
    replied
    The "Compute quality statistics" function in Galaxy (https://main.g2.bx.psu.edu)

    Leave a comment:


  • jgibbons1
    started a topic average quality score for fastq file

    average quality score for fastq file

    Hello,
    Simple question here, but I've had a problem finding a program to do it.

    Given a fastq file, is there software that will calculate the average quality score for the entire file?

    Thanks

Latest Articles

Collapse

  • seqadmin
    Exploring the Dynamics of the Tumor Microenvironment
    by seqadmin




    The complexity of cancer is clearly demonstrated in the diverse ecosystem of the tumor microenvironment (TME). The TME is made up of numerous cell types and its development begins with the changes that happen during oncogenesis. “Genomic mutations, copy number changes, epigenetic alterations, and alternative gene expression occur to varying degrees within the affected tumor cells,” explained Andrea O’Hara, Ph.D., Strategic Technical Specialist at Azenta. “As...
    07-08-2024, 03:19 PM
  • seqadmin
    Exploring Human Diversity Through Large-Scale Omics
    by seqadmin


    In 2003, researchers from the Human Genome Project (HGP) announced the most comprehensive genome to date1. Although the genome wasn’t fully completed until nearly 20 years later2, numerous large-scale projects, such as the International HapMap Project and 1000 Genomes Project, continued the HGP's work, capturing extensive variation and genomic diversity within humans. Recently, newer initiatives have significantly increased in scale and expanded beyond genomics, offering a more detailed...
    06-25-2024, 06:43 AM

ad_right_rmr

Collapse

News

Collapse

Topics Statistics Last Post
Started by seqadmin, 07-10-2024, 07:30 AM
0 responses
23 views
0 likes
Last Post seqadmin  
Started by seqadmin, 07-03-2024, 09:45 AM
0 responses
200 views
0 likes
Last Post seqadmin  
Started by seqadmin, 07-03-2024, 08:54 AM
0 responses
209 views
0 likes
Last Post seqadmin  
Started by seqadmin, 07-02-2024, 03:00 PM
0 responses
192 views
0 likes
Last Post seqadmin  
Working...
X