fastq2dataframe_rev: reverse a fastq corresponding data frame to a data.table of...

View source: R/fastq2datatable.R

fastq2dataframe_revR Documentation

reverse a fastq corresponding data frame to a data.table of fastq format, and save a fastq file

Description

reverse a fastq corresponding data frame to a data.table of fastq format, and save a fastq file

Usage

fastq2dataframe_rev(fastqDataframe, fileName = NULL)

Arguments

fastqDataframe

a data frame of four columns, and the column names must be "label", "sequence", "mark", and "score".

fileName

the fastq file to be written.

See Also

fastq2dataframe

Examples

{
## Not run: 
# Generating information for 3 reads, each of which is length of 50.
len = 50
n = 3
sequences = sapply(1:n, function(x) paste0(sample(c("A", "T", "C", "G"), len, replace = T), collapse = ""))
base = 33:(33+42) # ASCII_BASE=33
mode(base) = "raw"
scores = sapply(1:n, function(x) paste0(sapply(sample(base[2:40], len, replace = T), rawToChar), collapse = ""))
labels = paste0("@sequence", 1:n) # "label" must start with `@`.

fastq_test = data.frame(label = labels, sequence = sequences,
                        mark = "+", score = scores)

# Saving file
fastq = fastq2dataframe_rev(fastq_test, "./fastq_test.fastq")

# Reading fastq file to a data frame
fastqTable = fastq2dataframe("./fastq_test.fastq")

## End(Not run)
}

paodan/funcTools documentation built on April 1, 2024, 12:01 a.m.