<div dir="ltr">Hi Bow & Peter,<div><br></div><div>That seems fair enough, I'll have a look if <span style="font-size:12.8px">`HSP.hit_span_all` and `HSP.query_span_all` are the same as qcov* and add my thing to the cook book if they aren't.</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">Cheers,</span></div><div><span style="font-size:12.8px">John</span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 12 September 2017 at 11:12, Wibowo Arindrarto <span dir="ltr"><<a href="mailto:bow@bow.web.id" target="_blank">bow@bow.web.id</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>Hi John, Peter,<br></div><div><br></div><div>Thanks for looking into this. Indeed the `qcov` and `qcovhsp` values are already captured when parsing `blast-tab` formats with SearchIO. They are accessible via the `Hit.query_coverage` and `HSP.query_coverage` attributes respectively.<br></div><div><br></div><div>For non-`blast-tab` formats such as `blast-xml`, there may already be a similar attribute you can use in SearchIO. They are the `HSP.hit_span_all` and `HSP.query_span_all` attributes, which calculates how many bases are covered by the hit and query, respectively. You can find more about them here: <a href="http://biopython.org/DIST/docs/api/Bio.SearchIO._model.hsp.HSP-class.html" target="_blank">http://biopython.org/DIST/<wbr>docs/api/Bio.SearchIO._model.<wbr>hsp.HSP-class.html</a>. However I have to say I don't recall if these values are always the same as the qcov values BLAST outputs when using the `blast-tab` format. Maybe that is worth checking first.<br></div><div><br></div><div>That being said, if they do not end up being always equal (i.e. there are corner cases in BLAST that those attributes do not properly capture), I also am quite hesitant to add more derived values for specific file formats. The main reason is I feel this would make the current object model more brittle. We are already quite brittle in some respects, because of the fact that the formats we are parsing do not have precise specifications.<br></div><div><br></div><div>I am very open to having this put in our cookbook (<a href="http://biopython.org/wiki/Category%3ACookbook" target="_blank">http://biopython.org/wiki/<wbr>Category%3ACookbook</a>), however, since this would be more akin to a BLAST-specific recipe that many would find useful.<br></div><div><br></div><div>Let me know what you think.<br></div><div><br></div><div>Cheers,<br></div><div>Bow<br></div><div class="HOEnZb"><div class="h5"><div><br></div><div><br></div><div class="m_-1494729809966613732protonmail_signature_block m_-1494729809966613732protonmail_signature_block-empty"><div class="m_-1494729809966613732protonmail_signature_block-user m_-1494729809966613732protonmail_signature_block-empty"><br></div><div class="m_-1494729809966613732protonmail_signature_block-proton m_-1494729809966613732protonmail_signature_block-empty"><br></div></div><div><br></div><blockquote class="m_-1494729809966613732protonmail_quote" type="cite"><div>-------- Original Message --------<br></div><div>Subject: Re: [Biopython-dev] Adding overall coverage to blast-xml<br></div><div>Local Time: September 12, 2017 11:28 AM<br></div><div>UTC Time: September 12, 2017 9:28 AM<br></div><div>From: <a href="mailto:p.j.a.cock@googlemail.com" target="_blank">p.j.a.cock@googlemail.com</a><br></div><div>To: John T <<a href="mailto:jaytee00@gmail.com" target="_blank">jaytee00@gmail.com</a>><br></div><div><a href="mailto:bow@bow.web.id" target="_blank">bow@bow.web.id</a> <<a href="mailto:bow@bow.web.id" target="_blank">bow@bow.web.id</a>>, Biopython-Dev Mailing List <<a href="mailto:biopython-dev@mailman.open-bio.org" target="_blank">biopython-dev@mailman.open-<wbr>bio.org</a>><br></div><div><br></div><div dir="ltr"><div>Hi John,<br></div><div><br></div><div><div>At least if its qcovs (or qcovhsp) there is a clear base value<br></div><div>from the NCBI code for guidance and conformance testing.<br></div></div><div><br></div><div>I'm still a little uncomfortable with a parser inferring to many<br></div><div>advanced values like this, but will defer to Bow as the<br></div><div>SearchIO author to comment on this might fit into his<br></div><div>object model (e.g. does this have parallels in the other<br></div><div>supported formats?).<br></div><div><br></div><div><div>(I'm pretty sure this general topic has come up in the past,<br></div><div>but couldn't immediately find an old issue or email thread.)<br></div></div><div><br></div><div>Bow?<br></div><div><br></div><div>Peter<br></div></div><div class="gmail_extra"><div><br></div><div class="gmail_quote"><div>On Mon, Sep 11, 2017 at 10:02 PM, John T <span dir="ltr"><<a href="mailto:jaytee00@gmail.com" target="_blank">jaytee00@gmail.com</a>></span> wrote:<br></div><blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex" class="gmail_quote"><div dir="ltr"><div>It is indeed qcovs, I was stuck using XML, didn't investigate that before. I haven't looked into the SearchIO version yet, but I assume it won't be more difficult to implement there so I'm happy to commit to that.<span class="m_-1494729809966613732HOEnZb"><span class="m_-1494729809966613732colour" style="color:#888888"></span></span><br></div><span class="m_-1494729809966613732HOEnZb"><span class="m_-1494729809966613732colour" style="color:#888888"><div><br></div><div>John<br></div></span></span></div><div class="m_-1494729809966613732HOEnZb"><div class="m_-1494729809966613732h5"><div class="gmail_extra"><div><br></div><div class="gmail_quote"><div>On 11 September 2017 at 21:14, Peter Cock <span dir="ltr"><<a href="mailto:p.j.a.cock@googlemail.com" target="_blank">p.j.a.cock@googlemail.com</a>></span> wrote:<br></div><blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex" class="gmail_quote"><div>Hi John, CC Bow,<br></div><div> <br></div><div> Is this information in any of the BLAST output formats?<br></div><div> <br></div><div> I suspect you are talking about recreating one or more<br></div><div> of the coverage fields which can be requested in the<br></div><div> BLAST csv or tabular output files formats? i.e. qcovs<br></div><div> or qcovhsp perhaps?<br></div><div> <br></div><div> If so, I can see a rational for computing this for the<br></div><div> BLAST XML parsing... although given we'd like to<br></div><div> push people towards SearchIO (which supports the<br></div><div> BLAST tabular format as well), doing it there might<br></div><div> make more sense than in NCBIXML?<br></div><div> <br></div><div> Peter<br></div><div> <br></div><div><div class="m_-1494729809966613732m_9172762734742828488h5"><div><br></div><div>On Mon, Sep 11, 2017 at 5:40 PM, John T <<a href="mailto:jaytee00@gmail.com" target="_blank">jaytee00@gmail.com</a>> wrote:<br></div><div> > Hi all,<br></div><div> ><br></div><div> > I've written a script that calculates the overall coverage for all HSP in an<br></div><div> > alignment, like that given on the BLAST homepage. Would it make sense to add<br></div><div> > this to Bio.Blast.Record.Alignment (and/or the BlastIO equivalent)? It's not<br></div><div> > something that's explicitly defined in the XML and so may be out of scope,<br></div><div> > but it is something that's given in the website version of BLAST results so<br></div><div> > people might reasonably expect it to be there. I'd add it as a @property so<br></div><div> > it as only calculated when required.<br></div><div> ><br></div><div> > I've never tried contributing to an open source project before so I didn't<br></div><div> > want to dive in and do something stupid.<br></div><div> ><br></div><div> > Cheers,<br></div><div> > John<br></div><div> ><br></div><div> ><br></div></div></div><div>> ______________________________<wbr>_________________<br></div><div> > Biopython-dev mailing list<br></div><div> > <a href="mailto:Biopython-dev@mailman.open-bio.org" target="_blank">Biopython-dev@mailman.open-bio<wbr>.org</a><br></div><div> > <a rel="noreferrer" href="http://mailman.open-bio.org/mailman/listinfo/biopython-dev" target="_blank">http://mailman.open-bio.org/ma<wbr>ilman/listinfo/biopython-dev</a><br></div></blockquote></div></div></div></div></blockquote></div></div></blockquote><div><br></div></div></div></blockquote></div><br></div>