<jupyter_start><jupyter_text>Associated Data DemoDemonstrates how VMC might be used in conjunction with application-specific data---<jupyter_code>import json

from vmc.extra.demoapp import DemoApp 
from vmc.extra.utils import json_pretty_format

demoapp = DemoApp()
# *1: https://www.pharmgkb.org/haplotype/PA165819268
# *3A: https://www.pharmgkb.org/haplotype/PA165819270
# *3B: https://www.pharmgkb.org/haplotype/PA165819271
# *3C: https://www.pharmgkb.org/haplotype/PA165819272

# TPMT_hgvs_alleles
rs1142345T = "NC_000006.11:g.18130918="
rs1142345C = "NC_000006.11:g.18130918T>C"
rs1800460C = "NC_000006.11:g.18139228="
rs1800460T = "NC_000006.11:g.18139228C>T"

TPMT_hgvs_haplotypes = {
    "TPMT*1": [rs1142345T, rs1800460C],
    "TPMT*3A": [rs1142345C, rs1800460T],
    "TPMT*3B": [rs1800460T],
    "TPMT*3C": [rs1142345C],
}

# Data from CPIC via <NAME> (thanks!)
pop_labels = "CEU MED SA AFR".split()
pop_freq = {
    "TPMT*1": dict(zip(pop_labels, [0.95726, 0.96081, 0.95233, 0.93901])),
    "TPMT*3A": dict(zip(pop_labels, [0.0356, 0.0254, 0.0287, 0.00198])),
    "TPMT*3B": dict(zip(pop_labels, [0.000561, 0.00426, 0.000486, 0])),
    "TPMT*3C": dict(zip(pop_labels, [0.004205, 00.00545, 0.00924, 0.0495])),
}

pharmgkb_ids = {
    "TPMT*1": "PA165819268",
    "TPMT*3A": "PA165819270",
    "TPMT*3B": "PA165819271",
    "TPMT*3C": "PA165819272",
    }

def make_pharmgkb_info(name):
    id = pharmgkb_ids[name]
    return {
        "id": id,
        "name": "TPMT",
        "links": {
            "haplotype": f"https://www.pharmgkb.org/haplotype/{id}",
            "clinicalAnnotation": f"https://www.pharmgkb.org/haplotype/{id}/clinicalAnnotation",
        }
    }
for hapname in "TPMT*1 TPMT*3A TPMT*3B TPMT*3C".split():
    haplotype = demoapp.bm.add_hgvs_haplotype(TPMT_hgvs_haplotypes[hapname])
    demoapp.bm.identifiers[haplotype.id].add(hapname)
    demoapp.annotations["pop_freq"][haplotype.id] = pop_freq[hapname]
    demoapp.annotations["pharmgkb"][haplotype.id] = make_pharmgkb_info(hapname)
import json
print(json.dumps(demoapp.as_dict(), indent=2))
demoapp.get_record("VMC:GH_Pi0KRfcBXsMlBW2th1tBNul53qJ5P_TM")<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.16651291512915128, 'fraction_numerical': 0.14944649446494465, 'mean_word_length': 4.619170984455959, 'pattern_counts': {'":': 17, '<': 6, '<?xml version=': 0, '>': 8, 'https://': 6, 'lorem ipsum': 0, 'www.': 6, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '472022', 'license': 'Apache-2.0', 'n_tokens_mistral': 1185, 'n_tokens_neox': 965, 'n_words': 130, 'path': 'notebooks/archive/03 - TPMT Demo.ipynb', 'repo_name': 'GenomicMedLab/vrs-python', 'size': '2174'}