comparison COBRAxy/ras_to_bounds.py @ 58:42a8ccae86cd draft

Uploaded
author luca_milaz
date Sun, 13 Oct 2024 06:56:10 +0000
parents 9688ad27287b
children 547942aa1a93
comparison
equal deleted inserted replaced
57:0b4be1dbdbc4 58:42a8ccae86cd
230 ras.set_index("Reactions", drop=True, inplace=True) 230 ras.set_index("Reactions", drop=True, inplace=True)
231 ras = ras.T 231 ras = ras.T
232 ras = ras.astype(float) 232 ras = ras.astype(float)
233 ras_list.append(ras) 233 ras_list.append(ras)
234 for patient_id in ras.index: 234 for patient_id in ras.index:
235 class_assignments = class_assignments.append({"Patient_ID": patient_id, "Class": ras_class_name}, ignore_index=True) 235 class_assignments = pd.concat([class_assignments, pd.DataFrame({"Patient_ID": ras.index, "Class": ras_class_name})])
236
236 237
237 # Concatenate all ras DataFrames into a single DataFrame 238 # Concatenate all ras DataFrames into a single DataFrame
238 ras_combined = pd.concat(ras_list, axis=1) 239 ras_combined = pd.concat(ras_list, axis=1)
239 # Normalize the RAS values by max RAS 240 # Normalize the RAS values by max RAS
240 ras_combined = ras_combined.div(ras_combined.max(axis=0)) 241 ras_combined = ras_combined.div(ras_combined.max(axis=0))