Skip to content

Commit 5e0a3d3

Browse files
committed
REF: tree
1 parent f9ebc64 commit 5e0a3d3

File tree

7 files changed

+30
-28
lines changed

7 files changed

+30
-28
lines changed

q2_types/__init__.py

-4
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,7 @@
66
# The full license is in the file LICENSE, distributed with this software.
77
# ----------------------------------------------------------------------------
88

9-
import importlib
10-
119
from ._version import get_versions
1210

1311
__version__ = get_versions()['version']
1412
del get_versions
15-
16-
importlib.import_module('q2_types.tree')

q2_types/plugin_setup.py

+1
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,4 @@
4444
importlib.import_module('q2_types.profile_hmms._deferred_setup')
4545
importlib.import_module('q2_types.reference_db._deferred_setup')
4646
importlib.import_module('q2_types.sample_data._deferred_setup')
47+
importlib.import_module('q2_types.tree._deferred_setup')

q2_types/tree/__init__.py

+2-7
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,9 @@
55
#
66
# The full license is in the file LICENSE, distributed with this software.
77
# ----------------------------------------------------------------------------
8-
9-
import importlib
10-
11-
from ._format import NewickFormat, NewickDirectoryFormat
12-
from ._type import Phylogeny, Rooted, Unrooted, Hierarchy
8+
from ._formats import NewickFormat, NewickDirectoryFormat
9+
from ._types import Phylogeny, Rooted, Unrooted, Hierarchy
1310

1411
__all__ = [
1512
'NewickFormat', 'NewickDirectoryFormat', 'Phylogeny',
1613
'Rooted', 'Unrooted', 'Hierarchy']
17-
18-
importlib.import_module('q2_types.tree._transformer')

q2_types/tree/_type.py q2_types/tree/_deferred_setup/__init__.py

+7-9
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,19 @@
66
# The full license is in the file LICENSE, distributed with this software.
77
# ----------------------------------------------------------------------------
88

9+
import importlib
910
from io import StringIO
1011

1112
from skbio import TreeNode
1213

13-
from qiime2.plugin import SemanticType
1414
from qiime2.plugin.util import transform
1515

16-
from ..plugin_setup import plugin
17-
from . import NewickDirectoryFormat
16+
from .. import (NewickFormat, NewickDirectoryFormat,
17+
Phylogeny, Rooted, Unrooted, Hierarchy)
1818

19-
Phylogeny = SemanticType('Phylogeny', field_names=['type'])
19+
from ...plugin_setup import plugin
2020

21-
Rooted = SemanticType('Rooted', variant_of=Phylogeny.field['type'])
22-
23-
Unrooted = SemanticType('Unrooted', variant_of=Phylogeny.field['type'])
24-
25-
Hierarchy = SemanticType('Hierarchy')
21+
plugin.register_formats(NewickFormat, NewickDirectoryFormat)
2622

2723
plugin.register_semantic_types(Phylogeny, Rooted, Unrooted, Hierarchy)
2824

@@ -57,3 +53,5 @@ def factory():
5753

5854
plugin.register_artifact_class(Hierarchy,
5955
directory_format=NewickDirectoryFormat)
56+
57+
importlib.import_module('._transformers', __name__)

q2_types/tree/_transformer.py q2_types/tree/_deferred_setup/_transformers.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
88

99
import skbio
1010

11-
from ..plugin_setup import plugin
12-
from . import NewickFormat
11+
from .. import NewickFormat
12+
13+
from ...plugin_setup import plugin
1314

1415

1516
@plugin.register_transformer

q2_types/tree/_format.py q2_types/tree/_formats.py

-6
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,9 @@
55
#
66
# The full license is in the file LICENSE, distributed with this software.
77
# ----------------------------------------------------------------------------
8-
98
import skbio.io
109
import qiime2.plugin.model as model
1110

12-
from ..plugin_setup import plugin
13-
1411

1512
class NewickFormat(model.TextFileFormat):
1613
def sniff(self):
@@ -20,6 +17,3 @@ def sniff(self):
2017

2118
NewickDirectoryFormat = model.SingleFileDirectoryFormat(
2219
'NewickDirectoryFormat', 'tree.nwk', NewickFormat)
23-
24-
25-
plugin.register_formats(NewickFormat, NewickDirectoryFormat)

q2_types/tree/_types.py

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# ----------------------------------------------------------------------------
2+
# Copyright (c) 2016-2023, QIIME 2 development team.
3+
#
4+
# Distributed under the terms of the Modified BSD License.
5+
#
6+
# The full license is in the file LICENSE, distributed with this software.
7+
# ----------------------------------------------------------------------------
8+
from qiime2.plugin import SemanticType
9+
10+
11+
Phylogeny = SemanticType('Phylogeny', field_names=['type'])
12+
13+
Rooted = SemanticType('Rooted', variant_of=Phylogeny.field['type'])
14+
15+
Unrooted = SemanticType('Unrooted', variant_of=Phylogeny.field['type'])
16+
17+
Hierarchy = SemanticType('Hierarchy')

0 commit comments

Comments
 (0)