Created
July 26, 2018 19:48
-
-
Save kieranrcampbell/2896b526c6fbc3b9259fc7f8f16777b1 to your computer and use it in GitHub Desktop.
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
# Some common functions for manipulating bioconductor SingleCellExperiment objects | |
#' Return the corresponding ensembl gene id for a symbol in a given SCE | |
get_ensembl_id <- function(symbol, sce) { | |
stopifnot(symbol %in% rowData(sce)$Symbol) | |
rownames(sce)[rowData(sce)$Symbol == symbol] | |
} | |
#' Prepare an SCE read using read10XUtils for SC3 | |
prepare_for_sc3 <- function(sce) { | |
counts(sce) <- as.matrix(counts(sce)) | |
logcounts(sce) <- as.matrix(logcounts(sce)) | |
rowData(sce)$feature_symbol <- rowData(sce)$Symbol | |
sce | |
} | |
#' Remove calculated rowData to cbind two or more SCEs together | |
remove_rowdata <- function(sce) { | |
rowData(sce)[13:20] <- NULL | |
sce | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment