<html>
<head>
<style>
body {
  font-family: Verdana, sans-serif;
  font-size: 0.8em;
  color:#484848;
}
h1, h2, h3 { font-family: "Trebuchet MS", Verdana, sans-serif; margin: 0px; }
h1 { font-size: 1.2em; }
h2, h3 { font-size: 1.1em; }
a, a:link, a:visited { color: #2A5685;}
a:hover, a:active { color: #c61a1a; }
a.wiki-anchor { display: none; }
fieldset.attachments {border-width: 1px 0 0 0;}
hr {
  width: 100%;
  height: 1px;
  background: #ccc;
  border: 0;
}
span.footer {
  font-size: 0.8em;
  font-style: italic;
}
</style>
</head>
<body>
Issue #2705 has been updated by Peter Cock.

<ul>
  <li><strong>Description</strong> updated (<a title="View differences" href="https://redmine.open-bio.org/journals/diff/15406?detail_id=1759">diff</a>)</li>
  <li><strong>Status</strong> changed from <i>New</i> to <i>Migrated</i></li>
</ul>

<p>Migrated to GitHub issue <a class="external" href="https://github.com/biopython/biopython/issues/1719">https://github.com/biopython/biopython/issues/1719</a></p>
<hr />
<h1><a href="https://redmine.open-bio.org/issues/2705#change-15406">Bug #2705: Nicer GC and AT content and skew functions</a></h1>

<ul><li>Author: Peter Cock</li>
<li>Status: Migrated</li>
<li>Priority: Normal</li>
<li>Assignee: Biopython Dev Mailing List</li>
<li>Category: Main Distribution</li>
<li>Target version: Not Applicable</li>
<li>URL: </li></ul>

<p>This bug started out as a discussion on Bug 2671, based on some nucleotide scoring functions in GenomeDiagram which were used for plotting sequence properties along a sequence using a sliding window.  The basic underlying functions could make a nice addition under Bio.SeqUtils (rather than hiding them under Bio.Graphics.GenomeDiagram).</p>


        <p>In particular, GenomeDiagram's Utilities.py included the following (non-windowed) nucleotide composition functions:</p>


        <p>calc_gc_content - returns a float in the range 0 to 1.<br />calc_at_content - returns a float in the range 0 to 1.<br />calc_gc_skew - returns a float [*]<br />calc_at_skew - returns a float [*]</p>


        <p>[*] As discussed on Bug 2671, these currently give zero if there is no AT content, which was a reasonable shortcut given these functions were originally used for plotting only.  They should instead raise an exception or return None or NaN instead.</p>


        <p>Also, as implemented in GenomeDiagram, these functions do not cope with mixed case sequences (easily rectified).  Also, for GC and AT content these do not deal with ambiguous nucleotides (where we could follow the existing Bio.SeqUtils convention).</p>


        <p>Bio.SeqUtils already has several related functions including:</p>


        <p>GC - returns a float (a percentage in the range 0 to 100)<br />GC123 - returns a tuple of four floats (percentages between 0 and 100)</p>


        <p>GC_skew - returns a list of floats using a default window size of 100bp.  Gives<br />a floating point exception if there is no GC content in any window.</p>


        <p>Personally I don't like the fact that the existing GC function returns a number<br />between 0 and 100 (rather than 0 and 1).  Leighton agreed.</p>


        <p>I don't think the current GC_skew function is intuitive and doesn't cover the<br />non-windowed use-case where you want the GC_skew of the whole sequence passed<br />in.  This is important if you want to do your own windowing (e.g. comparing GC<br />skew of individual genes to the whole genome).</p>


        <p>Because they differ from the existing Bio.SeqUtils code, I think there is a<br />case for adding the four non-windowed functions from GenomeDiagram's<br />Utilities.py under Bio.SeqUtils.  Each would take a single argument, a sequence (coping with a string, Seq object or MutableSeq object).  I have no particularly strong views on the naming of these functions.  Perhaps they could be located under a sub module like Bio.SeqUtils.Nucleotides or Bio.SeqUtils.NucUtils?  The existing GC functions in Bio.SeqUtils could be deprecated or at least declared obsolete.</p>


        <p>This would also be a good opportunity to explicitly specify what we expect to get back for the GC content when there are ambiguous nucleotides.</p>


        <p>e.g. Following Bio.SeqUtils.GC, only count C, G and S (which means C or G) (in either case) and divide by the length giving a lower bound.  Here <abbr title=""ACGTN"">GC</abbr> is 40%.  An alternative approach might be to treat an N as 50% GC, and H (which is A, C or T) as 66.6% GC etc, meaning <abbr title=""ACGTN"">GC</abbr> gives 50%.</p>


        <p>The same approach should be used for the AT percentage, for example the current lower bound approach would count only A, T and W characters (in either case).</p>



<hr />
<span class="footer"><p>You have received this notification because you have either subscribed to it, or are involved in it.<br />To change your notification preferences, please click here and login: <a class="external" href="http://redmine.open-bio.org">http://redmine.open-bio.org</a></p></span>
</body>
</html>