AUCell_plotTSNE {AUCell} | R Documentation

## Plot

### Description

Plots the AUC histogram and t-SNE coloured by AUC, binary activity and TF expression

### Usage

    AUCell_plotTSNE(tSNE, exprMat, cellsAUC = NULL, thresholds = NULL,
      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, ...)

### Arguments

`tSNE` | t-SNE coordinates (e.g. `tSNE$Y`)
`exprMat` | Expression matrix
`cellsAUC` | AUC (as returned by calcAUC)
`thresholds` | Thresholds returned by AUCell
`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: `plots=c("histogram", "binaryAUC", "AUC", "expression")`
`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 `hist` function.

### Details

To avoid calculating thresholds, set thresholds to FALSE

### Value

Returns invisible: `cells_trhAssignment`

### See Also

List of vignettes included in the package: `vignette(package="AUCell")`

### Examples

    ######
    # 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
    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)

[Package AUCell version 1.2.4 Index]