PlotValues.PCA.CellGroup.10x {MARVEL}R Documentation

Annotate reduced dimension space with cell feature

Description

Annotates reduced dimension space, e.g., UMAP and tSNE, with cell features such as cell group, donor ID, sample ID, etc.

Usage

PlotValues.PCA.CellGroup.10x(
  MarvelObject,
  cell.group.list,
  legendtitle = "Cell group",
  alpha = 0.75,
  point.size = 1,
  point.stroke = 0.1,
  point.colors = NULL,
  point.size.legend = 2,
  type
)

Arguments

MarvelObject

Marvel object. S3 object generated from CheckAlignment.10x function.

cell.group.list

List of character strings. Each element of the list is a vector of cell IDs corresponding to a feature, e.g. cell group. The names of the element will be the cell feature label.

legendtitle

Character string. Legend title. Default is "Cell group".

alpha

Numeric value. Transparency of the data points. Takes any values between 0-1 whereby 0 is totally transparent and 1 is opaque. Default is 0.75.

point.size

Numeric value. Size of data points. Default is 1.

point.stroke

Numeric value. Outline thickness of data points. Default is 0.1.

point.colors

Vector of character strings. Colors of cell groups and should be same length as cell.group.list. Default ggplot2 colors are used.

point.size.legend

Numeric value. Size of legend keys. Default is 2.

type

Character string. Type of reduced dimension space. Options are "umap" and "tsne".

Value

An object of class S3 with new slot MarvelObject$adhocPlot$PCA$CellGroup.

Examples


marvel.demo.10x <- readRDS(system.file("extdata/data",
                               "marvel.demo.10x.rds",
                               package="MARVEL")
                               )

# Define cell groups
    # Retrieve sample metadata
    sample.metadata <- marvel.demo.10x$sample.metadata

    # iPSC
    index <- which(sample.metadata$cell.type=="iPSC")
    cell.ids.1 <- sample.metadata[index, "cell.id"]
    length(cell.ids.1)

    # Cardio day 10
    index <- which(sample.metadata$cell.type=="Cardio day 10")
    cell.ids.2 <- sample.metadata[index, "cell.id"]
    length(cell.ids.2)

    # Save into list
    cell.group.list <- list("iPSC"=cell.ids.1,
                            "Cardio d10"=cell.ids.2
                            )

# Plot cell groups
marvel.demo.10x <- PlotValues.PCA.CellGroup.10x(
                            MarvelObject=marvel.demo.10x,
                            cell.group.list=cell.group.list,
                            legendtitle="Cell group",
                            type="tsne"
                            )

# Check output
marvel.demo.10x$adhocPlot$PCA$CellGroup

[Package MARVEL version 1.4.0 Index]