Commit ·
10ed22f
0
Parent(s):
Initial Deployment
Browse files- .github/workflows/sync_to_hub.yml +20 -0
- README.md +19 -0
- app.py +96 -0
- requirements.txt +6 -0
.github/workflows/sync_to_hub.yml
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Sync to Hugging Face hub
|
| 2 |
+
on:
|
| 3 |
+
push:
|
| 4 |
+
branches: [main]
|
| 5 |
+
|
| 6 |
+
# to run this workflow manually from the Actions tab
|
| 7 |
+
workflow_dispatch:
|
| 8 |
+
|
| 9 |
+
jobs:
|
| 10 |
+
sync-to-hub:
|
| 11 |
+
runs-on: ubuntu-latest
|
| 12 |
+
steps:
|
| 13 |
+
- uses: actions/checkout@v3
|
| 14 |
+
with:
|
| 15 |
+
fetch-depth: 0
|
| 16 |
+
lfs: true
|
| 17 |
+
- name: Push to hub
|
| 18 |
+
env:
|
| 19 |
+
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
| 20 |
+
run: git push https://NurseCitizenDeveloper:$HF_TOKEN@huggingface.co/spaces/NurseCitizenDeveloper/VirtualGeneScope main
|
README.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Virtual Gene Scope
|
| 2 |
+
|
| 3 |
+
A nursing education tool to visualize the "Regulatory Genome" using Google DeepMind's AlphaGenome (Mocked/API).
|
| 4 |
+
|
| 5 |
+
## Overview
|
| 6 |
+
This application demonstrates how non-coding variants can impact gene expression, helping nurses understand complex genetic conditions beyond simple protein-coding errors.
|
| 7 |
+
|
| 8 |
+
## Features
|
| 9 |
+
- **Gene Selector**: Inspect key genes (e.g., *INS*, *SCN9A*).
|
| 10 |
+
- **Mutation Simulator**: Introduce variants in regulatory regions.
|
| 11 |
+
- **Visual Tracks**: See predicted changes in Promoter Activity and Splicing.
|
| 12 |
+
|
| 13 |
+
## Usage
|
| 14 |
+
1. Run locally:
|
| 15 |
+
```bash
|
| 16 |
+
pip install -r requirements.txt
|
| 17 |
+
streamlit run app.py
|
| 18 |
+
```
|
| 19 |
+
2. Deploy to Hugging Face Spaces (CPU Basic).
|
app.py
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import pandas as pd
|
| 3 |
+
import numpy as np
|
| 4 |
+
import matplotlib.pyplot as plt
|
| 5 |
+
|
| 6 |
+
# Page Config
|
| 7 |
+
st.set_page_config(
|
| 8 |
+
page_title="Virtual Gene Scope",
|
| 9 |
+
page_icon="🧬",
|
| 10 |
+
layout="wide"
|
| 11 |
+
)
|
| 12 |
+
|
| 13 |
+
# Custom CSS for Nursing/Medical Aesthetic
|
| 14 |
+
st.markdown("""
|
| 15 |
+
<style>
|
| 16 |
+
.main {
|
| 17 |
+
background-color: #f8f9fa;
|
| 18 |
+
}
|
| 19 |
+
h1 {
|
| 20 |
+
color: #2c3e50;
|
| 21 |
+
}
|
| 22 |
+
.stButton>button {
|
| 23 |
+
background-color: #007bff;
|
| 24 |
+
color: white;
|
| 25 |
+
}
|
| 26 |
+
.metric-card {
|
| 27 |
+
background-color: white;
|
| 28 |
+
padding: 20px;
|
| 29 |
+
border-radius: 10px;
|
| 30 |
+
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
|
| 31 |
+
}
|
| 32 |
+
</style>
|
| 33 |
+
""", unsafe_allow_html=True)
|
| 34 |
+
|
| 35 |
+
# Application Header
|
| 36 |
+
st.title("🧬 Virtual Gene Scope: The Regulatory Genome")
|
| 37 |
+
st.markdown("""
|
| 38 |
+
**Nursing Context**: 98% of the genome does not code for proteins. Instead, it acts as a "control panel" turning genes on and off.
|
| 39 |
+
**AlphaGenome** allows us to see this hidden layer. Use this tool to visualize how non-coding mutations affects patient health.
|
| 40 |
+
""")
|
| 41 |
+
|
| 42 |
+
# Sidebar controls
|
| 43 |
+
st.sidebar.header("Patient & Gene Settings")
|
| 44 |
+
gene_choice = st.sidebar.selectbox("Select Gene of Interest", ["INS (Insulin - Diabetes)", "SCN9A (Pain Sensitivity)", "MMP9 (Wound Healing)"])
|
| 45 |
+
mutation_intensity = st.sidebar.slider("Mutation Impact (Simulation)", 0.0, 1.0, 0.5, help="Simulate the severity of the regulatory disruption.")
|
| 46 |
+
|
| 47 |
+
# Mock Data Generation (Simulating AlphaGenome Output)
|
| 48 |
+
def get_mock_tracks(gene, mutation_factor):
|
| 49 |
+
# Base signal (Promoter activity)
|
| 50 |
+
x = np.linspace(0, 100, 500)
|
| 51 |
+
|
| 52 |
+
# "Normal" gene expression peak
|
| 53 |
+
base_signal = np.exp(-((x - 50)**2) / 20)
|
| 54 |
+
|
| 55 |
+
# "Mutated" signal - reduced by mutation factor
|
| 56 |
+
mutated_signal = base_signal * (1 - mutation_factor * 0.8) # up to 80% reduction
|
| 57 |
+
|
| 58 |
+
return x, base_signal, mutated_signal
|
| 59 |
+
|
| 60 |
+
# Main Content Area
|
| 61 |
+
col1, col2 = st.columns([1, 2])
|
| 62 |
+
|
| 63 |
+
with col1:
|
| 64 |
+
st.subheader("Variant details")
|
| 65 |
+
st.info(f"Analyzing Regulatory Region for **{gene_choice.split(' ')[0]}**")
|
| 66 |
+
|
| 67 |
+
st.write("Variant Type: **Non-Coding / Regulatory**")
|
| 68 |
+
st.write("Location: **Promoter / Enhancer Region**")
|
| 69 |
+
|
| 70 |
+
if mutation_intensity > 0.7:
|
| 71 |
+
st.error("⚠️ HIGH RISK: Significant reduction in gene expression predicted.")
|
| 72 |
+
elif mutation_intensity > 0.3:
|
| 73 |
+
st.warning("⚠️ MODERATE RISK: Partial loss of regulation.")
|
| 74 |
+
else:
|
| 75 |
+
st.success("✅ LOW RISK: Benign variant predicted.")
|
| 76 |
+
|
| 77 |
+
with col2:
|
| 78 |
+
st.subheader("AlphaGenome Predicted Activity Tracks")
|
| 79 |
+
|
| 80 |
+
x, normal, mutant = get_mock_tracks(gene_choice, mutation_intensity)
|
| 81 |
+
|
| 82 |
+
fig, ax = plt.subplots(figsize=(10, 5))
|
| 83 |
+
ax.plot(x, normal, label="Healthy Control (Reference)", color='green', linewidth=2, alpha=0.7)
|
| 84 |
+
ax.plot(x, mutant, label="Patient Variant (Alternative)", color='red', linewidth=2, linestyle='--')
|
| 85 |
+
|
| 86 |
+
ax.set_title(f"Promoter Activity: {gene_choice.split(' ')[0]}", fontsize=12)
|
| 87 |
+
ax.set_xlabel("Genomic Position (bp)")
|
| 88 |
+
ax.set_ylabel("Predicted RNA Expression")
|
| 89 |
+
ax.legend()
|
| 90 |
+
ax.grid(True, alpha=0.3)
|
| 91 |
+
ax.fill_between(x, normal, mutant, color='orange', alpha=0.2, label='Lost Expression')
|
| 92 |
+
|
| 93 |
+
st.pyplot(fig)
|
| 94 |
+
|
| 95 |
+
st.markdown("---")
|
| 96 |
+
st.caption("Powered by AlphaGenome Architecture (Mock Demo) | Nursing Genomics Education Toolkit")
|
requirements.txt
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
streamlit
|
| 2 |
+
pandas
|
| 3 |
+
matplotlib
|
| 4 |
+
numpy
|
| 5 |
+
huggingface_hub
|
| 6 |
+
# alphagenome - install from git in runtime or use mock for now
|