{ "cells": [ { "cell_type": "code", "execution_count": 2, "id": "6c08a8f0", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "2026-06-09 13:29:16.828 WARNING streamlit.runtime.caching.cache_data_api: No runtime found, using MemoryCacheStorageManager\n", "2026-06-09 13:29:16.829 WARNING streamlit.runtime.caching.cache_data_api: No runtime found, using MemoryCacheStorageManager\n", "2026-06-09 13:29:16.830 WARNING streamlit.runtime.caching.cache_data_api: No runtime found, using MemoryCacheStorageManager\n", "2026-06-09 13:29:16.830 WARNING streamlit.runtime.caching.cache_data_api: No runtime found, using MemoryCacheStorageManager\n", "2026-06-09 13:29:16.831 WARNING streamlit.runtime.caching.cache_data_api: No runtime found, using MemoryCacheStorageManager\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Base directory: /home/lippincm/gene-process-dependencies/9.webapp\n", "Repo root: /home/lippincm/gene-process-dependencies\n" ] } ], "source": [ "import os\n", "import pathlib\n", "\n", "import numpy as np\n", "import pandas as pd\n", "import streamlit as st\n", "from app_utils import latent_load_data, load_model_data, single_load_data\n", "from sklearn.decomposition import PCA" ] }, { "cell_type": "code", "execution_count": 3, "id": "328325ad", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "2026-06-09 13:29:16.839 WARNING streamlit.runtime.caching.cache_data_api: No runtime found, using MemoryCacheStorageManager\n", "2026-06-09 13:29:16.840 WARNING streamlit.runtime.scriptrunner_utils.script_run_context: Thread 'MainThread': missing ScriptRunContext! This warning can be ignored when running in bare mode.\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Base directory: /home/lippincm/gene-process-dependencies/9.webapp\n", "Repo root: /home/lippincm/gene-process-dependencies\n" ] } ], "source": [ "_base_reactome, _base_corum, _base_drug = latent_load_data()\n", "ALL_DISEASES = sorted(_base_reactome[\"OncotreePrimaryDisease\"].unique().tolist())\n", "ALL_MODEL_IDS = sorted(_base_reactome[\"ModelID\"].unique().tolist())\n", "# Go up one level to repo root, then into data/\n", "BASE_DIR = pathlib.Path().resolve()\n", "REPO_ROOT = BASE_DIR.parent\n", "REPO_ROOT = BASE_DIR.parent # goes up from 9.webapp/ to repo root\n", "print(f\"Base directory: {BASE_DIR}\")\n", "print(f\"Repo root: {REPO_ROOT}\")" ] }, { "cell_type": "code", "execution_count": 46, "id": "37924565", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "(1150, 18444)\n" ] } ], "source": [ "combined_df = single_load_data()\n", "data_directory = BASE_DIR / \"data\"\n", "dependency_file = data_directory / \"CRISPRGeneEffect.parquet\"\n", "gene_dict_file = data_directory / \"CRISPR_gene_dictionary.parquet\"\n", "cancer_type_input_file = BASE_DIR / \"data\" / \"Model.parquet\"\n", "dependency_df, gene_dict_df = load_model_data(dependency_file, gene_dict_file)\n", "dependency_df = dependency_df.set_index(\"ModelID\")\n", "cancer_type_input_file = pathlib.Path(f\"{BASE_DIR}/data/Model.parquet\")\n", "cancer_type_df = pd.read_parquet(cancer_type_input_file)\n", "reactome_matrix, corum_matrix, drug_matrix = latent_load_data()" ] }, { "cell_type": "code", "execution_count": null, "id": "0ef7365a", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": 63, "id": "4f84dac0", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
| \n", " | ModelID | \n", "OncotreePrimaryDisease | \n", "latent_score | \n", "gsea_es_score | \n", "pathway_score | \n", "feature | \n", "
|---|---|---|---|---|---|---|
| 0 | \n", "ACH-000001 | \n", "Ovarian Epithelial Tumor | \n", "0.392860 | \n", "0.824315 | \n", "0.392860 | \n", "Inactivation, Recovery And Regulation Of Photo... | \n", "
| 1 | \n", "ACH-000001 | \n", "Ovarian Epithelial Tumor | \n", "0.763630 | \n", "0.880116 | \n", "0.763630 | \n", "Elastic Fibre Formation R-HSA-1566948 | \n", "
| 2 | \n", "ACH-000001 | \n", "Ovarian Epithelial Tumor | \n", "0.435531 | \n", "0.839506 | \n", "0.435531 | \n", "Mismatch Repair (MMR) Directed By MSH2:MSH6 (M... | \n", "
| 3 | \n", "ACH-000001 | \n", "Ovarian Epithelial Tumor | \n", "0.531491 | \n", "-0.733375 | \n", "0.531491 | \n", "Processive Synthesis On Lagging Strand R-HSA-6... | \n", "
| 4 | \n", "ACH-000001 | \n", "Ovarian Epithelial Tumor | \n", "0.267750 | \n", "0.864257 | \n", "0.267750 | \n", "Mismatch Repair (MMR) Directed By MSH2:MSH3 (M... | \n", "
| ... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "
| 169777 | \n", "ACH-003012 | \n", "Non-Small Cell Lung Cancer | \n", "0.505296 | \n", "0.938271 | \n", "0.505296 | \n", "Kinase maturation complex 1 (human) | \n", "
| 169778 | \n", "ACH-003012 | \n", "Non-Small Cell Lung Cancer | \n", "0.282634 | \n", "0.808217 | \n", "0.282634 | \n", "immunoproteasome (mouse) | \n", "
| 169779 | \n", "ACH-003012 | \n", "Non-Small Cell Lung Cancer | \n", "0.073697 | \n", "0.748024 | \n", "0.073697 | \n", "ALL-1 supercomplex (human) | \n", "
| 169780 | \n", "ACH-003012 | \n", "Non-Small Cell Lung Cancer | \n", "0.032945 | \n", "0.739678 | \n", "0.032945 | \n", "Emerin complex 32 (human) | \n", "
| 169781 | \n", "ACH-003012 | \n", "Non-Small Cell Lung Cancer | \n", "0.283263 | \n", "0.815085 | \n", "0.283263 | \n", "Ikaros complex (mouse) | \n", "
169782 rows × 6 columns
\n", "