def test_saves_to_file_location_if_no_dst_supplied(self, patch): p = enrich2.Enrich2(src=self.store, wt_sequence=self.wt, offset=0) p.parse_input(self.enrich2.load_input_file()) expected_base_path = os.path.normpath( os.path.join(self.data_dir, "enrich2", "test_store")) for call_args in patch.call_args_list: self.assertIn(expected_base_path, call_args[0][0])
def test_saves_to_output_directory(self, patch): output = os.path.join(self.data_dir, "enrich2", "new") p = enrich2.Enrich2(src=self.store, dst=output, wt_sequence=self.wt, offset=0) p.parse_input(p.load_input_file()) for call_args in patch.call_args_list: self.assertIn(output, call_args[0][0])
def test_fails_when_no_variants(self): output = os.path.join(self.data_dir, "enrich2", "new") p = enrich2.Enrich2(src=self.store, dst=output, wt_sequence=self.wt, offset=0) with self.assertRaises(ValueError) as cm: p.parse_input(p.load_input_file()) self.assertEqual(str(cm.exception), "unable to find variants data in HDF5")
def setUp(self): super().setUp() self.wt = "GCTGAT" self.path = os.path.join(self.data_dir, "enrich2", "enrich2.tsv") self.enrich2 = enrich2.Enrich2( self.path, wt_sequence=self.wt, offset=0, one_based=True, hgvs_column="sequence", is_coding=False, )
def setUp(self): super().setUp() self.wt = "GCTGAT" self.path = os.path.join(self.data_dir, "enrich2", "test_store.h5") self.store = pd.HDFStore(self.path, "w") self.enrich2 = enrich2.Enrich2(self.path, wt_sequence=self.wt, offset=0, one_based=True) scores, shared, counts, *_ = self.mock_synonymous_frames() self.store["/main/synonymous/scores/"] = scores self.store["/main/synonymous/scores_shared/"] = shared self.store["/main/synonymous/counts/"] = counts self.files = [ os.path.normpath( os.path.join( self.data_dir, "enrich2", "test_store", "mavedb_test_store_synonymous_counts_c1.csv", )), os.path.normpath( os.path.join( self.data_dir, "enrich2", "test_store", "mavedb_test_store_synonymous_counts_c2.csv", )), os.path.normpath( os.path.join( self.data_dir, "enrich2", "test_store", "mavedb_test_store_synonymous_scores_c1.csv", )), os.path.normpath( os.path.join( self.data_dir, "enrich2", "test_store", "mavedb_test_store_synonymous_scores_c2.csv", )), ] self.store.close() self.store = pd.HDFStore(self.path, mode="r")