Cacoa: Cacoa R6 class

CacoaR Documentation

Cacoa R6 class

Description

The class encompasses etc etc

Public fields

n.cores

Number of cores (default=1)

verbose

boolean Whether to provide verbose output with diagnostic messages (default=FALSE)

test.results

list Results of the estimations, ready to use (default=list())

cache

list Intermediate results of the estimations, which can be used during some other computations (default=list())

data.object

list The main object storing data (Conos or Seurat) (default=list())

sample.groups

2-factor vector with annotation of groups/condition per sample (default=NULL)

cell.groups

Named factor with cell names with cluster per cell (default=NULL)

embedding

2D embedding to visualize the cells in (default=NULL)

sample.per.cell

Named factor with cell names (default=NULL)

ref.level

Reference level for sample.group vector (default=NULL)

target.level

Target/disease level for sample.group vector

sample.groups.palette

Color palette for the sample.groups (default=NULL)

cell.groups.palette

Color palette for the cell.groups (default=NULL)

plot.theme

ggplot2 theme for all plots (default=NULL)

plot.params

list with parameters, forwarded to all plotEmbedding calls (default=NULL)

Methods

Public methods


Method new()

Initialize Cacoa class

Usage
Cacoa$new(
  data.object,
  sample.groups = NULL,
  cell.groups = NULL,
  sample.per.cell = NULL,
  ref.level = NULL,
  target.level = NULL,
  sample.groups.palette = NULL,
  cell.groups.palette = NULL,
  embedding = NULL,
  graph.name = NULL,
  assay.name = "RNA",
  n.cores = 1,
  verbose = TRUE,
  plot.theme = ggplot2::theme_bw(),
  plot.params = NULL
)
Arguments
data.object

Object used to initialize the Cacoa class. Either a raw or normalized count matrix, Conos object, or Seurat object.

sample.groups

a two-level factor on the sample names describing the conditions being compared (default: extracted from data.object)

cell.groups

vector Indicates cell groups with cell names (default: extracted from data.object)

sample.per.cell

vector Sample name per cell (default: extracted from data.object)

ref.level

reference sample group level

target.level

target sample group level

sample.groups.palette

Color palette for the sample.groups (default=NULL)

cell.groups.palette

Color palette for the cell.groups (default=NULL)

embedding

embedding 2D embedding to visualize the cells in (default: extracted from data.object)

graph.name

graph name for Seurat object, ignored otherwise (default=NULL)

assay.name

assay name for Seurat object, ignored otherwise (default="RNA")

n.cores

Number of cores for parallelization (default=1)

verbose

boolean Whether to provide verbose output with diagnostic messages (default=TRUE)

plot.theme

ggplot2 plot theme (default=ggplot2::theme_bw())

plot.params

list with parameters, replacing defaults from embeddingPlot (default=NULL)

Returns

a new 'Cacoa' object

Examples
# Is it highly recommended that sample.groups and cell.groups are assigned in the initialization call. 
# Here, "con" is a Conos object.
\dontrun{
sample.groups <- c("control","control","disease","disease")
names(sample.groups) <- names(con$samples)
}
# cell.groups should be a named factor where names are cell names corresponding to cell names in the data object. 
# For Conos objects, they should overlap with rownames(con$embedding)
\dontrun{
cell.groups <- my.named.annotation.factor
cao <- Cacoa$new(data.object = con, sample.groups = sample.groups, cell.groups =  ref.level = "control", target.level = "disease")
}

Method estimateExpressionShiftMagnitudes()

Calculate expression shift magnitudes of different clusters between conditions

Usage
Cacoa$estimateExpressionShiftMagnitudes(
  cell.groups = self$cell.groups,
  sample.per.cell = self$sample.per.cell,
  dist = NULL,
  dist.type = "shift",
  min.cells.per.sample = 10,
  min.samp.per.type = 2,
  min.gene.frac = 0.01,
  ref.level = self$ref.level,
  sample.groups = self$sample.groups,
  verbose = self$verbose,
  n.cores = self$n.cores,
  name = "expression.shifts",
  n.permutations = 1000,
  genes = NULL,
  n.pcs = NULL,
  top.n.genes = NULL,
  ...
)
Arguments
cell.groups

vector Indicates cell groups with cell IDs as names (default: stored vector)

sample.per.cell

Sample per cell (default=self$sample.per.cell)

dist

distance metric: 'cor' - correlation distance, 'l1' - manhattan distance or 'l2' - euclidean (default=NULL, depends on dimensionality)

dist.type

type of expression distance: 'shift' (linear shift) 'var' (variance change) or 'total' (both) (default="shift")

min.cells.per.sample

numeric minimum cells per sample (default=10)

min.samp.per.type

numeric minimal number of samples per cell type for it to be included (default=2)

min.gene.frac

numeric minimal number of cells per cell type expressing a gene for it to be included (default=0.01)

ref.level

character Reference level, e.g. "control" (default=self$ref.level)

sample.groups

named vector indicating sample groups with sample IDs as names (default: stored sample.groups)

verbose

boolean Whether to show progress

n.cores

integer Number of cores for parallelization (default: stored integer)

name

character Test name (default="expression.shifts")

n.permutations

numeric number of permutations for estimating normalization coefficient (default=1000)

genes

character if provided, the expression distance is estimated only based on these genes (default=NULL)

n.pcs

numeric Number of principal components for estimating expression distance (default=NULL, no PCA)

top.n.genes

character vector Vector of top genes to show (default=NULL)

...

extra parameters to estimateExpressionChange

Returns

List including: dist.df: a table with cluster distances (normalized if within.group.normalization=TRUE), cell type and the number of cells # TODO: update p.dist.info: list of distance matrices per cell type sample.groups: filtered sample groups cell.groups: filtered cell groups

Examples
\dontrun{
cao$estimateExpressionShiftMagnitudes()
}

Method plotExpressionShiftMagnitudes()

Plot results from cao$estimateExpressionShiftMagnitudes() (shift.type="normal") or cao$estimateCommonExpressionShiftMagnitudes() (shift.type="common")

Usage
Cacoa$plotExpressionShiftMagnitudes(
  name = "expression.shifts",
  type = "box",
  notch = TRUE,
  show.jitter = TRUE,
  jitter.alpha = 0.05,
  show.pvalues = c("adjusted", "raw", "none"),
  ylab = "normalized expression distance",
  ...
)
Arguments
name

character Results slot name (default="expression.shifts")

type

character type of a plot "bar" or "box" (default="bar")

notch

boolean Whether to show notches in the boxplot version (default=TRUE)

show.jitter

boolean Whether to show individual data points (default=FALSE)

jitter.alpha

numeric Transparency value for the data points (default=0.05)

show.pvalues

character string Which p-values to plot. Accepted values are "none", "raw", or "adjusted". (default=c("adjusted", "raw", "none"))

ylab

character string Label of the y-axis (default="normalized expression distance")

...

additional arguments

Returns

A ggplot2 object

Examples
\dontrun{
cao$estimateExpressionShiftMagnitudes()
cao$plotExpressionShiftMagnitudes()
}

Method estimatePerCellTypeDE()

Alias for estimateDEPerCellType

Usage
Cacoa$estimatePerCellTypeDE(...)
Arguments
...

parameters fed to estimateDEPerCellType

Returns

A list of DE genes

Examples
\dontrun{
cao$estimatePerCellTypeDE() # Deprecated
}

Method estimateDEPerCellType()

Estimate differential gene expression per cell type between conditions

Usage
Cacoa$estimateDEPerCellType(
  cell.groups = self$cell.groups,
  sample.groups = self$sample.groups,
  ref.level = self$ref.level,
  target.level = self$target.level,
  name = "de",
  test = "DESeq2.Wald",
  resampling.method = NULL,
  n.resamplings = 30,
  seed.resampling = 239,
  min.cell.frac = 0.05,
  covariates = NULL,
  common.genes = FALSE,
  n.cores = self$n.cores,
  cooks.cutoff = FALSE,
  independent.filtering = FALSE,
  min.cell.count = 10,
  n.cells.subsample = NULL,
  verbose = self$verbose,
  fix.n.samples = NULL,
  genes.to.omit = NULL,
  ...
)
Arguments
cell.groups

factor specifying cell types (default=self$cell.groups)

sample.groups

2-factor vector with annotation of groups/condition per sample (default=self$sample.groups)

ref.level

character Reference level in 'sample.groups', e.g., ctrl, healthy (default=self$ref.level)

target.level

character Target level in 'sample.groups', e.g., case, diseased (default=self$target.level)

name

character string Slot in which to save the results (default='de')

test

character string Which DESeq2 test to use. The available options are "LRT", "Wald". (default="DESeq2.Wald")

resampling.method

character which resampling method should be used "loo" for leave-one-out or "bootstrap", (default=NULL, i.e. no resampling)

n.resamplings

numeric Number of resamplings to perform (default=30)

seed.resampling

numeric Seed to use for resamplings, input to set.seed() (default=239)

min.cell.frac

numeric Minimum fraction of cells to use to perform DE (default=0.05)

covariates

(default=NULL)

common.genes

boolean Whether to investigate common genes across cell groups (default=FALSE)

n.cores

numeric Number of cores for parallelization

cooks.cutoff

boolean cooksCutoff for DESeq2 (default=FALSE)

independent.filtering

boolean independentFiltering parameter for DESeq2 (default=FALSE)

min.cell.count

numeric minimum number of cells that need to be present in a given cell type in a given sample in order to be taken into account (default=10)

n.cells.subsample

integer Number of cells to subsample (default=NULL)

verbose

boolean Whether to show progress

fix.n.samples

Samples to be provided if resampling.method='fix.samples'.

genes.to.omit

character Genes to omit from calculations (default = NULL)

...

additional parameters

Returns

A list of DE genes

Examples
\dontrun{
cao$estimateDEPerCellType()
}

Method estimateDEStabilityPerCellType()

Estimate DE stability per cell type

Usage
Cacoa$estimateDEStabilityPerCellType(
  de.name = "de",
  name = "de.jaccards",
  top.n.genes = NULL,
  p.val.cutoff = NULL
)
Arguments
de.name

character string DE results slot name (default='de')

name

character string Name for storing results (default='de.jaccards')

top.n.genes

numeric Number of top DE genes to return (default=NULL)

p.val.cutoff

numeric The p-value cutoff to apply for returned DE values (default=NULL)

Returns

A ggplot2 object

Examples
\dontrun{
cao$estimateDEPerCellType()
cao$estimateDEStabilityPerCellType()
}

Method estimateDEStabilityPerGene()

Estimate DE stability per gene

Usage
Cacoa$estimateDEStabilityPerGene(
  de.name = "de",
  top.n.genes = 500,
  p.adj.cutoff = NULL,
  visualize = FALSE
)
Arguments
de.name

character string DE results slot name (default='de')

top.n.genes

numeric Number of top DE genes to return (default=500)

p.adj.cutoff

numeric The adjusted p-value cutoff to apply for returned DE values (default=NULL)

visualize

boolean Whether to visualize results (default=FALSE)

Returns

A ggplot2 object

Examples
\dontrun{
cao$estimateDEPerCellType()
cao$estimateDEStabilityPerGene()
}

Method plotDEStabilityPerCellType()

Plot DE stability per cell type

Usage
Cacoa$plotDEStabilityPerCellType(
  name = "de.jaccards",
  notch = FALSE,
  show.jitter = TRUE,
  jitter.alpha = 0.05,
  show.pairs = FALSE,
  sort.order = TRUE,
  pallete = self$cell.groups.palette,
  set.fill = TRUE
)
Arguments
name

character string DE stability results slot name (default='de.jaccards')

notch

boolean Whether to show notches on plot (default=FALSE)

show.jitter

boolean Whether to show jitter on plots (default=TRUE)

jitter.alpha

numeric Parameter for jitter (default=0.05)

show.pairs

boolean Whether to show pairs (default=FALSE)

sort.order

boolean Whether to show notches in the boxplot version (default=TRUE)

pallete

plot palette (default=self$cell.groups.palette)

set.fill

(default=TRUE)

Returns

A ggplot2 object

Examples
\dontrun{
cao$estimateDEPerCellType()
cao$estimateDEStability()
cao$plotDEStabilityPerCellType)
}

Method plotDEStabilityPerGene()

Plot DE stability per gene

Usage
Cacoa$plotDEStabilityPerGene(
  name = "de",
  cell.type = NULL,
  stability.score = "stab.median.rank"
)
Arguments
name

character string DE results slot name (default='de')

cell.type

character If set only show stability for a specific cell type in DE results (default=NULL)

stability.score

character string Any of "stab.median.rank", "stab.mean.rank", or "stab.var.rank" (default='stab.median.rank')

Returns

A ggplot2 object

Examples
\dontrun{
cao$estimateDEPerCellType()
cao$estimateDEStabilityPerGene()
cao$plotDEStabilityPerGene()
}

Method plotNumberOfDEGenes()

Plot number of significant DE genes

Usage
Cacoa$plotNumberOfDEGenes(
  name = "de",
  p.adjust = TRUE,
  pvalue.cutoff = 0.05,
  show.resampling.results = TRUE,
  show.jitter = FALSE,
  jitter.alpha = 0.05,
  type = "bar",
  notch = TRUE,
  ...
)
Arguments
name

string Field name where the test results are stored

p.adjust

boolean Whether the cutoff should be based on the adjusted P value (default=TRUE)

pvalue.cutoff

numeric P-value cutoff (default=0.05)

show.resampling.results

boolean Whether to show uncertainty based on resampling results (default=TRUE)

show.jitter

boolean Whether to apply jitter to the ggplot (default=FALSE)

jitter.alpha

numeric Opacity setting (default=0.05)

type

character string Any of 'box', 'point', or 'bar' (default='bar')

notch

boolean Whether to show notches (default=TRUE)

...

additional parameters passed to plotMeanMedValuesPerCellType()

Returns

A ggplot2 object

Examples
\dontrun{
cao$estimateDEPerCellType()
cao$plotNumberOfDEGenes()
}

Method plotVolcano()

Make volcano plots

Usage
Cacoa$plotVolcano(
  name = "de",
  cell.types = NULL,
  palette = NULL,
  build.panel = TRUE,
  n.col = 3,
  color.var = "CellFrac",
  ...
)
Arguments
name

character string DE results slot name (default='de')

cell.types

character If set will plot only for selected cell types in DE results (default=NULL)

palette

plot palette If NULL will use standard palette (default=NULL)

build.panel

boolean (default=TRUE)

n.col

numeric Number of columns (default=3)

color.var

character string (default='CellFrac')

...

additional parameters fed to plotVolcano

Returns

A ggplot2 object ## Not run: cao$estimateDEPerCellType() cao$plotVolcano() ## End(Not run)


Method saveDeAsJson()

Save DE results as JSON files

Usage
Cacoa$saveDeAsJson(
  saveprefix = NULL,
  dir.name = "JSON",
  de.raw = NULL,
  sample.groups = self$sample.groups,
  de.name = "de",
  ref.level = self$ref.level,
  gene.metadata = NULL,
  verbose = self$verbose
)
Arguments
saveprefix

character Prefix for created files (default=NULL)

dir.name

character Name for directory with results (default="JSON")

de.raw

List of DE results. If NULL will use stored DE results defined by "de.name" (default=NULL)

sample.groups

a two-level factor on the sample names describing the conditions being compared (default: stored vector)

de.name

character string DE results slot name (default='de')

ref.level

character Reference level in 'sample.groups', e.g., ctrl, healthy, wt (default=NULL)

gene.metadata

(default=NULL)

verbose

boolean Whether to output verbose messages (default=self$verbose)

Returns

saved JSON objects

Examples
\dontrun{
cao$estimateDEPerCellType()
cao$saveDeAsJson()
}

Method plotEmbedding()

Plot embedding

Usage
Cacoa$plotEmbedding(
  embedding = self$embedding,
  color.by = NULL,
  plot.theme = self$plot.theme,
  ...
)
Arguments
embedding

A cell embedding to use (two-column data frame with rownames corresponding to cells) (default: stored embedding object)

color.by

color cells by 'cell.groups', 'condition' or 'sample'. Overrides groups and palette. (default: NULL)

plot.theme

plot theme to use (default: self$plot.theme)

...

other parameters passed to embeddingPlot

Returns

embedding plot as output by sccore::embeddingPlot

Examples
\dontrun{
cao$plotEmbedding()
}

Method estimateOntology()

Estimate ontology terms based on DEs

Usage
Cacoa$estimateOntology(
  type = c("GO", "DO", "GSEA"),
  name = NULL,
  de.name = "de",
  org.db,
  n.top.genes = 500,
  p.adj = 1,
  p.adjust.method = "BH",
  readable = TRUE,
  min.gs.size = 10,
  max.gs.size = 500,
  keep.gene.sets = FALSE,
  ignore.cache = NULL,
  de.raw = NULL,
  verbose = self$verbose,
  n.cores = self$n.cores,
  ...
)
Arguments
type

character Ontology type, either GO (gene ontology) or DO (disease ontology). Please see DOSE package for more information (default="GO")

name

character If NULL will use type to look for ontology results (default=NULL)

de.name

character string DE results slot name (default='de')

org.db

Organism database, e.g., org.Hs.eg.db::org.Hs.eg.db for human or org.Ms.eg.db::org.Ms.eg.db for mouse. Input must be of class 'OrgDb'

n.top.genes

numeric Number of top highest-expressed genes to consider (default=500)

p.adj

numeric adjust-pvalues cutoff fed to getDEEntrezIdsSplitted() (default: 1)

p.adjust.method

character string Method for calculating adjusted p-values (default="BH")

readable

boolean Mapping gene ID to gene name (default=TRUE)

min.gs.size

numeric Minimal geneset size, please see clusterProfiler package for more information (default=5)

max.gs.size

numeric Minimal geneset size, please see clusterProfiler package for more information (default=5e2)

keep.gene.sets

boolean (default=FALSE)

ignore.cache

(default=NULL)

de.raw

(default=NULL)

verbose

boolean Whether to show progress

n.cores

numeric Number of cores for parallelization

...

further argument for ontology estimation. Pass nPerm with type='GSEA' to use fgseaSimple method

min.genes

numeric Minimum number of input genes overlapping with ontologies (default=0)

qvalue.cutoff

numeric Q value cutoff, please see clusterProfiler package for more information (default=0.2)

Returns

A list containing a list of terms per ontology, and a data frame with merged results

Examples
\dontrun{
cao$estimateDEPerCellType()
library(org.Hs.eg.db)
cao$estimateOntology(type = "GSEA", org.db = org.Hs.eg.db)
}

Method estimateOntologyFamilies()

Estimate ontology families based on ontology results

Usage
Cacoa$estimateOntologyFamilies(name = "GO", p.adj = 0.05)
Arguments
name

character Type of ontology result: "GO", "GSEA", or "DO" (default="GO")

p.adj

double Cutoff for adjusted p (default=0.05)

Returns

List of families and ontology data per cell type

Examples
\dontrun{
cao$estimateDEPerCellType()
cao$estimateOntology(name = "GSEA")
cao$estimateOntologyFamilies(name = "GSEA")
}

Method getFamiliesPerGO()

Identify families containing a specific ontology term or ID

Usage
Cacoa$getFamiliesPerGO(
  name = "GO",
  go.term = NULL,
  go.id = NULL,
  common = FALSE
)
Arguments
name

character string Type of ontology result: "GO", "GSEA", or "DO" (default="GO")

go.term

character vector with term description(s) (default=NULL)

go.id

character vector with ID(s) (default=NULL)

common

boolean Only identify families with all the supplied terms or IDs (default = FALSE)

Returns

Data frame

Examples
\dontrun{
cao$estimateDEPerCellType()
cao$estimateOntology(name = "GSEA")
cao$estimateOntologyFamilies(name = "GSEA")
cao$getFamiliesPerGO(name = "GSEA", go.term = "antigen presentation") # Either go.term og go.id has to be specified 
}

Method plotNumOntologyTermsPerType()

Bar plot of ontology terms per cell type

Usage
Cacoa$plotNumOntologyTermsPerType(
  name = "GO",
  genes = "up",
  p.adj = 0.05,
  q.value = 0.2,
  min.genes = 1,
  families = FALSE
)
Arguments
name

character string Type of ontology result: "GO", "GSEA", or "DO" (default="GO")

genes

Specify which genes to plot, can either be 'down', 'up' or 'all' (default="up")

p.adj

numeric adjusted p-value cutoff (default=0.05)

q.value

numeric Q value used for filtering (default=0.2)

min.genes

integer Minimum number of overlapping genes in terms (default=1)

families

boolean Plot family terms (default=FALSE)

Returns

A ggplot2 object

Examples
\dontrun{
cao$estimateDEPerCellType()
cao$estimateOntology(name = "GSEA")
cao$plotNumOntologyTermsPerType()
}

Method plotOntology()

Plot a dotplot of ontology terms with adj. P values for a specific cell subgroup

Usage
Cacoa$plotOntology(
  cell.type,
  name = "GO",
  plot = "dot",
  genes = c("up", "down", "all"),
  subtype = c("BP", "CC", "MF"),
  n = 20,
  p.adj = 0.05,
  min.genes = 1,
  ...
)
Arguments
cell.type

character string Cell type to plot

name

character string Type of ontology result: "GO", "GSEA", or "DO" (default="GO")

plot

character string Type of plot to return (default="dot"). Either "dot" or "bar".

genes

Specify which genes to plot, can either be 'down', 'up' or 'all' (default="up")

subtype

character string Ontology type, must be either "BP", "CC", or "MF" (GO types), "GO" or "DO" (default="GO")

n

integer Number of ontology terms to show. Not applicable when order is 'unique' or 'unique-max-row' (default=10)

p.adj

numeric Adjusted P cutoff (default=0.05)

min.genes

integer Minimum overlapping genes per term (default=1)

...

additional parameters passed to enrichplot::dotplot() or enrichplot::barplot()

cell.subgroup

character Specific cell group to plot

Returns

A ggplot2 object

Examples
\dontrun{
cao$estimateDEPerCellType()
cao$estimateOntology(name = "GSEA")
cao$plotOntology(name = "GSEA", cell.type = "Neurons") # "cell.type" is a cell type in self$cell.groups used for calculating ontologies
}

Method plotOntologyHeatmap()

Plot a heatmap of ontology P values per cell type

Usage
Cacoa$plotOntologyHeatmap(
  name = "GO",
  genes = "up",
  subtype = "BP",
  p.adj = 0.05,
  q.value = 0.2,
  min.genes = 1,
  top.n = Inf,
  legend.position = "left",
  selection = "all",
  cluster = TRUE,
  cell.subgroups = NULL,
  row.order = TRUE,
  col.order = TRUE,
  max.log.p = 10,
  only.family.children = FALSE,
  description.regex = NULL,
  description.exclude.regex = NULL,
  clust.naming = "medoid",
  readjust.p = TRUE,
  p.adjust.method = "BH",
  palette = NULL,
  color.range = NULL,
  return.info = FALSE,
  ...
)
Arguments
name

string Field name where the test results are stored

genes

Specify which genes to plot, can either be 'down' for downregulated genes, 'up' or 'all' (default="up")

subtype

character string (default="BP")

p.adj

numeric Cut-off for adjusted p-values (default=0.05)

q.value

numeric (default=0.2)

min.genes

integer Minimum genes (default=1)

top.n

Number of terms to show (default=Inf)

legend.position

Position of legend in plot. See ggplot2::theme (default="left")

selection

Order of rows in heatmap. Can be 'unique' (only show terms that are unique for any cell type); 'common' (only show terms that are present in at least two cell types); 'all' (all ontology terms) (default="all")

cluster

boolean Whether to show GO clusters or raw GOs (default=TRUE)

cell.subgroups

Cell groups to plot (default=NULL). This affects only visualization, but not clustering.

row.order

boolean Whether to order rows (default=TRUE)

col.order

boolean Whether to order columns (default=TRUE)

max.log.p

numeric Maximum log P value, used for coloring (default=10)

only.family.children

boolean Whether to only include family children (default=FALSE)

description.regex

(default=NULL)

description.exclude.regex

(default=NULL)

clust.naming

Field with the results for GO clustering. Ignored if clusters == FALSE.

readjust.p

boolean Whether to re-adjust p-values (default=TRUE)

p.adjust.method

character string Method used to adjust p-values (default="BH")

palette

plot palette. If NULL default will be used (default=NULL)

color.range

vector with two values for min/max values of p-values

return.info

boolean (default=FALSE)

...

parameters forwarded to plotHeatmap

type

Ontology, must be either "BP", "CC", or "MF" (GO types) or "DO" (default="GO")

Returns

A ggplot2 object

Examples
\dontrun{
cao$estimateDEPerCellType()
cao$estimateOntology(name = "GSEA")
cao$plotOntologyHeatmap()

cao$estimateOntologyFamilies(name = "GSEA")
cao$plotOntologyHeatmap(name = "GSEA", only.family.children = TRUE)
}

Method plotOntologyHeatmapCollapsed()

Plot a heatmap of ontology p-values per cell type heatmap, collapsed

Usage
Cacoa$plotOntologyHeatmapCollapsed(
  name = "GO",
  genes = "up",
  subtype = "BP",
  p.adj = 0.05,
  q.value = 0.2,
  min.genes = 1,
  n = 20,
  legend.position = "left",
  selection = "all",
  max.log.p = 10,
  cluster = TRUE,
  cell.subgroups = NULL,
  palette = NULL,
  row.order = TRUE,
  col.order = TRUE,
  only.family.children = FALSE,
  readjust.p = TRUE,
  p.adjust.method = "BH",
  description.regex = NULL,
  description.exclude.regex = NULL,
  distance = "manhattan",
  clust.method = "complete",
  clust.naming = "consensus",
  n.words = 5,
  exclude.words = NULL,
  return.info = FALSE,
  ...
)
Arguments
name

character string Type of ontology result: "GO", "GSEA", or "DO" (default="GO")

genes

character Specify which genes to plot, can either be 'down' for downregulated genes, 'up' or 'all' (default="up")

subtype

character Ontology type, must be either "BP", "CC", or "MF" (GO types) or "DO" (default="GO")

p.adj

numeric Adj. P value cutoff (default=0.05)

q.value

numeric Q value cutoff (default=0.2)

min.genes

integer Minimum number of overlapping genes per term (default=1)

n

integer Number of terms to plot (default=20)

legend.position

character Position of legend in plot. See ggplot2::theme (default="left")

selection

character Order of rows in heatmap. Can be 'unique' (only show terms that are unique for any cell type); 'common' (only show terms that are present in at least two cell types); 'all' (all ontology terms) (default="all")

max.log.p

numeric Maximum log P value, used for coloring (default=10)

cluster

Whether to show GO clusters or raw GOs (default=TRUE)

cell.subgroups

Cell groups to plot (default=NULL). This affects only visualization, but not clustering.

palette

(default=NULL)

row.order

boolean Whether to order rows (default=TRUE)

col.order

boolean Whether to order columns (default=TRUE)

only.family.children

boolean (default=FALSE)

readjust.p

boolean Whether to re-adjust p-values (default=TRUE)

p.adjust.method

character string Method for calculating adjusted p-values (default="BH")

description.regex

(default=NULL)

description.exclude.regex

(default=NULL)

distance

character string (default="manhattan")

clust.method

character string (default="complete")

clust.naming

Field with the results for GO clustering. Ignored if clusters == FALSE.

n.words

integer (default=5)

exclude.words

(default=NULL)

return.info

boolean Whether to return the info (default=FALSE)

...

parameters forwarded to plotHeatmap

top.n

Number of terms to show (default=Inf)

color.range

vector with two values for min/max values of p-values

Returns

A ggplot2 object

Examples
\dontrun{
cao$estimateDEPerCellType()
cao$estimateOntology(name = "GSEA")
cao$plotOntologyHeatmapCollapsed(name = "GSEA")

cao$estimateOntologyFamilies(name = "GSEA")
cao$plotOntologyHeatmapCollapsed(name = "GSEA", only.family.children = TRUE)
}

Method plotOntologySimilarities()

Plot correlation matrix for ontology terms between cell types

Usage
Cacoa$plotOntologySimilarities(
  name = "GO",
  subtype = c("BP", "MF", "CC"),
  genes = "up",
  p.adj = 0.05,
  only.family.children = FALSE,
  q.value = 0.2,
  min.genes = 1
)
Arguments
name

character string Type of ontology result: "GO", "GSEA", or "DO" (default="GO")

subtype

character Type of ontology result, must be "BP", "MF", or "CC" (default="BP")

genes

Specify which genes to plot, can either be 'down', 'up' or 'all' (default="up")

p.adj

numeric Cut-off for adjusted p-values (default=0.05)

only.family.children

boolean Plot similarities for ontology family lonely children (default=FALSE)

q.value

numeric Q value for filtering (default=0.2)

min.genes

numeric Minimum number of overlapping genes per term (default=1)

Returns

A ggplot2 object

Examples
\dontrun{
cao$estimateDEPerCellType()
cao$estimateOntology()
cao$plotOntologySimilarities()
}

Method plotOntologyFamily()

Plot related ontologies in one hierarchical network plot

Usage
Cacoa$plotOntologyFamily(
  name = "GO",
  cell.type,
  family = NULL,
  genes = "up",
  subtype = "BP",
  plot.type = c("complete", "dense", "minimal"),
  show.ids = FALSE,
  string.length = 14,
  legend.label.size = 1,
  legend.position = "topright",
  verbose = self$verbose,
  n.cores = self$n.cores,
  ...
)
Arguments
name

character string Type of ontology result: "GO", "GSEA", or "DO" (default="GO")

cell.type

character Cell subtype to plot

family

numeric Family within cell subtype to plot (default=NULL)

genes

character string Only for GO results: Direction of genes, must be "up", "down", or "all" (default="up")

subtype

character Type of ontology result, must be "BP", "MF", or "CC" (default="BP")

plot.type

character Extend of family network Can be "complete" (entire network), "dense" (show 1 parent for each significant term), or "minimal" (only show significant terms) (default="complete")

show.ids

boolean Whether to show ontology IDs instead of names (default=FALSE)

string.length

integer Length of strings for wrapping in order to fit text within boxes (default: 14)

legend.label.size

numeric Size og legend labels (default: 1)

legend.position

numeric Position of legend (default: topright)

verbose

boolean Print messages (default=self$verbose)

n.cores

integer Number of cores to use for parallelization (default=self$n.cores)

...

additional parameters passed to plotOntologyFamily

Returns

Rgraphviz object

Examples
\dontrun{
cao$estimateDEPerCellType()
cao$estimateOntology(name = "GSEA")
cao$estimateOntologyFamilies(name = "GSEA")
cao$plotOntologyFamily(name = "GSEA", cell.type = "Neurons") # "cell.type" is a cell type in self$cell.groups used for calculating ontologies
}

Method saveOntologyAsTable()

Save ontology results as a table

Usage
Cacoa$saveOntologyAsTable(
  file,
  name = "GO",
  subtype = NULL,
  genes = NULL,
  p.adj = 0.05,
  sep = "\t",
  ...
)
Arguments
file

character string File name passed to write.table(). Set to NULL to return the table instead of saving.

name

string Field name where the test results are stored

subtype

character string Only for GO results: Type of result to filter by, must be "BP", "MF", or "CC" (default: NULL)

genes

character Direction of genes to filter by, must be "up", "down", or "all" (default: NULL)

p.adj

numeric Cut-off for adjusted p-values (default=0.05)

sep

character Separator (default: "\t", tab)

...

additional arguments passed to write.table()

Returns

table for import into text editor

Examples
\dontrun{
cao$estimateDEPerCellType()
cao$estimateOntology(name = "GSEA")
cao$saveOntologyAsTable(name = "GSEA", file = "Ontologies.tsv")
}

Method saveFamiliesAsTable()

Save family results as a table

Usage
Cacoa$saveFamiliesAsTable(
  file,
  name = "GO",
  subtype = NULL,
  genes = NULL,
  p.adj = 0.05,
  sep = "\t",
  ...
)
Arguments
file

character string File name passed to write.table(). Set to NULL to return the table instead of saving.

name

string Field name where the test results are stored

subtype

character Type of result to filter by, must be "BP", "MF", or "CC" (default=NULL)

genes

character Direction of genes to filter by, must be "up", "down", or "all" (default=NULL)

p.adj

numeric Adjusted P to filter by (default=0.05)

sep

character Separator (default = "\t", tab)

...

additional arguments passed to write.table()

type

character string Type of ontology result, i.e., GO, GSEA, or DO (default='GO')

Returns

table for import into text editor

Examples
\dontrun{
cao$estimateDEPerCellType()
cao$estimateOntology(name = "GSEA")
cao$estimateOntologyFamilies(name = "GSEA")
cao$saveFamiliesAsTable(name = "GSEA", file = "Families.tsv")
}

Method plotCellGroupSizes()

Plot the cell group sizes or proportions per sample

Usage
Cacoa$plotCellGroupSizes(
  cell.groups = self$cell.groups,
  show.significance = FALSE,
  filter.empty.cell.types = TRUE,
  proportions = TRUE,
  palette = self$sample.groups.palette,
  ...
)
Arguments
cell.groups

factor Cell annotations with cell IDs as names (default=self$cell.groups)

show.significance

boolean show statistical significance between sample groups. wilcox.test was used; (* < 0.05; ⁠**⁠ < 0.01; ⁠***⁠ < 0.001) (default=FALSE)

filter.empty.cell.types

boolean Remove cell types without cells (default=TRUE)

proportions

boolean Plot proportions or absolute numbers (default=TRUE)

palette

color palette to use for conditions (default: stored $sample.groups.palette)

...

additional plot parameters, forwarded to plotCountBoxplotsPerType

Returns

A ggplot2 object

Examples
\dontrun{
cao$plotCellGroupSizes()
}

Method plotCellGroupAbundanceVariation()

Plot the cell group sizes or proportions per sample

Usage
Cacoa$plotCellGroupAbundanceVariation(
  cell.groups = self$cell.groups,
  type = "mad",
  rotate.xticks = TRUE,
  min.rel.abundance = 0.05
)
Arguments
cell.groups

character Cell annotations with cell IDs as names(default=self$cell.groups)

type

character string Must be "mad", "sd", "sample.num", or "sample.frac" (default='mad')

rotate.xticks

boolean Turn x labels 90 degrees (default=TRUE)

min.rel.abundance

numeric Minimum relative abundance to plot (default=0.05)

Returns

ggplot2 object

Examples
\dontrun{
cao$plotCellGroupAbundanceVariation()
}

Method plotCodaSpace()

Plot compositions in CoDA space (PCA or CDA)

Usage
Cacoa$plotCodaSpace(
  space = "CDA",
  cell.groups = self$cell.groups,
  font.size = 3,
  cells.to.remain = NULL,
  cells.to.remove = NULL,
  samples.to.remove = NULL,
  palette = self$sample.groups.palette
)
Arguments
space

character either 'PCA' or 'CDA' (default="CDA")

cell.groups

vector Indicates cell groups with cell IDs as names (default: stored vector)

font.size

numeric Font size (default=3)

cells.to.remain

character Specific cell types to keep (default=NULL)

cells.to.remove

character Specific cell types to remove (default=NULL)

samples.to.remove

character Specific samples to remove (default=NULL)

palette

plot palette (default=self$sample.groups.palette)

Returns

A ggplot2 object

Examples
\dontrun{
cao$estimateCellLoadings()
cao$plotCodaSpace()
}

Method plotContrastTree()

Plot contrast tree

Usage
Cacoa$plotContrastTree(
  cell.groups = self$cell.groups,
  palette = self$sample.groups.palette,
  name = "coda",
  cells.to.remain = NULL,
  cells.to.remove = NULL,
  filter.empty.cell.types = TRUE,
  adjust.pvalues = TRUE,
  h.method = c("both", "up", "down"),
  reorder.tree = TRUE,
  ...
)
Arguments
cell.groups

character Cell annotations with cell IDs as name (default=self$cell.groups)

palette

plot palette (default=self$sample.groups.palette)

name

character Results name slot (default='coda')

cells.to.remain

character Specific cell types to keep (default=NULL)

cells.to.remove

character Specific cell types to remove (default=NULL)

filter.empty.cell.types

boolean Remove cell types without cells (default=TRUE)

adjust.pvalues

boolean Adjust P values or not (default=TRUE)

h.method

character Must be one of 'both', 'up', 'down' (default='both')

reorder.tree

boolean Reorder tree or not (default=TRUE)

...

additional parameters

Returns

A ggplot2 object

Examples
\dontrun{
cao$estimateCellLoadings()
cao$plotContratsTree()
}

Method plotCompositionSimilarity()

Plot composition similarity

Usage
Cacoa$plotCompositionSimilarity(
  cell.groups = self$cell.groups,
  cells.to.remain = NULL,
  cells.to.remove = NULL,
  palette = brewerPalette("YlOrRd", rev = FALSE),
  ...
)
Arguments
cell.groups

character Cell annotations with cell IDs as name (default=self$cell.groups)

cells.to.remain

character Specific cell types to keep (default=NULL)

cells.to.remove

character Specific cell types to remove (default=NULL)

palette

plot palette (default=brewerPalette("YlOrRd", rev=FALSE))

...

parameters passed to plotHeatmap()

Returns

A ggplot2 object

Examples
\dontrun{
cao$estimateCellLoadings()
cao$plotCompositionSimilarity()
}

Method estimateCellLoadings()

Estimate cell loadings

Usage
Cacoa$estimateCellLoadings(
  n.boot = 1000,
  ref.cell.type = NULL,
  name = "coda",
  n.seed = 239,
  cells.to.remove = NULL,
  cells.to.remain = NULL,
  samples.to.remove = NULL,
  filter.empty.cell.types = TRUE,
  n.cores = self$n.cores,
  verbose = self$verbose,
  method = "lda"
)
Arguments
n.boot

numeric Number of boot straps (default=1000)

ref.cell.type

character Reference cell type (default=NULL)

name

character Results name slot (default='coda')

n.seed

numeric Seed number for reproducibility (default=239)

cells.to.remove

character Specific cell types to keep (default=NULL)

cells.to.remain

character Specific cell types to remove (default=NULL)

samples.to.remove

character Specific samples to remove (default=NULL)

filter.empty.cell.types

boolean Remove cell types without cells (default=TRUE)

n.cores

integer Number of cores to use for parallelization (default=self$n.cores)

verbose

boolean Print messages (default=self$verbose)

method

character One of 'lda', svm', 'cda', or 'cda.std' (default=lda)

Returns

resulting cell loadings

Examples
\dontrun{
cao$estimateCellLoadings()
}

Method plotCellLoadings()

Plot Loadings

Usage
Cacoa$plotCellLoadings(
  alpha = 0.01,
  palette = self$cell.groups.palette,
  font.size = NULL,
  name = "coda",
  ordering = "pvalue",
  show.pvals = TRUE,
  ...
)
Arguments
alpha

numeric Transparency (default=0.01)

palette

plot palette specification for cell types (default: stored $cell.groups.palette)

font.size

numeric Font size (default=NULL)

name

character Results slot name (default='coda')

ordering

character Must be one of "pvalue", "loadings" (default='pvalue')

show.pvals

boolean Show P values (default=TRUE)

...

additional parameters plotCellLoadings()

Returns

A ggplot2 object

Examples
\dontrun{
cao$estimateCellLoadings()
cao$plotCellLoadings()
}

Method estimateCellDensity()

Estimate cell density in giving embedding

Usage
Cacoa$estimateCellDensity(
  bins = 400,
  method = "kde",
  name = "cell.density",
  beta = 30,
  estimate.variation = TRUE,
  sample.groups = self$sample.groups,
  verbose = self$verbose,
  n.cores = self$n.cores,
  bandwidth = 0.05,
  ...
)
Arguments
bins

numeric Number of bins for density estimation (default=400)

method

character string Density estimation method, graph: graph smooth based density estimation. kde: embedding grid based density estimation. (default: 'kde')

name

string Field name where the test results are stored

beta

numeric Smoothing strength parameter of the heatFilter for graph based cell density (default=30)

estimate.variation

boolean Estimate variation (default=TRUE)

sample.groups

2-factor vector with annotation of groups/condition per sample (default=self$sample.groups)

verbose

boolean Print messages (default=self$verbose)

n.cores

integer Number of cores to use for parallelization (default=self$n.cores)

bandwidth

numeric KDE bandwidth multiplier (default=0.5). The full bandwidth is estimated by multiplying this value on the difference between 90% and 10% of the corresponding embedding dimension. Set it to NULL to use bandwidth.nrd estimator. (default=0.05)

...

additional arguments

Returns

estimated cell densities

Examples
\dontrun{
cao$estimateCellDensity()
}

Method plotCellDensity()

Plot cell density depending on the method that was used for estimating cao$test.resulst[[name]]

Usage
Cacoa$plotCellDensity(
  show.grid = TRUE,
  add.points = TRUE,
  size = 0.1,
  show.legend = FALSE,
  palette = NULL,
  point.col = "#313695",
  contours = NULL,
  contour.color = "black",
  contour.conf = "10%",
  name = "cell.density",
  show.cell.groups = TRUE,
  cell.groups = self$cell.groups,
  font.size = c(2, 4),
  color.range = c(0, "99%"),
  ...
)
Arguments
show.grid

boolean Whether to show grid (default=TRUE)

add.points

boolean Add points to cell density figure (default=TRUE)

size

numeric Point size (default=0.1)

show.legend

boolean Show legend (default=FALSE)

palette

plot palette (default=NULL)

point.col

character Point color (default='#313695')

contours

character Specify cell types for contour, multiple cell types are also supported (default=NULL)

contour.color

character Color for contour line (default='black')

contour.conf

character Confidence interval of contour (default='10%')

name

character Slot in which to saved results from estimateCellDensity (default='cell.density')

show.cell.groups

boolean Plot cell group names (default=TRUE)

cell.groups

character Cell annotations with cell IDs as name (default=self$cell.groups)

font.size

numeric Font size (default=c(2, 4))

color.range

character Color range (default=c(0, "99%"))

...

plot style parameters forwarded to sccore::styleEmbeddingPlot.

Returns

A ggplot2 object

Examples
\dontrun{
cao$estimateCellDensity()
cao$plotCellDensity()
}

Method plotCellDensityVariation()

Plot cell density variation

Usage
Cacoa$plotCellDensityVariation(
  type = "mad",
  plot.type = "embedding",
  name = "cell.density",
  cutoff = NULL,
  condition = c("both", "ref", "target"),
  ...
)
Arguments
type

character Must be one of "mad", "sd", "sample.frac" (default='mad')

plot.type

character Must be one of "hist", "embedding" (default='embedding')

name

character Results slot name (default='cell.density')

cutoff

numeric Score cutoff (default=NULL)

condition

character Must be one of 'both', 'ref', 'target' (default="both")

...

additional arguments

Returns

ggplot2 object

Examples
\dontrun{
cao$estimateCellDensity(estimate.variation=TRUE)
cao$plotCellDensityVariation()
}

Method estimateDiffCellDensity()

Estimate differential cell density

Usage
Cacoa$estimateDiffCellDensity(
  type = "permutation",
  adjust.pvalues = NULL,
  name = "cell.density",
  n.permutations = 400,
  smooth = TRUE,
  verbose = self$verbose,
  n.cores = self$n.cores,
  ...
)
Arguments
type

character method to calculate differential cell density; permutation, t.test, wilcox or subtract (target subtract ref density);

adjust.pvalues

boolean Whether to adjust Z-scores for multiple comparison using BH method (default: FALSE for type='subtract', TRUE for everything else)

name

character Slot with results from estimateCellDensity. New results will be appended there. (Default: 'cell.density')

n.permutations

numeric Number of permutations (default=400)

smooth

boolean Smooth results (default=TRUE)

verbose

boolean Print messages (default=self$verbose)

n.cores

integer Number of cores to use for parallelization (default=self$n.cores)

...

additional arguments to the function

Returns

estimated differential cell densities

Examples
\dontrun{
cao$estimateCellDensity()
cao$estimateDiffCellDensity()
}

Method plotDiffCellDensity()

Estimate differential cell density

Usage
Cacoa$plotDiffCellDensity(
  type = NULL,
  name = "cell.density",
  size = 0.2,
  palette = NULL,
  adjust.pvalues = NULL,
  contours = NULL,
  contour.color = "black",
  contour.conf = "10%",
  plot.na = FALSE,
  color.range = NULL,
  mid.color = "gray95",
  scale.z.palette = adjust.pvalues,
  min.z = qnorm(0.9),
  ...
)
Arguments
type

character method to calculate differential cell density; t.test, wilcox or subtract (target subtract ref density);

name

character Slot with results from estimateCellDensity. New results will be appended there. (Default: 'cell.density')

size

numeric (default=0.2)

palette

color palette, default is c('blue','white','red')

adjust.pvalues

boolean Adjust P values (default=NULL)

contours

character Specify cell types for contour, multiple cell types are also supported (default: NULL)

contour.color

character color for contour line (default: 'black')

contour.conf

character confidence interval of contour (default: '10%')

plot.na

boolean Plot NAs (default=FALSE)

color.range

numeric, e.g. c(0,90) (default=NULL)

mid.color

character Color code for medium value in color range (default='gray95')

scale.z.palette

boolean Scale plot palette for Z scores (default=adjust.pvalues)

min.z

numeric Minimum Z score to plot (default=qnorm(0.9))

...

additional parameters

Returns

ggplot2 object

Examples
\dontrun{
cao$estimateCellDensity()
cao$estimateDiffCellDensity()
cao$plotDiffCellDensity()
}

Method plotExpressionDistance()

Plot inter-sample expression distance. The inputs to this function are the results from cao$estimateExpressionShiftMagnitudes()

Usage
Cacoa$plotExpressionDistance(
  name = "expression.shifts",
  joint = FALSE,
  palette = self$sample.groups.palette,
  show.significance = FALSE,
  ...
)
Arguments
name

character Test results to plot (default=expression.shifts)

joint

boolean Whether to show joint boxplot with the expression distance weighed by the sizes of cell types (default: TRUE), or show distances for each individual cell type

palette

plot palette (default=self$sample.groups.palette)

show.significance

boolean Whether to show statistical significance between sample groups. wilcox.test was used; (* < 0.05; ⁠**⁠ < 0.01; ⁠***⁠ < 0.001)

...

other plot parameters, forwarded to plotCountBoxplotsPerType

Returns

A ggplot2 object

Examples
\dontrun{
cao$estimateExpressionShiftMagnitudes()
cao$plotExpressionDistance()
}

Method getSampleDistanceMatrix()

Plot inter-sample expression distance. The inputs to this function are the results from cao$estimateExpressionShiftMagnitudes()

Usage
Cacoa$getSampleDistanceMatrix(
  space = c("expression.shifts", "coda", "pseudo.bulk"),
  cell.type = NULL,
  dist = NULL,
  name = NULL,
  verbose = self$verbose,
  sample.subset = NULL,
  ...
)
Arguments
space

character One of 'expression.shifts', 'coda', 'pseudo.bulk' (default="expression.shifts")

cell.type

character Cell type reference for distancing (default=NULL)

dist

character Must be one of "cor", "l1" (manhattan), "l2" (euclidian) (default=NULL)

name

character Results slot name (default=NULL)

verbose

boolean Print messages (default=self$verbose)

sample.subset

subset data for analysis only to the given samples

...

additional arguments

Returns

sample distance matrix

Examples
\dontrun{
cao$getSampleDistanceMatrix()
}

Method plotSampleDistances()

Project samples to 2D space with MDS. Plots results from cao$estimateExpressionShiftMagnitudes() or cao$estimateCellLoadings()

Usage
Cacoa$plotSampleDistances(
  space = "expression.shifts",
  method = "MDS",
  dist = NULL,
  name = NULL,
  cell.type = NULL,
  palette = NULL,
  show.sample.size = FALSE,
  sample.colors = NULL,
  color.title = NULL,
  title = NULL,
  n.permutations = 2000,
  show.pvalues = FALSE,
  sample.subset = NULL,
  n.cores = self$n.cores,
  ...
)
Arguments
space

character string "expression.shifts" Results from cao$estimateExpressionShiftMagnitudes(); CDA- cell composition shifts result from cao$estimateCellLoadings(); sudo.bulk- expression distance of sudo bulk

method

character string "MDS"

dist

'cor' - correlation distance, 'l1' - manhattan distance or 'l2' - euclidean (default correlation distance)

name

string Field name where the test results are stored

cell.type

If a name of a cell type is specified, the sample distances will be assessed based on this cell type alone. Otherwise (cell.type=NULL, default), sample distances will be estimated as an average distance across all cell types (weighted by the minimum number of cells of that cell type between any two samples being compared)

palette

a set of colors to use for conditions (default: stored $sample.groups.palette)

show.sample.size

make point size proportional to the log10 of the number of cells per sample (default: FALSE)

sample.colors

(default=NULL)

color.title

(default=NULL)

title

(default=NULL)

n.permutations

numeric (default=2000)

show.pvalues

boolean (default=FALSE)

sample.subset

subset data for analysis only to the given samples

n.cores

numeric Number of cores for parallelization

...

additional parameters passed to plotSampleDistanceMatrix()

Returns

A ggplot2 object

Examples
\dontrun{
cao$estimateExpressionShiftMagnitudes()
cao$plotSampleDistances()
}

Method estimateMetadataSeparation()

Estimate metadata separation using variance on the sample distance graph

Usage
Cacoa$estimateMetadataSeparation(
  sample.meta,
  space = "expression.shifts",
  dist = NULL,
  space.name = NULL,
  sample.subset = NULL,
  name = "metadata.separation",
  n.permutations = 5000,
  trim = 0.05,
  k = 20,
  show.warning = TRUE,
  verbose = self$verbose,
  n.cores = self$n.cores,
  adjust.pvalues = TRUE,
  p.adjust.method = "BH",
  pvalue.cutoff = 0.05
)
Arguments
sample.meta

sample metadata is a list or data.frame with metadata per sample

space

(default="expression shifts")

dist

(default=NULL)

space.name

(default=NULL)

sample.subset

subset data for analysis only to the given samples

name

string Field name where the test results are stored

n.permutations

number permutations for the test (default=5000)

trim

trim distance matrix above the given quantile (default=0.05)

k

if this parameter is supplied, k-NN graph is used for variance estimation, otherwise the function uses a fully-connected graph (default=20)

show.warning

boolean (default=TRUE)

verbose

boolean Print messages (default=self$verbose)

n.cores

integer Number of cores to use for parallelization (default=self$n.cores)

adjust.pvalues

boolean (default=TRUE)

p.adjust.method

character string Method for calculating adjusted p-values (default="BH")

pvalue.cutoff

numeric (default=0.05)

Returns

results

Examples
\dontrun{
cao$estimateExpressionShiftMagnitudes() # or estimateCellLoadings()
cao$estimateMetadataSeparation(sample.meta = meta.data) # meta.data is a list or data.frame with metadata per sample
}

Method plotMetadataSeparation()

Plot metadata separation

Usage
Cacoa$plotMetadataSeparation(
  name = "metadata.separation",
  pvalue.y = 0.93,
  ...
)
Arguments
name

character Name for storage in test.results (default="metadata.separation")

pvalue.y

numeric (default=0.93)

...

additional parameters forwarded to plotMeanMedValuesPerCellType

Examples
\dontrun{
cao$estimateExpressionShiftMagnitudes() # or estimateCellLoadings()
cao$estimateMetadataSeparation(sample.meta = meta.data)
cao$plotMetadataSeparation()
}

Method estimateClusterFreeDE()

Estimate differential expression Z-scores between two conditions per individual cell

Usage
Cacoa$estimateClusterFreeDE(
  n.top.genes = Inf,
  genes = NULL,
  max.z = 20,
  min.expr.frac = 0.01,
  min.n.samp.per.cond = 2,
  min.n.obs.per.samp = 2,
  robust = FALSE,
  norm.both = TRUE,
  adjust.pvalues = FALSE,
  smooth = TRUE,
  wins = 0.01,
  n.permutations = 200,
  lfc.pseudocount = 1e-05,
  min.edge.weight = 0.6,
  verbose = self$verbose,
  n.cores = self$n.cores,
  name = "cluster.free.de"
)
Arguments
n.top.genes

(default=Inf)

genes

(default=NULL)

max.z

z-score value to winsorize the estimates for reducing impact of outliers. Default: 20.

min.expr.frac

minimal fraction of cell expressing a gene for estimating z-scores for it. Default: 0.001.

min.n.samp.per.cond

minimal number of samples per condition for estimating z-scores (default: 2)

min.n.obs.per.samp

minimal number of cells per samples for estimating z-scores (default: 2)

robust

whether to use median estimates instead of mean. Using median is more robust, but greatly increase the number of zeros in the data, leading to bias towards highly-express genes. (Default: FALSE)

norm.both

boolean (default=TRUE)

adjust.pvalues

boolean (default=FALSE)

smooth

boolean Whether to apply smoothing (default=TRUE)

wins

numeric (default=0.01)

n.permutations

numeric (default=200)

lfc.pseudocount

pseudocount value for estimation of log2(fold-change)

min.edge.weight

numeric (default=0.6)

verbose

boolean Print messages (default=self$verbose)

n.cores

integer Number of cores to use for parallelization (default=self$n.cores)

name

character string (default='cluster.free.de')

smoooth

boolean (default=TRUE)

Returns

list with sparce matrices containing various DE metrics with genes as columns and cells as rows:

  • z: DE Z-scores

  • reference mean or median expression in reference samples

  • target mean or median expression in target samples

  • lfc: log2(fold-change) of expression Cells that have only one condition in their expression neighborhood have NA Z-scores for all genes. Results are also stored in the cluster.free.de field.

Examples
\dontrun{
cao$estimateClusterFreeDE()
}

Method getMostChangedGenes()

Get most changed genes

Usage
Cacoa$getMostChangedGenes(
  n,
  method = c("z", "z.adj", "lfc"),
  min.z = 0.5,
  min.lfc = 1,
  max.score = 20,
  cell.subset = NULL,
  excluded.genes = NULL,
  included.genes = NULL,
  name = "cluster.free.de"
)
Arguments
n

numeric Number of genes to retrieve

method

character Must be one of "z", "z.adj", "lfc" (default="z")

min.z

numeric Minimum Z score (default=0.5)

min.lfc

numeric Minimum log fold change (default=1)

max.score

numeric Maximum Z score (default=20)

cell.subset

character Cells to subset (default=NULL)

excluded.genes

character Genes to exclude (default=NULL)

included.genes

character Genes to include (default=NULL)

name

character Results slot name (default="cluster.free.de")

Returns

named numeric with scores and gene symbols as names

Examples
\dontrun{
cao$estimateClusterFreeDE()
cao$getMostChangedGenes(n = 10) # n can be any number of genes to extract
}

Method estimateClusterFreeExpressionShifts()

Estimate Cluster-free Expression Shift

Usage
Cacoa$estimateClusterFreeExpressionShifts(
  n.top.genes = 3000,
  gene.selection = "z",
  name = "cluster.free.expr.shifts",
  min.n.between = 2,
  min.n.within = max(min.n.between, 1),
  min.expr.frac = 0,
  min.n.obs.per.samp = 3,
  normalize.both = FALSE,
  dist = "cor",
  log.vectors = (dist != "js"),
  wins = 0.025,
  genes = NULL,
  n.permutations = 500,
  verbose = self$verbose,
  n.cores = self$n.cores,
  min.edge.weight = 0,
  ...
)
Arguments
n.top.genes

number of top genes for the distance estimation (default: 3000)

gene.selection

character string Method to select top genes, "z" selects genes by cluster-free Z-score change, "lfc" uses log2(fold-change) instead, "expression" picks the most expressed genes and "od" picks overdispersed genes. Default: "z".

name

string Field name where the test results are stored

min.n.between

minimal number of pairs between condition for distance estimation (default: 2)

min.n.within

minimal number of pairs within one condition for distance estimation (default: min.n.between)

min.expr.frac

numeric (default=0.0)

min.n.obs.per.samp

minimal number of cells per sample for using it in distance estimation (default: 3)

normalize.both

whether to normalize results relative to distances within both conditions (TRUE) or only to the control (FALSE)

dist

distance measure. Options: "cor" (correlation), "cosine" or "js" (Jensen–Shannon)

log.vectors

whether to use log10 on the normalized expression before estimating the distance. In most cases, must be TRUE for "cosine" and "cor" distances and always must be FALSE for "js". (default: dist != 'js')

wins

numeric (default=0.025)

genes

character vector Genes to include (default=NULL)

n.permutations

numeric Number of permutations (default=500)

verbose

boolean Print messages (default=self$verbose)

n.cores

integer Number of cores to use for parallelization (default=self$n.cores)

min.edge.weight

numeric Minimum edge weight (default=0.0)

...

additional parameters passed to estimateClusterFreeExpressionShiftsC()

Returns

Vector of cluster-free expression shifts per cell. Values above 1 correspond to difference between conditions. Results are also stored in the cluster.free.expr.shifts field.

Examples
\dontrun{
cao$estimateClusterFreeDE()
cao$estimateClusterFreeExpressionShifts()
}

Method smoothClusterFreeZScores()

Performs graph smoothing of the cluster-free DE Z-scores

Usage
Cacoa$smoothClusterFreeZScores(
  n.top.genes = 1000,
  smoothing = 20,
  filter = NULL,
  z.adj = FALSE,
  gene.selection = ifelse(z.adj, "z.adj", "z"),
  excluded.genes = NULL,
  n.cores = self$n.cores,
  verbose = self$verbose,
  name = "cluster.free.de",
  ...
)
Arguments
n.top.genes

numeric Number of top ranked genes to include (default=1000)

smoothing

beta parameter of the heatFilter. (default=20)

filter

graph filter function. (default=NULL)

z.adj

boolean Adjust Z scores (default=FALSE)

gene.selection

character Must be one of "z.adj" or "z", default is based on the "z.adj" parameter (default=ifelse(z.adj, "z.adj", "z"))

excluded.genes

List of genes to exclude during estimation. For example, a list of mitochondrial genes.

n.cores

integer Number of cores to use for parallelization (default=self$n.cores)

verbose

boolean Print messages (default=self$verbose)

name

character Results slot name (default='cluster.free.de')

...

parameters forwarded to smoothSignalOnGraph

exluded.genes

character Genes to exclude (default=NULL)

Returns

Sparse matrix of smoothed Z-scores. Results are also stored in the cluster.free.de$z.smoothed field.

Examples
\dontrun{
cao$estimateClusterFreeDE()
cao$smoothClusterFreeZScores()
}

Method estimateGenePrograms()

Estimate Gene Programs based on cluster-free Z-scores

Usage
Cacoa$estimateGenePrograms(
  method = c("pam", "leiden", "fabia"),
  n.top.genes = Inf,
  genes = NULL,
  n.programs = 15,
  z.adj = FALSE,
  gene.selection = ifelse(z.adj, "z.adj", "z"),
  smooth = TRUE,
  abs.scores = FALSE,
  name = "gene.programs",
  cell.subset = NULL,
  n.cores = self$n.cores,
  verbose = self$verbose,
  max.z = 5,
  min.z = 0.5,
  min.change.frac = 0.01,
  de.name = "cluster.free.de",
  ...
)
Arguments
method

character String Method to use (default=c("pam", "leiden", "fabia"))

n.top.genes

(default=Inf)

genes

(default=NULL)

n.programs

maximal number of gene programs to find (parameter p for fabia). (default=15)

z.adj

boolean (default=FALSE)

gene.selection

character string Method to select top genes, "z" selects genes by cluster-free Z-score change, "lfc" uses log2(fold-change) instead, "expression" picks the most expressed genes and "od" picks overdispersed genes. Default: "z".

smooth

boolean (default=TRUE)

abs.scores

boolean (default=FALSE)

name

string Field name where the test results are stored

cell.subset

(default=NULL)

n.cores

integer Number of cores to use for parallelization (default=self$n.cores)

verbose

boolean Print messages (default=self$verbose)

max.z

numeric (default=5)

min.z

numeric (default=0.5)

min.change.frac

numeric (default=0.01)

de.name

character string (default="cluster.free.de")

...

keyword arguments forwarded to estimateGenePrograms

Returns

a list includes:

  • fabia: fabia::Factorization object, result of the fabia::fabia call

  • sample.ids: ids of the subsampled cells used for fabia estimates

  • scores.exact: vector of fabia estimates of gene program scores per cell. Estimated only for the subsampled cells.

  • scores.approx: vector of approximate gene program scores, estimated for all cells in the dataset

  • loadings: matrix with fabia gene loadings per program

  • gene.scores: list of vectors of gene scores per program. Contains only genes, selected for the program using fabia biclustering.

  • bi.clusts fabia biclustering information, result of the fabia::extractBic call

Examples
\dontrun{
cao$estimateClusterFreeDE()
cao$estimateGenePrograms()
}

Method plotGeneProgramScores()

Plot gene program scores

Usage
Cacoa$plotGeneProgramScores(
  name = "gene.programs",
  prog.ids = NULL,
  build.panel = TRUE,
  nrow = NULL,
  adj.list = NULL,
  legend.title = "Score",
  palette = NULL,
  min.genes.per.prog = 10,
  color.range = c("0.5%", "99.5%"),
  ...
)
Arguments
name

string Field name where the test results are stored

prog.ids

(default=NULL)

build.panel

boolean (default=TRUE)

nrow

(default=NULL)

adj.list

(default=NULL)

legend.title

character string (default="Score")

palette

(default=NULL)

min.genes.per.prog

numeric (default=10)

color.range

(default=c("0.5%", "99.5%"))

...

additional parameters

Returns

gene program scores

Examples
\dontrun{
cao$estimateClusterFreeDE()
cao$estimateGenePrograms()
cao$plotGeneProgramScores()
}

Method plotGeneProgramGenes()

Plot gene program genes

Usage
Cacoa$plotGeneProgramGenes(
  program.id,
  name = "gene.programs",
  ordering = c("similarity", "loading"),
  max.genes = 9,
  build.panel = TRUE,
  ncol = 3,
  plots = "z.adj",
  ...
)
Arguments
program.id

program id

name

string Field name where the test results are stored

ordering

character vector (default=c("similarity", "loading"))

max.genes

integer (default=9)

build.panel

boolean Plot in a grid (default=TRUE)

ncol

numeric Number of columns for build.panel (default=3)

plots

character string (default="z.adj")

...

additional parameters passed to plotGeneExpressionComparison()

Returns

plotGeneExpressionComparison

Examples
\dontrun{
cao$estimateClusterFreeDE()
cao$estimateGenePrograms()
cao$plotGeneProgramGenes(program.id = 1) # program.id is any gene program ID in 1:cao$test.results$gene.programs$n.progs
}

Method plotClusterFreeExpressionShifts()

Plot cluster-free expression shift z-scores

Usage
Cacoa$plotClusterFreeExpressionShifts(
  cell.groups = self$cell.groups,
  smooth = TRUE,
  plot.na = FALSE,
  name = "cluster.free.expr.shifts",
  scale.z.palette = TRUE,
  min.z = qnorm(0.9),
  color.range = c("0", "97.5%"),
  alpha = 0.2,
  font.size = c(3, 5),
  adj.list = NULL,
  palette = brewerPalette("YlOrRd", rev = FALSE),
  build.panel = TRUE,
  ...
)
Arguments
cell.groups

Indicates cell groups with cell names. Set to NULL if it shouldn't be shown. (default: stored vector)

smooth

boolean (default=TRUE)

plot.na

boolean (default=FALSE)

name

string Field name where the test results are stored

scale.z.palette

boolean (default=TRUE)

min.z

(default=qnorm(0.9))

color.range

(default=c("0", "97.5%"))

alpha

numeric (default=0.2)

font.size

size range for cell type labels

adj.list

(default=NULL)

palette

(default=brewerPalette("YlOrRd", rev=FALSE))

build.panel

boolean (default=TRUE)

...

parameters forwarded to embeddingPlot

Examples
\dontrun{
cao$estimateClusterFreeDE()
cao$estimateClusterFreeExpressionShifts()
cao$plotClusterFreeExpressionShifts()
}

Method plotMostChangedGenes()

Plot most changed genes

Usage
Cacoa$plotMostChangedGenes(
  n.top.genes,
  method = "z",
  min.z = 0.5,
  min.lfc = 1,
  max.score = 20,
  cell.subset = NULL,
  excluded.genes = NULL,
  build.panel = TRUE,
  ncol = 1,
  ...
)
Arguments
n.top.genes

numeric

method

character string (default='z')

min.z

numeric (default=0.5)

min.lfc

numeric (default=1)

max.score

numeric (default=20)

cell.subset

(default=NULL)

excluded.genes

(default=NULL)

build.panel

boolean Plot in grid (default=TRUE)

ncol

numeric Number of columns for build.panel (default=1)

...

additional parameters input to self$plotGeneExpressionComparison()

Returns

plot of the most changed genes via plotGeneExpressionComparison()

Examples
\dontrun{
cao$estimateClusterFreeDE()
cao$plotMostChangedGenes(n.top.genes = 10) # n.top.genes is any number of genes to plot
}

Method plotGeneExpressionComparison()

Plot gene expression comparison

Usage
Cacoa$plotGeneExpressionComparison(
  genes = NULL,
  scores = NULL,
  max.expr = "97.5%",
  plots = c("z.adj", "z", "expression"),
  min.z = qnorm(0.9),
  max.z = 4,
  max.z.adj = NULL,
  max.lfc = 3,
  smoothed = FALSE,
  gene.palette = dark.red.palette,
  z.palette = NULL,
  z.adj.palette = z.palette,
  lfc.palette = NULL,
  scale.z.palette = TRUE,
  plot.na = -1,
  adj.list = NULL,
  build.panel = TRUE,
  nrow = 1,
  ncol = 1,
  cell.subset = NULL,
  groups = NULL,
  subgroups = NULL,
  keep.limits = NULL,
  name = "cluster.free.de",
  ...
)
Arguments
genes

(default=NULL)

scores

(default=NULL)

max.expr

character string (default="97.5%")

plots

(default=c("z.adj", "z", "expression"))

min.z

(default=qname(0.9))

max.z

numeric (default=4)

max.z.adj

(default=NULL)

max.lfc

numeric (default=3)

smoothed

boolean (default=FALSE)

gene.palette

(default=dark.red.palette)

z.palette

(default=NULL)

z.adj.palette

(default=z.palette)

lfc.palette

(default=NULL)

scale.z.palette

boolean (default=TRUE)

plot.na

(default=-1)

adj.list

(default=NULL)

build.panel

boolean (default=TRUE)

nrow

numeric Number of rows for build.panel (default=1)

ncol

numeric Number of columns for build.panel (default = 1)

cell.subset

(default=NULL)

groups

(default=NULL)

subgroups

(default=NULL)

keep.limits

(default=NULL)

name

string Field name where the test results are stored

...

additional parameters

Returns

list

Examples
\dontrun{
cao$estimateClusterFreeDE()
cao$plotGeneExpressionComparison()
}

Method getConditionPerCell()

Get condition per cell

Usage
Cacoa$getConditionPerCell()
Returns

conditions per cell

Examples
\dontrun{
cao$getConditionPerCell()
}

Method getJointCountMatrix()

Get joint count matrix

Usage
Cacoa$getJointCountMatrix(force = FALSE, raw = TRUE)
Arguments
force

boolean, if TRUE the joint count matrix will be recalculated even though it already exists in self$cache (default=FALSE)

raw

boolean, return raw counts (default=TRUE)

Returns

joint count matrix

Examples
\dontrun{
cao$getJointCountMatrix()
}

Method getGOEnvironment()

Get GO environment

Usage
Cacoa$getGOEnvironment(org.db, verbose = FALSE, ignore.cache = NULL)
Arguments
org.db

object of class OrgDB from Bioconductor (e.g. org.Hs.eg.db::org.Hs.eg.db)

verbose

boolean, print progress (default=FALSE)

ignore.cache

ignore GO environments already in self$cache (default=NULL)

Returns

GO environment

Examples
\dontrun{
cao$getGOEnvironment(org.db = org.Hs.eg.db::org.Hs.eg.db)
}

Method clone()

The objects of this class are cloneable with this method.

Usage
Cacoa$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Examples


## ------------------------------------------------
## Method `Cacoa$new`
## ------------------------------------------------

# Is it highly recommended that sample.groups and cell.groups are assigned in the initialization call. 
# Here, "con" is a Conos object.
## Not run: 
sample.groups <- c("control","control","disease","disease")
names(sample.groups) <- names(con$samples)

## End(Not run)
# cell.groups should be a named factor where names are cell names corresponding to cell names in the data object. 
# For Conos objects, they should overlap with rownames(con$embedding)
## Not run: 
cell.groups <- my.named.annotation.factor
cao <- Cacoa$new(data.object = con, sample.groups = sample.groups, cell.groups =  ref.level = "control", target.level = "disease")

## End(Not run)

## ------------------------------------------------
## Method `Cacoa$estimateExpressionShiftMagnitudes`
## ------------------------------------------------

## Not run: 
cao$estimateExpressionShiftMagnitudes()

## End(Not run)

## ------------------------------------------------
## Method `Cacoa$plotExpressionShiftMagnitudes`
## ------------------------------------------------

## Not run: 
cao$estimateExpressionShiftMagnitudes()
cao$plotExpressionShiftMagnitudes()

## End(Not run)

## ------------------------------------------------
## Method `Cacoa$estimatePerCellTypeDE`
## ------------------------------------------------

## Not run: 
cao$estimatePerCellTypeDE() # Deprecated

## End(Not run)

## ------------------------------------------------
## Method `Cacoa$estimateDEPerCellType`
## ------------------------------------------------

## Not run: 
cao$estimateDEPerCellType()

## End(Not run)

## ------------------------------------------------
## Method `Cacoa$estimateDEStabilityPerCellType`
## ------------------------------------------------

## Not run: 
cao$estimateDEPerCellType()
cao$estimateDEStabilityPerCellType()

## End(Not run)

## ------------------------------------------------
## Method `Cacoa$estimateDEStabilityPerGene`
## ------------------------------------------------

## Not run: 
cao$estimateDEPerCellType()
cao$estimateDEStabilityPerGene()

## End(Not run)

## ------------------------------------------------
## Method `Cacoa$plotDEStabilityPerCellType`
## ------------------------------------------------

## Not run: 
cao$estimateDEPerCellType()
cao$estimateDEStability()
cao$plotDEStabilityPerCellType)

## End(Not run)

## ------------------------------------------------
## Method `Cacoa$plotDEStabilityPerGene`
## ------------------------------------------------

## Not run: 
cao$estimateDEPerCellType()
cao$estimateDEStabilityPerGene()
cao$plotDEStabilityPerGene()

## End(Not run)

## ------------------------------------------------
## Method `Cacoa$plotNumberOfDEGenes`
## ------------------------------------------------

## Not run: 
cao$estimateDEPerCellType()
cao$plotNumberOfDEGenes()

## End(Not run)

## ------------------------------------------------
## Method `Cacoa$saveDeAsJson`
## ------------------------------------------------

## Not run: 
cao$estimateDEPerCellType()
cao$saveDeAsJson()

## End(Not run)

## ------------------------------------------------
## Method `Cacoa$plotEmbedding`
## ------------------------------------------------

## Not run: 
cao$plotEmbedding()

## End(Not run)

## ------------------------------------------------
## Method `Cacoa$estimateOntology`
## ------------------------------------------------

## Not run: 
cao$estimateDEPerCellType()
library(org.Hs.eg.db)
cao$estimateOntology(type = "GSEA", org.db = org.Hs.eg.db)

## End(Not run)

## ------------------------------------------------
## Method `Cacoa$estimateOntologyFamilies`
## ------------------------------------------------

## Not run: 
cao$estimateDEPerCellType()
cao$estimateOntology(name = "GSEA")
cao$estimateOntologyFamilies(name = "GSEA")

## End(Not run)

## ------------------------------------------------
## Method `Cacoa$getFamiliesPerGO`
## ------------------------------------------------

## Not run: 
cao$estimateDEPerCellType()
cao$estimateOntology(name = "GSEA")
cao$estimateOntologyFamilies(name = "GSEA")
cao$getFamiliesPerGO(name = "GSEA", go.term = "antigen presentation") # Either go.term og go.id has to be specified 

## End(Not run)

## ------------------------------------------------
## Method `Cacoa$plotNumOntologyTermsPerType`
## ------------------------------------------------

## Not run: 
cao$estimateDEPerCellType()
cao$estimateOntology(name = "GSEA")
cao$plotNumOntologyTermsPerType()

## End(Not run)

## ------------------------------------------------
## Method `Cacoa$plotOntology`
## ------------------------------------------------

## Not run: 
cao$estimateDEPerCellType()
cao$estimateOntology(name = "GSEA")
cao$plotOntology(name = "GSEA", cell.type = "Neurons") # "cell.type" is a cell type in self$cell.groups used for calculating ontologies

## End(Not run)

## ------------------------------------------------
## Method `Cacoa$plotOntologyHeatmap`
## ------------------------------------------------

## Not run: 
cao$estimateDEPerCellType()
cao$estimateOntology(name = "GSEA")
cao$plotOntologyHeatmap()

cao$estimateOntologyFamilies(name = "GSEA")
cao$plotOntologyHeatmap(name = "GSEA", only.family.children = TRUE)

## End(Not run)

## ------------------------------------------------
## Method `Cacoa$plotOntologyHeatmapCollapsed`
## ------------------------------------------------

## Not run: 
cao$estimateDEPerCellType()
cao$estimateOntology(name = "GSEA")
cao$plotOntologyHeatmapCollapsed(name = "GSEA")

cao$estimateOntologyFamilies(name = "GSEA")
cao$plotOntologyHeatmapCollapsed(name = "GSEA", only.family.children = TRUE)

## End(Not run)

## ------------------------------------------------
## Method `Cacoa$plotOntologySimilarities`
## ------------------------------------------------

## Not run: 
cao$estimateDEPerCellType()
cao$estimateOntology()
cao$plotOntologySimilarities()

## End(Not run)

## ------------------------------------------------
## Method `Cacoa$plotOntologyFamily`
## ------------------------------------------------

## Not run: 
cao$estimateDEPerCellType()
cao$estimateOntology(name = "GSEA")
cao$estimateOntologyFamilies(name = "GSEA")
cao$plotOntologyFamily(name = "GSEA", cell.type = "Neurons") # "cell.type" is a cell type in self$cell.groups used for calculating ontologies

## End(Not run)

## ------------------------------------------------
## Method `Cacoa$saveOntologyAsTable`
## ------------------------------------------------

## Not run: 
cao$estimateDEPerCellType()
cao$estimateOntology(name = "GSEA")
cao$saveOntologyAsTable(name = "GSEA", file = "Ontologies.tsv")

## End(Not run)

## ------------------------------------------------
## Method `Cacoa$saveFamiliesAsTable`
## ------------------------------------------------

## Not run: 
cao$estimateDEPerCellType()
cao$estimateOntology(name = "GSEA")
cao$estimateOntologyFamilies(name = "GSEA")
cao$saveFamiliesAsTable(name = "GSEA", file = "Families.tsv")

## End(Not run)

## ------------------------------------------------
## Method `Cacoa$plotCellGroupSizes`
## ------------------------------------------------

## Not run: 
cao$plotCellGroupSizes()

## End(Not run)

## ------------------------------------------------
## Method `Cacoa$plotCellGroupAbundanceVariation`
## ------------------------------------------------

## Not run: 
cao$plotCellGroupAbundanceVariation()

## End(Not run)

## ------------------------------------------------
## Method `Cacoa$plotCodaSpace`
## ------------------------------------------------

## Not run: 
cao$estimateCellLoadings()
cao$plotCodaSpace()

## End(Not run)

## ------------------------------------------------
## Method `Cacoa$plotContrastTree`
## ------------------------------------------------

## Not run: 
cao$estimateCellLoadings()
cao$plotContratsTree()

## End(Not run)

## ------------------------------------------------
## Method `Cacoa$plotCompositionSimilarity`
## ------------------------------------------------

## Not run: 
cao$estimateCellLoadings()
cao$plotCompositionSimilarity()

## End(Not run)

## ------------------------------------------------
## Method `Cacoa$estimateCellLoadings`
## ------------------------------------------------

## Not run: 
cao$estimateCellLoadings()

## End(Not run)

## ------------------------------------------------
## Method `Cacoa$plotCellLoadings`
## ------------------------------------------------

## Not run: 
cao$estimateCellLoadings()
cao$plotCellLoadings()

## End(Not run)

## ------------------------------------------------
## Method `Cacoa$estimateCellDensity`
## ------------------------------------------------

## Not run: 
cao$estimateCellDensity()

## End(Not run)

## ------------------------------------------------
## Method `Cacoa$plotCellDensity`
## ------------------------------------------------

## Not run: 
cao$estimateCellDensity()
cao$plotCellDensity()

## End(Not run)

## ------------------------------------------------
## Method `Cacoa$plotCellDensityVariation`
## ------------------------------------------------

## Not run: 
cao$estimateCellDensity(estimate.variation=TRUE)
cao$plotCellDensityVariation()

## End(Not run)

## ------------------------------------------------
## Method `Cacoa$estimateDiffCellDensity`
## ------------------------------------------------

## Not run: 
cao$estimateCellDensity()
cao$estimateDiffCellDensity()

## End(Not run)

## ------------------------------------------------
## Method `Cacoa$plotDiffCellDensity`
## ------------------------------------------------

## Not run: 
cao$estimateCellDensity()
cao$estimateDiffCellDensity()
cao$plotDiffCellDensity()

## End(Not run)

## ------------------------------------------------
## Method `Cacoa$plotExpressionDistance`
## ------------------------------------------------

## Not run: 
cao$estimateExpressionShiftMagnitudes()
cao$plotExpressionDistance()

## End(Not run)

## ------------------------------------------------
## Method `Cacoa$getSampleDistanceMatrix`
## ------------------------------------------------

## Not run: 
cao$getSampleDistanceMatrix()

## End(Not run)

## ------------------------------------------------
## Method `Cacoa$plotSampleDistances`
## ------------------------------------------------

## Not run: 
cao$estimateExpressionShiftMagnitudes()
cao$plotSampleDistances()

## End(Not run)

## ------------------------------------------------
## Method `Cacoa$estimateMetadataSeparation`
## ------------------------------------------------

## Not run: 
cao$estimateExpressionShiftMagnitudes() # or estimateCellLoadings()
cao$estimateMetadataSeparation(sample.meta = meta.data) # meta.data is a list or data.frame with metadata per sample

## End(Not run)

## ------------------------------------------------
## Method `Cacoa$plotMetadataSeparation`
## ------------------------------------------------

## Not run: 
cao$estimateExpressionShiftMagnitudes() # or estimateCellLoadings()
cao$estimateMetadataSeparation(sample.meta = meta.data)
cao$plotMetadataSeparation()

## End(Not run)

## ------------------------------------------------
## Method `Cacoa$estimateClusterFreeDE`
## ------------------------------------------------

## Not run: 
cao$estimateClusterFreeDE()

## End(Not run)

## ------------------------------------------------
## Method `Cacoa$getMostChangedGenes`
## ------------------------------------------------

## Not run: 
cao$estimateClusterFreeDE()
cao$getMostChangedGenes(n = 10) # n can be any number of genes to extract

## End(Not run)

## ------------------------------------------------
## Method `Cacoa$estimateClusterFreeExpressionShifts`
## ------------------------------------------------

## Not run: 
cao$estimateClusterFreeDE()
cao$estimateClusterFreeExpressionShifts()

## End(Not run)

## ------------------------------------------------
## Method `Cacoa$smoothClusterFreeZScores`
## ------------------------------------------------

## Not run: 
cao$estimateClusterFreeDE()
cao$smoothClusterFreeZScores()

## End(Not run)

## ------------------------------------------------
## Method `Cacoa$estimateGenePrograms`
## ------------------------------------------------

## Not run: 
cao$estimateClusterFreeDE()
cao$estimateGenePrograms()

## End(Not run)

## ------------------------------------------------
## Method `Cacoa$plotGeneProgramScores`
## ------------------------------------------------

## Not run: 
cao$estimateClusterFreeDE()
cao$estimateGenePrograms()
cao$plotGeneProgramScores()

## End(Not run)

## ------------------------------------------------
## Method `Cacoa$plotGeneProgramGenes`
## ------------------------------------------------

## Not run: 
cao$estimateClusterFreeDE()
cao$estimateGenePrograms()
cao$plotGeneProgramGenes(program.id = 1) # program.id is any gene program ID in 1:cao$test.results$gene.programs$n.progs

## End(Not run)

## ------------------------------------------------
## Method `Cacoa$plotClusterFreeExpressionShifts`
## ------------------------------------------------

## Not run: 
cao$estimateClusterFreeDE()
cao$estimateClusterFreeExpressionShifts()
cao$plotClusterFreeExpressionShifts()

## End(Not run)

## ------------------------------------------------
## Method `Cacoa$plotMostChangedGenes`
## ------------------------------------------------

## Not run: 
cao$estimateClusterFreeDE()
cao$plotMostChangedGenes(n.top.genes = 10) # n.top.genes is any number of genes to plot

## End(Not run)

## ------------------------------------------------
## Method `Cacoa$plotGeneExpressionComparison`
## ------------------------------------------------

## Not run: 
cao$estimateClusterFreeDE()
cao$plotGeneExpressionComparison()

## End(Not run)

## ------------------------------------------------
## Method `Cacoa$getConditionPerCell`
## ------------------------------------------------

## Not run: 
cao$getConditionPerCell()

## End(Not run)

## ------------------------------------------------
## Method `Cacoa$getJointCountMatrix`
## ------------------------------------------------

## Not run: 
cao$getJointCountMatrix()

## End(Not run)

## ------------------------------------------------
## Method `Cacoa$getGOEnvironment`
## ------------------------------------------------

## Not run: 
cao$getGOEnvironment(org.db = org.Hs.eg.db::org.Hs.eg.db)

## End(Not run)

kharchenkolab/cacoa documentation built on Nov. 8, 2024, 6:06 a.m.