{ "cells": [ { "cell_type": "code", "execution_count": 8, "id": "22332556", "metadata": {}, "outputs": [ { "ename": "SyntaxError", "evalue": "invalid syntax (55915107.py, line 1)", "output_type": "error", "traceback": [ " \u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[8]\u001b[39m\u001b[32m, line 1\u001b[39m\n\u001b[31m \u001b[39m\u001b[31mfrom PRENTICE ANALYSIS import *\u001b[39m\n ^\n\u001b[31mSyntaxError\u001b[39m\u001b[31m:\u001b[39m invalid syntax\n" ] } ], "source": [ "from PRENTICE ANALYSIS import *\n", "\n", "data = load_prentice_mat(\n", " \"/mnt/data/flags_combined.mat\",\n", " \"/mnt/data/suv_percentilesSLOthenUWM.mat\"\n", ")\n", "\n", "percentiles = list(range(5, 101, 5))\n", "\n", "# IMPORTANT:\n", "# treatment_col and ae_col below are column indices inside data[\"flags\"].\n", "# These still need your confirmed mapping.\n", "df = build_analysis_df_from_mat(\n", " data,\n", " treatment_col=0,\n", " ae_col=5,\n", " percentiles=percentiles\n", ")\n", "\n", "df.head()" ] }, { "cell_type": "code", "execution_count": 6, "id": "4729fe28", "metadata": {}, "outputs": [ { "ename": "NameError", "evalue": "name 'collapse_treatment_to_two_groups' is not defined", "output_type": "error", "traceback": [ "\u001b[31m---------------------------------------------------------------------------\u001b[39m", "\u001b[31mNameError\u001b[39m Traceback (most recent call last)", "\u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[6]\u001b[39m\u001b[32m, line 9\u001b[39m\n\u001b[32m 1\u001b[39m treatment_map = {\n\u001b[32m 2\u001b[39m \u001b[32m1\u001b[39m: \u001b[32m0\u001b[39m, \u001b[38;5;66;03m# mono\u001b[39;00m\n\u001b[32m 3\u001b[39m \u001b[32m2\u001b[39m: \u001b[32m0\u001b[39m, \u001b[38;5;66;03m# mono\u001b[39;00m\n\u001b[32m (...)\u001b[39m\u001b[32m 6\u001b[39m \u001b[32m9\u001b[39m: \u001b[32m1\u001b[39m, \u001b[38;5;66;03m# combo\u001b[39;00m\n\u001b[32m 7\u001b[39m }\n\u001b[32m----> \u001b[39m\u001b[32m9\u001b[39m df[\u001b[33m\"\u001b[39m\u001b[33mTreatment\u001b[39m\u001b[33m\"\u001b[39m] = \u001b[43mcollapse_treatment_to_two_groups\u001b[49m(df[\u001b[33m\"\u001b[39m\u001b[33mTreatment_raw\u001b[39m\u001b[33m\"\u001b[39m], treatment_map)\n\u001b[32m 10\u001b[39m df[\u001b[33m\"\u001b[39m\u001b[33mAE\u001b[39m\u001b[33m\"\u001b[39m] = df[\u001b[33m\"\u001b[39m\u001b[33mAE_raw\u001b[39m\u001b[33m\"\u001b[39m]\n\u001b[32m 12\u001b[39m biomarker_cols = [\u001b[33mf\u001b[39m\u001b[33m\"\u001b[39m\u001b[33mLung_SUV_\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mp\u001b[38;5;132;01m}\u001b[39;00m\u001b[33m_max\u001b[39m\u001b[33m\"\u001b[39m \u001b[38;5;28;01mfor\u001b[39;00m p \u001b[38;5;129;01min\u001b[39;00m percentiles]\n", "\u001b[31mNameError\u001b[39m: name 'collapse_treatment_to_two_groups' is not defined" ] } ], "source": [ "treatment_map = {\n", " 1: 0, # mono\n", " 2: 0, # mono\n", " 3: 0, # mono\n", " 5: 1, # combo\n", " 9: 1, # combo\n", "}\n", "\n", "df[\"Treatment\"] = collapse_treatment_to_two_groups(df[\"Treatment_raw\"], treatment_map)\n", "df[\"AE\"] = df[\"AE_raw\"]\n", "\n", "biomarker_cols = [f\"Lung_SUV_{p}_max\" for p in percentiles]\n", "results = run_prentice_multiple(df, biomarker_cols, treatment_col=\"Treatment\", ae_col=\"AE\")\n", "results" ] }, { "cell_type": "code", "execution_count": null, "id": "43e472e1", "metadata": {}, "outputs": [], "source": [ "COL_PATIENT = \"Patient_ID\"\n", "COL_TREAT = \"Treatment\"\n", "COL_AE = \"Lung_AE_Flag\"" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.13.4" } }, "nbformat": 4, "nbformat_minor": 5 }