@@ -76,10 +76,15 @@ def _wes_alterations(repo: Path) -> tuple[dict[str, dict[str, set[str]]], set[st
7676 cnv = pd .read_parquet (repo / "data/raw/soragni/tables/cnv.parquet" )
7777 snv = snv [snv ["BestEffect_Variant_Classification" ].astype (str ) != "intron" ]
7878 alt : dict [str , dict [str , set [str ]]] = {"mut" : {}, "amp" : {}, "del" : {}}
79- for gene , sid in zip (snv ["BestEffect_Hugo_Symbol" ].astype (str ), snv ["Sample_ID" ].astype (str )):
79+ for gene , sid in zip (
80+ snv ["BestEffect_Hugo_Symbol" ].astype (str ), snv ["Sample_ID" ].astype (str ), strict = True
81+ ):
8082 alt ["mut" ].setdefault (gene , set ()).add (canonicalize_patient_id (sid ))
8183 for gene , sid , call in zip (
82- cnv ["Gene" ].astype (str ), cnv ["Sample_ID" ].astype (str ), cnv ["Pathologist_Call" ].astype (str )
84+ cnv ["Gene" ].astype (str ),
85+ cnv ["Sample_ID" ].astype (str ),
86+ cnv ["Pathologist_Call" ].astype (str ),
87+ strict = True ,
8388 ):
8489 p = canonicalize_patient_id (sid )
8590 if call == "Amplification" :
@@ -142,9 +147,7 @@ def main() -> None:
142147 # prior (want_sign is the expected sign of rho(biomarker, viability)).
143148 y_pred = want_sign * bv
144149 bm_preds .append (
145- pd .DataFrame (
146- {"patient" : common , "drug" : bm ["drug" ], "y_true" : yv , "y_pred" : y_pred }
147- )
150+ pd .DataFrame ({"patient" : common , "drug" : bm ["drug" ], "y_true" : yv , "y_pred" : y_pred })
148151 )
149152
150153 # per-patient actionability for genomic positives: where does the matched drug
@@ -174,7 +177,8 @@ def main() -> None:
174177 print (" sensitivity_pctile = fraction of this organoid's drugs MORE potent than the" )
175178 print (" matched drug (0.0 = the matched drug is its single most effective)." )
176179 act = pd .DataFrame (actionable )
177- print (act .to_string (index = False ) if not act .empty else " (no genomic-positive organoids with a matched-drug response)" )
180+ empty_msg = " (no genomic-positive organoids with a matched-drug response)"
181+ print (act .to_string (index = False ) if not act .empty else empty_msg )
178182
179183 # ---- head-to-head: single biomarker vs global PCA-of-expression (within Soragni) ----
180184 bm_all = pd .concat (bm_preds , ignore_index = True ) if bm_preds else pd .DataFrame ()
0 commit comments