motif search: indel tolerance is hardcoded to 7-bp motif geometry

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

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
38/100
Tipo di issue
Refactoring
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
python

Direzione di ricerca

Start in src/leech/io/motif_search.py at the allow_edge_indels block (around lines 78-86) and the length check near lines 358-366, and note how motif_offset is already used. The issue leaves the protected-region definition and the default for max_length_delta open, so settle those with maintainers first. Done means the searcher takes edge_tolerance and max_length_delta as parameters with defaults that keep CCATGGC behaviour unchanged, and that tests cover a 2-bp and a 15-bp motif.

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

Descrizione

enhancement

Found during the generalization audit (#125). Not currently listed there.

Problem

Indel tolerance in reference-based motif search is hardcoded to the geometry of a 7-bp tRNA motif:

https://github.com/rnabioco/leech/blob/main/src/leech/io/motif_search.py#L78-L86

if allow_edge_indels:
    # Only check core region (exclude ±3bp edges for 7bp motif)
    # For CCATGGC (7bp), this checks only middle position (amino acid site)
    motif_len = ref_end - ref_start
    edge_tolerance = min(3, motif_len // 2)  # ±3bp or half motif length

and again at :358-366:

# Lenient check when accepting indels - within ±3bp tolerance
length_ok = abs(mapped_len - motif_len) <= 3

The 3 is tuned to CCATGGC. For a 2-bp motif, min(3, motif_len // 2) collapses the protected core to nothing. For a 15-bp motif, a <= 3 length tolerance is far tighter than the ±3 edge exclusion implies. Neither constant scales.

Suggested fix

Parameterize on the searcher: edge_tolerance: int | None = None (defaulting to motif_len // 2, so the protected core is always the single focus base) and max_length_delta: int | None = None (defaulting to something derived from motif length).

Better still, define the protected region relative to motif_offset rather than as a symmetric edge exclusion — motif_offset already names the position that matters, and the comment at :80 says the intent was exactly that.

Lingua principale
Python
Stelle
0
Fork
0
Merge medio
11h 17m
PR unite (30g)
23

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 rnabioco/leech

Tutte le issue di rnabioco/leech

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.