comparison COBRAxy/ras_to_bounds.py @ 236:1e7a8da6c47a draft default tip

Uploaded
author luca_milaz
date Tue, 17 Dec 2024 15:38:56 +0000
parents c2ce7d75fceb
children
comparison
equal deleted inserted replaced
235:5c70439f2907 236:1e7a8da6c47a
237 ras = read_dataset(ras_matrix, "ras dataset") 237 ras = read_dataset(ras_matrix, "ras dataset")
238 ras.replace("None", None, inplace=True) 238 ras.replace("None", None, inplace=True)
239 ras.set_index("Reactions", drop=True, inplace=True) 239 ras.set_index("Reactions", drop=True, inplace=True)
240 ras = ras.T 240 ras = ras.T
241 ras = ras.astype(float) 241 ras = ras.astype(float)
242 #append class name to patient id (dataframe index) 242 if(len(ras_file_list)>1):
243 ras.index = [f"{idx}_{ras_class_name}" for idx in ras.index] 243 #append class name to patient id (dataframe index)
244 ras.index = [f"{idx}_{ras_class_name}" for idx in ras.index]
245 else:
246 ras.index = [f"{idx}" for idx in ras.index]
244 ras_list.append(ras) 247 ras_list.append(ras)
245 for patient_id in ras.index: 248 for patient_id in ras.index:
246 class_assignments.loc[class_assignments.shape[0]] = [patient_id, ras_class_name] 249 class_assignments.loc[class_assignments.shape[0]] = [patient_id, ras_class_name]
247 250
248 251