Description Usage Arguments Details Value Author(s) See Also Examples
Convert read positions for a single chromosome (both strands) into read sequences + qualities and write them to file
1 2 3 |
readPos |
A list of two numeric vectors (one per strand) |
names |
List of names to use for reads in fastq file. Has to be of same shape as |
quality |
Passed on as argument to |
sequence |
Reference sequence (a |
qualityFun |
Function to generate quality scores. |
errorFun |
Function to introduce sequencing errors. |
readLen |
Read length to generate. |
file |
Output file (either file name or connection). |
qualityType |
Encoding to use for read quality scores. |
... |
Further arguments (see Details). |
Arguments passed as part of ... will be passed on to qualityFun, except an argument called prob which is
passed on to errorFun instead if present.
Invisibly returns the number of records that were written.
Peter Humburg
See readError for a possible choice of errorFun and readQualitySample for a simple
qualityFun.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | set.seed(1)
## a function to generate random read qualities (in Sanger format)
randomQuality <- function(read, ...){
paste(sample(unlist(strsplit(rawToChar(as.raw(33:126)),"")),
length(read), replace = TRUE), collapse="")
}
## generate a reference sequence
chromosome <- DNAString(paste(sample(c("A", "C", "G", "T"),
1e5, replace = TRUE), collapse = ""))
## and a few read positions
reads <- list(sample(100:9900, 5), sample(100:9900, 5))
names <- list(paste("read", 1:5, sep="_"), paste("read", 6:10, sep="_"))
## convert to fastq format
pos2fastq(reads, names, sequence=chromosome, qualityFun=randomQuality,
errorFun=readError, file="")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.