-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Problem
plot_tRNA_structure() currently requires 1-based sequence positions for all annotation parameters (modifications, outlines, text_colors, linkages). However, users typically think in terms of Sprinzl positions (e.g., anticodon = 34-36, discriminator = 73). The mapping between Sprinzl and sequence positions varies by tRNA depending on D-loop insertions, making manual conversion error-prone.
For example, for E. coli tRNA-Glu-TTC, Sprinzl 34-36 maps to sequence positions 35-37 (not 34-36), and Sprinzl 73 maps to sequence position 72 (not 73).
Proposal
Add an optional sprinzl_coords parameter to plot_tRNA_structure(). When provided, all position columns in modifications, outlines, text_colors, and linkages would be interpreted as Sprinzl positions and converted internally to sequence positions.
This would simplify usage from:
sprinzl <- read_sprinzl_coords(...)
glu_coords <- sprinzl |> filter(trna_id == "tRNA-Glu-UUC-1-1")
ac_pos <- glu_coords |>
filter(sprinzl_label %in% c("34", "35", "36")) |>
pull(pos)
anticodon <- tibble::tibble(pos = ac_pos, mod1 = "anticodon")
plot_tRNA_structure("tRNA-Glu-TTC", "Escherichia coli", modifications = anticodon)to:
sprinzl <- read_sprinzl_coords(...)
anticodon <- tibble::tibble(pos = c(34, 35, 36), mod1 = "anticodon")
plot_tRNA_structure(
"tRNA-Glu-TTC", "Escherichia coli",
modifications = anticodon,
sprinzl_coords = sprinzl
)Output from modomics_mods() already returns 1-based sequence positions, so backward compatibility is maintained when sprinzl_coords is not provided.