[Biopython-dev] Bio.Motif._Motif has_instances, has_counts
Peter Cock
p.j.a.cock at googlemail.com
Fri Aug 10 20:04:54 UTC 2012
On Fri, Aug 10, 2012 at 9:33 AM, Peter Cock <p.j.a.cock at googlemail.com> wrote:
> On Thu, Aug 9, 2012 at 5:00 PM, Michiel de Hoon <mjldehoon at yahoo.com> wrote:
>> OK, done. Thanks!
>> -Michiel.
>
> You'll also need to update the example in the Tutorial, quote:
>
> The arnt and srf motifs can both do the same things for us,
> but they use different internal representations of the motif.
> We can tell that by inspecting the \verb|has_counts| and
> has_instances properties:
>
> >>> arnt.has_instances
> True
> >>> srf.has_instances
> False
> >>> srf.has_counts
> True
>
> This means test_Tutorial.py is failing (across all platforms).
> Presumably we would suggest switching these to somethinglike:
>
> >>> arnt.instances is None
> False
Fixed:
https://github.com/biopython/biopython/commit/b866e74dc9b6162517588ea4c0e4d1ecde5ed87c
> etc? In fact given the old methods were documents like
> this, I would be happier if we could phase them out with
> a deprecation warning via a read only property method,
>
> @property
> def has_instances(self):
> """"Does this motif have instances (DEPRECATED)."""
> import warnings
> from Bio import BiopythonDeprecationWarning
> warnings.warn("Check if motif.instance is None or not instead",
> BiopythonDeprecationWarning)
> return self.instances is not None
>
> (untested, but something like that)
Done:
https://github.com/biopython/biopython/commit/fd2223d118227c921524e070c803b97bc979a70f
Although since that won't work on old Biopython either (you'd
get an AttributeError), perhaps we should label these new
backwards compatible properties as obsolete with a pending
deprecation warning for the next release (delay the deprecation)?
Peter
More information about the Biopython-dev
mailing list