__init__.py 2.24 KB
Newer Older
1
# coding: utf-8
2
"""Cython bindings and Python interface to HMMER3.
3
4
5
6
7
8
9
10
11
12

HMMER is a biological sequence analysis tool that uses profile hidden Markov
models to search for sequence homologs. HMMER3 is maintained by members of the
the `Eddy/Rivas Laboratory <http://eddylab.org/>`_ at Harvard University.

``pyhmmer`` is a module, implemented using the `Cython <https://cython.org/>`_
language, that provides bindings to HMMER3. It directly interacts with the
HMMER internals, which has several advantages over CLI wrappers like
`hmmer-py <https://pypi.org/project/hmmer/>`_.

13
14
"""

15
16
import collections.abc as _collections_abc
import contextlib as _contextlib
17
import os as _os
18

19
from . import errors
20
21
22
from . import easel
from . import plan7

23
from .hmmer import hmmalign, hmmsearch, hmmpress, nhmmer, phmmer
24
25
26
27


__author__ = "Martin Larralde <martin.larralde@embl.de>"
__license__ = "MIT"
Martin Larralde's avatar
Martin Larralde committed
28
__version__ = "0.4.7"
29
30
31
32
__all__ = [
    errors.__name__,
    easel.__name__,
    plan7.__name__,
33
    hmmalign.__name__,
34
    hmmsearch.__name__,
Martin Larralde's avatar
Martin Larralde committed
35
36
    hmmpress.__name__,
    phmmer.__name__,
Martin Larralde's avatar
Martin Larralde committed
37
    nhmmer.__name__,
38
]
39
40
41
42

# Small addition to the docstring: we want to show a link redirecting to the
# rendered version of the documentation, but this can only work when Python
# is running with docstrings enabled
43
44
45
46
if __doc__ is not None:
    __doc__ += """See Also:
    An online rendered version of the documentation for this version of the
    library on `Read The Docs <https://pyhmmer.readthedocs.io/en/v{}/>`_.
47

Martin Larralde's avatar
Martin Larralde committed
48
    """.format(__version__)
49
50
51
52
53

# Register collections using the `collections.abc` module (this is probably
# not required with later versions of Python)
_collections_abc.Iterator.register(easel.SequenceFile)
_collections_abc.Iterator.register(plan7.HMMFile)
54
_collections_abc.Mapping.register(easel.KeyHash)
55
56
57
58
_collections_abc.Sized.register(plan7.Alignment)
_collections_abc.Sequence.register(easel.Bitfield)
_collections_abc.Sequence.register(plan7.Domains)
_collections_abc.Sequence.register(plan7.TopHits)
59
60
61

if hasattr(_contextlib, "AbstractContextManager"):
    _contextlib.AbstractContextManager.register(easel.SequenceFile)
62
63
    _contextlib.AbstractContextManager.register(easel.SSIReader)
    _contextlib.AbstractContextManager.register(easel.SSIWriter)
64
    _contextlib.AbstractContextManager.register(plan7.HMMFile)