<div dir="ltr">Hi Michiel,<div><br></div><div>I think we'd need to work on making the API more string like before it would be practical to considering subclassing.</div><div><br></div><div>Would anyone like to make a list of all the string methods which we do not currently implement, starting with replace (where dealing with the alphabet is tricky if new letters are introduced)?</div><div><br></div><div>Then there is the translate method where we deliberately did not follow the Python string method behaviour, but it would be possible to match it as a special case where currently we issue an exception:</div><div><br></div><div><a href="https://github.com/biopython/biopython/blob/biopython-169/Bio/Seq.py#L985">https://github.com/biopython/biopython/blob/biopython-169/Bio/Seq.py#L985</a><br></div><div><div><br></div><div>Peter<br><div> </div><div><br></div><div><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, May 23, 2017 at 2:32 AM, Michiel de Hoon <span dir="ltr"><<a href="mailto:mjldehoon@yahoo.com" target="_blank">mjldehoon@yahoo.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div style="color:rgb(0,0,0);background-color:rgb(255,255,255);font-family:"Helvetica Neue",Helvetica,Arial,"Lucida Grande",sans-serif;font-size:10px"><div id="gmail-m_1808604028086401641yui_3_16_0_ym19_1_1495501943768_10128">Dear all,<br></div><div id="gmail-m_1808604028086401641yui_3_16_0_ym19_1_1495501943768_10129"><br></div><div id="gmail-m_1808604028086401641yui_3_16_0_ym19_1_1495501943768_10140">Ten years ago we talked about subclassing Seq objects from a string:</div><div id="gmail-m_1808604028086401641yui_3_16_0_ym19_1_1495501943768_10141"><br></div><div id="gmail-m_1808604028086401641yui_3_16_0_ym19_1_1495501943768_10016" dir="ltr"><a id="gmail-m_1808604028086401641yui_3_16_0_ym19_1_1495501943768_10015" class="gmail-m_1808604028086401641enhancr2_bc7c3527-d291-256c-0378-74fbaeccd654" href="http://lists.open-bio.org/pipermail/biopython/2007-August/009867.html" target="_blank">[BioPython] Making the Seq object act more like a string</a><br></div><div id="gmail-m_1808604028086401641yui_3_16_0_ym19_1_1495501943768_10208"><br></div><div id="gmail-m_1808604028086401641enhancr2_bc7c3527-d291-256c-0378-74fbaeccd654" class="gmail-m_1808604028086401641yahoo-link-enhancr-card gmail-m_1808604028086401641yahoo-link-enhancr-not-allow-cover gmail-m_1808604028086401641ymail-preserve-class gmail-m_1808604028086401641ymail-preserve-style" style="max-width:400px;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif" dir="ltr"> <a id="gmail-m_1808604028086401641yui_3_16_0_ym19_1_1495501943768_10032" href="http://lists.open-bio.org/pipermail/biopython/2007-August/009867.html" style="text-decoration:none;color:rgb(0,0,0)" class="gmail-m_1808604028086401641yahoo-enhancr-cardlink" rel="noreferrer" target="_blank"> <table id="gmail-m_1808604028086401641yui_3_16_0_ym19_1_1495501943768_10031" class="gmail-m_1808604028086401641card-wrapper gmail-m_1808604028086401641yahoo-compose-table-card" style="max-width:400px" border="0" cellpadding="0" cellspacing="0"> <tbody id="gmail-m_1808604028086401641yui_3_16_0_ym19_1_1495501943768_10030"><tr id="gmail-m_1808604028086401641yui_3_16_0_ym19_1_1495501943768_10029"> <td id="gmail-m_1808604028086401641yui_3_16_0_ym19_1_1495501943768_10028" width="400"> <table id="gmail-m_1808604028086401641yui_3_16_0_ym19_1_1495501943768_10027" class="gmail-m_1808604028086401641card-info gmail-m_1808604028086401641yahoo-compose-table-card" style="background:rgb(255,255,255);max-width:400px;border-width:1px 1px 3px;border-style:solid;border-color:rgb(224,228,233) rgb(224,228,233) rgb(0,0,0)" border="0" cellpadding="0" cellspacing="0" width="100%"> <tbody id="gmail-m_1808604028086401641yui_3_16_0_ym19_1_1495501943768_10026"><tr id="gmail-m_1808604028086401641yui_3_16_0_ym19_1_1495501943768_10025"> <td style="vertical-align:top;padding:16px 0px 16px 12px"> </td> <td id="gmail-m_1808604028086401641yui_3_16_0_ym19_1_1495501943768_10024" style="vertical-align:middle;padding:16px 12px;width:99%"> <h2 id="gmail-m_1808604028086401641yui_3_16_0_ym19_1_1495501943768_10023" class="gmail-m_1808604028086401641card-title" style="margin:0px 0px 4px;font-size:16px;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;word-break:break-word">[BioPython] Making the Seq object act more like a string</h2> <div class="gmail-m_1808604028086401641card-description" style="font-size:11px;line-height:15px;color:rgb(153,153,153);word-break:break-word"></div> </td> <td class="gmail-m_1808604028086401641card-share-container"></td> </tr> </tbody></table> </td> </tr> </tbody></table> </a></div><div id="gmail-m_1808604028086401641yui_3_16_0_ym19_1_1495501943768_11861"><br></div><div id="gmail-m_1808604028086401641yui_3_16_0_ym19_1_1495501943768_11919"><br></div><div id="gmail-m_1808604028086401641yui_3_16_0_ym19_1_1495501943768_11886">Can we move forward?</div><div id="gmail-m_1808604028086401641yui_3_16_0_ym19_1_1495501943768_11920" dir="ltr">As the Seq documentation says, a Seq object is <span id="gmail-m_1808604028086401641yui_3_16_0_ym19_1_1495501943768_11924">essentially a string with an alphabet.</span></div><div id="gmail-m_1808604028086401641yui_3_16_0_ym19_1_1495501943768_13583" dir="ltr"><span id="gmail-m_1808604028086401641yui_3_16_0_ym19_1_1495501943768_11924">Then, following the object oriented programming paradigm, Seq objects should inherit from a string object.</span></div><div dir="ltr"><br><span id="gmail-m_1808604028086401641yui_3_16_0_ym19_1_1495501943768_11924"></span></div><div id="gmail-m_1808604028086401641yui_3_16_0_ym19_1_1495501943768_13623" dir="ltr"><span id="gmail-m_1808604028086401641yui_3_16_0_ym19_1_1495501943768_11924">This would help with C extensions that take Seq or string objects as arguments (as both can then be treated as strings).</span></div><div dir="ltr"><br><span id="gmail-m_1808604028086401641yui_3_16_0_ym19_1_1495501943768_11924"></span></div><div dir="ltr"><span id="gmail-m_1808604028086401641yui_3_16_0_ym19_1_1495501943768_11924">Best,</span></div><div dir="ltr"><span id="gmail-m_1808604028086401641yui_3_16_0_ym19_1_1495501943768_11924">-Michiel<br></span></div></div></div><br>______________________________<wbr>_________________<br>
Biopython-dev mailing list<br>
<a href="mailto:Biopython-dev@mailman.open-bio.org">Biopython-dev@mailman.open-<wbr>bio.org</a><br>
<a href="http://mailman.open-bio.org/mailman/listinfo/biopython-dev" rel="noreferrer" target="_blank">http://mailman.open-bio.org/<wbr>mailman/listinfo/biopython-dev</a><br></blockquote></div><br></div></div></div></div></div>