Skip to content

Commit

Permalink
STXBP1
Browse files Browse the repository at this point in the history
  • Loading branch information
pnrobinson committed Oct 3, 2023
1 parent 2108885 commit 2dd5683
Show file tree
Hide file tree
Showing 464 changed files with 107,841 additions and 0 deletions.
166 changes: 166 additions & 0 deletions notebooks/STXBP1/STXBP1.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "9dc963e1",
"metadata": {},
"source": [
"<h1>STXBP1 genotype-phenotype correlation analysis</h1>\n",
"<p>todo</p>"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "492f5c98",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Using genophenocorr version 0.1.1dev\n"
]
}
],
"source": [
"import genophenocorr\n",
"print(f\"Using genophenocorr version {genophenocorr.__version__}\")"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "c0692465",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Loaded HPO v2022-10-05\n"
]
}
],
"source": [
"import hpotk\n",
"hpo_purl = \"/Users/robinp/data/hpo/hp.json\"\n",
"hpo = hpotk.load_minimal_ontology(hpo_purl)\n",
"print(f'Loaded HPO v{hpo.version}')"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "77660956-d30f-4c49-a4a0-7fdae1e75b9f",
"metadata": {},
"outputs": [],
"source": [
"from genophenocorr.preprocessing import configure_caching_patient_creator\n",
"patient_creator = configure_caching_patient_creator(hpo)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "76967087-8fde-4388-95d2-dba1776bfa08",
"metadata": {},
"outputs": [],
"source": [
"from genophenocorr.preprocessing import load_phenopacket_folder"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "3c07a0a5-560a-4970-9f6e-deed8f06fe35",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Expected a result but got an Error for variant: 9_127684372_127684373_A_A_heterozygous\n"
]
},
{
"ename": "HTTPError",
"evalue": "400 Client Error: Bad Request for url: https://rest.ensembl.org/vep/human/region/9:127684373-127684373/A?LoF=1&canonical=1&domains=1&hgvs=1&mutfunc=1&numbers=1&protein=1&refseq=1&mane=1&transcript_version=1&variant_class=1",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mHTTPError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[0;32mIn[5], line 2\u001b[0m\n\u001b[1;32m 1\u001b[0m phenopacket_input_folder \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124minput\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m----> 2\u001b[0m patient_list \u001b[38;5;241m=\u001b[39m \u001b[43mload_phenopacket_folder\u001b[49m\u001b[43m(\u001b[49m\u001b[43mpp_directory\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mphenopacket_input_folder\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mpatient_creator\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mpatient_creator\u001b[49m\u001b[43m)\u001b[49m\n",
"File \u001b[0;32m~/GIT/genophenocorr/src/genophenocorr/preprocessing/_phenopacket.py:196\u001b[0m, in \u001b[0;36mload_phenopacket_folder\u001b[0;34m(pp_directory, patient_creator)\u001b[0m\n\u001b[1;32m 193\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mValueError\u001b[39;00m(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mNo JSON Phenopackets were found in \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mpp_directory\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m\"\u001b[39m)\n\u001b[1;32m 195\u001b[0m \u001b[38;5;66;03m# turn phenopackets into patients using patient creator\u001b[39;00m\n\u001b[0;32m--> 196\u001b[0m patients \u001b[38;5;241m=\u001b[39m [patient_creator\u001b[38;5;241m.\u001b[39mcreate_patient(pp) \u001b[38;5;28;01mfor\u001b[39;00m pp \u001b[38;5;129;01min\u001b[39;00m pps]\n\u001b[1;32m 198\u001b[0m \u001b[38;5;66;03m# create cohort from patients\u001b[39;00m\n\u001b[1;32m 199\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m Cohort\u001b[38;5;241m.\u001b[39mfrom_patients(patients)\n",
"File \u001b[0;32m~/GIT/genophenocorr/src/genophenocorr/preprocessing/_phenopacket.py:196\u001b[0m, in \u001b[0;36m<listcomp>\u001b[0;34m(.0)\u001b[0m\n\u001b[1;32m 193\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mValueError\u001b[39;00m(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mNo JSON Phenopackets were found in \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mpp_directory\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m\"\u001b[39m)\n\u001b[1;32m 195\u001b[0m \u001b[38;5;66;03m# turn phenopackets into patients using patient creator\u001b[39;00m\n\u001b[0;32m--> 196\u001b[0m patients \u001b[38;5;241m=\u001b[39m [\u001b[43mpatient_creator\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcreate_patient\u001b[49m\u001b[43m(\u001b[49m\u001b[43mpp\u001b[49m\u001b[43m)\u001b[49m \u001b[38;5;28;01mfor\u001b[39;00m pp \u001b[38;5;129;01min\u001b[39;00m pps]\n\u001b[1;32m 198\u001b[0m \u001b[38;5;66;03m# create cohort from patients\u001b[39;00m\n\u001b[1;32m 199\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m Cohort\u001b[38;5;241m.\u001b[39mfrom_patients(patients)\n",
"File \u001b[0;32m~/GIT/genophenocorr/src/genophenocorr/preprocessing/_phenopacket.py:116\u001b[0m, in \u001b[0;36mPhenopacketPatientCreator.create_patient\u001b[0;34m(self, item)\u001b[0m\n\u001b[1;32m 108\u001b[0m \u001b[38;5;250m\u001b[39m\u001b[38;5;124;03m\"\"\"Creates a Patient from the data in a given Phenopacket\u001b[39;00m\n\u001b[1;32m 109\u001b[0m \n\u001b[1;32m 110\u001b[0m \u001b[38;5;124;03mArgs:\u001b[39;00m\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 113\u001b[0m \u001b[38;5;124;03m Patient: A Patient object\u001b[39;00m\n\u001b[1;32m 114\u001b[0m \u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[1;32m 115\u001b[0m phenotypes \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_add_phenotypes(item)\n\u001b[0;32m--> 116\u001b[0m variants \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_add_variants\u001b[49m\u001b[43m(\u001b[49m\u001b[43mitem\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 117\u001b[0m protein_data \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_add_protein_data(variants)\n\u001b[1;32m 118\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m Patient(item\u001b[38;5;241m.\u001b[39mid, phenotypes, variants, protein_data)\n",
"File \u001b[0;32m~/GIT/genophenocorr/src/genophenocorr/preprocessing/_phenopacket.py:136\u001b[0m, in \u001b[0;36mPhenopacketPatientCreator._add_variants\u001b[0;34m(self, pp)\u001b[0m\n\u001b[1;32m 134\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_logger\u001b[38;5;241m.\u001b[39mwarning(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mPatient \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mpp\u001b[38;5;241m.\u001b[39mid\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m has unknown alternative variant \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mvc\u001b[38;5;241m.\u001b[39malt\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m and will not be included.\u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[1;32m 135\u001b[0m \u001b[38;5;28;01mcontinue\u001b[39;00m\n\u001b[0;32m--> 136\u001b[0m variant \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_func_ann\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mannotate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvc\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 137\u001b[0m variants_list\u001b[38;5;241m.\u001b[39mappend(variant)\n\u001b[1;32m 138\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n",
"File \u001b[0;32m~/GIT/genophenocorr/src/genophenocorr/preprocessing/_variant.py:227\u001b[0m, in \u001b[0;36mVarCachingFunctionalAnnotator.annotate\u001b[0;34m(self, variant_coordinates)\u001b[0m\n\u001b[1;32m 225\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m annotations\n\u001b[1;32m 226\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m--> 227\u001b[0m ann \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_fallback\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mannotate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariant_coordinates\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 228\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_cache\u001b[38;5;241m.\u001b[39mstore_annotations(variant_coordinates, ann)\n\u001b[1;32m 229\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m ann\n",
"File \u001b[0;32m~/GIT/genophenocorr/src/genophenocorr/preprocessing/_variant.py:79\u001b[0m, in \u001b[0;36mVepFunctionalAnnotator.annotate\u001b[0;34m(self, variant_coordinates)\u001b[0m\n\u001b[1;32m 71\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mannotate\u001b[39m(\u001b[38;5;28mself\u001b[39m, variant_coordinates: VariantCoordinates) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m Variant:\n\u001b[1;32m 72\u001b[0m \u001b[38;5;250m \u001b[39m\u001b[38;5;124;03m\"\"\"Creates a Variant object by searching variant coordinates with Variant Effect Predictor (VEP) REST API. \u001b[39;00m\n\u001b[1;32m 73\u001b[0m \n\u001b[1;32m 74\u001b[0m \u001b[38;5;124;03m Args:\u001b[39;00m\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 77\u001b[0m \u001b[38;5;124;03m Variant: A Variant object\u001b[39;00m\n\u001b[1;32m 78\u001b[0m \u001b[38;5;124;03m \"\"\"\u001b[39;00m\n\u001b[0;32m---> 79\u001b[0m variant \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_query_vep\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariant_coordinates\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 80\u001b[0m variant_id \u001b[38;5;241m=\u001b[39m variant\u001b[38;5;241m.\u001b[39mget(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mid\u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[1;32m 81\u001b[0m variant_class \u001b[38;5;241m=\u001b[39m variant\u001b[38;5;241m.\u001b[39mget(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mvariant_class\u001b[39m\u001b[38;5;124m'\u001b[39m)\n",
"File \u001b[0;32m~/GIT/genophenocorr/src/genophenocorr/preprocessing/_variant.py:130\u001b[0m, in \u001b[0;36mVepFunctionalAnnotator._query_vep\u001b[0;34m(self, variant_coordinates)\u001b[0m\n\u001b[1;32m 128\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m r\u001b[38;5;241m.\u001b[39mok:\n\u001b[1;32m 129\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_logging\u001b[38;5;241m.\u001b[39merror(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mExpected a result but got an Error for variant: \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mvariant_coordinates\u001b[38;5;241m.\u001b[39mas_string()\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m\"\u001b[39m)\n\u001b[0;32m--> 130\u001b[0m \u001b[43mr\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mraise_for_status\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 131\u001b[0m results \u001b[38;5;241m=\u001b[39m r\u001b[38;5;241m.\u001b[39mjson()\n\u001b[1;32m 132\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(results, \u001b[38;5;28mlist\u001b[39m):\n",
"File \u001b[0;32m~/GIT/genophenocorr/gpc2venv/lib/python3.8/site-packages/requests/models.py:1021\u001b[0m, in \u001b[0;36mResponse.raise_for_status\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 1016\u001b[0m http_error_msg \u001b[38;5;241m=\u001b[39m (\n\u001b[1;32m 1017\u001b[0m \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;132;01m{\u001b[39;00m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mstatus_code\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m Server Error: \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mreason\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m for url: \u001b[39m\u001b[38;5;132;01m{\u001b[39;00m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39murl\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 1018\u001b[0m )\n\u001b[1;32m 1020\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m http_error_msg:\n\u001b[0;32m-> 1021\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m HTTPError(http_error_msg, response\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m)\n",
"\u001b[0;31mHTTPError\u001b[0m: 400 Client Error: Bad Request for url: https://rest.ensembl.org/vep/human/region/9:127684373-127684373/A?LoF=1&canonical=1&domains=1&hgvs=1&mutfunc=1&numbers=1&protein=1&refseq=1&mane=1&transcript_version=1&variant_class=1"
]
}
],
"source": [
"phenopacket_input_folder = \"input\"\n",
"patient_list = load_phenopacket_folder(pp_directory=phenopacket_input_folder, patient_creator=patient_creator)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "a41be80d-0678-4dc3-97b6-2876d69648e0",
"metadata": {},
"outputs": [],
"source": [
"from genophenocorr.model import Cohort\n",
"from genophenocorr.view import CohortViewer\n",
"from IPython.display import display, HTML\n",
"cohort = Cohort.from_patients(patient_list)"
]
},
{
"cell_type": "markdown",
"id": "175d2b14-b75a-499a-9251-5154aa31c683",
"metadata": {},
"source": [
"<h2>CohortViewer</h2>\n",
"<p>The CohortViewer class offers various methods to create tables and graphics to view the data in the cohort.\n",
"It is still very much in progress</p>"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "1c7c5c1e-8e5e-488a-98ec-85689adff61c",
"metadata": {},
"outputs": [],
"source": [
"viewer = CohortViewer(hpo=hpo)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "gpc2venv",
"language": "python",
"name": "gpc2venv"
},
"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.8.10"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
140 changes: 140 additions & 0 deletions notebooks/STXBP1/input/PMID_35190816_STX_102.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
{
"id": "STX_102",
"subject": {
"id": "STX_102",
"timeAtLastEncounter": {
"age": {
"iso8601duration": "P25Y"
}
}
},
"phenotypicFeatures": [
{
"type": {
"id": "HP:0002360",
"label": "Sleep disturbance"
}
},
{
"type": {
"id": "HP:0007359",
"label": "Focal-onset seizure"
}
},
{
"type": {
"id": "HP:0000717",
"label": "Autism"
}
},
{
"type": {
"id": "HP:0002342",
"label": "Intellectual disability, moderate"
}
}
],
"interpretations": [
{
"id": "STX_102",
"progressStatus": "SOLVED",
"diagnosis": {
"disease": {
"id": "OMIM:602926c",
"label": "NDD"
},
"genomicInterpretations": [
{
"subjectOrBiosampleId": "STX_102",
"interpretationStatus": "CAUSATIVE",
"variantInterpretation": {
"variationDescriptor": {
"id": "var_QNjawtALouzsBvwKjYXyBdCvT",
"geneContext": {
"valueId": "HGNC:11444",
"symbol": "STXBP1"
},
"expressions": [
{
"syntax": "hgvs.c",
"value": "NM_001032221.6:c.1501_1519del"
},
{
"syntax": "hgvs.g",
"value": "NC_000009.12:g.127680196_127680214del"
}
],
"vcfRecord": {
"genomeAssembly": "hg38",
"chrom": "chr9",
"pos": "127680192",
"ref": "CCCTTATATCTCTACCCGTT",
"alt": "C"
},
"moleculeContext": "genomic",
"allelicState": {
"id": "GENO:0000135",
"label": "heterozygous"
}
}
}
}
]
}
}
],
"metaData": {
"created": "2023-10-02T22:26:06.164090871Z",
"createdBy": "ORCID:0000-0002-0736-9199",
"resources": [
{
"id": "geno",
"name": "Genotype Ontology",
"url": "http://purl.obolibrary.org/obo/geno.owl",
"version": "2022-03-05",
"namespacePrefix": "GENO",
"iriPrefix": "http://purl.obolibrary.org/obo/GENO_"
},
{
"id": "hgnc",
"name": "HUGO Gene Nomenclature Committee",
"url": "https://www.genenames.org",
"version": "06/01/23",
"namespacePrefix": "HGNC",
"iriPrefix": "https://www.genenames.org/data/gene-symbol-report/#!/hgnc_id/"
},
{
"id": "omim",
"name": "An Online Catalog of Human Genes and Genetic Disorders",
"url": "https://www.omim.org",
"version": "January 4, 2023",
"namespacePrefix": "OMIM",
"iriPrefix": "https://www.omim.org/entry/"
},
{
"id": "so",
"name": "Sequence types and features ontology",
"url": "http://purl.obolibrary.org/obo/so.obo",
"version": "2021-11-22",
"namespacePrefix": "SO",
"iriPrefix": "http://purl.obolibrary.org/obo/SO_"
},
{
"id": "hp",
"name": "human phenotype ontology",
"url": "http://purl.obolibrary.org/obo/hp.owl",
"version": "2023-09-01",
"namespacePrefix": "HP",
"iriPrefix": "http://purl.obolibrary.org/obo/HP_"
}
],
"phenopacketSchemaVersion": "2.0",
"externalReferences": [
{
"id": "PMID:35190816",
"reference": "https://pubmed.ncbi.nlm.nih.gov/35190816",
"description": "Assessing the landscape of STXBP1-related disorders in 534 individuals"
}
]
}
}
Loading

0 comments on commit 2dd5683

Please sign in to comment.