) if use_plan_b_hla_c_retained and has_anti_hlac_dsa_input and not anti_hlac_dsa_cleared_input: clinical_override_warnings.append( "CONTRAINDICATED_ANTI_HLAC_DSA_BLOCKS_HLA_C_BEARING_SUBBANK_RELEASE: recipient carries anti-HLA-C DSA; " "fixed-peptide SCT does not delete polymorphic HLA-C heavy-chain alloepitopes and cannot be cleared by " "MLC-only flags or on endogenous HLA-C retention (Aubert et al. 2014 PMID:24804568; AUDIT-REF; AUDIT-REF)." ) if has_anti_hlae_dsa_input and not exact_hlae_sct_serum_crossmatch_neg_input: clinical_override_warnings.append( "HOLD_RECIPIENT_ANTI_HLAE_DSA_EXACT_SCT_CROSSMATCH_REQUIRED: recipient carries anti-HLA-E antibody; " "requires negative exact-product HLA-E SCT serum CDC/ADCC crossmatch prior to release (Ravindranath et al. 2022 PMID:35323192; AUDIT-REF)." ) if ( selected_track != "TRACK_3_PERSONALIZED_AUTOLOGOUS_PATIENT_IPSC" and recipient_cpra_pct_input >= 80.0 and not exact_product_non_hla_and_sct_flow_crossmatch_neg_input ): clinical_override_warnings.append( "HOLD_HIGH_CPRA_SENSITIZED_EXACT_PRODUCT_CROSSMATCH_REQUIRED: recipient cPRA >= 80%; " "requires negative exact-product non-HLA and SCT flow/CDC crossmatch prior to allogeneic release (AUDIT-REF)." ) if cmv_nkg2c_adaptive_nk_fraction_input >= 0.25 and not gate0a_nkg2c_adaptive_nk_cleared_input: clinical_override_warnings.append( "HOLD_CMV_HIGH_NKG2C_ADAPTIVE_NK_DONOR_PANEL_GATE_0A_REQUIRED (WARN_CMV_HIGH_NKG2C_ADAPTIVE_NK_DONOR_PANEL_GATE_0A_REQUIRED): " "recipient CMV-seropositive NKG2C+ adaptive NK fraction >= 0.25; requires Gate 0A donor-panel verification of net NKG2A/NKG2C " "inhibition on VMAPRTLVL-loaded HLA-E SCT (vs high-affinity HLA-G leader VMAPRTLFL; Hammer et al. 2018 PMID:29632329; " "AUDIT-REF, AUDIT-REF, & AUDIT-REF)." ) if ( use_plan_b_hla_c_retained and kir_ligand_group in {"C2/C2", "C1/C2", "C2/C1"} and has_activating_kir2ds1_hazard_input and not kir2ds1_cleared_input ): clinical_override_warnings.append( "HOLD_B_PRIME_SCT_C2_QYDDAVYKL_REQUIRES_KIR2DS1_NON_ACTIVATION_CLEARANCE " "(HOLD_RECIPIENT_ACTIVATING_KIR2DS1_UNLICENSED_HAZARD_REQUIRES_SORTED_NK_NON_ACTIVATION_GATE): recipient carries " "activating KIR2DS1 with C2-bearing sub-bank; requires sorted KIR2DS1+/KIR2DL1- NK non-activation clearance on " "HLA-C*04:01[Y84A, QYDDAVYKL] (Stewart et al. 2005 PMID:16141329; AUDIT-REF & AUDIT-REF)." ) if ( use_b_prime_sct_k4 and kir_ligand_group in {"C2/C2", "C1/C2", "C2/C1"} and not cd8_mlc_cleared_input ): clinical_override_warnings.append( "HOLD_B_PRIME_SCT_C2_QYDDAVYKL_REQUIRES_ALL_RECIPIENT_CD8_MLC_CLEARANCE " "(HOLD_B_PRIME_SCT_C2_QYDDAVYKL_REQUIRES_ALL_RECIPIENT_CD8_MLC_NON_REACTIVITY): HLA-C*04:01[Y84A, QYDDAVYKL] " "requires recipient CD8+ T-cell MLC non-reactivity across all C2/C1+C2 recipients, including 4-digit heavy-chain-matched " "SELF_4DIGIT_MATCH / EXACT_4DIGIT_AUTOLOGOUS_OR_MATCHED recipients (AUDIT-REF & AUDIT-REF)." ) if ( use_b_prime_sct_k4 and kir_ligand_group == "C1/C1" and hlac_4digit_rel_input in {"UNSPECIFIED_ASSUMED_4DIGIT_OR_B_PRIME_SCT", "UNSPECIFIED"} and not cd8_mlc_cleared_input ): clinical_override_warnings.append( "HOLD_B_PRIME_SCT_C1_UNSPECIFIED_4DIGIT_RELATION_REQUIRES_ALLELE_TYPING_AND_CD8_MLC_CLEARANCE: " "C1/C1 recipient (e.g. HLA-C*07:02 homozygous) receiving HLA-C*03:04[Y84A, GAVDPLLAL] B'-SCT without explicit " "4-digit allele relation or recipient CD8+ MLC clearance cannot clear by default (AUDIT-REF; DEC-042)." ) if use_b_prime_sct_k4: sct_spec = ( "CIITA_EXON5_B_SCT_C0304_GAVDPLLAL (HLA-C*03:04[Y84A, GAVDPLLAL] SCT at CIITA exon 5)" if kir_ligand_group == "C1/C1" else ( "CIITA_EXON5_B_SCT_C0401_QYDDAVYKL (HLA-C*04:01[Y84A, QYDDAVYKL] SCT at CIITA exon 5)" if kir_ligand_group == "C2/C2" else "CIITA_EXON5_B_SCT_C0304_C0401_HETEROALLELIC (C1+C2 SCT at CIITA exon 5)" ) ) locus1_arm = f"OI-L2-DONOR-1B_B2M_EEF1A1_HLAE_CD47IGV + {sct_spec}" grna_set = [ "OI-GRNA-01_B2M_EXON1_ASCAS12A", "OI-GRNA-02_CIITA_EXON5_ASCAS12A", "OI-GRNA-03_CXCL10_EXON1_HIFI_SPCAS9", "OI-GRNA-04_AAVS1_PPP1R12C_HIFI_SPCAS9", ] k_dsb_loci = 4 elif use_plan_b_hla_c_retained: # Match retained HLA-C sub-bank to recipient KIR ligand group (C1/C1 -> HLA-C*07:02 [Design B-prime SP-1C upgrade: HLA-C*03:04 or C*01:02]; C2/C2 -> HLA-C*04:01; C1/C2 -> dual C1+C2; AUDIT-REF & AUDIT-REF): hlac_subbank_spec = ( "HLA-C*07:02 (C1/C1 sub-bank; Design B-prime SP-1C upgrade: HLA-C*03:04 or HLA-C*01:02)" if kir_ligand_group == "C1/C1" else ("HLA-C*04:01 (C2/C2 sub-bank)" if kir_ligand_group == "C2/C2" else "HLA-C*07:02 / HLA-C*04:01 (C1/C2 dual-licensed heterozygote sub-bank; Design B-prime SP-1C/SP-2C upgrade: HLA-C*03:04 / HLA-C*04:01)") ) locus1_arm = ( f"PLAN_B_SELECTIVE_HLAA_HLAB_KO_RETAINED_HLAC_SUBLINE [{hlac_subbank_spec}] " "(Investigational comparator; retains B2M for surface HLA-C1/C2 trafficking; separate HLA-A/HLA-B KO + CD47-IgV/HLA-E donor ledger required)" ) grna_set = [ "PLAN_B_HLAA_EXON2_KO_GUIDE_INVESTIGATIONAL", "PLAN_B_HLAB_EXON2_KO_GUIDE_INVESTIGATIONAL", "OI-GRNA-02_CIITA_EXON5_ASCAS12A", "OI-GRNA-03_CXCL10_EXON1_HIFI_SPCAS9", "OI-GRNA-04_AAVS1_PPP1R12C_HIFI_SPCAS9", ] k_dsb_loci = 5 else: # High NKG2A- KIR+ educated NK fraction (>= 0.30) or low-stability recipient HLA-E (*01:01/*01:01) # mandates Arm 1B; surface density remains a modeled assumption requiring per-lineage flow-cytometry qualification. locus1_arm = ( "OI-L2-DONOR-1B_B2M_EEF1A1_HLAE_CD47IGV (2A-free bidirectional cassette; per-lineage surface density unmeasured)" if (kir_licensed_nkg2a_neg_fraction >= 0.30 or recipient_hla_e == "*01:01/*01:01") else "OI-L2-DONOR-1A_B2M_ENDO_HLAE_CD47IGV (Non-Viral dsDNA Comparator; 5,170 bp with ITRs)" ) grna_set = [ "OI-GRNA-01_B2M_EXON1_ASCAS12A", "OI-GRNA-02_CIITA_EXON5_ASCAS12A", "OI-GRNA-03_CXCL10_EXON1_HIFI_SPCAS9", "OI-GRNA-04_AAVS1_PPP1R12C_HIFI_SPCAS9", ] k_dsb_loci = 4 if include_tyk2_p1104a_edit: grna_set.append("OI-GRNA-05_TYK2_P1104A_PEMAX_EPEGRNA_OPTIONAL") b_prime_loci = 1 if include_tyk2_p1104a_edit else 0 # Custom allele-specific gRNA re-synthesis is triggered ONLY if the genome actually being edited # (recipient autologous iPSC in Track 3, or a non-reference donor MCB) carries a protospacer/PAM SNP (AUDIT-REF): editing_genome_has_snp = (recipient_has_protospacer_snp if selected_track == "TRACK_3_PERSONALIZED_AUTOLOGOUS_PATIENT_IPSC" else donor_mcb_has_protospacer_snp) if editing_genome_has_snp and not rare_snp_pam_disrupted_input: grna_set.append("PATIENT_ALLELE_MATCHED_CUSTOM_SPACER_SYNTHESIS") # Explicit (K, B) editing complexity & manufacturing yield accounting (AUDIT-REF & AUDIT-REF): params = engineering_parameters if engineering_parameters is not None else _engineering_parameters() ranker_utility_penalty_factor = engineering_complexity_discount( k_dsb_loci, b_prime_loci, lambda_K=params["lambda_K"], gamma_B=params["gamma_B"] ) if use_b_prime_sct_k4: variant_id = ( ("ISLET1_B_SCT_C1_CIITA_TYK2_PE" if include_tyk2_p1104a_edit else "ISLET1_B_SCT_C1_CIITA") if kir_ligand_group == "C1/C1" else ( ("ISLET1_B_SCT_C2_CIITA_TYK2_PE" if include_tyk2_p1104a_edit else "ISLET1_B_SCT_C2_CIITA") if kir_ligand_group == "C2/C2" else ("ISLET1_B_SCT_C1C2_CIITA_TYK2_PE" if include_tyk2_p1104a_edit else "ISLET1_B_SCT_C1C2_CIITA") ) ) elif use_plan_b_hla_c_retained: variant_id = "ISLET1_B2_5LOCUS_TYK2_PE" if include_tyk2_p1104a_edit else "ISLET1_B2_5LOCUS_BASE" else: variant_id = "ISLET1_A4_ARM1B" if "DONOR-1B" in locus1_arm else "ISLET1_A4_ARM1A" if include_tyk2_p1104a_edit: variant_id += "_TYK2_PE" product = copy.deepcopy(_product_contract_snapshot(str(REPO_ROOT), variant_id)) _check(product["K"] == k_dsb_loci and product["B"] == b_prime_loci, "Compiler K/B differs from its product contract") default_promoted_track2_subbank_product_id = ( ( ("ISLET1_B_SCT_C1_CIITA_TYK2_PE" if include_tyk2_p1104a_edit else "ISLET1_B_SCT_C1_CIITA") if kir_ligand_group == "C1/C1" else ( ("ISLET1_B_SCT_C2_CIITA_TYK2_PE" if include_tyk2_p1104a_edit else "ISLET1_B_SCT_C2_CIITA") if kir_ligand_group == "C2/C2" else ("ISLET1_B_SCT_C1C2_CIITA_TYK2_PE" if include_tyk2_p1104a_edit else "ISLET1_B_SCT_C1C2_CIITA") ) ) if use_plan_b_hla_c_retained else None ) active_qualification_holds: List[str] = [] if use_plan_b_hla_c_retained and has_anti_hlac_dsa_input and not anti_hlac_dsa_cleared_input: active_qualification_holds.append("HOLD_INCOMPATIBLE_ANTI_HLAC_DSA_CONTRAINDICATED_REQUIRES_CROSSMATCH_OR_TRACK3") if use_plan_b_hla_c_retained and hlac_4digit_rel_input == "KIR_LIGAND_MISMATCH": active_qualification_holds.append("HOLD_KIR_LIGAND_MISMATCH_CONTRAINDICATED_FOR_SUBBANK") if has_anti_hlae_dsa_input and not exact_hlae_sct_serum_crossmatch_neg_input: active_qualification_holds.append("HOLD_RECIPIENT_ANTI_HLAE_DSA_EXACT_SCT_CROSSMATCH_REQUIRED") exact_product_crossmatch_explicit_false = ( "exact_product_non_hla_and_sct_flow_crossmatch_negative" in patient and patient.get("exact_product_non_hla_and_sct_flow_crossmatch_negative") is False ) if exact_product_crossmatch_explicit_false: active_qualification_holds.append("HOLD_EXACT_PRODUCT_NON_HLA_AND_SCT_FLOW_CROSSMATCH_FAILED") clinical_override_warnings.append( "HOLD_EXACT_PRODUCT_NON_HLA_AND_SCT_FLOW_CROSSMATCH_FAILED: recipient exact-product non-HLA and SCT flow/CDC crossmatch " "explicitly returned positive/failed (exact_product_non_hla_and_sct_flow_crossmatch_negative=False), blocking release across all tracks " "(including Track 3 autologous iPSC due to chimeric linker/DAF-junction neoepitope reactivity) regardless of baseline cPRA (AUDIT-REF & AUDIT-REF [DEC-050/052])." ) if ( selected_track != "TRACK_3_PERSONALIZED_AUTOLOGOUS_PATIENT_IPSC" and recipient_cpra_pct_input >= 80.0 and not exact_product_non_hla_and_sct_flow_crossmatch_neg_input ): active_qualification_holds.append("HOLD_HIGH_CPRA_SENSITIZED_EXACT_PRODUCT_CROSSMATCH_REQUIRED") if use_b_prime_sct_k4 and sct_cd8_mlc_explicit_false_input: active_qualification_holds.append("HOLD_TARGET_BSCT_CD8_MLC_FAILED_OVERRIDES_COMPOSITE") if use_b_prime_sct_k4 and sct_serum_xm_explicit_false_input: active_qualification_holds.append("HOLD_TARGET_BSCT_SERUM_CROSSMATCH_FAILED") if use_plan_b_hla_c_retained and hlac_4digit_rel_input == "KIR_MATCH_FOREIGN_4DIGIT_ALLO" and not cd8_mlc_cleared_input: active_qualification_holds.append("HOLD_FOREIGN_4DIGIT_HLAC_REQUIRES_EXACT_PRODUCT_SERUM_AND_MLC_CROSSMATCH") if ( use_plan_b_hla_c_retained and kir_ligand_group in {"C2/C2", "C1/C2", "C2/C1"} and has_activating_kir2ds1_hazard_input and not kir2ds1_cleared_input ): active_qualification_holds.append("HOLD_ACTIVATING_KIR2DS1_REQUIRES_SORTED_NK_NON_ACTIVATION_CLEARANCE") if cmv_nkg2c_adaptive_nk_fraction_input >= 0.25 and not gate0a_nkg2c_adaptive_nk_cleared_input: active_qualification_holds.append("HOLD_CMV_HIGH_NKG2C_ADAPTIVE_NK_REQUIRES_GATE_0A_DONOR_PANEL_CLEARANCE") if use_b_prime_sct_k4 and kir_ligand_group in {"C2/C2", "C1/C2", "C2/C1"} and not cd8_mlc_cleared_input: active_qualification_holds.append("HOLD_B_PRIME_SCT_C2_QYDDAVYKL_REQUIRES_ALL_RECIPIENT_CD8_MLC_CLEARANCE") if ( use_b_prime_sct_k4 and kir_ligand_group == "C1/C1" and hlac_4digit_rel_input in {"UNSPECIFIED_ASSUMED_4DIGIT_OR_B_PRIME_SCT", "UNSPECIFIED"} and not cd8_mlc_cleared_input ): active_qualification_holds.append( "HOLD_B_PRIME_SCT_C1_UNSPECIFIED_4DIGIT_RELATION_REQUIRES_ALLELE_TYPING_AND_CD8_MLC_CLEARANCE" ) if ( plan_b_biologically_indicated and selected_track == "TRACK_1_UNIVERSAL_OFF_THE_SHELF_ALLOGENEIC" and not track1_sorted_kir_nk_cleared ): active_qualification_holds.append( "HOLD_FORCED_TRACK1_OVERRIDES_HIGH_KIR_NK_REQUIRES_SORTED_KIR_NK_CLEARANCE" ) if ( plan_b_biologically_indicated and selected_track == "TRACK_3_PERSONALIZED_AUTOLOGOUS_PATIENT_IPSC" and not track1_sorted_kir_nk_cleared ): active_qualification_holds.append( "HOLD_FORCED_MHC_NULL_TRACK_OVERRIDES_EXTREME_KIR_NK_REQUIRES_SORTED_KIR_NK_CLEARANCE" ) if cd47_sirpa_binding_compromised_input or "v8" in sirpa_genotype.lower(): active_qualification_holds.append( "HOLD_CD47_SIRPA_BINDING_COMPROMISED_REQUIRES_ALTERNATIVE_STEALTH_QUALIFICATION" ) clinical_override_warnings.append( "HOLD_CD47_SIRPA_BINDING_COMPROMISED_REQUIRES_ALTERNATIVE_STEALTH_QUALIFICATION: cd47_sirpa_binding_compromised=True or unmeasured SIRPa V8 allele " "indicates impaired/unverified CD47-IgV -> SIRPa checkpoint engagement and requires orthogonal macrophage/NK stealth qualification prior to release (AUDIT-REF & AUDIT-REF; DEC-071/072)." ) if rare_snp_pam_disrupted_input: active_qualification_holds.append( "HOLD_RARE_SNP_PAM_DISRUPTED_REQUIRES_SHIFTED_PROTOSPACER_OR_ORTHOGONAL_NUCLEASE_QUALIFICATION" ) clinical_override_warnings.append( "HOLD_RARE_SNP_PAM_DISRUPTED_REQUIRES_SHIFTED_PROTOSPACER_OR_ORTHOGONAL_NUCLEASE_QUALIFICATION: rare SNP disrupts " "the PAM motif on the active editing genome (rare_snp_pam_disrupted=True); spacer-only re-synthesis cannot restore PAM recognition " "and requires a shifted protospacer or orthogonal PAM-relaxed nuclease qualification (AUDIT-REF, AUDIT-REF & AUDIT-REF; DEC-071/072/073)." ) if recipient_bw4_kir3dl1_educated and not bw4_kir3dl1_nk_lysis_cleared: active_qualification_holds.append( "HOLD_RECIPIENT_BW4_KIR3DL1_EDUCATED_NK_REQUIRES_SORTED_KIR3DL1_NK_CLEARANCE" )