Match attribute groups by whole name, not by word, when looking up valid terms

Aperta
#299 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à
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
57/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
r
Ambito
data

Direzione di ricerca

Start with .validAttributes() in R/physiologies.R and the multistate Attribute_value check in tests/testthat/test-importBugphyzz.R; then review inst/scripts/stop_on_unmapped.R and taxPPro's filterDataDiscrete() so the checks and export filter agree. Check whether any shape rows in the sheets or sources use endospore, branched, or cell chain. Done when group matching uses exact names across all four locations, tests confirm shape and halophily exclude unrelated terms, and the export still handles current source rows.

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

Descrizione

The valid terms for a physiology are looked up in inst/extdata/attributes.tsv by searching for the physiology name as a whole word in attribute_group (\b<name>\b). A physiology whose name is a whole word inside another group name therefore also gets that group's terms.

Two cases exist now:

  • shape also accepts three terms that belong only to spore shape: endospore, branched, cell chain.
  • halophily also accepts the terms of halophily class (halophilic, halotolerant, non-halophilic), added in #298.

Neither does harm today. halophily is a range attribute, so it is never checked against the vocabulary, and no shape source uses those three terms. The risk is a later discrete physiology whose wrong values pass the vocabulary check unnoticed.

Proposed fix

Match the whole group name: split attribute_group on ; and test for equality, in place of the regex.

Where the match is made

  1. bugphyzz, .validAttributes() in R/physiologies.R.
  2. bugphyzz, tests/testthat/test-importBugphyzz.R, the Attribute_value check for multistate attributes (grepl(unique(x$Attribute), attribute_group), with no word boundary at all).
  3. bugphyzzExports, stop_on_unmapped() in inst/scripts/stop_on_unmapped.R.
  4. taxPPro, filterDataDiscrete(), which decides the rows the export keeps.

The four should change together, so that the check in bugphyzz and the filter in the export keep agreeing. A test that .validAttributes("halophily") excludes the class terms and that .validAttributes("shape") excludes endospore would pin it.

Check before changing

With an exact match, shape loses the three terms above. Confirm that no shape row in the sheets or sources uses them, otherwise the export would stop on unmapped values. On the current attributes.tsv these two physiologies are the only ones whose valid terms change.

Raised in the review of #298.

Written with Claude Code.

Lingua principale
R
Stelle
6
Fork
6
Merge medio
3h 17m
PR unite (30g)
20

Preparare l'ambiente

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 waldronlab/bugphyzz

Tutte le issue di waldronlab/bugphyzz

Issue simili

Altre issue su R

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.