Skip to content

Commit

Permalink
REF: tree
Browse files Browse the repository at this point in the history
  • Loading branch information
ebolyen committed Jul 24, 2024
1 parent f9ebc64 commit 5e0a3d3
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 28 deletions.
4 changes: 0 additions & 4 deletions q2_types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@
# The full license is in the file LICENSE, distributed with this software.
# ----------------------------------------------------------------------------

import importlib

from ._version import get_versions

__version__ = get_versions()['version']
del get_versions

importlib.import_module('q2_types.tree')
1 change: 1 addition & 0 deletions q2_types/plugin_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,4 @@
importlib.import_module('q2_types.profile_hmms._deferred_setup')
importlib.import_module('q2_types.reference_db._deferred_setup')
importlib.import_module('q2_types.sample_data._deferred_setup')
importlib.import_module('q2_types.tree._deferred_setup')
9 changes: 2 additions & 7 deletions q2_types/tree/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,9 @@
#
# The full license is in the file LICENSE, distributed with this software.
# ----------------------------------------------------------------------------

import importlib

from ._format import NewickFormat, NewickDirectoryFormat
from ._type import Phylogeny, Rooted, Unrooted, Hierarchy
from ._formats import NewickFormat, NewickDirectoryFormat
from ._types import Phylogeny, Rooted, Unrooted, Hierarchy

__all__ = [
'NewickFormat', 'NewickDirectoryFormat', 'Phylogeny',
'Rooted', 'Unrooted', 'Hierarchy']

importlib.import_module('q2_types.tree._transformer')
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,19 @@
# The full license is in the file LICENSE, distributed with this software.
# ----------------------------------------------------------------------------

import importlib
from io import StringIO

from skbio import TreeNode

from qiime2.plugin import SemanticType
from qiime2.plugin.util import transform

from ..plugin_setup import plugin
from . import NewickDirectoryFormat
from .. import (NewickFormat, NewickDirectoryFormat,
Phylogeny, Rooted, Unrooted, Hierarchy)

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

Rooted = SemanticType('Rooted', variant_of=Phylogeny.field['type'])

Unrooted = SemanticType('Unrooted', variant_of=Phylogeny.field['type'])

Hierarchy = SemanticType('Hierarchy')
plugin.register_formats(NewickFormat, NewickDirectoryFormat)

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

Expand Down Expand Up @@ -57,3 +53,5 @@ def factory():

plugin.register_artifact_class(Hierarchy,
directory_format=NewickDirectoryFormat)

importlib.import_module('._transformers', __name__)
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@

import skbio

from ..plugin_setup import plugin
from . import NewickFormat
from .. import NewickFormat

from ...plugin_setup import plugin


@plugin.register_transformer
Expand Down
6 changes: 0 additions & 6 deletions q2_types/tree/_format.py → q2_types/tree/_formats.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,9 @@
#
# The full license is in the file LICENSE, distributed with this software.
# ----------------------------------------------------------------------------

import skbio.io
import qiime2.plugin.model as model

from ..plugin_setup import plugin


class NewickFormat(model.TextFileFormat):
def sniff(self):
Expand All @@ -20,6 +17,3 @@ def sniff(self):

NewickDirectoryFormat = model.SingleFileDirectoryFormat(
'NewickDirectoryFormat', 'tree.nwk', NewickFormat)


plugin.register_formats(NewickFormat, NewickDirectoryFormat)
17 changes: 17 additions & 0 deletions q2_types/tree/_types.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# ----------------------------------------------------------------------------
# Copyright (c) 2016-2023, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ----------------------------------------------------------------------------
from qiime2.plugin import SemanticType


Phylogeny = SemanticType('Phylogeny', field_names=['type'])

Rooted = SemanticType('Rooted', variant_of=Phylogeny.field['type'])

Unrooted = SemanticType('Unrooted', variant_of=Phylogeny.field['type'])

Hierarchy = SemanticType('Hierarchy')

0 comments on commit 5e0a3d3

Please sign in to comment.