Build a Dual-Species Metagenomic Contamination Classifier — implementation
Linked challenge: Build a Dual-Species Metagenomic Contamination Classifier
Prompt source
implementation86 lines11 sectionsNo variables1 code block
## Build
Examine mixed-read FASTA sequence repositories to detect microbial contamination in mammalian cell-line catalogs. Compute sequence complexity indices and generate quarantine manifests for cell-line biocurators.
## User
Genomics Core Facility Scientist
## Workflow
1. Load multi-sample FASTA sequence files from cell-line research gene package downloads.
2. Compute GC ratio distributions and pentamer frequencies using Biopython parsing modules.
3. Compare sequence composition against known mammalian and mycoplasma reference distributions.
4. Export a validated sequence purity index and alert biocurators to suspected microbial contamination.
## Interface
Web console showing read distribution plots, GC-content shift metrics, and sample disposition actions.
## Data
Download public gene data packages with NCBI Datasets (--taxon rodent) and introduce synthetic microbial control fragments.
Starter examples below are synthetic. They are not downloaded records.
## Source
[Biopython](https://raw.githubusercontent.com/biopython/biopython/master/README.rst)
Employ Biopython SeqIO readers and nucleotide counting functions to compute base composition metrics.
## Tools
mlflow, biopython, numpy.
mlflow logs assay quality parameters, GC-drift distributions, and contamination threshold runs over time.
Local script execution with optional hosted LLM for generating biocurator narrative summaries.
## Deliverables
Submit runnable source, pinned dependencies, setup commands, a working interface, example outputs, and a recorded end-to-end demo. Include tests and an action log.
## Acceptance
- Calculates sequence GC percentages across all ingested FASTA reads via Biopython.
- Detects bimodal GC distributions indicative of dual-species foreign contamination.
- Logs assay quality parameters and metric artifacts into an MLflow experiment run.
- Emits human-actionable quarantine notifications for samples exceeding 15% contamination.
## Starter Examples
```json
[
{
"input": {
"run_id": "RUN-CELL-881",
"host_species": "Mus musculus",
"expected_gc_mean": 0.42,
"reads": [
{
"id": "R1",
"seq": "GCGCGCGCGCGCGCGCGCGCGCGCGC"
},
{
"id": "R2",
"seq": "ATATATATATATATATATATATATAT"
},
{
"id": "R3",
"seq": "ATCGATCGATCGATCGATCGATCGAT"
}
]
},
"expected_output": {
"run_id": "RUN-CELL-881",
"samples_analyzed": 3,
"contamination_detected": true,
"anomalous_read_ids": [
"R1"
],
"recommendation": "flag_for_microbial_assay"
}
},
{
"input": {
"run_id": "RUN-CELL-882",
"host_species": "Homo sapiens",
"expected_gc_mean": 0.45,
"reads": [
{
"id": "R4",
"seq": "ATCGATCGATCGATCGATCGATCGAT"
}
]
},
"expected_output": {
"run_id": "RUN-CELL-882",
"samples_analyzed": 1,
"contamination_detected": false,
"anomalous_read_ids": [],
"recommendation": "pass"
}
}
]
```
## Safety
Analytical quality assurance for cell line research; synthetic data only; no medical or in vitro diagnostic claims.
Use mock external writes. Require human review before any real deployment.