Skip to content

R: Reverse Complementary Base Problem

2 messages · saran wai, Boris Steipe

#
Hi I'm new to R programming and trying to write program for Reverse and Complementary Base. the objective is to Design A DNA primer. So I have a DNA sequence with base A T C G and A complement to T; T=A;C=G;G=C.  I just figure out How to Reverse It Already. but for the Complement i can only make it answer for just 1 base but cant be all of the sequence.  and i dont know how to combine reverse and complement function. here is my code and im totallt confuse with it. Cn someone help me with this problem? You will be my life savior! thank you! strReverse <- function(x)   sapply(lapply(strsplit(x, NULL), rev), paste, collapse="") strReverse(c("ATCGGTCAATCGA")) complement.base = function(base){   if(base == 'A' | base ==  'a')   print("T")   if(base == 'T' | base == 't') print("A")   if(base == 'G' | base == 'g') print("C")   if(base == 'C' | base == 'c') print("G")} complement.base(base="A")
#
Use reverseComplement() in the Biostrings package.
B.
On Mar 8, 2015, at 10:08 PM, saran wai <darwinm13sg37 at hotmail.com> wrote: