[Seqinr-commits] r1701 - pkg/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sat Nov 7 09:09:57 CET 2009
Author: lobry
Date: 2009-11-07 09:09:55 +0100 (Sat, 07 Nov 2009)
New Revision: 1701
Modified:
pkg/R/comp.R
Log:
fix the bug reported by Darren Obbard
Modified: pkg/R/comp.R
===================================================================
--- pkg/R/comp.R 2009-11-05 14:12:34 UTC (rev 1700)
+++ pkg/R/comp.R 2009-11-07 08:09:55 UTC (rev 1701)
@@ -3,7 +3,15 @@
###########################################
comp <- function(seq, forceToLower = TRUE, ambiguous = FALSE){
- if(forceToLower) seq <- tolower(seq)
+
+ if(all(seq %in% LETTERS)){
+ isUpper <- TRUE
+ } else {
+ isUpper <- FALSE
+ }
+
+ seq <- tolower(seq)
+
result <- as.vector(n2s((3-s2n(seq))))
#
# More work is required if ambiguous bases are taken into account
@@ -20,6 +28,9 @@
result[which(seq == "w")] <- "w"
result[which(seq == "n")] <- "n"
}
+ if(isUpper && !forceToLower){
+ result <- toupper(result)
+ }
return(result)
}
More information about the Seqinr-commits
mailing list