<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div><span>Hi,</span></div><div><br><span></span></div><div><span>I do not completely follow you, but perhaps you could check out this page: http://code.activestate.com/recipes/576869-longest-common-subsequence-problem-solver/</span></div><div><span>Another source of inspiration could be the levenshtein distance.</span></div><div>&nbsp;</div><div>Regards,<br>Albert-Jan<br><br></div><div>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>All right, but apart from the sanitation, the medicine, education, wine, public order, irrigation, roads, a <br>fresh water system, and public health, what have the Romans ever done for us?<br>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&nbsp;<br> <blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; margin-top: 5px;
 padding-left: 5px;">  <div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> <div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> <div dir="ltr"> <font size="2" face="Arial"> <hr size="1">  <b><span style="font-weight:bold;">From:</span></b> Hs Hs &lt;ilhs_hs@yahoo.com&gt;<br> <b><span style="font-weight: bold;">To:</span></b> "tutor@python.org" &lt;tutor@python.org&gt; <br> <b><span style="font-weight: bold;">Sent:</span></b> Friday, March 2, 2012 8:11 PM<br> <b><span style="font-weight: bold;">Subject:</span></b> [Tutor] number of mismatches in a string<br> </font> </div> <br>
<div id="yiv1861276130"><div><div style="color:#000;background-color:#fff;font-family:times new roman, new york, times, serif;font-size:12pt;"><div style="font-family:times, serif;font-size:12pt;">Hi:</div><div style="font-family:times, serif;font-size:12pt;"><span style="font-size:12pt;">I have the following table and I am interested in calculating mismatch ratio. I am not completely clear how to do this and any help is deeply appreciated.&nbsp;</span></div><div style="font-family:times, serif;font-size:12pt;"><span style="font-size:12pt;"><br></span></div><div style="font-family:times, serif;font-size:12pt;">Length &nbsp; &nbsp; Matches</div><div><span><font face="'times new roman', 'new york', times, serif">77 &nbsp; &nbsp; &nbsp;24A0T9T36</font><br></span></div><div><span><font face="'times new roman', 'new york', times,
 serif">71 &nbsp; &nbsp; &nbsp;25^T9^T37<br></font></span></div><div><span><font face="'times new roman', 'new york', times, serif">60 &nbsp; &nbsp; &nbsp;25^T9^T26</font></span></div><div><span><font face="'times new roman', 'new york', times, serif">62 &nbsp; &nbsp; &nbsp;42A19<br></font></span></div><div><span><font face="'times new roman', 'new york', times, serif"><br></font></span></div><div><span><font face="'times new roman', 'new york', times, serif"><br></font></span></div><div><span><font face="'times new roman', 'new york', times, serif">In length column I have length of the character string.&nbsp;</font></span></div><div><span><font face="'times new roman', 'new york', times, serif">In the second column I have the matches my reference string.&nbsp;</font></span></div><div><span><font face="'times new roman', 'new york', times, serif"><br></font></span></div><div><span><font face="'times new roman', 'new york', times,
 serif"><br></font></span></div><div><span><font face="'times new roman', 'new york', times, serif">In fist case, where 77 is length, in matches from left to right, first 24 matched my reference string following by a extra character A, a null (does not account to proble) and extra T, 9 matches, extra T and 36 matches. &nbsp;Totally there are 3 mismatches</font></span></div><div><span><font face="'times new roman', 'new york', times, serif"><br></font></span></div><div><span><font face="'times new roman', 'new york', times, serif">In case 2, I lost 2 characters (^ = loss of character compared to reference sentence) &nbsp; -&nbsp;</font></span></div><div><span><font face="'times new roman', 'new york', times, serif"><br></font></span></div><div><span><font face="'times new roman', 'new york', times, serif">TOMISAGOODBOY</font></span></div><div><span><font face="'times new roman', 'new york', times, serif">T^MISAGOOD^OY &nbsp; (here I lost 2 characters)
 &nbsp;= I have 2 mismatches</font></span></div><div><span><font face="'times new roman', 'new york', times, serif">TOMISAGOOODBOOY (here I have 2 extra characters O and O) = I have two mismatches</font></span></div><div><span><font face="'times new roman', 'new york', times, serif"><br></font></span></div><div><span><font face="'times new roman', 'new york', times, serif"><br></font></span></div><div><font face="'times new roman', 'new york', times, serif">In case 4: I have 42 matches, extra A and 19 matches = so I have 1 mismatch</font></div><div><font face="'times new roman', 'new york', times, serif"><br></font></div><div><font face="'times new roman', 'new york', times, serif"><br></font></div><div><font face="'times new roman', 'new york', times, serif">How can that mismatch number from matches string.</font></div><div><font face="'times new roman', 'new york', times, serif">1. I have to count how many A or T or G or C (believe me only these 4
 letters will appear in this, i will not see Z or B or K etc)</font></div><div><font face="'times new roman', 'new york', times, serif">2. ^T or ^A or ^G or ^C will also be a mismatch</font></div><div><font face="'times new roman', 'new york', times, serif"><br></font></div><div><font face="'times new roman', 'new york', times, serif"><br></font></div><div><font face="'times new roman', 'new york', times, serif">desired output:</font></div><div><font face="'times new roman', 'new york', times, serif"><br></font></div><div><font face="'times new roman', 'new york', times, serif"><div style="font-size:12pt;">Length &nbsp; &nbsp; Matches &nbsp; mismatches</div><div style="font-family:'Times New Roman';"><span><font face="'times new roman', 'new york', times, serif">77 &nbsp; &nbsp; &nbsp;24A0T9T36 &nbsp; &nbsp;3&nbsp;</font><br></span></div><div style="font-family:'Times New Roman';"><font face="'times new roman', 'new york', times, serif">71 &nbsp;
 &nbsp; &nbsp;25^T9^T37 &nbsp; &nbsp; 2<br></font></div><div style="font-family:'Times New Roman';"><font face="'times new roman', 'new york', times, serif">60 &nbsp; &nbsp; &nbsp;25^T9^T26 &nbsp; &nbsp; 2</font></div><div style="font-family:'Times New Roman';"><font face="'times new roman', 'new york', times, serif">62 &nbsp; &nbsp; &nbsp;42A19 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 1</font></div><div style="font-family:'Times New Roman';"><font face="'times new roman', 'new york', times, serif">10 &nbsp; &nbsp; &nbsp;6^TTT1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 3</font></div><div style="font-family:'Times New Roman';"><font face="'times new roman', 'new york', times, serif"><br></font></div><div style="font-family:'Times New Roman';"><font face="'times new roman', 'new york', times, serif"><br></font></div><div style="font-family:'Times New Roman';"><font face="'times new roman', 'new york', times, serif">thanks&nbsp;</font></div><div
 style="font-family:'Times New Roman';"><font face="'times new roman', 'new york', times, serif">Hs.</font></div></font></div><div><font face="'times new roman', 'new york', times, serif"><br></font></div></div></div></div><br>_______________________________________________<br>Tutor maillist&nbsp; -&nbsp; <a ymailto="mailto:Tutor@python.org" href="mailto:Tutor@python.org">Tutor@python.org</a><br>To unsubscribe or change subscription options:<br><a href="http://mail.python.org/mailman/listinfo/tutor" target="_blank">http://mail.python.org/mailman/listinfo/tutor</a><br><br><br> </div> </div> </blockquote>  </div></div></body></html>