[R] R: Reverse Complementary Base Problem

saran wai darwinm13sg37 at hotmail.com
Mon Mar 9 03:08:54 CET 2015


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") 		 	   		  
	[[alternative HTML version deleted]]



More information about the R-help mailing list