View source: R/fastq2datatable.R
fastq2dataframe_rev | R Documentation |
reverse a fastq corresponding data frame to a data.table of fastq format, and save a fastq file
fastq2dataframe_rev(fastqDataframe, fileName = NULL)
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. |
fastq2dataframe
{
## 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)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.