1 |
DNAseq |
|
rev |
|
compl |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function (DNAseq, rev = TRUE, compl = TRUE)
{
if (is.character(DNAseq)) {
resultVect <- sapply(DNAseq, (function(seqString) {
mySeq <- toupper(seqString)
if (rev == TRUE) {
mySeq <- paste(sapply(1:nchar(mySeq), (function(i) {
pos <- nchar(mySeq) + 1 - i
substr(mySeq, pos, pos)
})), collapse = "")
}
if (compl == TRUE) {
mySeq <- paste(sapply(1:nchar(mySeq), (function(i) {
aBase <- substr(mySeq, i, i)
complBase <- c("A", "T", "C", "G", "N", "A")
names(complBase) <- c("T", "A", "G", "C", "N",
"U")
returnBase <- complBase[aBase]
if (is.na(returnBase)) {
stop("Bad input")
}
returnBase
})), collapse = "")
}
return(mySeq)
}))
names(resultVect) <- NULL
return(resultVect)
}
else {
warning("Bad input")
}
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.