How sahasransuacharjya/dna-cancer-classifier works
Project type & purpose (from README + tree)
This is a data science / ML inference app packaged as a lightweight Streamlit “live demo” for 5-class cancer prediction from DNA sequences, with an experimental notebook and pre-trained model artifacts.
Key indicators:
• app.py + README command streamlit run app.py ⇒ interactive web UI (Streamlit) for inference.
• models/*.pth, *.pkl ⇒ pretrained PyTorch (and possibly sklearn/pickle) models.
• data/DNA_Dataset_Normalized.csv ⇒ local dataset used for training/validation or demo inputs.
• DNA_Sequence_Disease_Prediction.ipynb ⇒ training/experimentation pipeline (offline).
• deployment/Dockerfile, heroku.yml ⇒ container + PaaS deployment path.
• Offline training/experimentation (notebook + dataset → model artifacts)
• Online inference serving (Streamlit UI → model load → prediction)
• Deployment runtime (Docker/Heroku/Streamlit Cloud)
Online app (runtime)
• app.py: Streamlit entrypoint.
• Input acquisition (paste/upload sequence, maybe file upload)
• Preprocessing/tokenization (convert DNA strings → tensors/features)
• Model loading (from models/)
• Prediction + post-processing (probabilities, class label)
• Visualization (charts, feature importance images from results/)
Model artifacts
• models/best_transformer.pth, best_model.pth, final_model.pth: PyTorch weights/checkpoints.
• models/dna_cancer_model_complete.pkl: serialized pipeline or baseline model (MLP / sklearn pipeline / or torch wrapper).
Data assets
• data/DNA_Dataset_Normalized.csv: training dataset; may also be used for sample inputs.
Treat it as “Local dataset file” (offline) rather than an operational datastore.
Offline workflow
• DNA_Sequence_Disease_Prediction.ipynb: training, evaluation, comparison (Transformer vs MLP), generation of plots.
• results/: dashboard images and feature importance plots referenced in README.
• presentation/: slides/results PDF (non-runtime).
Deployment packaging
• deployment/Dockerfile, .dockerignore, heroku.yml: build + run configuration.
• requirements.txt: Python dependency boundary (runtime + training deps).
What to include from README (architecture hints)
The README tells you:
Streamlit Web App (app.py)
• UI Layer
• Preprocessing Layer
• Inference Layer
Deployment Environment
• Container (Docker)
• Hosting (Heroku / Streamlit Cloud)
Online inference path
• User Browser → Streamlit App: “DNA sequence input / upload”
• Streamlit App → Preprocessing: “encode/tokenize DNA”
• Streamlit App → Model Artifacts: “load transformer checkpoint (.pth) / pipeline (.pkl)”
• Streamlit App → Prediction Output: “class probs + label”
• Streamlit App → User Browser: “render prediction + charts”
Offline training path
• Dataset CSV → Notebook: “training/validation data”
• Notebook → Model Artifacts: “export trained weights (.pth) / serialized model (.pkl)”
• Notebook → Results folder: “generate dashboard + feature importance plots”
• (Optional) Results folder → README/Docs: “published figures”
Deployment path
• Source (app.py, requirements.txt, models/) → Docker Image (Dockerfile)
• Docker Image → Hosting (Heroku/Streamlit Cloud): “runtime container”
• Hosting → User Browser: “served Streamlit app”
Architectural patterns/principles used
• Separation of concerns (offline vs online):
• Offline training produces immutable artifacts.
• Online app consumes artifacts for inference.
• Artifact-based deployment:
• No live training in production; only inference.
• File-based “model registry”:
• Models are bundled with the app container rather than fetched from an external registry (based on current tree).
Technologies
• UI/Serving: Streamlit
• Model: PyTorch Transformer (and MLP baseline if referenced)
• Packaging: Docker, Heroku (via heroku.yml) / Streamlit Cloud (from README badge)
• Data: CSV (local)
Extra fidelity: what to annotate even if code is monolithic
Because this repo is small and likely monolithic in app.py, add callouts:
• Tokenizer/Encoding (k-mer, one-hot, embedding indices, etc.—whatever is used)
• Post-processing (softmax, thresholding, top-k classes)
• Explainability (feature importance plot generation is offline; show that)
Don’t overthink: maximize component separation
Even with limited files, treat responsibilities as components:
• UI
• Preprocess
• Model inference
• Artifact storage
• Offline training
• Deployment packaging