metacooler 0.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- metacooler/__init__.py +204 -0
- metacooler/_version.py +5 -0
- metacooler/api.py +923 -0
- metacooler/cli/__init__.py +1 -0
- metacooler/cli/_options.py +333 -0
- metacooler/cli/_provenance.py +187 -0
- metacooler/cli/cmd_aggregate.py +90 -0
- metacooler/cli/cmd_annotate.py +187 -0
- metacooler/cli/cmd_attrs.py +148 -0
- metacooler/cli/cmd_binnify.py +92 -0
- metacooler/cli/cmd_check.py +50 -0
- metacooler/cli/cmd_collect.py +228 -0
- metacooler/cli/cmd_cp.py +127 -0
- metacooler/cli/cmd_create.py +102 -0
- metacooler/cli/cmd_create_cool.py +144 -0
- metacooler/cli/cmd_create_pairs.py +216 -0
- metacooler/cli/cmd_dump.py +210 -0
- metacooler/cli/cmd_extract.py +112 -0
- metacooler/cli/cmd_flatten.py +51 -0
- metacooler/cli/cmd_info.py +128 -0
- metacooler/cli/cmd_ls.py +92 -0
- metacooler/cli/cmd_merge.py +80 -0
- metacooler/cli/cmd_metadata.py +168 -0
- metacooler/cli/cmd_mv.py +72 -0
- metacooler/cli/cmd_network.py +91 -0
- metacooler/cli/cmd_ps.py +210 -0
- metacooler/cli/cmd_qc.py +150 -0
- metacooler/cli/cmd_reassign.py +198 -0
- metacooler/cli/cmd_rm.py +55 -0
- metacooler/cli/cmd_show.py +170 -0
- metacooler/cli/cmd_stack.py +140 -0
- metacooler/cli/cmd_tree.py +70 -0
- metacooler/cli/cmd_zoomify.py +99 -0
- metacooler/cli/logging_utils.py +67 -0
- metacooler/cli/main.py +275 -0
- metacooler/filters.py +487 -0
- metacooler/io/__init__.py +1 -0
- metacooler/io/_utils.py +1372 -0
- metacooler/io/annotate.py +817 -0
- metacooler/io/collect.py +1287 -0
- metacooler/io/colspec.py +317 -0
- metacooler/io/contigs.py +137 -0
- metacooler/io/create.py +3257 -0
- metacooler/io/dump.py +364 -0
- metacooler/io/extract.py +210 -0
- metacooler/io/flatten.py +87 -0
- metacooler/io/genomes.py +71 -0
- metacooler/io/merge.py +356 -0
- metacooler/io/mmetacool.py +383 -0
- metacooler/io/network.py +188 -0
- metacooler/io/reassign.py +1011 -0
- metacooler/ops/__init__.py +1 -0
- metacooler/ops/aggregate.py +245 -0
- metacooler/ops/binnify.py +795 -0
- metacooler/ops/ps.py +468 -0
- metacooler/ops/qc.py +129 -0
- metacooler/ops/range.py +75 -0
- metacooler/ops/show.py +862 -0
- metacooler/ops/zoomify.py +457 -0
- metacooler/ps.py +466 -0
- metacooler/qc.py +497 -0
- metacooler/schema.py +1369 -0
- metacooler/uri.py +45 -0
- metacooler-0.2.0.dist-info/METADATA +296 -0
- metacooler-0.2.0.dist-info/RECORD +68 -0
- metacooler-0.2.0.dist-info/WHEEL +4 -0
- metacooler-0.2.0.dist-info/entry_points.txt +2 -0
- metacooler-0.2.0.dist-info/licenses/LICENSE +21 -0
metacooler/__init__.py
ADDED
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
"""metacooler: Hi-C contact maps for metagenomes.
|
|
2
|
+
|
|
3
|
+
Public names are loaded lazily on first access via ``__getattr__`` to keep
|
|
4
|
+
import time fast and avoid circular dependencies. All symbols listed in
|
|
5
|
+
``__all__`` are importable directly from ``metacooler``:
|
|
6
|
+
|
|
7
|
+
.. code-block:: python
|
|
8
|
+
|
|
9
|
+
import metacooler
|
|
10
|
+
mc = metacooler.MetaCooler("file.metacool")
|
|
11
|
+
metacooler.from_pairs(...)
|
|
12
|
+
|
|
13
|
+
Each ``if name == "..."`` branch inside :func:`__getattr__` imports the real
|
|
14
|
+
symbol from its submodule and returns it; Python then caches the resolved
|
|
15
|
+
attribute on the module object so subsequent accesses skip the lookup.
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
from metacooler._version import __version__
|
|
19
|
+
|
|
20
|
+
__all__ = [
|
|
21
|
+
"__version__",
|
|
22
|
+
"MetaCooler",
|
|
23
|
+
# creation
|
|
24
|
+
"from_pairs",
|
|
25
|
+
"from_cool",
|
|
26
|
+
"collect",
|
|
27
|
+
# transforms and readers
|
|
28
|
+
"reassign",
|
|
29
|
+
"annotate",
|
|
30
|
+
"extract",
|
|
31
|
+
"flatten",
|
|
32
|
+
"merge",
|
|
33
|
+
"binnify",
|
|
34
|
+
"zoomify",
|
|
35
|
+
"aggregate",
|
|
36
|
+
"network",
|
|
37
|
+
"dump_table",
|
|
38
|
+
# quality control
|
|
39
|
+
# Spelled ``contact_qc``, not ``qc``: ``metacooler.qc`` is the tally engine
|
|
40
|
+
# *module*, and importing it anywhere (``io.create`` does, at import time)
|
|
41
|
+
# binds that name on the package — which would shadow a lazily-exported
|
|
42
|
+
# function of the same name, making ``metacooler.qc`` mean different things
|
|
43
|
+
# depending on what had been imported first.
|
|
44
|
+
"contact_qc",
|
|
45
|
+
"contact_probability",
|
|
46
|
+
"plot_ps",
|
|
47
|
+
# format
|
|
48
|
+
"is_metacooler",
|
|
49
|
+
"is_mmetacooler",
|
|
50
|
+
"validate",
|
|
51
|
+
"validate_mmetacooler",
|
|
52
|
+
"check",
|
|
53
|
+
"CheckResult",
|
|
54
|
+
"parse_uri",
|
|
55
|
+
# mmetacool collections
|
|
56
|
+
"create_mmetacool",
|
|
57
|
+
"add_entry",
|
|
58
|
+
"remove_entry",
|
|
59
|
+
"copy_entry",
|
|
60
|
+
"move_entry",
|
|
61
|
+
"list_entries",
|
|
62
|
+
"copy_entry_cross_file",
|
|
63
|
+
]
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def __getattr__(name: str) -> object:
|
|
67
|
+
"""Lazily import public symbols from their submodules on first access.
|
|
68
|
+
|
|
69
|
+
Args:
|
|
70
|
+
name: Attribute name requested from the ``metacooler`` package.
|
|
71
|
+
|
|
72
|
+
Returns:
|
|
73
|
+
The resolved symbol from its source submodule.
|
|
74
|
+
|
|
75
|
+
Raises:
|
|
76
|
+
AttributeError: If *name* is not a recognised public attribute.
|
|
77
|
+
"""
|
|
78
|
+
if name == "MetaCooler":
|
|
79
|
+
from metacooler.api import MetaCooler as _MetaCooler
|
|
80
|
+
|
|
81
|
+
return _MetaCooler
|
|
82
|
+
if name == "from_pairs":
|
|
83
|
+
from metacooler.io.create import from_pairs as _from_pairs
|
|
84
|
+
|
|
85
|
+
return _from_pairs
|
|
86
|
+
if name == "reassign":
|
|
87
|
+
from metacooler.io.reassign import reassign as _reassign
|
|
88
|
+
|
|
89
|
+
return _reassign
|
|
90
|
+
if name == "annotate":
|
|
91
|
+
from metacooler.io.annotate import annotate as _annotate
|
|
92
|
+
|
|
93
|
+
return _annotate
|
|
94
|
+
if name == "from_cool":
|
|
95
|
+
from metacooler.io.create import from_cool as _from_cool
|
|
96
|
+
|
|
97
|
+
return _from_cool
|
|
98
|
+
if name == "collect":
|
|
99
|
+
from metacooler.io.collect import collect as _collect
|
|
100
|
+
|
|
101
|
+
return _collect
|
|
102
|
+
if name == "extract":
|
|
103
|
+
from metacooler.io.extract import extract as _extract
|
|
104
|
+
|
|
105
|
+
return _extract
|
|
106
|
+
if name == "flatten":
|
|
107
|
+
from metacooler.io.flatten import flatten as _flatten
|
|
108
|
+
|
|
109
|
+
return _flatten
|
|
110
|
+
if name == "merge":
|
|
111
|
+
from metacooler.io.merge import merge as _merge
|
|
112
|
+
|
|
113
|
+
return _merge
|
|
114
|
+
if name == "network":
|
|
115
|
+
from metacooler.io.network import network as _network
|
|
116
|
+
|
|
117
|
+
return _network
|
|
118
|
+
if name == "dump_table":
|
|
119
|
+
from metacooler.io.dump import dump_table as _dump_table
|
|
120
|
+
|
|
121
|
+
return _dump_table
|
|
122
|
+
if name == "binnify":
|
|
123
|
+
from metacooler.ops.binnify import binnify as _binnify
|
|
124
|
+
|
|
125
|
+
return _binnify
|
|
126
|
+
if name == "zoomify":
|
|
127
|
+
from metacooler.ops.zoomify import zoomify as _zoomify
|
|
128
|
+
|
|
129
|
+
return _zoomify
|
|
130
|
+
if name == "aggregate":
|
|
131
|
+
from metacooler.ops.aggregate import aggregate as _aggregate
|
|
132
|
+
|
|
133
|
+
return _aggregate
|
|
134
|
+
if name == "contact_qc":
|
|
135
|
+
from metacooler.ops.qc import qc as _qc
|
|
136
|
+
|
|
137
|
+
return _qc
|
|
138
|
+
if name == "contact_probability":
|
|
139
|
+
from metacooler.ops.ps import contact_probability as _contact_probability
|
|
140
|
+
|
|
141
|
+
return _contact_probability
|
|
142
|
+
if name == "plot_ps":
|
|
143
|
+
from metacooler.ops.ps import plot_ps as _plot_ps
|
|
144
|
+
|
|
145
|
+
return _plot_ps
|
|
146
|
+
if name == "validate":
|
|
147
|
+
from metacooler.schema import validate as _validate
|
|
148
|
+
|
|
149
|
+
return _validate
|
|
150
|
+
if name == "validate_mmetacooler":
|
|
151
|
+
from metacooler.schema import validate_mmetacooler as _validate_mmetacooler
|
|
152
|
+
|
|
153
|
+
return _validate_mmetacooler
|
|
154
|
+
if name == "check":
|
|
155
|
+
from metacooler.schema import check as _check
|
|
156
|
+
|
|
157
|
+
return _check
|
|
158
|
+
if name == "CheckResult":
|
|
159
|
+
from metacooler.schema import CheckResult as _CheckResult
|
|
160
|
+
|
|
161
|
+
return _CheckResult
|
|
162
|
+
if name == "is_metacooler":
|
|
163
|
+
from metacooler.schema import is_metacooler as _is_metacooler
|
|
164
|
+
|
|
165
|
+
return _is_metacooler
|
|
166
|
+
if name == "is_mmetacooler":
|
|
167
|
+
from metacooler.schema import is_mmetacooler as _is_mmetacooler
|
|
168
|
+
|
|
169
|
+
return _is_mmetacooler
|
|
170
|
+
if name == "parse_uri":
|
|
171
|
+
from metacooler.uri import parse_uri as _parse_uri
|
|
172
|
+
|
|
173
|
+
return _parse_uri
|
|
174
|
+
if name == "create_mmetacool":
|
|
175
|
+
from metacooler.io.mmetacool import create_mmetacool as _create_mmetacool
|
|
176
|
+
|
|
177
|
+
return _create_mmetacool
|
|
178
|
+
if name == "add_entry":
|
|
179
|
+
from metacooler.io.mmetacool import add_entry as _add_entry
|
|
180
|
+
|
|
181
|
+
return _add_entry
|
|
182
|
+
if name == "remove_entry":
|
|
183
|
+
from metacooler.io.mmetacool import remove_entry as _remove_entry
|
|
184
|
+
|
|
185
|
+
return _remove_entry
|
|
186
|
+
if name == "copy_entry":
|
|
187
|
+
from metacooler.io.mmetacool import copy_entry as _copy_entry
|
|
188
|
+
|
|
189
|
+
return _copy_entry
|
|
190
|
+
if name == "move_entry":
|
|
191
|
+
from metacooler.io.mmetacool import move_entry as _move_entry
|
|
192
|
+
|
|
193
|
+
return _move_entry
|
|
194
|
+
if name == "list_entries":
|
|
195
|
+
from metacooler.io.mmetacool import list_entries as _list_entries
|
|
196
|
+
|
|
197
|
+
return _list_entries
|
|
198
|
+
if name == "copy_entry_cross_file":
|
|
199
|
+
from metacooler.io.mmetacool import (
|
|
200
|
+
copy_entry_cross_file as _copy_entry_cross_file,
|
|
201
|
+
)
|
|
202
|
+
|
|
203
|
+
return _copy_entry_cross_file
|
|
204
|
+
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|