Created
November 1, 2025 13:09
-
-
Save vjcitn/86135435d4905a9bc03b6a5b6f2fb46f to your computer and use it in GitHub Desktop.
adjustable biplot for SummarizedExperiment
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(SummarizedExperiment) | |
| library(irlba) | |
| ibiplot = function(se, choices=1:2, nfeat=5, ircomp=6, ...) { | |
| dat = t(assay(se)) | |
| pcs = prcomp_irlba(dat, ircomp) | |
| rot = pcs$rotation | |
| ss = rowSums(abs(rot[,choices])^2) | |
| kp = order(ss, decreasing=TRUE)[seq_len(nfeat)] | |
| labs = rep(" ", nrow(rot)) | |
| labs[kp] = rownames(se)[kp] | |
| biplot(pcs, choices, ylabs=labs, ...) | |
| } | |
| library(airway) | |
| data(airway) | |
| rownames(airway) = make.names(rowData(airway)$gene_name, unique=TRUE) | |
| ibiplot(airway, expand=.6) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment