|There's more than one way to do things|
How can I count the number of substitutions of one letter in a string by another letter in the other string?by supriyoch_2008 (Scribe)
|on May 11, 2012 at 18:39 UTC||Need Help??|
supriyoch_2008 has asked for the
wisdom of the Perl Monks concerning the following question:
I am beginner in perl programming. Suppose, I have two strings i.e. $seq1="AAAGATCGTG"; and $seq2="AGTACTTTCC"; I am interested in counting the number of substitutions of A in $seq1 by G in $seq2 i.e. $A2G and similarly, $G2A, $C2T, $T2C, $A2T, $A2C, $G2T and $G2C. Some sites like 0 and 5 are same in $seq1 and $seq2. Which perl code should I use to find out the number of such substitutions? I don't know the code that I should write in the places marked ?????? in the following program to find the correct results. Can any perlmonk help me to count the substitutions?
The results should look like:A2G=1; G2A=1; C2T=1; T2C=1; A2T=1; A2C=1; G2T=1; G2C=1.