create_missing_features: opt-in / configurable strictness for synthesized parent rows

Aperta
#65 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
python

Direzione di ricerca

Inizia da gtfparse.create_missing_features e rivedi gli esempi downstream in transcript.py di pyensembl, inclusi il controllo column_exists("exon", "exon_id") e il comportamento di Transcript.coding_sequence. Confronta le opzioni strict/policy proposte e il design di required_attributes_per_feature, preservando il comportamento best-effort per impostazione predefinita. Il lavoro è completato quando i chiamanti possono scegliere di generare un'eccezione oppure di emettere un avviso/saltare quando gli attributi parent sintetizzati sono insufficienti, lasciando invariata l'impostazione predefinita esistente.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Observation

pyensembl calls gtfparse.create_missing_features to backfill transcript and gene rows that the GTF omits (legitimate when the upstream only emits exon / CDS). The synthesizer derives the parent feature from the child rows it sees, which is usually correct — but when the input GTF deviates in ways the synthesizer doesn't anticipate, downstream consumers have to clean up.

Two recent pyensembl issues are downstream of this:

  • openvax/pyensembl#331 / v2.6.4 — older Ensembl releases (e.g. release 54) omit exon_id. create_missing_features synthesizes transcript rows that don't carry exon_id either, and pyensembl's Transcript.exons then crashed with sqlite3.OperationalError: no such column: exon_id. Workaround lives in pyensembl: a column_exists("exon", "exon_id") check at transcript.py:149.
  • openvax/pyensembl#252 / v2.6.4 — TAIR chr_patch_hapl_scaff fragments contain CDS rows without matching start_codon/stop_codon. After feature synthesis the transcript row exists but coding_sequence couldn't compute its endpoints. Workaround in pyensembl: Transcript.coding_sequence returns None rather than raising.

In both cases the inconsistency is structural to the input GTF rather than to gtfparse's logic, but a caller-side knob would help.

Proposal

Add a strict / policy kwarg to create_missing_features:

  • strict="raise" — when a child row lacks attributes the synthesizer would need to faithfully build the parent, raise.
  • strict="warn" — log + skip the synthesized row.
  • strict="best_effort" — current behavior; synthesize whatever we can, fill missing attrs with None.

Or more granularly: a required_attributes_per_feature: dict[str, set[str]] knob so callers can pin "if you're going to synthesize a transcript row, only do so when the child exon carries exon_id".

Why it'd help

The two issues above both look like "pyensembl handles partial GTFs" but the upstream signal that something's off (exon_id missing, start_codon missing) gets eaten by the synthesizer and lives later as a crash at query time.

Scope guard

  • Existing default behavior should stay best-effort. This is purely additive.
  • Bacteria/archaea GFFs with their own synthesis quirks are out of scope for this issue (separate parser ecosystem).
Lingua principale
Python
Stelle
130
Fork
34
Merge medio
23h 45m
PR unite (30g)
9

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di openvax/gtfparse

Tutte le issue di openvax/gtfparse

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.