[Biopython-dev] Bio.Motif._Motif has_instances, has_counts

Peter Cock p.j.a.cock at googlemail.com
Fri Aug 10 08:33:43 UTC 2012


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

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)

Peter



More information about the Biopython-dev mailing list