getBiomarker {singleCellTK} | R Documentation

## Get and plot PCA and t-SCE components for a SCtkE object

### Description

Selects the 500 most variable genes in the SCE, performs PCA or t-SNE based on them and stores the values in the reducedDims slot of the SCE object.

### Usage

    getBiomarker(inSCE, gene, binary = "Binary", useAssay = "counts")

    getPCA(inSCE, useAssay = "logcounts", reducedDimName = "PCA")

    getTSNE(inSCE, useAssay = "logcounts", reducedDimName = "TSNE")

    plotBiomarker(inSCE, gene, binary = "Binary", visual = "PCA",
      shape = "No Shape", x = "PC1", y = "PC2", useAssay = "counts",
      reducedDimName = "PCA")

    plotPCA(inSCE, colorBy = "No Color", shape = "No Shape", pcX = "PC1",
      pcY = "PC2", reducedDimName = "PCA", runPCA = FALSE,
      useAssay = "logcounts")

    plotTSNE(inSCE, colorBy = "No Color", shape = "No Shape",
      reducedDimName = "TSNE", runTSNE = FALSE, useAssay = "logcounts")

### Arguments

`inSCE` | Input SCtkExperiment object. Required
`gene` | gene list
`binary` | "Binary" for binary expression or "Continuous" for a gradient. Default: "Binary"
`useAssay` | Indicate which assay to use for PCA. Default is "counts"
`reducedDimName` | Store the PCA data with this name. The default is PCA. The toolkit will store data with the pattern <ASSAY>_<ALGORITHM>.
`visual` | Type of visualization (PCA or tSNE). Default: "PCA"
`shape` | Shape of the points
`x` | x coordinate for PCA
`y` | y coordinate for PCA
`colorBy` | The variable to color clusters by
`pcX` | User choice for the first principal component
`pcY` | User choice for the second principal component
`runPCA` | Run PCA if the reducedDimName does not exist. the Default is FALSE.
`runTSNE` | Run t-SNE if the reducedDimName does not exist. the Default is FALSE.

### Value

getBiomarker(): A data.frame of expression values

getPCA(): A SCtkE object with the specified reduecedDim and pcaVariances updated

getTSNE(): A SCtkE object with the specified reduecedDim and pcaVariances updated

plotBiomarker(): A Biomarker plot

plotPCA(): A PCA plot

plotTSNE(): A t-SNE plot

### Functions

- `getBiomarker`: Given a list of genes and a SCtkExperiment object, return the binary or continuous expression of the genes.

- `getPCA`: Get PCA components for a SCtkE object

- `getTSNE`: Get t-SNE components for a SCtkE object

- `plotBiomarker`: Given a set of genes, return a ggplot of expression values.

- `plotPCA`: plot PCA results

- `plotTSNE`: plot t-SNE results

### Examples

    getBiomarker(mouseBrainSubsetSCE, gene="C1qa")

    data("mouseBrainSubsetSCE")
    #add a CPM assay
    assay(mouseBrainSubsetSCE, "cpm") <- apply(assay(mouseBrainSubsetSCE,
                                                     "counts"),
                                               2, function(x) {
                                                 x / (sum(x) / 1000000)
                                               })
    mouseBrainSubsetSCE <- getPCA(mouseBrainSubsetSCE,
                                  useAssay = "cpm",
                                  reducedDimName = "PCA_cpm")
    reducedDims(mouseBrainSubsetSCE)

    data("mouseBrainSubsetSCE")
    #add a CPM assay
    assay(mouseBrainSubsetSCE, "cpm") <- apply(
      assay(mouseBrainSubsetSCE, "counts"), 2, function(x) {
        x / (sum(x) / 1000000)
      })
    mouseBrainSubsetSCE <- getTSNE(mouseBrainSubsetSCE, useAssay = "cpm",
                                   reducedDimName = "TSNE_cpm")
    reducedDims(mouseBrainSubsetSCE)

    data("mouseBrainSubsetSCE")
    plotBiomarker(mouseBrainSubsetSCE, gene="C1qa", shape="level1class")

    data("mouseBrainSubsetSCE")
    plotPCA(mouseBrainSubsetSCE, colorBy = "level1class",
            reducedDimName = "PCA_counts")

    data("mouseBrainSubsetSCE")
    plotTSNE(mouseBrainSubsetSCE, colorBy = "level1class",
             reducedDimName = "TSNE_counts")

[Package singleCellTK version 1.2.3 Index]