18
18
import biom
19
19
import pandas as pd
20
20
from q2_types .feature_data import DNAIterator
21
- from q2_types .feature_table ._transformer import _table_to_dataframe
22
21
from qiime2 .plugin .testing import TestPluginBase
22
+ from qiime2 .plugin .util import transform
23
23
24
24
from q2_assembly .iss .iss import (
25
25
_abundances_to_biom ,
@@ -153,13 +153,13 @@ def test_abundances_to_biom(self):
153
153
glob .glob (os .path .join (self .get_data_path ("abundances" ), "*.txt" ))
154
154
)
155
155
obs_table = _abundances_to_biom (abunds_fp )
156
+ obs_df = transform (obs_table , to_type = pd .DataFrame )
156
157
157
158
with open (self .get_data_path ("abundances/biom_table.tsv" ), "r" ) as f :
158
159
exp_table = biom .Table .from_tsv (f , None , None , lambda x : x )
160
+ exp_df = transform (exp_table , to_type = pd .DataFrame )
159
161
160
- pd .testing .assert_frame_equal (
161
- _table_to_dataframe (obs_table ), _table_to_dataframe (exp_table )
162
- )
162
+ pd .testing .assert_frame_equal (obs_df , exp_df )
163
163
164
164
def test_generate_reads_wrong_genome_counts (self ):
165
165
with self .assertRaisesRegex (Exception , r".*provided 2 kingdom\(s\) but 1.*" ):
@@ -189,6 +189,8 @@ def test_generate_reads_action(self, p1, p2, p3):
189
189
["samp1" , "samp2" ], self .test_params_list , test_temp_dir .name
190
190
)
191
191
192
+ obs_abundances_df = transform (obs_abundances , to_type = pd .DataFrame )
193
+
192
194
exp_genomes = {
193
195
"genome1" : "ATGCATGC" ,
194
196
"genome2" : "GATCGCATGA" ,
@@ -201,9 +203,8 @@ def test_generate_reads_action(self, p1, p2, p3):
201
203
202
204
with open (self .get_data_path ("abundances/biom_table.tsv" ), "r" ) as f :
203
205
exp_biom_table = biom .Table .from_tsv (f , None , None , lambda x : x )
204
- pd .testing .assert_frame_equal (
205
- _table_to_dataframe (obs_abundances ), _table_to_dataframe (exp_biom_table )
206
- )
206
+ exp_df = transform (exp_biom_table , to_type = pd .DataFrame )
207
+ pd .testing .assert_frame_equal (obs_abundances_df , exp_df )
207
208
208
209
209
210
if __name__ == "__main__" :
0 commit comments