Skip to content

Commit

Permalink
MAINT: Bring back BIOMV100, drop downcast trnsfrmr
Browse files Browse the repository at this point in the history
  • Loading branch information
thermokarst committed Jul 30, 2019
1 parent c3d9dc2 commit 8d7855f
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 48 deletions.
23 changes: 0 additions & 23 deletions q2_types/feature_table/_transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,30 +73,13 @@ def _table_to_v210(data):
return ff


def _table_to_v100(data):
ff = BIOMV100Format()
with ff.open() as fh:
data.to_json(generated_by=_get_generated_by(), direct_io=fh)
return ff


def _dataframe_to_table(df):
if df.index.inferred_type != 'string':
raise TypeError("Please provide a DataFrame with a string-based Index")
return biom.Table(df.T.values, observation_ids=df.columns,
sample_ids=df.index)


@plugin.register_transformer
def _1(data: biom.Table) -> BIOMV100Format:
data = _drop_axis_metadata(data)

ff = BIOMV100Format()
with ff.open() as fh:
fh.write(data.to_json(generated_by=_get_generated_by()))
return ff


@plugin.register_transformer
def _2(ff: BIOMV100Format) -> biom.Table:
return _parse_biom_table_v100(ff)
Expand Down Expand Up @@ -152,12 +135,6 @@ def _10(df: pd.DataFrame) -> BIOMV210Format:
return _table_to_v210(_dataframe_to_table(df))


@plugin.register_transformer
def _11(ff: BIOMV210Format) -> BIOMV100Format:
data = _parse_biom_table_v210(ff)
return _table_to_v100(data)


@plugin.register_transformer
def _12(data: biom.Table) -> qiime2.Metadata:
return _table_to_metadata(data)
Expand Down
25 changes: 0 additions & 25 deletions q2_types/feature_table/tests/test_transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,6 @@
class TestTransformers(TestPluginBase):
package = 'q2_types.feature_table.tests'

def test_biom_table_to_biom_v100_format(self):
filepath = self.get_data_path('feature-table_v100.biom')
transformer = self.get_transformer(biom.Table, BIOMV100Format)
input = biom.load_table(filepath)

obs = transformer(input)
obs = biom.load_table(str(obs))

exp = input
self.assertEqual(obs.ids(axis='observation').all(),
exp.ids(axis='observation').all())
self.assertEqual(obs.ids(axis='sample').all(),
exp.ids(axis='sample').all())

def test_biom_v100_format_to_biom_table(self):
input, obs = self.transform_format(BIOMV100Format, biom.Table,
filename='feature-table_v100.biom')
Expand Down Expand Up @@ -111,17 +97,6 @@ def test_biom_v100_format_to_biom_v210_format(self):
self.assertEqual(obs.ids(axis='sample').all(),
exp.ids(axis='sample').all())

def test_biom_v210_format_to_biom_v100_format(self):
input, obs = self.transform_format(BIOMV210Format, BIOMV100Format,
filename='feature-table_v210.biom')
exp = biom.load_table(str(input))
obs = biom.load_table(str(obs))

self.assertEqual(obs.ids(axis='observation').all(),
exp.ids(axis='observation').all())
self.assertEqual(obs.ids(axis='sample').all(),
exp.ids(axis='sample').all())

def test_to_pandas_data_frame_to_biom_v210_format(self):
filepath = self.get_data_path('feature-table_v100.biom')
transformer1 = self.get_transformer(BIOMV100Format, pd.DataFrame)
Expand Down

0 comments on commit 8d7855f

Please sign in to comment.