R/RcppExports.R

Defines functions write_fastq write_fasta read_fastq read_fasta

Documented in read_fasta read_fastq write_fasta write_fastq

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

#' Read in raw data from a fasta file.
#' 
#' @param filename The name of the fasta file to read data from.
#'
#' @examples
#' fastq_example_file = system.file('extdata/small_unittest.fasta', 
#'                                   package = 'bioreadr')
#' data = read_fastq(fastq_example_file)
#' @return returns a dataframe with the columns: 
#' "header", "sequence"
#' 
read_fasta <- function(filename) {
    .Call(`_CamBioR_read_fasta`, filename)
}

#' Read in data from a fastq file.
#' 
#' @param filename The name of the fastq file to read data from.
#'
#' @examples
#' fastq_example_file = system.file('extdata/small_unittest.fastq', 
#'                                   package = 'bioreadr')
#' data = read_fastq(fastq_example_file)
#' @return returns a dataframe with the columns: 
#' "header", "sequence", "strand", "qual"
#'
read_fastq <- function(filename) {
    .Call(`_CamBioR_read_fastq`, filename)
}

#' Write data to a fasta file.
#' 
#' @param df The dataframe of sequence data to write to file. The dataframe must
#' contain the columns: "header" and "sequence". Other columns in the dataframe
#' are permitted but will be ignored.
#' @param path Path or connection to write to.
#'
#' @examples
#' fasta_ex_dat = data.frame(
#'     header = c("seq1", "seq2", "seq3"),
#'     sequence = c("ATGC", "AATTGGCC", "TGACTGAC"),
#'     stringsAsFactors = FALSE
#'     )
#' data = write_fasta(fasta_ex_dat, "example_output.fasta")
#' @return NULL
#' 
write_fasta <- function(df, path) {
    invisible(.Call(`_CamBioR_write_fasta`, df, path))
}

#' Write data to a fastq file.
#' 
#' @param df The dataframe of sequence data to write to file. The dataframe must
#' contain the columns: "header", "sequence", "strand", and "qual". 
#' Other columns in the dataframe are permitted but will be ignored.
#' @param path Path or connection to write to.
#' 
#' @examples
#' fastq_ex_dat = data.frame(
#'     header = c("seq1", "seq2", "seq3"),
#'     sequence = c("ATGC", "AATTGGCC", "TGACTGAC"),
#'     strand = c("+", "+","+"),
#'     qual = c("~~ua", "~AZ~ngZO", "lvykl~Qv"),
#'     stringsAsFactors = FALSE)
#' data = write_fastq(fastq_ex_dat, "example_output.fastq")
#' @return NULL
#' 
write_fastq <- function(df, path) {
    invisible(.Call(`_CamBioR_write_fastq`, df, path))
}
CNuge/CamBioR documentation built on May 28, 2022, 12:23 a.m.