<html><head></head><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue-Light, Helvetica Neue Light, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:10px"><div>Or you could have an ambiguous=True|False keyword on the original function.</div><div id="yui_3_16_0_ym19_1_1466646000669_5610">Best,</div><div id="yui_3_16_0_ym19_1_1466646000669_5611">-Michiel<br></div><div id="yui_3_16_0_ym19_1_1466646000669_5577"><span></span></div> <div class="qtdSeparateBR"><br><br></div><div style="display: block;" class="yahoo_quoted"> <div style="font-family: HelveticaNeue-Light, Helvetica Neue Light, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 10px;"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;"> <div dir="ltr"><font face="Arial" size="2"> On Thursday, June 23, 2016 5:35 AM, Sefa Kilic <sefa1@umbc.edu> wrote:<br></font></div>  <br><br> <div class="y_msg_container"><div id="yiv6443403570"><div><div dir="ltr"><div class="yiv6443403570gmail_default" style="font-family:arial, helvetica, sans-serif;font-size:small;">Thank you, Peter and Bartek, for the comments.</div><div class="yiv6443403570gmail_default" style="font-family:arial, helvetica, sans-serif;font-size:small;"><br clear="none"></div><div class="yiv6443403570gmail_default" style="font-family:arial, helvetica, sans-serif;font-size:small;">I agree that modifying existing calculate function might be confusing for users and it can slow things down. I will go ahead and create a separate function and you can merge it if you think it would be useful for others.</div><div class="yiv6443403570gmail_default" style="font-family:arial, helvetica, sans-serif;font-size:small;"><br clear="none"></div><div class="yiv6443403570gmail_default" style="font-family:arial, helvetica, sans-serif;font-size:small;">Cheers,</div><div class="yiv6443403570yqt4683132002" id="yiv6443403570yqt92682"><div class="yiv6443403570gmail_extra"><br clear="none"><div class="yiv6443403570gmail_quote">On Wed, Jun 22, 2016 at 5:17 AM, Peter Cock <span dir="ltr"><<a rel="nofollow" shape="rect" ymailto="mailto:p.j.a.cock@googlemail.com" target="_blank" href="mailto:p.j.a.cock@googlemail.com">p.j.a.cock@googlemail.com</a>></span> wrote:<br clear="none"><blockquote class="yiv6443403570gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div dir="ltr">Thanks Bartek - very useful comments!<div><br clear="none"></div><div>I was also worried about changing the default - making this into</div><div>a separate method would be even more explicit than the optional</div><div>argument I was suggesting.<br clear="none"><div><br clear="none"></div><div>(Apologies, I had a typo in Michiel's email address.)</div><span><font color="#888888"></font></span><div><br clear="none"></div><div><span><font color="#888888">Peter</font></span><div><div><br clear="none"><div class="yiv6443403570gmail_extra"><br clear="none"><div class="yiv6443403570gmail_quote">On Wed, Jun 22, 2016 at 10:08 AM, Bartek Wilczynski <span dir="ltr"><<a rel="nofollow" shape="rect" ymailto="mailto:barwil@gmail.com" target="_blank" href="mailto:barwil@gmail.com">barwil@gmail.com</a>></span> wrote:<br clear="none"><blockquote class="yiv6443403570gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div dir="ltr"><div><div><div><div><div><div><div>Dear Peter and Sefa, <br clear="none"><br clear="none"></div>I was involved in Bio.Motif, but not so much in Bio.motifs anymore. Since you ask me personally, and I think this is an important issue, I can certainly give you comments, and you can make decisions accordingly. <br clear="none"><br clear="none">This is a big change in  the sense, that it can potentially:<br clear="none"></div>- give surprising results to some people (the semantic you suggest is by no means standard, and the usual interpretation of this score is log-odds, so taking arithmetic mean of log odds is questionable, however arguably natural to some users)<br clear="none"></div>- allow for some errors (using DNA motif on protein sequence, etc) that are currently prevented by strict checking<br clear="none"></div>- slow things down when people are actually searching for unambiguous DNA motifs<br clear="none"><br clear="none"></div>If you think this functionality is important (I can see many places where it would come in handy), I'd suggest considering writing a new function. like "calculate_ambiguous" or something similar, that would be slower and have a certain semantic (potentially, user selected - I could see people interested in min and max semantic in addition to average proposed by Sefa).<br clear="none"><br clear="none"></div>That's pretty much my 2 cents<br clear="none"></div>B<br clear="none"></div><div class="yiv6443403570gmail_extra"><div><div><br clear="none"><div class="yiv6443403570gmail_quote">On Wed, Jun 22, 2016 at 10:56 AM, Peter Cock <span dir="ltr"><<a rel="nofollow" shape="rect" ymailto="mailto:p.j.a.cock@googlemail.com" target="_blank" href="mailto:p.j.a.cock@googlemail.com">p.j.a.cock@googlemail.com</a>></span> wrote:<br clear="none"><blockquote class="yiv6443403570gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div dir="ltr">Hi Sefa,<div><br clear="none"></div><div>It looks like Michiel is extra busy at the moment, but in the absence<div>of his input, perhaps Bartek has some thoughts (he was the original</div><div>author of the motif module)?</div><div><br clear="none"></div><div>I would suggest the new mode might need to be an option, e.g.</div><div>default to the current NaN results, but easy to pick your proposed</div><div>mean scoring. Might the minimum or maximum ever be useful?</div><div><br clear="none"></div><div>If you (Sefa) want to go ahead and fork the repository and explore</div><div>this on a branch leading to a potential pull request that seems sensible.</div><div><br clear="none"></div><div>Note we define the IUPAC ambiguity codes centrally in Python in</div><div>Bio/Data/IUPACData.py which you can import for the new Python</div><div>code. I can see arguments for and against having them hard coded</div><div>in the proposed new C code.</div><div><br clear="none"></div><div>Thanks,</div><div><br clear="none"></div><div>Peter<br clear="none"><div class="yiv6443403570gmail_extra"><br clear="none"><div class="yiv6443403570gmail_quote">On Wed, Jun 22, 2016 at 2:37 AM, Sefa Kilic <span dir="ltr"><<a rel="nofollow" shape="rect" ymailto="mailto:sefa1@umbc.edu" target="_blank" href="mailto:sefa1@umbc.edu">sefa1@umbc.edu</a>></span> wrote:<br clear="none"><blockquote class="yiv6443403570gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex;"><div dir="ltr"><div style="font-family:arial, helvetica, sans-serif;font-size:small;">Any thoughts?</div></div><div><div><div class="yiv6443403570gmail_extra"><br clear="none"><div class="yiv6443403570gmail_quote">On Mon, Jun 13, 2016 at 10:58 AM, Peter Cock <span dir="ltr"><<a rel="nofollow" shape="rect" ymailto="mailto:p.j.a.cock@googlemail.com" target="_blank" href="mailto:p.j.a.cock@googlemail.com">p.j.a.cock@googlemail.com</a>></span> wrote:<br clear="none"><blockquote class="yiv6443403570gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex;">What do you think Michiel?<br clear="none">
<br clear="none">
Also related, earlier today I filed this issue:<br clear="none">
<a rel="nofollow" shape="rect" target="_blank" href="https://github.com/biopython/biopython/issues/851">https://github.com/biopython/biopython/issues/851</a><br clear="none">
<br clear="none">
Peter<br clear="none">
<div><div><br clear="none">
On Mon, Jun 13, 2016 at 3:26 PM, Sefa Kilic <<a rel="nofollow" shape="rect" ymailto="mailto:sefa1@umbc.edu" target="_blank" href="mailto:sefa1@umbc.edu">sefa1@umbc.edu</a>> wrote:<br clear="none">
> Hello all,<br clear="none">
><br clear="none">
> I have been using the Bio.motifs PSSM search for a long time. Occasionally,<br clear="none">
> I work with genome sequences containing ambiguous bases. Biopython currently<br clear="none">
> does not support scoring sequences with ambiguous bases and I would like to<br clear="none">
> propose a change to fix that.<br clear="none">
><br clear="none">
> Currently, the "calculate" function in PositionSpecificScoringMatrix class<br clear="none">
> checks if alphabets of both motif and sequence are<br clear="none">
> IUPAC.IUPACUnambiguousDNA. If they are not, a ValueError exception is<br clear="none">
> raised.<br clear="none">
><br clear="none">
> The code itself, however, tolerates ambiguous bases on the sequence as NaN.<br clear="none">
> That is, given a PSSM of length L, all L-mer subsequences of the given<br clear="none">
> sequence are scored as NaN. I would like to extend it and do the scoring<br clear="none">
> properly for ambiguous sequences. For instance, if the base is Y (C or T),<br clear="none">
> it should be scored as the average of scoring it as C and as T. If the base<br clear="none">
> is N, it should be scored as the average of all bases [S(A) + S(T) + S(C) +<br clear="none">
> S(G)] / 4.<br clear="none">
><br clear="none">
> The change needs to be done on both Python and C (_pwm.c) sides. What do you<br clear="none">
> think? If you agree, I can implement it and send a pull request.<br clear="none">
><br clear="none">
> Cheers,<br clear="none">
><br clear="none">
</div></div>> _______________________________________________<br clear="none">
> Biopython-dev mailing list<br clear="none">
> <a rel="nofollow" shape="rect" ymailto="mailto:Biopython-dev@mailman.open-bio.org" target="_blank" href="mailto:Biopython-dev@mailman.open-bio.org">Biopython-dev@mailman.open-bio.org</a><br clear="none">
> <a rel="nofollow" shape="rect" target="_blank" href="http://mailman.open-bio.org/mailman/listinfo/biopython-dev">http://mailman.open-bio.org/mailman/listinfo/biopython-dev</a><br clear="none">
</blockquote></div><br clear="none"></div>
</div></div><br clear="none">_______________________________________________<br clear="none">
Biopython-dev mailing list<br clear="none">
<a rel="nofollow" shape="rect" ymailto="mailto:Biopython-dev@mailman.open-bio.org" target="_blank" href="mailto:Biopython-dev@mailman.open-bio.org">Biopython-dev@mailman.open-bio.org</a><br clear="none">
<a rel="nofollow" shape="rect" target="_blank" href="http://mailman.open-bio.org/mailman/listinfo/biopython-dev">http://mailman.open-bio.org/mailman/listinfo/biopython-dev</a><br clear="none"></blockquote></div><br clear="none"></div></div></div></div>
</blockquote></div><br clear="none"><br clear="all"><br clear="none"></div></div><span><font color="#888888">-- <br clear="none"></font></span><div>Bartek Wilczynski<br clear="none">==================<br clear="none">Institute of Informatics<br clear="none">University of Warsaw<br clear="none"><a rel="nofollow" shape="rect" target="_blank" href="http://www.mimuw.edu.pl/~bartek">http://www.mimuw.edu.pl/~bartek</a><br clear="none"></div>
</div>
</blockquote></div><br clear="none"></div></div></div></div></div></div>
</blockquote></div><br clear="none"></div></div></div></div></div><br><br></div>  </div> </div>  </div></div></body></html>