Skip to main content
Loading navigation
Back to prompt library

Build a Gene Data Package FASTA Cleanser and Telemetry Monitor — implementation

Linked challenge: Build a Gene Data Package FASTA Cleanser and Telemetry Monitor

Prompt source

implementation64 lines11 sectionsNo variables1 code block
## Build
Process multi-FASTA gene packages to detect non-IUPAC nucleotide characters and low-complexity repeats. Track data cleansing performance and error drift using Langfuse.

## User
Bioinformatics Pipeline Engineer

## Workflow
1. Stream multi-FASTA files from NCBI Datasets gene archives using Biopython SeqIO.
2. Scan each sequence entry for non-IUPAC nucleotide symbols, masked N-stretches, and degenerate codons.
3. Log cleaning latency, token counts, and sequence anomaly rates into Langfuse telemetry spans.
4. Export sanitized FASTA output alongside a structured data cleaning audit log.

## Interface
Command-line pipeline configured with environment variables sending real-time telemetry to Langfuse UI.

## Data
Generate synthetic multi-FASTA files containing random mutations, non-IUPAC characters, and poly-N stretches.
Starter examples below are synthetic. They are not downloaded records.

## Source
[Biopython](https://raw.githubusercontent.com/biopython/biopython/master/README.rst)
Employs Biopython's Bio.SeqIO and sequence validation routines to inspect sequence headers and character contents.

## Tools
langfuse, biopython, pydantic.
Langfuse provides observability, trace tracking, and latency metrics for repetitive data curation pipelines.
Local or hosted LLM for generating contextual summaries of sequence anomaly clusters.

## 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
- Correctly identifies non-standard IUPAC characters (e.g. 'Z', '?', numbers) in input FASTA records.
- Sends telemetry traces to Langfuse containing sequence identifier and processing duration.
- Generates sanitized FASTA files preserving sequence IDs and valid biological characters.

## Starter Examples
```json
[
  {
    "input": {
      "record_id": "TRANS_001",
      "raw_sequence": "ATGCGTACNNNGTACG"
    },
    "expected_output": {
      "valid_iupac": true,
      "n_ratio": 0.1875,
      "sanitized_sequence": "ATGCGTACNNNGTACG",
      "telemetry_logged": true
    }
  },
  {
    "input": {
      "record_id": "TRANS_002",
      "raw_sequence": "ATGC123GZZTAG"
    },
    "expected_output": {
      "valid_iupac": false,
      "invalid_characters": [
        "1",
        "2",
        "3",
        "Z"
      ],
      "sanitized_sequence": "ATGCGGTAG",
      "telemetry_logged": true
    }
  }
]
```

## Safety
Processes pure nucleotide strings from public or synthetic data without clinical patient associations.
Use mock external writes. Require human review before any real deployment.