[Bioc-sig-seq] complement and reverseComplement from a character vector

Nicolas Delhomme delhomme at embl.de
Tue Jun 2 11:56:52 CEST 2009


Hi all,

As described in the doc for reverse, complement and reverseComplement,  
x can be a character vector.

When I tried, it turned out that these functions are not implemented  
for complement and reverseComplement.

There are of some use for me, so I just wrote them up:

setMethod("complement", "character",
     function(x, ...){
     		if(length(x)==1) x<-DNAString(x)
		else x<-DNAStringSet(x)
		complement(x)
     }
)

setMethod("reverseComplement", "character",
     function(x, ...){
     		if(length(x)==1) x<-DNAString(x)
     		else x<- DNAStringSet(x)
     		reverseComplement(x)
     }
)

I just post them in case there would be of use for someone else. I  
recognize that it does not save much compared to first converting the  
character vector into a DNAString or DNAStringSet. At least, for me,  
it allows to skip some "input" evaluation test checking whether I  
start with a character vector or a DNAString.

Best,

---------------------------------------------------------------
Nicolas Delhomme

High Throughput Functional Genomics Center

European Molecular Biology Laboratory

Tel: +49 6221 387 8426
Email: nicolas.delhomme at embl.de
Meyerhofstrasse 1 - Postfach 10.2209
69102 Heidelberg, Germany



More information about the Bioc-sig-sequencing mailing list