def restrict_to_cell_lines(df, cell_lines): new_colname = [CCLE_Info.split_ccle_name(n)[0] for n in list(df.columns)] df.columns = new_colname df_truncated = df[['Description'] + cell_lines] df_truncated = df_truncated.rename(columns={'Description': 'Gene'}) df_truncated = df_truncated.set_index('Gene') return df_truncated.T
def expression_cell(fp): df = pd.read_csv(fp, sep='\t', header=0, skiprows=range(0, 2)) cells = list(df.columns) cells.remove('Name') cells.remove('Description') cell_lines = [CCLE_Info.split_ccle_name(n)[0] for n in cells] return set(cell_lines)
def test_CCLE_info(self): ccle_info = CCLE_Info('../data/raw/CCLE_metadata.csv') self.assertEqual(ccle_info.split_ccle_name('NIHOVCAR3_OVARY'), ('NIHOVCAR3','OVARY')) self.assertEqual(ccle_info.broad_id_2_ccle_name('ACH-000001'), 'NIHOVCAR3') self.assertEqual(ccle_info.ccle_name_2_broad_id('NIHOVCAR3'),'ACH-000001' )