OpenIslet

scripts/run_layer2_perturbation_and_regulatory_plane.py

Layer 2: Single-Cell Perturbation & Regulatory Sequence Plane (v0.8.0)

script Release v0.8.0 gen-eb955f8266035aba 1.13 MB · 71 sections

Use this file in any AI chat (paste-only or attachment-capable):

Download as text (.txt) Download section (.txt)

Pinned raw file: https://openislet.org/files/gen-eb955f8266035aba/scripts/run_layer2_perturbation_and_regulatory_plane.py · SHA-256: 3220e68f97203dbc…

            m_acc_coords = {(a["strand_relative_to_input"], a["exon_start_1based_on_input_plus"]) for a in m_scan["acceptors"]}
            if len(neos["created_donors_cv70_or_u1_7"]) != 0 or len(m_acc_coords - wt_acc_coords) != 0:
                raise ValueError(f"Splice hardening regression on {cid}")

            construct_entries.append({
                "construct_id": cid,
                "arm_index": arm_idx,
                "backbone": btag,
                "parent_construct_id": parent_id,
                "role": role,
                "promotion_eligibility": elig,
                "is_replacement_challenger": is_repl,
                "donor_length_bp": len(donor_seq),
                "packaged_aav6_bp": len(donor_seq) + 290,
                "donor_sha256": sha_hex,
                "nonamer_aa": pep,
                "nonamer_dna27": dna27,
                "alpha3_allele": alpha3_allele,
                "sct_precursor_aa_diffs_vs_wt_parent": aa_diffs,
                "junction_8_to_11mer_windows": p1_p4["gate_P3_chimeric_junction_neoepitopes"]["construct_total_8_11mer"],
                "junction_15mer_windows": p1_p4["gate_P3_chimeric_junction_neoepitopes"]["construct_total_15mer"],
                "created_donors_cv70_or_u1_7": len(neos["created_donors_cv70_or_u1_7"]),
                "created_new_acceptor_coordinates": len(m_acc_coords - wt_acc_coords),
                "created_acceptors_idx68_context_shift_count": len(neos["created_acceptors_idx68"]),
                "subthreshold_64_to_68_acceptors_created_or_shifted_count": len(sub68_created),
                "cargo_acceptors_delta_vs_parent": m_scan["cargo_acceptors"] - wt_scan["cargo_acceptors"],
            })

    return {
        "proposal_id": "IIP-0016",
        "decision_id": "DEC-094",
        "mode_b_comparator_fasta": {
            "relative_path": "data/constructs/islet1_locus1_s10_modeb_comparators_v0.8.0.fasta",
            "construct_count": 20,
            "sha256": hashlib.sha256(s10_fasta_path.read_bytes()).hexdigest(),
            "canonical_scenario_a_fasta_untouched": True,
        },
        "divergent_bidirectional_locus1_note": (
            "Locus 1 (Embodiment A* / Arm 1B) is a divergent head-to-head bidirectional cassette "
            "(<- SV40 polyA <- antisense CD47 CDS [877..1404 on ASTAR_4143 / 723..1250 on ARM1B_3974] <- antisense promoter "
            "| sense promoter -> HLA-E SCT CDS [1801..3318 on ASTAR_4143 / 1647..3149 on ARM1B_3974] -> bGH polyA). "
            "Two-strand CTC/CTT Leu codon hardening eliminates +2 naive-CTG minus-strand acceptors (indices 68.46 and 72.46 on SP-6B) "
            "with 0 created donors across all 20 constructs; Arm 3 (Hsp60 QMRPVSRVL) retains 1 sub-threshold sense ('+') motif "
            "CCGTGTCCAG|AGT at heuristic index 67.92 (0.08 below 68.0), reinforcing mandatory Stage-0 5'/3'-RACE across all arms."
        ),
        "mature_vs_precursor_numbering_note": (
            "Mature HLA-E alpha3 D227K/T228A maps to precursor codons D395K/T396A in ASTAR_4143 (20-aa L1) and D390K/T391A in ARM1B_3974 (15-aa L1)."
        ),
        "mhcflurry_2_3_28_scope_and_swissprot_provenance": {
            "uniprot_human_swissprot_records": 20429,
            "uniprot_fasta_gz_sha256": "40a8856b4e3f3620b11635143b501ef701558ed97309b0cdb4423ef09e4618d0",
            "mhcflurry_version": "2.3.28",
            "pseudosequence_caveat": (
                "MHCflurry 2.3.28 assigns an identical 39-residue binding-pocket pseudosequence to HLA-E*01:01 and HLA-E*01:03 "
                "and scores free 8-11mers rather than covalent (G4S)n-tethered SCTs; outputs are strictly in silico host Class-I "
                "cross-presentation flags (e.g., synthetic P8=Ala VMAPRTLAL predicted at 17.8 nM on HLA-B*08:01), never proof of stronger SCT stability."
            ),
        },
        "naive_ctg_counterfactuals_both_backbones": naive_ctg_runs,
        "verified_20_constructs": construct_entries,
    }



def _build_species_separated_proteome_census_iip_0017() -> Dict[str, Any]:
    """Return the deterministic species-separated Swiss-Prot-subtracted peptide & TYK2 HLA-C ledger (IIP-0017; DEC-095)."""
    return {'decision_id': 'DEC-095',
 'contribution_id': 'IIP-0017',
 'evidence_class': 'deterministic_swissprot_subtracted_species_separated_sequence_census_and_stage0_gate_specification',
 'canonical_fasta_and_ranking_invariance': {'canonical_scenario_a_fasta': 'data/constructs/islet1_scenario_a_constructs_v0.7.0.fasta',
                                            'canonical_scenario_a_fasta_sha256': 'b5ba4e2b4bbbcc7d6cf1138975c5fae5c6ab074dda43973f071c671cd8cd1d88',
                                            'layer1_stack_scores_and_subjective_odds_modified': False,
                                            'safety_switch_and_duplex_gates_modified': False},
 'primary_citations': ['PMID:32711842',
                       'PMID:37733863',
                       'PMID:23698740',
                       'PMID:27807284',
                       'PMID:30578352',
                       'PMID:36289205',
                       'PMID:30853558',
                       'PMID:29302013',
                       'PMID:40757665',
                       'PMID:22047558',
                       'PMID:9724721',
                       'PMID:11297676',
                       'PMID:15064769',
                       'PMID:37207206',
                       'PMID:39988068',
                       'PMID:37264229'],
 'rule_c3_and_reference_proteome_provenance': {'uniprot_human_swissprot_snapshot': {'license': 'CC-BY-4.0',
                                                                                    'reviewed_canonical_protein_count': 20429,
                                                                                    'fasta_gz_sha256': '40a8856b4e3f3620b11635143b501ef701558ed97309b0cdb4423ef09e4618d0',
                                                                                    'unique_canonical_kmers': {'8mer': 10304732,
                                                                                                               '9mer': 10409155,
                                                                                                               '10mer': 10470109,
                                                                                                               '11mer': 10513225,
                                                                                                               '15mer': 10596151},
                                                                                    'corroborated_live_release_2026_04_check': {'reviewed_canonical_protein_count': 20425,
                                                                                                                                'uncompressed_fasta_sha256': '0444b7cf4f4ddca5467aee7e2d86d45fcf440a9a879c791ecfc4cc186ac0b3d7',
                                                                                                                                'matrix_counts_identical_across_snapshots': True},
                                                                                    'scope_qualification': 'Canonical '
                                                                                                           'UniProt/Swiss-Prot '
                                                                                                           'reference '
                                                                                                           'subtraction '
                                                                                                           'flags '
                                                                                                           'non-reference '
                                                                                                           'sequence '
                                                                                                           'windows '
                                                                                                           'across '
                                                                                                           'declared '
                                                                                                           'molecular '
                                                                                                           'species; '
                                                                                                           'it omits '
                                                                                                           'uncataloged '
                                                                                                           'tissue '
                                                                                                           'isoforms, '
                                                                                                           'polymorphic '
                                                                                                           'recipient '
                                                                                                           'allotypes, '
                                                                                                           'post-translational '
                                                                                                           'modifications, '
                                                                                                           'and '
                                                                                                           'proteasome-catalyzed '
                                                                                                           'peptide '
                                                                                                           'splicing. '
                                                                                                           'A human '
                                                                                                           'reference '
                                                                                                           'match does '
                                                                                                           'not '
                                                                                                           'guarantee '
                                                                                                           'peripheral '
                                                                                                           'immune '
                                                                                                           'tolerance '
                                                                                                           'under '
                                                                                                           'ectopic/high-density '
                                                                                                           'expression, '
                                                                                                           'and a '
                                                                                                           'non-match '
                                                                                                           'does not '
                                                                                                           'establish '
                                                                                                           'physical '
                                                                                                           'MHC '
                                                                                                           'presentation '
                                                                                                           'or T-cell '
                                                                                                           'immunogenicity.'},
                                               'mhcflurry_2_3_28_and_v2_3_0_weights_provenance': {'software_package_version': '2.3.28',
                                                                                                  'software_license': 'Apache-2.0 '
                                                                                                                      "(O'Donnell "
                                                                                                                      'et '
                                                                                                                      'al. '
                                                                                                                      '2020 '
                                                                                                                      'PMID:32711842)',
                                                                                                  'weights_bundle': 'models_class1_presentation.20260928 '
                                                                                                                    '(release '
                                                                                                                    'v2.3.0)',
                                                                                                  'training_git_commit': 'ac253f8c859dc687f7fbce9f4840fb55d5acf2c5',
                                                                                                  'pinned_model_file_sha256s': {'DOWNLOAD_INFO.csv': '17c7125cc269d2d7b771898a07e268938d8c3d20d7c01e63c77867c67727b02b',
                                                                                                                                'models/inference_export.json': 'd262b457324fab4a55e32fec7c03fb557f7207428584c1bbece4e00f97bac11b',
                                                                                                                                'models/weights.csv': 'ce91f12e0d6f437ed5477d55fd9df81bef6bdb5a70344be8c6a9f71bd83402fd',
                                                                                                                                'models/percent_ranks.json': '39e53c5ea6ad30d19f59b9822e47832d8b154cd8b28d5a8cab365540fb40e233',
                                                                                                                                'models/affinity_predictor/allele_sequences.csv': '0967249e8d73dc06a675ecfafae71f03f90d13a274bb1c0122140d22d521df8a',
                                                                                                                                'models/affinity_predictor/manifest.csv': '5e749c5b9da19ee2b0467aa2486b447a9e2971b13f7954a803f75f93fc12d56e',
                                                                                                                                'models/affinity_predictor/percent_ranks.json': '9cb4ee611dfce6b7f8c3365bd420546ef4f05e91af3e18ef58abec4dbd30df2b',
                                                                                                                                'models/affinity_predictor/pseudosequences.mhcflurry.39aa.csv': '80bcdf5c250ce9954524b7bffccf80f030add9e9a090dd61bed0380f55652980',
                                                                                                                                'models/processing_predictor_with_flanks/manifest.csv': '57d305002b9924375a9e399684f9e7e6dc08ca6b5af40486d92575e09cc76a7e',
                                                                                                                                'models/processing_predictor_without_flanks/manifest.csv': '93a2ed30e31a905cc30eefdbfea38743fdfa0265857569d5d39d4accb0f4c35f'},
                                                                                                  'excluded_non_open_tools': ['MHCnuggets '
                                                                                                                              '(quarantined '
                                                                                                                              'and '
                                                                                                                              'excluded: '
                                                                                                                              'JHU '
                                                                                                                              'Academic '
                                                                                                                              'Software '
                                                                                                                              'License '
                                                                                                                              'sha256 '
                                                                                                                              '0637b6154f7ad7230deed230346609daaab5ddaade783d22bc165631a7ca27fb)',
                                                                                                                              'NetMHCpan '
                                                                                                                              '/ '
                                                                                                                              'NetMHCIIpan '
                                                                                                                              '(academic-only '