Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: Added new type FeatureTable[Normalized] #340

Merged
merged 3 commits into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions q2_types/feature_table/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
BIOMV210DirFmt)
from ._types import (FeatureTable, Frequency, RelativeFrequency,
PresenceAbsence, Composition, Balance,
PercentileNormalized, Design)
PercentileNormalized, Design, Normalized)

__all__ = ['BIOMV100Format', 'BIOMV100DirFmt', 'FeatureTable', 'Frequency',
'RelativeFrequency', 'PresenceAbsence', 'BIOMV210Format',
'BIOMV210DirFmt', 'Composition', 'Balance', 'PercentileNormalized',
'Design']
'Design', 'Normalized']
9 changes: 7 additions & 2 deletions q2_types/feature_table/_deferred_setup/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from .. import (BIOMV100Format, BIOMV210Format, BIOMV100DirFmt,
BIOMV210DirFmt, FeatureTable, Frequency, RelativeFrequency,
PresenceAbsence, Composition, Balance,
PercentileNormalized, Design)
PercentileNormalized, Design, Normalized)

from ...plugin_setup import plugin

Expand All @@ -27,7 +27,7 @@

plugin.register_semantic_types(FeatureTable, Frequency, RelativeFrequency,
PresenceAbsence, Balance, Composition,
PercentileNormalized, Design)
PercentileNormalized, Design, Normalized)

plugin.register_artifact_class(
FeatureTable[Frequency],
Expand Down Expand Up @@ -76,5 +76,10 @@
FeatureTable[Design],
directory_format=BIOMV210DirFmt
)
plugin.register_artifact_class(
FeatureTable[Normalized],
directory_format=BIOMV210DirFmt,
description="A feature table that was normalized."
)

importlib.import_module('._transformers', __name__)
3 changes: 3 additions & 0 deletions q2_types/feature_table/_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,6 @@
# Design is the type of design matrices for linear regressions that have
# been transformed/coded.
Design = SemanticType('Design', variant_of=FeatureTable.field['content'])

Normalized = SemanticType('Normalized',
variant_of=FeatureTable.field['content'])
9 changes: 8 additions & 1 deletion q2_types/feature_table/tests/test_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
from q2_types.feature_table import (FeatureTable, Frequency,
RelativeFrequency, PercentileNormalized,
Composition, Balance,
PresenceAbsence, BIOMV210DirFmt, Design)
PresenceAbsence, BIOMV210DirFmt, Design,
Normalized)


class TestTypes(TestPluginBase):
Expand All @@ -37,6 +38,9 @@ def test_composition_semantic_type_registration(self):
def test_balance_semantic_type_registration(self):
self.assertRegisteredSemanticType(Balance)

def test_normalized_semantic_type_registration(self):
self.assertRegisteredSemanticType(Normalized)

def test_feature_table_semantic_type_to_v210_format_registration(self):
self.assertSemanticTypeRegisteredToFormat(
FeatureTable[Frequency],
Expand All @@ -59,6 +63,9 @@ def test_feature_table_semantic_type_to_v210_format_registration(self):
self.assertSemanticTypeRegisteredToFormat(
FeatureTable[Design],
BIOMV210DirFmt)
self.assertSemanticTypeRegisteredToFormat(
FeatureTable[Normalized],
BIOMV210DirFmt)


if __name__ == "__main__":
Expand Down
Loading