[Seqinr-commits] r2127 - pkg/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue May 25 13:40:29 CEST 2021
Author: simonpenel
Date: 2021-05-25 13:40:28 +0200 (Tue, 25 May 2021)
New Revision: 2127
Modified:
pkg/R/comp.R
Log:
Correction of comp function according to Dr. Haruo Suzuki
Modified: pkg/R/comp.R
===================================================================
--- pkg/R/comp.R 2021-05-25 11:35:20 UTC (rev 2126)
+++ pkg/R/comp.R 2021-05-25 11:40:28 UTC (rev 2127)
@@ -3,13 +3,13 @@
###########################################
comp <- function(seq, forceToLower = TRUE, ambiguous = FALSE){
-
+
if(all(seq %in% LETTERS)){
isUpper <- TRUE
} else {
isUpper <- FALSE
}
-
+
seq <- tolower(seq)
result <- as.vector(n2s((3-s2n(seq))))
@@ -16,7 +16,7 @@
#
# More work is required if ambiguous bases are taken into account
#
-
+
if(ambiguous){
result[which(seq == "b")] <- "v"
result[which(seq == "d")] <- "h"
@@ -26,19 +26,18 @@
result[which(seq == "s")] <- "s"
result[which(seq == "v")] <- "b"
result[which(seq == "w")] <- "w"
- result[which(seq == "n")] <- "n"
+ result[which(seq == "n")] <- "n"
result[which(seq == "y")] <- "r"
result[which(seq == "r")] <- "y"
}
-
- # Checking for N in the sequence, thanks to Jeremy Shearman.
-
- result[which(seq == "n")] <- "n"
-
-
+
+ # Checking for N in the sequence, thanks to Jeremy Shearman.
+ # Now this is done only with ambigous option, thanks to Suzuki Haruo
+ # result[which(seq == "n")] <- "n"
+
+
if(isUpper && !forceToLower){
result <- toupper(result)
}
return(result)
}
-
More information about the Seqinr-commits
mailing list