R/RcppExports.R

Defines functions fixFastq fastqValidator getSkippedLineCount getSequenceQualityMismatchCount getZeroLengthSequenceCount getFastqPlusErrorCount getMalformedFastqHeaderCount getFastqBases getFastqCount

Documented in fastqValidator fixFastq getFastqBases getFastqCount getFastqPlusErrorCount getMalformedFastqHeaderCount getSequenceQualityMismatchCount getSkippedLineCount getZeroLengthSequenceCount

# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

#' return the number of fastq entries previously parsed from provided Fastq
#' file
#'
#' @return long integer of read fastq elements
#'
#' @examples
#' fastq <- system.file("extdata", "example.fastq.gz", package = "nanopoRe")
#' fastqValidator(fastq)
#' getFastqCount()
#'
#' @export
getFastqCount <- function() {
    .Call(`_nanopoRe_getFastqCount`)
}

#' return the number of fastq bases previously parsed from
#' provided Fastq file
#'
#' @return long long integer of read fastq bases
#'
#' @examples
#' fastq <- system.file("extdata", "example.fastq.gz", package = "nanopoRe")
#' fastqValidator(fastq)
#' getFastqBases()
#'
#' @export
getFastqBases <- function() {
    .Call(`_nanopoRe_getFastqBases`)
}

#' count of fastq elements rejected due to malformed fastq header
#'
#' @return integer count of malformed fastq header entries
#'
#' @examples
#' fastq <- system.file("extdata", "frankenFastq.fastq.gz",
#'     package = "nanopoRe")
#' fastqValidator(fastq)
#' getMalformedFastqHeaderCount()
#'
#' @export
getMalformedFastqHeaderCount <- function() {
    .Call(`_nanopoRe_getMalformedFastqHeaderCount`)
}

#' count of fastq elements rejected due to line 3 plus separator
#'
#' @return integer count of malformed fastq '+' separator entries
#'
#' @examples
#' fastq <- system.file("extdata", "frankenFastq.fastq.gz",
#'     package = "nanopoRe")
#' fastqValidator(fastq)
#' getFastqPlusErrorCount()
#'
#' @export
getFastqPlusErrorCount <- function() {
    .Call(`_nanopoRe_getFastqPlusErrorCount`)
}

#' count of fastq elements rejected due to zero length sequence
#'
#' @return integer count of fastq entries with zero sequence length
#'
#' @examples
#' fastq <- system.file("extdata", "frankenFastq.fastq.gz",
#'     package = "nanopoRe")
#' fastqValidator(fastq)
#' getZeroLengthSequenceCount()
#'
#' @export
getZeroLengthSequenceCount <- function() {
    .Call(`_nanopoRe_getZeroLengthSequenceCount`)
}

#' count of fastq elements rejected due to mismatch between sequence and
#' quality field lengths
#'
#' @return integer count of fastq entries with seq/qual length challenges
#'
#' @examples
#' fastq <- system.file("extdata", "frankenFastq.fastq.gz",
#'     package = "nanopoRe")
#' fastqValidator(fastq)
#' getSequenceQualityMismatchCount()
#'
#' @export
getSequenceQualityMismatchCount <- function() {
    .Call(`_nanopoRe_getSequenceQualityMismatchCount`)
}

#' count of lines of fastq file skipped to enable fastq entry parsing
#'
#' @return integer count of lines skipped
#'
#' @examples
#' fastq <- system.file("extdata", "frankenFastq.fastq.gz",
#'     package = "nanopoRe")
#' fastqValidator(fastq)
#' getSkippedLineCount()
#'
#' @export
getSkippedLineCount <- function() {
    .Call(`_nanopoRe_getSkippedLineCount`)
}

#' parse a fastq file aiming to validate sequences
#'
#' fastqValidator will parse the specified fastq (or fastq.gz) file looking
#' for fastq entry compliance. A boolean value of overall file compliance will
#' be returned. Additional summary counts describing the reason for rejection
#' are also made available
#'
#' @param fastq A fastq format DNA/RNA sequence file
#' @return logical defining if fastq provided is indeed valid fastq
#'
#' @examples
#' fastq <- system.file("extdata", "example.fastq.gz", package = "nanopoRe")
#' fastqValidator(fastq)
#' badFastq <- system.file("extdata", "frankenFastq.fastq.gz",
#'     package = "nanopoRe")
#' fastqValidator(badFastq)
#'
#' @export
fastqValidator <- function(fastq) {
    .Call(`_nanopoRe_fastqValidator`, fastq)
}

#' fix a corrupted fastq file (if fastq-like)
#'
#' fixFastq parses a fastq (or fastq.gz) file for compliant fastq entries
#' and writes these to the file specified in newfastq parameter. Any
#' non-compliant reads are dropped
#'
#' @param fastq file location of fastq source
#' @param newfastq location of file to write content to
#' @return path to new fastq file (same as newfastq provided)
#'
#' @examples
#' badFastq <- system.file("extdata", "frankenFastq.fastq.gz", package =
#'     "nanopoRe")
#' fastqValidator(badFastq)
#' tempFile <- tempfile(pattern="fastq", fileext=".fq")
#' fixFastq(badFastq, tempFile)
#' fastqValidator(tempFile)
#'
#' @export
fixFastq <- function(fastq, newfastq) {
    .Call(`_nanopoRe_fixFastq`, fastq, newfastq)
}
sagrudd/nanopoRe documentation built on June 7, 2020, 10:20 p.m.