@@ -41,6 +41,18 @@ def setUpClass(cls):
4141
4242
4343class TestANCOMBC2 (TestANCOMBC2Base ):
44+ @classmethod
45+ def setUpClass (cls ):
46+ super ().setUpClass ()
47+
48+ cls .abc2_output = ancombc2 (
49+ table = cls .biom_table ,
50+ metadata = cls .metadata ,
51+ fixed_effects_formula = 'body-site + year' ,
52+ group = 'body-site' ,
53+ structural_zeros = True
54+ )
55+
4456 def _slices_to_single_df (
4557 self , slices : ANCOMBC2SliceMapping
4658 ) -> pd .DataFrame :
@@ -149,16 +161,8 @@ def test_ancombc2_visualizer(self):
149161 test of whether or not the visualizer got built into the
150162 q2_composition/_ancombc2_visualizer/dist/ folder successfully.
151163 '''
152- abc2_output = ancombc2 (
153- table = self .biom_table ,
154- metadata = self .metadata ,
155- fixed_effects_formula = 'body-site + year' ,
156- group = 'body-site' ,
157- structural_zeros = True
158- )
159-
160164 with tempfile .TemporaryDirectory () as tempdir :
161- ancombc2_visualizer (tempdir , abc2_output )
165+ ancombc2_visualizer (tempdir , self . abc2_output )
162166 assert os .path .exists (os .path .join (tempdir , 'index.html' ))
163167
164168 def test_ancombc2_visualizer_non_overlapping_taxonomy (self ):
@@ -167,14 +171,6 @@ def test_ancombc2_visualizer_non_overlapping_taxonomy(self):
167171 data with a taxonomy that contains none of the features present in the
168172 ancombc2 data.
169173 '''
170- abc2_output = ancombc2 (
171- table = self .biom_table ,
172- metadata = self .metadata ,
173- fixed_effects_formula = 'body-site + year' ,
174- group = 'body-site' ,
175- structural_zeros = True
176- )
177-
178174 taxonomy_df = pd .DataFrame ({
179175 'Feature ID' : ['feat1' , 'feat2' ],
180176 'Taxon' : ['taxon1' , 'taxon2' ],
@@ -185,7 +181,7 @@ def test_ancombc2_visualizer_non_overlapping_taxonomy(self):
185181 with self .assertRaisesRegex (
186182 ValueError , 'No features remained in your taxonomy'
187183 ):
188- ancombc2_visualizer (tempdir , abc2_output , taxonomy_df )
184+ ancombc2_visualizer (tempdir , self . abc2_output , taxonomy_df )
189185
190186
191187class TestFormulaProcessing (TestANCOMBC2Base ):
0 commit comments