Skip to content

Commit 2c2f4cd

Browse files
Fix roxygen examples, vignette consistency, and pkgdown config
Replace \dontrun{} with working examples using bundled data so they render on the pkgdown website. Use \donttest{} for examples that depend on Suggests packages. Fix hardcoded anticodon (34-36) and discriminator (73) positions to use Sprinzl coordinate lookups instead of assuming sequence positions match Sprinzl positions. Standardize vignettes to use library() calls instead of qualified namespace calls. Add missing heatmap article to navbar and structure article to pkgdown articles section. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent f3aeb3c commit 2c2f4cd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+365
-257
lines changed

R/clover-se.R

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,9 @@
2323
#' @export
2424
#'
2525
#' @examples
26-
#' \dontrun{
27-
#' se <- create_clover("path/to/config.yaml")
28-
#' SummarizedExperiment::assay(se, "counts")
26+
#' se <- create_clover(clover_example("ecoli/config.yaml"))
27+
#' SummarizedExperiment::assay(se, "counts")[1:3, ]
2928
#' SummarizedExperiment::colData(se)
30-
#' }
3129
create_clover <- function(
3230
config_path,
3331
types = c("charging", "bcerror", "odds_ratios"),
@@ -113,7 +111,7 @@ create_clover <- function(
113111
#' Read FASTA reference
114112
#'
115113
#' @examples
116-
#' fa <- clover_example("ecoli/validated.fa.gz")
114+
#' fa <- clover_example("ecoli/trna_only.fa.gz")
117115
#' read_fasta(fa)
118116
#'
119117
#' @param fa path to fasta file

R/deseq.R

Lines changed: 32 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,11 @@
1818
#' @export
1919
#'
2020
#' @examples
21-
#' \dontrun{
22-
#' charging <- read_charging_multi(paths)
23-
#' mat <- abundance_count_matrix(charging)
24-
#' }
21+
#' results <- read_pipeline_results(
22+
#' clover_example("ecoli/config.yaml"),
23+
#' types = "charging"
24+
#' )
25+
#' abundance_count_matrix(results$charging)
2526
abundance_count_matrix <- function(charging_data, min_count = 10) {
2627
abundance <- charging_data |>
2728
dplyr::mutate(
@@ -63,10 +64,11 @@ abundance_count_matrix <- function(charging_data, min_count = 10) {
6364
#' @export
6465
#'
6566
#' @examples
66-
#' \dontrun{
67-
#' charging <- read_charging_multi(paths)
68-
#' mat <- charging_count_matrix(charging)
69-
#' }
67+
#' results <- read_pipeline_results(
68+
#' clover_example("ecoli/config.yaml"),
69+
#' types = "charging"
70+
#' )
71+
#' charging_count_matrix(results$charging)
7072
charging_count_matrix <- function(charging_data, min_count = 10) {
7173
long <- charging_data |>
7274
dplyr::mutate(
@@ -115,14 +117,12 @@ charging_count_matrix <- function(charging_data, min_count = 10) {
115117
#' @export
116118
#'
117119
#' @examples
118-
#' \dontrun{
119-
#' mat <- abundance_count_matrix(charging)
120-
#' sample_info <- data.frame(
121-
#' sample_id = c("wt_1", "wt_2", "mut_1", "mut_2"),
122-
#' condition = c("wt", "wt", "mut", "mut")
120+
#' results <- read_pipeline_results(
121+
#' clover_example("ecoli/config.yaml"),
122+
#' types = "charging"
123123
#' )
124-
#' coldata <- build_coldata(mat, sample_info)
125-
#' }
124+
#' mat <- abundance_count_matrix(results$charging)
125+
#' build_coldata(mat)
126126
build_coldata <- function(count_matrix, sample_info = NULL) {
127127
col_names <- colnames(count_matrix)
128128

@@ -181,8 +181,14 @@ build_coldata <- function(count_matrix, sample_info = NULL) {
181181
#' @export
182182
#'
183183
#' @examples
184-
#' \dontrun{
185-
#' dds <- run_deseq(mat, coldata, design = ~ condition)
184+
#' \donttest{
185+
#' se <- create_clover(clover_example("ecoli/config.yaml"))
186+
#' counts <- SummarizedExperiment::assay(se, "counts")
187+
#' coldata <- as.data.frame(SummarizedExperiment::colData(se))
188+
#' coldata$condition <- ifelse(
189+
#' grepl("ctl", coldata$sample_id), "ctl", "inf"
190+
#' )
191+
#' dds <- run_deseq(counts, coldata, design = ~condition)
186192
#' }
187193
run_deseq <- function(count_matrix, coldata, design, ...) {
188194
rlang::check_installed("DESeq2", reason = "to run differential analysis.")
@@ -214,9 +220,15 @@ run_deseq <- function(count_matrix, coldata, design, ...) {
214220
#' @export
215221
#'
216222
#' @examples
217-
#' \dontrun{
218-
#' res <- tidy_deseq_results(dds, contrast = c("condition", "mut", "wt"))
219-
#' res
223+
#' \donttest{
224+
#' se <- create_clover(clover_example("ecoli/config.yaml"))
225+
#' counts <- SummarizedExperiment::assay(se, "counts")
226+
#' coldata <- as.data.frame(SummarizedExperiment::colData(se))
227+
#' coldata$condition <- ifelse(
228+
#' grepl("ctl", coldata$sample_id), "ctl", "inf"
229+
#' )
230+
#' dds <- run_deseq(counts, coldata, design = ~condition)
231+
#' tidy_deseq_results(dds, contrast = c("condition", "inf", "ctl"))
220232
#' }
221233
tidy_deseq_results <- function(dds, contrast, padj_cutoff = 0.05) {
222234
rlang::check_installed("DESeq2", reason = "to extract results.")

R/identity.R

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -168,14 +168,14 @@ identity_organisms <- function() {
168168
#' @export
169169
#'
170170
#' @examples
171-
#' \dontrun{
172171
#' coords <- read_sprinzl_coords(
173172
#' clover_example("sprinzl/sacCer_global_coords.tsv.gz")
174173
#' )
175-
#' elems <- identity_elements("Saccharomyces cerevisiae",
176-
#' amino_acid = "Ala")
174+
#' elems <- identity_elements(
175+
#' "Saccharomyces cerevisiae",
176+
#' amino_acid = "Ala"
177+
#' )
177178
#' map_identity_to_trna(elems, coords, "nuc-tRNA-Ala-AGC-1-1")
178-
#' }
179179
map_identity_to_trna <- function(elements, sprinzl_coords, trna_id) {
180180
coords <- sprinzl_coords[sprinzl_coords$trna_id == trna_id, ]
181181

@@ -228,7 +228,7 @@ map_identity_to_trna <- function(elements, sprinzl_coords, trna_id) {
228228
#' @export
229229
#'
230230
#' @examples
231-
#' \dontrun{
231+
#' \donttest{
232232
#' coords <- read_sprinzl_coords(
233233
#' clover_example("sprinzl/sacCer_global_coords.tsv.gz")
234234
#' )
@@ -315,13 +315,12 @@ plot_identity_structure <- function(
315315
#' @export
316316
#'
317317
#' @examples
318-
#' \dontrun{
318+
#' \donttest{
319319
#' coords <- read_sprinzl_coords(
320320
#' clover_example("sprinzl/sacCer_global_coords.tsv.gz")
321321
#' )
322322
#' plot_identity_panel(
323-
#' c("tRNA-Ala-AGC", "tRNA-Asp-GTC",
324-
#' "tRNA-Phe-GAA", "tRNA-His-GTG"),
323+
#' c("tRNA-Ala-AGC", "tRNA-Asp-GTC"),
325324
#' "Saccharomyces cerevisiae",
326325
#' coords
327326
#' )

R/modomics.R

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,9 @@
2626
#' @export
2727
#'
2828
#' @examples
29-
#' \dontrun{
30-
#' fa <- clover_example("ecoli/validated.fa.gz")
31-
#' mods <- modomics_mods(fa, "Escherichia coli")
32-
#' mods
29+
#' \donttest{
30+
#' fa <- clover_example("ecoli/trna_only.fa.gz")
31+
#' modomics_mods(fa, "Escherichia coli")
3332
#' }
3433
modomics_mods <- function(fasta, organism, min_identity = 0.7) {
3534
rlang::check_installed("pwalign")

R/plot-chord.R

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,12 @@
3939
#' @export
4040
#'
4141
#' @examples
42-
#' \dontrun{
43-
#' or_data <- read_odds_ratios("sample1.odds_ratios.tsv.gz")
42+
#' \donttest{
43+
#' path <- clover_example(
44+
#' "ecoli/summary/tables/wt-15-ctl-01/wt-15-ctl-01.odds_ratios.tsv.gz"
45+
#' )
46+
#' or_data <- read_odds_ratios(path)
47+
#' or_data <- dplyr::filter(or_data, ref == "host-tRNA-Glu-TTC-1-1")
4448
#' plot_chord_or(or_data)
4549
#' }
4650
plot_chord_or <- function(
@@ -123,13 +127,15 @@ plot_chord_or <- function(
123127
#' @export
124128
#'
125129
#' @examples
126-
#' \dontrun{
127-
#' combined_or <- read_odds_ratios_multi(paths)
128-
#' combined_or$condition <- ifelse(
129-
#' grepl("wt", combined_or$sample_id), "wt", "mut"
130+
#' results <- read_pipeline_results(
131+
#' clover_example("ecoli/config.yaml"),
132+
#' types = "odds_ratios"
130133
#' )
131-
#' ror <- compute_ror(combined_or, numerator = "mut", denominator = "wt")
132-
#' }
134+
#' or_data <- results$odds_ratios
135+
#' or_data$condition <- ifelse(
136+
#' grepl("ctl", or_data$sample_id), "ctl", "inf"
137+
#' )
138+
#' compute_ror(or_data, numerator = "inf", denominator = "ctl")
133139
compute_ror <- function(
134140
odds_data,
135141
condition_col = "condition",
@@ -201,8 +207,16 @@ compute_ror <- function(
201207
#' @export
202208
#'
203209
#' @examples
204-
#' \dontrun{
205-
#' ror <- compute_ror(combined_or, numerator = "mut", denominator = "wt")
210+
#' \donttest{
211+
#' results <- read_pipeline_results(
212+
#' clover_example("ecoli/config.yaml"),
213+
#' types = "odds_ratios"
214+
#' )
215+
#' or_data <- results$odds_ratios
216+
#' or_data$condition <- ifelse(
217+
#' grepl("ctl", or_data$sample_id), "ctl", "inf"
218+
#' )
219+
#' ror <- compute_ror(or_data, numerator = "inf", denominator = "ctl")
206220
#' plot_chord_ror(ror)
207221
#' }
208222
plot_chord_ror <- function(

R/plot-network.R

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#' @export
2121
#'
2222
#' @examples
23-
#' \dontrun{
23+
#' \donttest{
2424
#' df <- tibble::tibble(
2525
#' pos1 = c("20", "34", "20"),
2626
#' pos2 = c("34", "58", "58"),
@@ -85,8 +85,13 @@ build_or_network <- function(data, value_col = "ror", min_weight = 0) {
8585
#' @export
8686
#'
8787
#' @examples
88-
#' \dontrun{
89-
#' graph <- build_or_network(or_data)
88+
#' \donttest{
89+
#' df <- tibble::tibble(
90+
#' pos1 = c("20", "34", "20"),
91+
#' pos2 = c("34", "58", "58"),
92+
#' ror = c(1.5, -0.8, 0.3)
93+
#' )
94+
#' graph <- build_or_network(df)
9095
#' plot_arc_diagram(graph)
9196
#' }
9297
plot_arc_diagram <- function(

R/plot-structure.R

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,7 @@ structure_organisms <- function() {
3939
#' @export
4040
#'
4141
#' @examples
42-
#' \dontrun{
4342
#' structure_trnas("Escherichia coli")
44-
#' }
4543
structure_trnas <- function(organism) {
4644
org_dir <- structure_org_dir(organism)
4745
svg_files <- list.files(org_dir, pattern = "\\.svg$")
@@ -97,17 +95,8 @@ structure_trnas <- function(organism) {
9795
#' @export
9896
#'
9997
#' @examples
100-
#' \dontrun{
101-
#' # Base structure only
102-
#' plot_tRNA_structure("tRNA-Ala-GGC", "Escherichia coli")
103-
#'
104-
#' # With MODOMICS modifications
105-
#' fa <- clover_example("ecoli/validated.fa.gz")
106-
#' mods <- modomics_mods(fa, "Escherichia coli")
107-
#' plot_tRNA_structure(
108-
#' "tRNA-Ala-GGC", "Escherichia coli",
109-
#' modifications = mods
110-
#' )
98+
#' \donttest{
99+
#' plot_tRNA_structure("tRNA-Glu-TTC", "Escherichia coli")
111100
#' }
112101
plot_tRNA_structure <- function(
113102
trna,
@@ -243,9 +232,9 @@ plot_tRNA_structure <- function(
243232
#' @export
244233
#'
245234
#' @examples
246-
#' \dontrun{
235+
#' \donttest{
247236
#' svg <- plot_tRNA_structure("tRNA-Glu-TTC", "Escherichia coli")
248-
#' png <- structure_to_png(svg)
237+
#' structure_to_png(svg)
249238
#' }
250239
structure_to_png <- function(
251240
svg_path,
@@ -286,7 +275,7 @@ structure_to_png <- function(
286275
#' @export
287276
#'
288277
#' @examples
289-
#' \dontrun{
278+
#' \donttest{
290279
#' svg <- plot_tRNA_structure("tRNA-Glu-TTC", "Escherichia coli")
291280
#' structure_html(svg)
292281
#' }

R/plots.R

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -120,18 +120,14 @@ cluster_refs_by_group <- function(
120120
#' @export
121121
#'
122122
#' @examples
123-
#' \dontrun{
124-
#' bcerror_delta <- compute_bcerror_delta(bcerror_summary, delta = wt - tb)
123+
#' bcerror_rds <- readRDS(clover_example("ecoli/bcerror_summary.rds"))
124+
#' bcerror_delta <- compute_bcerror_delta(
125+
#' bcerror_rds$bcerror_summary, delta = wt - tb
126+
#' )
125127
#' sprinzl <- read_sprinzl_coords(
126128
#' clover_example("sprinzl/ecoliK12_global_coords.tsv.gz")
127129
#' )
128-
#' mods <- modomics_mods(trna_fasta, organism = "Escherichia coli")
129-
#' heatmap_data <- prep_mod_heatmap(
130-
#' bcerror_delta,
131-
#' sprinzl_coords = sprinzl,
132-
#' mods = mods
133-
#' )
134-
#' }
130+
#' prep_mod_heatmap(bcerror_delta, sprinzl_coords = sprinzl)
135131
prep_mod_heatmap <- function(
136132
data,
137133
value_col = "delta",
@@ -965,8 +961,15 @@ plot_mod_landscape <- function(
965961
#' @export
966962
#'
967963
#' @examples
968-
#' \dontrun{
969-
#' mat <- prepare_rewiring_matrix(ror_data)
964+
#' \donttest{
965+
#' mat <- matrix(
966+
#' c(1.5, -0.8, 0.3, 2.1, 0.5, -1.2),
967+
#' nrow = 3,
968+
#' dimnames = list(
969+
#' c("tRNA-Ala", "tRNA-Gly", "tRNA-Ser"),
970+
#' c("20_vs_34", "34_vs_58")
971+
#' )
972+
#' )
970973
#' scores <- calculate_rewiring_scores(mat)
971974
#' pcoa <- perform_pcoa(mat)
972975
#' plot_pcoa_rewiring(pcoa, scores)

R/read-bcerror.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#'
1111
#' @examples
1212
#' \dontrun{
13-
#' counts <- read_counts("sample1.counts.tsv.gz")
13+
#' read_counts("sample1.counts.tsv.gz")
1414
#' }
1515
read_counts <- function(path) {
1616
readr::read_tsv(path, show_col_types = FALSE)

0 commit comments

Comments
 (0)