Skip to content

find_sprinzl_id() assumes nuc- prefix not present in bundled coords #31

Description

@jmbilodeaux

Summary

find_sprinzl_id() in R/identity.R builds its search pattern as:

pattern <- paste0("^nuc-", rna_name, "-")

The bundled E. coli, T4, T5, and S. cerevisiae Sprinzl coordinate
files (in inst/extdata/sprinzl/) use plain tRNA-... identifiers
with no prefix. The ^nuc- prefix is never present, so
find_sprinzl_id() always returns NULL for these organisms, causing
plot_identity_structure() and plot_identity_panel() to fail with
"No Sprinzl coordinate entry found" for any bundled dataset.

Minimal reproducible

# Using the bundled E. coli coords:
path <- system.file("extdata/sprinzl/ecoliK12_global_coords.tsv.gz",
                    package = "clover")
coords <- read_sprinzl_coords(path)
head(unique(coords$trna_id))
# [1] "tRNA-Ala-GGC-1-1" ...   ← no "nuc-" prefix

# find_sprinzl_id looks for "^nuc-tRNA-Ala-AGC-1-1-"  → NULL every time

Suggested fix

Make the prefix optional — try ^nuc- first, then fall back to
^tRNA-:

find_sprinzl_id <- function(trna, sprinzl_coords) {
  ...
  for (prefix in c("^nuc-", "^")) {
    pattern <- paste0(prefix, rna_name, "-")
    matches <- grep(pattern, ids, value = TRUE)
    if (length(matches) > 0) return(sort(matches)[1])
  }
  NULL
}

cc @jayhesselberth for review

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions