R: Dot plot adapted from Seurat:::DotPlot, see ?Seurat:::DotPlot...

dotPlot {sccore} | R Documentation

## Dot plot adapted from Seurat:::DotPlot, see ?Seurat:::DotPlot for details

### Description

Dot plot adapted from Seurat:::DotPlot, see ?Seurat:::DotPlot for details

### Usage

    dotPlot(
      markers,
      count.matrix,
      cell.groups,
      marker.colour = "black",
      cluster.colour = "black",
      xlab = "Marker",
      ylab = "Cluster",
      n.cores = 1,
      text.angle = 45,
      gene.order = NULL,
      cols = c("blue", "red"),
      col.min = -2.5,
      col.max = 2.5,
      dot.min = 0,
      dot.scale = 6,
      scale.by = "radius",
      scale.min = NA,
      scale.max = NA,
      verbose = TRUE,
      ...
    )

### Arguments

`markers` | Vector of gene markers to plot
`count.matrix` | Merged count matrix, cells in rows and genes in columns
`cell.groups` | Named factor containing cell groups (clusters) and cell names as names
`marker.colour` | Character or numeric vector (default="black")
`cluster.colour` | Character or numeric vector (default="black")
`xlab` | string X-axis title (default="Marker")
`ylab` | string Y-axis title (default="Cluster")
`n.cores` | integer Number of cores (default=1)
`text.angle` | numeric Angle of text displayed (default=45)
`gene.order` | Either factor of genes passed to dplyr::mutate(levels=gene.order), or a boolean. (default=NULL) If TRUE, gene.order is set to the unique markers. If FALSE, gene.order is set to NULL. If NULL, the argument is ignored.
`cols` | Colors to plot (default=c("blue", "red")). The name of a palette from 'RColorBrewer::brewer.pal.info', a pair of colors defining a gradient, or 3+ colors defining multiple gradients (if 'split.by' is set).
`col.min` | numeric Minimum scaled average expression threshold (default=-2.5). Everything smaller will be set to this.
`col.max` | numeric Maximum scaled average expression threshold (default=2.5). Everything larger will be set to this.
`dot.min` | numeric The fraction of cells at which to draw the smallest dot (default=0). All cell groups with less than this expressing the given gene will have no dot drawn.
`dot.scale` | numeric Scale the size of the points, similar to cex (default=6)
`scale.by` | string Scale the size of the points by 'size' or by 'radius' (default="radius")
`scale.min` | numeric Set lower limit for scaling, use NA for default (default=NA)
`scale.max` | numeric Set upper limit for scaling, use NA for default (default=NA)
`verbose` | boolean Verbose output (default=TRUE)
`...` | Additional inputs passed to sccore::plapply(), see man for description.

### Value

ggplot2 object

### Examples

    library(dplyr)
    ## Create merged count matrix
    ## In this example, cms is a list of count matrices from, e.g., Cellranger count,
    ## where cells are in columns and genes in rows
    ## cm <- sccore:::mergeCountMatrices(cms, transposed = FALSE) %>% Matrix::t()

    ## If coming from Conos, this can be extracted like so
    ## cm <- conos.obj$getJointCountMatrix(raw = FALSE) # Either normalized or raw values can be used

    ## Here, we create a random sparse matrix
    cm <- Matrix::rsparsematrix(30,3,0.5) %>% abs(.) %>%
                `dimnames<-`(list(1:30,c("gene1","gene2","gene3")))

    ## Create marker vector
    markers <- c("gene1","gene2","gene3")

    ## Additionally, color vectors can be included.
    ## These should have the same length as the input (markers, cell groups)
    ## Otherwise, they are recycled
    col.markers <- c("black","black","red") # or c(1,1,2)
    col.clusters <- c("black","red","black") # or c(1,2,1)

    ## Create annotation vector
    annotation <- c(rep("cluster1",10),rep("cluster2",10),rep("cluster3",10)) %>%
        factor() %>% setNames(1:30)

    ## Plot. Here, the expression colours range from gray (low expression) to purple (high expression)
    sccore:::dotPlot(markers = markers, count.matrix = cm, cell.groups = annotation,
        marker.colour = col.markers, cluster.colour = col.clusters, cols=c("gray","purple"))

[Package sccore version 1.0.1 Index]