View source: R/aux_AUCell_plotTSNE.R
AUCell_plotTSNE | R Documentation |
Plots the AUC histogram and t-SNE coloured by AUC, binary activity and TF expression
AUCell_plotTSNE(
tSNE,
exprMat = NULL,
cellsAUC = NULL,
thresholds = NULL,
reorderGeneSets = FALSE,
cex = 1,
alphaOn = 1,
alphaOff = 0.2,
borderColor = adjustcolor("lightgray", alpha.f = 0.1),
offColor = "lightgray",
plots = c("histogram", "binaryAUC", "AUC", "expression"),
exprCols = c("goldenrod1", "darkorange", "brown"),
asPNG = FALSE,
...
)
tSNE |
t-SNE coordinates (e.g. |
exprMat |
Expression matrix |
cellsAUC |
AUC (as returned by calcAUC) |
thresholds |
Thresholds returned by AUCell |
reorderGeneSets |
Whether to reorder the gene sets based on AUC similarity |
cex |
Scaling factor for the dots in the scatterplot |
alphaOn |
Transparency for the dots representing "active" cells |
alphaOff |
Transparency for the dots representing "inactive" cells |
borderColor |
Border color for the dots (scatterplot) |
offColor |
Color for the dots representing "inactive" cells |
plots |
Which plots to generate? Select one or multiple: |
exprCols |
Color scale for the expression |
asPNG |
Output each individual plot in a .png file? (can also be a directory) |
... |
Other arguments to pass to |
To avoid calculating thresholds, set thresholds to FALSE
Returns invisible: cells_trhAssignment
List of vignettes included in the package: vignette(package="AUCell")
######
# Fake run of AUCell
set.seed(123)
exprMatrix <- matrix(
data=sample(c(rep(0, 5000), sample(1:3, 5000, replace=TRUE))),
nrow=20,
dimnames=list(paste("Gene", 1:20, sep=""),
paste("Cell", 1:500, sep="")))
geneSets <- list(geneSet1=sample(rownames(exprMatrix), 10),
geneSet2=sample(rownames(exprMatrix), 5))
cells_rankings <- AUCell_buildRankings(exprMatrix, plotStats = FALSE)
cells_AUC <- AUCell_calcAUC(geneSets, cells_rankings, aucMaxRank=5, nCores=1)
selectedThresholds <- rowMeans(getAUC(cells_AUC))
cellsTsne<- Rtsne::Rtsne(t(exprMatrix),max_iter = 10)$Y
# cellsTsne<- tsne::tsne(t(exprMatrix),max_iter = 10)
rownames(cellsTsne) <- colnames(exprMatrix)
######
par(mfrow=c(2,3))
thrs <- AUCell_plotTSNE(tSNE=cellsTsne, exprMat=NULL,
cellsAUC=cells_AUC, thresholds=selectedThresholds,
plots = c("histogram", "binaryAUC", "AUC"))
#####
# Color based on the known phenodata:
cellInfo <- data.frame(cellType1=sample(LETTERS[1:3],ncol(exprMatrix), replace=TRUE),
cellType2=sample(letters[5:7],ncol(exprMatrix), replace=TRUE),
nGenes=abs(rnorm(ncol(exprMatrix))),
row.names=colnames(exprMatrix))
colVars <- list(cellType2=setNames(c("skyblue","magenta", "darkorange"),letters[5:7]))
# dev.off()
plotTsne_cellProps(cellsTsne, cellInfo, colVars=colVars)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.