Skip to content

Instantly share code, notes, and snippets.

@mikelove
Last active February 24, 2026 19:00
Show Gist options
  • Select an option

  • Save mikelove/32cdd4411416b9ae97cf64cb7df44216 to your computer and use it in GitHub Desktop.

Select an option

Save mikelove/32cdd4411416b9ae97cf64cb7df44216 to your computer and use it in GitHub Desktop.
plyxp vs as_tibble
library(airway)
library(tidySummarizedExperiment)
library(plyxp)
data(airway)
se <- airway
rowRanges(se) <- NULL
forced_conversion <- function(se) {
tib <- tidySummarizedExperiment:::as_tibble.SummarizedExperiment(se)
res <- tib |>
dplyr::mutate(
length = gene_seq_end - gene_seq_start,
counts_per_bp = counts / length
)
tidySummarizedExperiment:::update_SE_from_tibble(res, se)
}
system.time({
se_update <- forced_conversion(se)
})
xp <- new_plyxp(se)
plyxp_version <- function(xp) {
xp |>
mutate(
rows(length = gene_seq_end - gene_seq_start),
counts_per_bp = counts / .rows$length
)
}
system.time({
xp_update <- plyxp_version(xp)
})
all.equal(
assay(se_update, "counts_per_bp"),
assay(xp_update, "counts_per_bp")
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment