Friday, 15 June 2012

php - I need the compliment of text file containing "ATGC" -


I have a text file that contains only four types of characters A, T, G, C, for example String -

  TGTGGCCAAGAAAACAGGAAAAGAGGGCGGACCGAAAATCATGGTTGCCGGACACCTGGA CGAAGTAGGATTCATGATCACAAGCATTGATGACAAAGGCTTCCTCCGCTTCCAGACGGT CGGTGGCTGGTGGTCACAGGTTATGCTTGCCCAGCGTGTCACCATTGTAACTAGCAAAGG  

now I need to praise praised above text file using PHP

and < / P>

  is AT, TA is, GC is C  

My code is

  $ str = TGTGGCCAA; $ Str = str_replace ("a", "t", $ str); $ Str = str_replace ("t", "a", $ str); $ Str = str_replace ("G", "C", $ str); $ Str = str_replace ("c", "g", $ str); Echo "$ str";    

Use the strtr function, see the code below (I 'you just reduced the input input string):

   

No comments:

Post a Comment