Skip to content

Instantly share code, notes, and snippets.

@mikelove
Last active June 26, 2025 15:55
Show Gist options
  • Save mikelove/5f388e1af24453010dbc619a78854b42 to your computer and use it in GitHub Desktop.
Save mikelove/5f388e1af24453010dbc619a78854b42 to your computer and use it in GitHub Desktop.
hooking up tidySE to plyxp, example case
library(tidySummarizedExperiment)
library(plyxp)
nfeat <- 1e4
nsamp <- 1e3
coldata <- data.frame(x=rep(1:2,length=nsamp))
assay <- matrix(rnorm(nfeat*nsamp), ncol=nsamp)
rownames(assay) <- paste0("f",1:nfeat)
colnames(assay) <- paste0("s",1:nsamp)
se <- SummarizedExperiment(list(data=assay), colData=coldata)
system.time({
new_se <- se |>
mutate(newdata = data * x)
})
system.time({
new_se2 <- se |>
new_plyxp() |>
mutate(newdata = data * .cols$x) |>
se()
})
all.equal(assay(new_se), assay(new_se2))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment