Skip to main content
Loading navigation
Back to prompt library

Build a Gene Transcript FASTA Curation Pipeline with DSPy and FHIR — implementation

Linked challenge: Build a Gene Transcript FASTA Curation Pipeline with DSPy and FHIR

Prompt source

implementation91 lines11 sectionsNo variables1 code block
## Build
Parse eukaryotic gene packages from NCBI Datasets to validate transcript coding sequences with Biopython. Structure sequence verification summaries into FHIR Molecular Observation resources.

## User
Bioinformatics Curation Specialist

## Workflow
1. Unpack NCBI Datasets zip archive containing transcript rna.fna and data_report.jsonl.
2. Parse transcript sequences using Biopython SeqIO to check start and stop codon integrity.
3. Execute a DSPy signature to categorize transcript completeness based on sequence coordinates.
4. Construct FHIR R5 Observation resources containing sequence validity status for curator review.

## Interface
Web curation console with sequence audit tables and interactive JSON bundle inspector.

## Data
Download open NCBI Datasets packages using CLI for gene ID 672 or read bundled mock fixture zip archives.
Starter examples below are synthetic. They are not downloaded records.

## Source
[NCBI Datasets gene download](https://www.ncbi.nlm.nih.gov/datasets/docs/v2/how-tos/genes/download-gene-data-package/)
Utilizes the NCBI Datasets gene data package structure containing transcript RNA sequences and data report lines.

## Tools
dspy, biopython, pydantic.
DSPy compiles robust prompt pipelines to extract structured metadata assessments from open reading frame audits.
Local quantized Llama 3 or hosted small instruction model via standard API.

## 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
- Extracts valid SeqRecord instances from transcript FASTA input without fatal parser exceptions.
- Outputs valid FHIR R5 Observation JSON containing code 'molecular-sequence-assessment'.
- Flags incomplete reading frames lacking standard ATG initiation codons with warning status.

## Starter Examples
```json
[
  {
    "input": {
      "gene_id": "672",
      "fasta_header": "NM_007294.4 Homo sapiens BRCA1 transcript variant 1",
      "sequence": "ATGGATTTATCTGCTCTTCGCGTTGAAGAAGTACAAAATGTCATTAATGCTATGCAGAAAATCTTAGAGTGTCCCATCTGA"
    },
    "expected_output": {
      "resourceType": "Observation",
      "status": "final",
      "code": {
        "coding": [
          {
            "system": "http://example.org/fhir/codes",
            "code": "molecular-sequence-assessment"
          }
        ]
      },
      "valueString": "complete_cds",
      "component": [
        {
          "code": {
            "text": "has_valid_start_and_stop"
          },
          "valueBoolean": true
        }
      ]
    }
  },
  {
    "input": {
      "gene_id": "672",
      "fasta_header": "NM_007294.4_truncated Homo sapiens BRCA1 partial",
      "sequence": "TTATCTGCTCTTCGCGTTGAAGAAGTACAAAATGTCATTAATGCTATGCAGAAAATCTTAGAGTGTCCC"
    },
    "expected_output": {
      "resourceType": "Observation",
      "status": "preliminary",
      "code": {
        "coding": [
          {
            "system": "http://example.org/fhir/codes",
            "code": "molecular-sequence-assessment"
          }
        ]
      },
      "valueString": "incomplete_cds",
      "component": [
        {
          "code": {
            "text": "has_valid_start_and_stop"
          },
          "valueBoolean": false
        }
      ]
    }
  }
]
```

## Safety
Research software only; outputs are non-diagnostic and must undergo curator sign-off before biobank indexing.
Use mock external writes. Require human review before any real deployment.