Last active
June 26, 2025 15:55
-
-
Save mikelove/5f388e1af24453010dbc619a78854b42 to your computer and use it in GitHub Desktop.
hooking up tidySE to plyxp, example case
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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