Skip to main content
Back to Prompt Library
implementation

Build the application

Inspect the original prompt language first, then copy or adapt it once you know how it fits your workflow.

Linked challenge: Build a Multi-Transcript Coding Frame and Peptide Translation Auditor

Format
Code-aware
Lines
83
Sections
11
Linked challenge
Build a Multi-Transcript Coding Frame and Peptide Translation Auditor

Prompt source

Original prompt text with formatting preserved for inspection.

83 lines
11 sections
No variables
1 code block
## Build
Inspect coding sequence coordinates across multi-transcript gene packages to identify translational frame shifts. Generate structured FHIR Observation payloads tracking open reading frame integrity.

## User
Functional Genomics Biocurator

## Workflow
1. Load CDS and protein sequences from NCBI gene packages using Biopython.
2. Translate nucleotide CDS records across all three reading frames using the standard translation table.
3. Identify reading frame alignments that produce exact peptide matches against NCBI RefSeq protein records.
4. Generate FHIR Observation resources documenting reading frame validity and detected stop anomalies.

## Interface
FastAPI backend serving JSON inspection endpoints and an HTML table displaying frame translation alignments.

## Data
Download human BRCA1 gene packages using NCBI Datasets CLI `--include cds,protein` into local sandbox folders.
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/)
Processes CDS and protein sequences retrieved via NCBI Datasets `--include cds,protein` parameters.

## Tools
pydantic-ai, biopython, fastapi.
Pydantic AI guarantees type constraints and schema enforcement for complex translation and reading frame models.
Lightweight API or local model to generate structured explanations of frame-shift causes.

## 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
- Translates CDS sequences using Biopython Seq.translate and compares with target protein sequences.
- Identifies reading frame offset (frame 0, +1, or +2) matching the documented protein product.
- Outputs compliant FHIR R5 Observation records with appropriate status codes and valueCodings.

## Starter Examples
```json
[
  {
    "input": {
      "transcript_id": "NM_0001",
      "cds_seq": "ATGGCCAACGTATAG",
      "expected_protein": "MANV"
    },
    "expected_output": {
      "frame_offset": 0,
      "exact_match": true,
      "fhir_observation": {
        "resourceType": "Observation",
        "status": "final",
        "code": {
          "coding": [
            {
              "system": "http://hl7.org/fhir/sid/ncbi-gene",
              "code": "NM_0001"
            }
          ]
        },
        "valueString": "In-frame translation confirmed with matching protein accession"
      }
    }
  },
  {
    "input": {
      "transcript_id": "NM_0002",
      "cds_seq": "TGGCCAACGTATAG",
      "expected_protein": "MANV"
    },
    "expected_output": {
      "frame_offset": null,
      "exact_match": false,
      "fhir_observation": {
        "resourceType": "Observation",
        "status": "preliminary",
        "code": {
          "coding": [
            {
              "system": "http://hl7.org/fhir/sid/ncbi-gene",
              "code": "NM_0002"
            }
          ]
        },
        "valueString": "Frame shift or missing start codon: no reading frame matched MANV"
      }
    }
  }
]
```

## Safety
Uses open-access reference transcript sequences without individual patient exposure or clinical claims.
Use mock external writes. Require human review before any real deployment.

Adaptation plan

Keep the source stable, then change the prompt in a predictable order so the next run is easier to evaluate.

Keep stable

Hold the task contract and output shape stable so generated implementations remain comparable.

Tune next

Update libraries, interfaces, and environment assumptions to match the stack you actually run.

Verify after

Test failure handling, edge cases, and any code paths that depend on hidden context or secrets.