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

Abierto
#65 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
35/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Tranquilo
Stack tecnológico
python

Línea de trabajo

Comienza en gtfparse.create_missing_features y revisa los ejemplos posteriores en transcript.py de pyensembl, incluida la comprobación column_exists("exon", "exon_id") y el comportamiento de Transcript.coding_sequence. Compara las opciones strict/policy propuestas y el diseño de required_attributes_per_feature, preservando el comportamiento best-effort de forma predeterminada. Se considera terminado cuando los llamadores pueden optar por provocar un error o emitir una advertencia/omitir cuando los atributos parent sintetizados son insuficientes, manteniendo sin cambios el valor predeterminado existente.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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).
Lenguaje dominante
Python
Estrellas
130
Forks
34
Merge medio
23 h 45 min
PR fusionados (30 d)
9

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de openvax/gtfparse

Todos los issues de openvax/gtfparse

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.