readError {ChIPsim} | R Documentation |
Given a read sequence and quality this function introduces errors by first choosing positions
that should be modified based on the quality score and then exchanges nucleotides based on the
probabilities given in prob
.
readError(read, qual, alphabet = c("A", "C", "G", "T"), prob = defaultErrorProb(), ...)
read |
A character string representing a read sequence. |
qual |
Numeric vector of read error probabilities. |
alphabet |
Alphabet used for read sequence. |
prob |
Nucleotide exchange probabilities. |
... |
Further arguments (currently ignored). |
If the read sequence contains letters that are not part of alphabet
they are replaced
by the first entry of alphabet
before positions of sequencing errors are determined.
The alphabet used has to match the names used in prob
.
The modified read sequence.
Peter Humburg
defaultErrorProb
, readSequence
set.seed(42) ## generate sequence read and quality quality <- paste(sample(unlist(strsplit(rawToChar(as.raw(33:126)),"")), 36, replace = TRUE), collapse="") errorProb <- decodeQuality(quality, type = "Sanger") read <- paste(sample(c("A", "C", "G", "T"), 36, replace = TRUE), collapse = "") ## use readError to introduce sequencing errors read2 <- readError(read, errorProb) all.equal(read, read2) ## "1 string mismatch"