R/per_read_quality.R

Defines functions per_read_quality

Documented in per_read_quality

#' Compute the mean quality score per read.
#' \code{per_read_quality}
#' @param infile Path to FASTQ file
#' @param output_file File to write plot to. Will not write to file if NA. Default NA.
#' @examples
#' infile <- system.file("extdata", "10^5_reads_test.fq.gz", package = "qckitfastq")
#' prq <- per_read_quality(infile)
#' 
#' @return Data frame of mean quality score per read
#' @export
per_read_quality <- function(infile,output_file=NA){
    qs <- qual_score_per_read(infile)$mu_per_read
    score_sequence_mean <- data.frame(read = seq(1,length(qs)),
                                      sequence_mean = qs)
    if (!is.na(output_file)) write.csv(file=output_file,score_sequence_mean)
    return(score_sequence_mean)
}

Try the qckitfastq package in your browser

Any scripts or data that you put into this service are public.

qckitfastq documentation built on Nov. 8, 2020, 5:24 p.m.