## ----include = FALSE---------------------------------------------------------- knitr::opts_chunk$set( collapse = TRUE, comment = "#>" ) ## ----setup, eval=FALSE-------------------------------------------------------- # if (!require("BiocManager", quietly=TRUE)) # install.packages("BiocManager") # # BiocManager::install("scLang") ## ----message=FALSE, warning=FALSE, results=FALSE------------------------------ library(scLang) library(scRNAseq) library(scater) library(Seurat) sceObj <- BaronPancreasData('human') ## ----message=FALSE, warning=FALSE, results=FALSE------------------------------ sceObj <- logNormCounts(sceObj) ## ----message=FALSE, warning=FALSE, results=FALSE------------------------------ sceObj <- runPCA(sceObj) sceObj <- runUMAP(sceObj) ## ----message=FALSE, warning=FALSE, results=FALSE------------------------------ seuratObj <- as.Seurat(sceObj) ## ----message=FALSE, warning=FALSE--------------------------------------------- mat1 <- scExpMat(sceObj) dim(mat1) mat2 <- scExpMat(seuratObj) identical(mat1, mat2) ## ----------------------------------------------------------------------------- mat2 <- scExpMat(mat1) identical(mat1, mat2) ## ----------------------------------------------------------------------------- is(mat1)[1] mat2 <- scExpMat(sceObj, densify=FALSE) is(mat2)[2] ## ----------------------------------------------------------------------------- mat2 <- scExpMat(sceObj, genes=rownames(sceObj)[seq(30, 80)]) dim(mat2) ## ----------------------------------------------------------------------------- col1 <- scCol(seuratObj, 'label') col2 <- scCol(sceObj, 'label') identical(col1, col2) head(col1) ## ----------------------------------------------------------------------------- scCol(seuratObj, 'labelCopy') <- paste0(scCol(seuratObj, 'label'), '_copy') head(seuratObj[['labelCopy']]) ## ----------------------------------------------------------------------------- df1 <- metadataDF(seuratObj) df2 <- metadataDF(sceObj) identical(df1, df2) head(df1)[, c(1, 2)] ## ----------------------------------------------------------------------------- colNames1 <- metadataNames(seuratObj) colNames2 <- metadataNames(sceObj) identical(colNames1, colNames2) head(colNames1) ## ----------------------------------------------------------------------------- freq1 <- scColCounts(sceObj, 'donor') freq2 <- scColCounts(seuratObj, 'donor') identical(freq1, freq2) head(freq1) freq1 <- scColPairCounts(sceObj, 'donor', 'label') freq2 <- scColPairCounts(seuratObj, 'donor', 'label') identical(freq1, freq2) head(freq1) ## ----------------------------------------------------------------------------- dimPlot(sceObj, groupBy='label') ## ----------------------------------------------------------------------------- featurePlot(sceObj, 'SOX4') ## ----------------------------------------------------------------------------- violinPlot(sceObj, 'SOX4', groupBy='label') ## ----------------------------------------------------------------------------- sessionInfo()