def testMakeGeneGroupDF(self): if IGNORE_TEST: return self.grouper._makeGeneGroupDF() helpers.isValidDataFrame(self.grouper.df_gene_group, [cn.GROUP]) df = copy.deepcopy(self.grouper.df_gene_group) self.grouper._makeGeneGroupDF(is_include_0_group=True) helpers.isValidDataFrame(self.grouper.df_gene_group, [cn.GROUP]) self.assertGreater(len(self.grouper.df_gene_group), len(df))
def testGroupTrinaryValueRows(self): if IGNORE_TEST: return self.grouper._makeGroupDF() expecteds = set([cn.CNT_GROUP, cn.CNT_UP, cn.CNT_DOWN, cn.GENE_IDS]) difference = expecteds.symmetric_difference(self.grouper.df_group) helpers.isValidDataFrame( self.grouper.df_group, [cn.CNT_GROUP, cn.CNT_UP, cn.CNT_DOWN, cn.GENE_IDS])
def testMakeTrinaryData(self): if IGNORE_TEST: return df = transform_data.makeTrinaryData( df=self.provider.df_normalized) columns = self.provider.df_normalized.columns self.assertTrue(helpers.isValidDataFrame(df, columns))
def testAggregateGenes(self): if IGNORE_TEST: return provider = DataProvider() provider.do() df = transform_data.aggregateGenes(provider=provider) self.assertTrue(helpers.isValidDataFrame(df, provider.df_normalized.columns))
def testMakeTimeAggregationMatrix(self): if IGNORE_TEST: return return df = self.matrix.makeTimeAggregationMatrix() self.assertTrue(helpers.isValidDataFrame(df, self.matrix.df_matrix.columns)) self.assertEqual(len(df), cn.NUM_TIMES)
def testWriteFitResultCSV(self): if IGNORE_TEST: return main.run(PERSISTER_PATH, True, max_iter=1, is_report=False, mcfo_kwargs=MCFO_KWARGS) df = main.makeFitResultCSV(path=PERSISTER_PATH, csv_path=None) self.assertTrue(helpers.isValidDataFrame(df, cn.FIT_RESULT_COLUMNS))
def testNormalizeReadsDF(self): if IGNORE_TEST: return provider = data_provider.DataProvider(is_only_qgenes=False, is_display_errors=False) provider.do() df = provider.dfs_read_count[0] df_normalized = provider.normalizeReadsDF(df) columns = ["T%d" % n for n in range(len(df.columns))] self.assertTrue(helpers.isValidDataFrame(df_normalized, columns)) self.assertEqual(len(df), len(df_normalized))
def testConstructor(self): for cls in [TrinaryData, NormalizedData]: data = cls() self.assertTrue(isinstance(data.df_X, pd.DataFrame)) self.assertTrue(isinstance(data.ser_y, pd.Series)) self.assertTrue(isinstance(data.features, list)) self.assertTrue(isinstance(data.state_dict, dict)) self.assertTrue( helpers.isValidDataFrame(data.df_X, data.df_X.columns)) self.assertEqual(len(data.df_X.columns), len(data.features)) self.assertEqual(len(data.df_X), len(data.ser_y))
def testNormalizeReadsDF(self): if IGNORE_TEST: return provider = data_provider.DataProvider( is_only_qgenes=False, is_display_errors=False) provider.do() df = provider.dfs_read_count[0] df_normalized = provider.normalizeReadsDF(df) self.assertTrue(helpers.isValidDataFrame(df_normalized, df.columns)) self.assertEqual(len(df), len(df_normalized)) ser_length = provider.df_gene_description[cn.LENGTH]
def testRunState(self): if IGNORE_TEST: return df_instance = pd.read_csv(TEST_IN_PATH) arguments = main.Arguments(state=STATE, df=df_instance, num_fset=5) df = main._runState(arguments) columns = expected_columns = [ ccn.FEATURE_VECTOR, ccn.SIGLVL, cn.STATE, main.INSTANCE, ccn.FRAC, ccn.COUNT ] self.assertTrue( helpers.isValidDataFrame(df, expected_columns=columns, nan_columns=columns))
def testConstructor(self): if IGNORE_TEST: return self.assertTrue(helpers.isValidDataFrame(self.analyzer.df_term, self.analyzer.df_term.columns))
def testMakeGeneTerm(self): if IGNORE_TEST: return self.assertTrue(helpers.isValidDataFrame(self.matrix.df_gene_term, [cn.GROUP, cn.TERM, cn.GENE_ID, cn.CNT_TERM, cn.CNT_GENE, cn.CNT_REGULATED]))
def testConstructor(self): if IGNORE_TEST: return self.assertTrue(helpers.isValidDataFrame( self.matrix.df_matrix, self.matrix.df_matrix.columns))