Skip to content

Commit

Permalink
MAINT: organizes table/tree data consistently
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisKeefe committed May 19, 2020
1 parent 1083ff2 commit c4d7ed9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
9 changes: 5 additions & 4 deletions q2_diversity_lib/tests/test_alpha.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,31 +39,32 @@ class FaithPDTests(TestPluginBase):

def setUp(self):
super().setUp()
# TODO: re-organize tables and trees
self.empty_table_fp = self.get_data_path('empty_table.biom')
self.empty_table_as_BIOMV210Format = \
BIOMV210Format(self.empty_table_fp, mode='r')
self.input_table_fp = self.get_data_path('faith_test_table.biom')
self.input_table_as_BIOMV210Format = \
BIOMV210Format(self.input_table_fp, mode='r')
self.input_tree_fp = self.get_data_path('faith_test.tree')
self.input_tree_as_NewickFormat = NewickFormat(self.input_tree_fp,
mode='r')
self.rf_table_fp = self.get_data_path('faith_test_table_rf.biom')
self.rf_table_as_BIOMV210Format = \
BIOMV210Format(self.rf_table_fp, mode='r')
self.pa_table_fp = self.get_data_path('faith_test_table_pa.biom')
self.pa_table_as_BIOMV210Format = \
BIOMV210Format(self.pa_table_fp, mode='r')

self.empty_tree_fp = self.get_data_path('empty.tree')
self.empty_tree_as_NewickFormat = NewickFormat(self.empty_tree_fp,
mode='r')
self.input_tree_fp = self.get_data_path('faith_test.tree')
self.input_tree_as_NewickFormat = NewickFormat(self.input_tree_fp,
mode='r')
self.root_only_tree_fp = self.get_data_path('root_only.tree')
self.root_only_tree_as_NewickFormat = \
NewickFormat(self.root_only_tree_fp, mode='r')
self.missing_tip_tree_fp = self.get_data_path('missing_tip.tree')
self.missing_tip_tree_as_NewickFormat = \
NewickFormat(self.missing_tip_tree_fp, mode='r')

self.expected = pd.Series({'S1': 0.5, 'S2': 0.7, 'S3': 1.0,
'S4': 100.5, 'S5': 101},
name='faith_pd')
Expand Down
4 changes: 4 additions & 0 deletions q2_diversity_lib/tests/test_beta.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ def setUp(self):
[0.25, 0.00, 0.00],
[0.25, 0.00, 0.00]],
ids=['S1', 'S2', 'S3'])

self.table_fp = self.get_data_path('two_feature_table.biom')
self.table_as_BIOMV210Format = BIOMV210Format(self.table_fp, mode='r')
self.rf_table_fp = self.get_data_path('two_feature_rf_table.biom')
Expand All @@ -231,6 +232,7 @@ def setUp(self):
self.p_a_table_fp = self.get_data_path('two_feature_p_a_table.biom')
self.p_a_table_as_BIOMV210Format = BIOMV210Format(self.p_a_table_fp,
mode='r')

self.tree_fp = self.get_data_path('three_feature.tree')

def test_method(self):
Expand Down Expand Up @@ -286,11 +288,13 @@ def setUp(self):
ids=('10084.PC.481', '10084.PC.593', '10084.PC.356',
'10084.PC.355', '10084.PC.354', '10084.PC.636',
'10084.PC.635', '10084.PC.607', '10084.PC.634'))

self.table_fp = self.get_data_path('crawford.biom')
self.table_as_BIOMV210Format = BIOMV210Format(self.table_fp, mode='r')
self.rel_freq_table_fp = self.get_data_path('crawford_rf.biom')
self.rf_table_as_BIOMV210Format = \
BIOMV210Format(self.rel_freq_table_fp, mode='r')

self.tree_fp = self.get_data_path('crawford.nwk')

def test_method(self):
Expand Down
4 changes: 2 additions & 2 deletions q2_diversity_lib/tests/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,14 @@ def function_w_param(n_jobs=3):
return n_jobs
self.function_w_n_jobs_param = function_w_param

# TODO: re-organize tables and trees
self.valid_table_fp = self.get_data_path('two_feature_table.biom')
self.valid_table_as_BIOMV210Format = \
BIOMV210Format(self.valid_table_fp, mode='r')
self.valid_table = biom.load_table(self.valid_table_fp)

self.valid_tree_fp = self.get_data_path('three_feature.tree')
self.valid_tree_as_NewickFormat = \
NewickFormat(self.valid_tree_fp, mode='r')
self.valid_table = biom.load_table(self.valid_table_fp)

def test_function_without_n_jobs_param(self):
with self.assertRaisesRegex(TypeError, 'without \'n_jobs'):
Expand Down

0 comments on commit c4d7ed9

Please sign in to comment.