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

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


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 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 (default=10)

min.samp.per.type

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

min.gene.frac

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

ref.level

reference sample group level (default=self$ref.level)

sample.groups

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

verbose

boolean Whether to show progress

n.cores

numeric Number of cores for parallelization

name

string Field name where the test results are stored

n.permutations

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

genes

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

n.pcs

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.gorup.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

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


Method plotExpressionShiftMagnitudes()

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

string Field name where the test results are stored

type
  • type of a plot "bar" (default) or "box"

notch

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

show.jitter

boolean Whether to show indivudal 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


Method estimatePerCellTypeDE()

Alias for estimateDEPerCellType

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

parameters fed to estimateDEPerCellType

Returns

A list of DE genes Estimate differential gene expression per cell type between conditions


Method estimateDEPerCellType()

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,
  ...
)
Arguments
cell.groups

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

sample.groups

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

ref.level

reference sample group level (default=self$ref.level)

target.level

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

name

string Field name where the test results are stored

test

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

resampling.method

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

numeric (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

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'.

...

additional parameters

Returns

A list of DE genes Estimate DE stability per cell type


Method estimateDEStabilityPerCellType()

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

character string Results slot name (default='de')

name

string Field name where the test results are stored

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 Estimate DE stability per gene


Method estimateDEStabilityPerGene()

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

character string Results slot name (default='de')

top.n.genes

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

p.adj

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 Plot DE stability per cell type


Method plotDEStabilityPerCellType()

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

string Field name where the test results are stored

notch

boolean Whether (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

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

pallete

color palette for the cell.groups (default: stored value)

set.fill

boolean Whether to fill the boxes based on cell type (default=TRUE)

Returns

A ggplot2 object Plot DE stability per gene


Method plotDEStabilityPerGene()

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

string Field name where the test results are stored

cell.type

(default=NULL)

stability.score

character string (default='stab.median.rank')

Returns

A ggplot2 object Plot number of significant DE genes


Method plotNumberOfDEGenes()

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 (default='bar')

notch

boolean Whether to show notches (default=TRUE)

...

additional parameters passed to plotMeanMedValuesPerCellType()

Returns

A ggplot2 object Make volcano plots


Method plotVolcano()

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

string Field name where the test results are stored

cell.types

(default=NULL)

palette

(default=NULL)

build.panel

boolean (default=TRUE)

n.col

numeric Number of columns (default=3)

color.var

character strign (default='CellFrac')

...

additional parameters fed to plotVolcano

Returns

A ggplot2 object Save DE results as JSON files


Method saveDEasJSON()

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

Prefix for created files (default=NULL)

dir.name

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

de.raw

List of DE results

sample.groups

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

de.name

character string (default='de')

ref.level

reference sample group level (default=self$ref.level)

gene.metadata

(default=NULL)

verbose

boolean Whether to show progress

Returns

saved JSON object Plot embedding


Method plotEmbedding()

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 Estimate ontology terms based on DEs


Method estimateOntology()

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

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

name

string Field name where the test results are stored

de.name

character string (default='de.name')

org.db

Organism database, e.g., org.Hs.eg.db for human or 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 Estimate ontology families based on ontology results


Method estimateOntologyFamilies()

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

string Field name where the test results are stored

p.adj

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

Returns

List of families and ontology data per cell type Identify families containing a specific ontology term or ID


Method getFamiliesPerGO()

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

string Field name where the test results are stored

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 Bar plot of ontology terms per cell type


Method plotNumOntologyTermsPerType()

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

string Field name where the test results are stored

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)

q.value

numeric (default=0.2)

min.genes

integer (default=1)

Returns

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


Method plotOntology()

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

string Field name where the test results are stored

plot

chracter string Type of plot to return (default="dot"). Either

genes

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

subtype

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

n

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

p.adj

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

min.genes

integer Minimum genes (default=1)

...

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

cell.subgroup

Cell group to plot

Returns

A ggplot2 object Plot a heatmap of ontology P values per cell type


Method plotOntologyHeatmap()

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 (default=10)

only.family.children

boolean (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 for calculating adjusted p-values (default="BH")

palette

(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 Plot a heatmap of ontology p-values per cell type heatmap, collapsed


Method plotOntologyHeatmapCollapsed()

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

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

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

p.adj

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

q.value

numeric (default=0.2)

min.genes

integer (default=1)

n

integer (default=20)

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

max.log.p

numeric (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 Plot correlation matrix for ontology terms between cell types


Method plotOntologySimilarities()

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

string Field name where the test results are stored

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)

q.value

numeric (default=0.2)

min.genes

numeric (default=1)

Returns

A ggplot2 object Plot related ontologies in one hierarchical network plot


Method plotOntologyFamily()

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

string Field name where the test results are stored

cell.type

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

Only for GO results: Type of result, must be "BP", "MF", or "CC" (default="BP")

plot.type

How much of the family network should be plotted. 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

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

legend.label.size

Size og legend labels (default: 1)

legend.position

Position of legend (default: topright)

verbose

boolean Whether to show progress

n.cores

numeric Number of cores for parallelization

...

additional parameters passed to plotOntologyFamily

Returns

Rgraphviz object Save ontology results as a table


Method saveOntologyAsTable()

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

Only for GO results: 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

Separator (default: tab)

...

additional arguments passed to write.table()

Returns

table for import into text editor Save family results as a table


Method saveFamiliesAsTable()

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

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

genes

Only for GO results: 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

Separator (default=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 Plot the cell group sizes or proportions per sample


Method plotCellGroupSizes()

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

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

show.significance

whether to show statistical significance betwwen sample groups. wilcox.test was used; (* < 0.05; ** < 0.01; *** < 0.001)

filter.empty.cell.types

boolean (default=TRUE)

proportions

boolean Whether to 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 Plot the cell group sizes or proportions per sample


Method plotCellGroupAbundanceVariation()

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

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

type

character string (default='mad')

rotate.xticks

boolean (deafult=TRUE)

min.rel.abundance

numeric (default=0.05)

Returns

ggplot2 object Plot compositions in CoDA space (PCA or CDA)


Method plotCodaSpace()

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

either 'PCA' or 'CDA'

cell.groups

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

font.size

numeric (default=3)

cells.to.remain

(default=NULL)

cells.to.remove

(default=NULL)

samples.to.remove

(default=NULL)

palette

(self$sample.groups.palette)

Returns

A ggplot2 object Plot contrast tree


Method plotContrastTree()

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

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

palette

(default=self$sample.groups.palette)

name

string Field name where the test results are stored

cells.to.remain

(default=NULL)

cells.to.remove

(default=NULL)

filter.empty.cell.types

boolean (default=TRUE)

adjust.pvalues

boolean (default=TRUE)

h.method

(default=c('both', 'up', 'down'))

reorder.tree

boolean (default=TRUE)

...

additional parameters

Returns

A ggplot2 object Plot composition similarity


Method plotCompositionSimilarity()

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

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

cells.to.remain

cells to remain

cells.to.remove

cells to remove

palette

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

...

parameters passed to plotHeatmap()

Returns

A ggplot2 object Estimate cell loadings


Method estimateCellLoadings()

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
)
Arguments
n.boot

numeric (default=1000)

ref.cell.type

(default=NULL)

name

string Field name where the test results are stored

n.seed

numeric (default=239)

cells.to.remove

vector (default=NULL)

cells.to.remain

vector (default=NULL)

samples.to.remove

vector (default=NULL)

filter.empty.cell.types

vector (default=NULL)

n.cores

numeric Number of cores for parallelization

verbose

boolean Whether to show progress

Returns

resulting cell loadings Plot Loadings


Method plotCellLoadings()

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

numeric (default=0.01)

palette

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

font.size

(default=NULL)

name

string Field name where the test results are stored

ordering

character string (default='pvalue')

show.pvals

boolean (default=TRUE)

...

additional parameters plotCellLoadings()

Returns

A ggplot2 object Estimate cell density in giving embedding


Method estimateCellDensity()

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 (default=TRUE)

sample.groups

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

verbose

boolean Whether to show progress

n.cores

numeric Number of cores for parallelization

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 Plot cell density depending on the method that was used for estimating cao$test.resulst[[name]]


Method plotCellDensity()

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 (default=0.1)

show.legend

boolean (default=FALSE)

palette

(default=NULL)

point.col

character string (default='#313695')

contours

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

contour.color

color for contour line (default='black')

contour.conf

confidence interval of contour (default='10%')

name

string Field name where the test results are stored

show.cell.groups

boolean (default=TRUE)

cell.groups

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

font.size

(default=c(2, 4))

color.range

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

...

plot style parameters forwarded to sccore::styleEmbeddingPlot.

Returns

A ggplot2 object Plot cell density variation


Method plotCellDensityVariation()

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

character string (default='mad')

plot.type

character string (default='embedding')

name

string Field name where the test results are stored

cutoff

(default=NULL)

condition

character vector (default=c('both', 'ref', 'target'))

...

additional arguments

Returns

ggplot2 object Estimate differential cell density


Method estimateDiffCellDensity()

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

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

adjust.pvalues

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

name

string Field name where the test results are stored

n.permutations

numeric (default=400)

smooth

boolean (default=TRUE)

verbose

boolean Whether to show progress

n.cores

numeric Number of cores for parallelization

...

additional arguments to the function

Returns

estimated differential cell densities Estimate differential cell density


Method plotDiffCellDensity()

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

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

name

string Field name where the test results are stored

size

numeric (default=0.2)

palette

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

adjust.pvalues

(default=NULL)

contours

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

contour.color

color for contour line (default: 'black')

contour.conf

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

plot.na

boolean (default=FALSE)

color.range

(default=NULL)

mid.color

character string (default='gray95')

scale.z.palette

(default=adjust.pvalues)

min.z

(default=qnorm(0.9))

...

additional parameters

Returns

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


Method plotExpressionDistance()

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

string Field name where the test results are stored

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

(default=self$sample.groups.palette)

show.significance

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 Plot inter-sample expression distance. The inputs to this function are the results from cao$estimateExpressionShiftMagnitudes()


Method getSampleDistanceMatrix()

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

(default=c('expression.shifts', 'coda', 'pseudo.bulk'))

cell.type

(default=NULL)

dist

(default=NULL)

name

string Field name where the test results are stored

verbose

boolean Whether to show progress

...

additional arguments

Returns

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


Method plotSampleDistances()

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,
  ...
)
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)

...

additional parameters passed to plotSampleDistanceMatrix()

Returns

A ggplot2 object Estimate metadata separation


Method estimateMetadataSeparation()

Usage
Cacoa$estimateMetadataSeparation(
  sample.meta,
  space = "expression.shifts",
  dist = NULL,
  space.name = NULL,
  name = "metadata.separation",
  n.permutations = 5000,
  trim = 0.05,
  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

space

(default="expression shifts")

dist

(default=NULL)

space.name

(default=NULL)

name

string Field name where the test results are stored

n.permutations

(default=5000)

trim

(default=0.05)

show.warning

boolean (default=TRUE)

verbose

boolean Whether to show progress

n.cores

numeric Number of cores for parallelization

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 Estimate differential expression Z-scores between two conditions per individual cell


Method estimateClusterFreeDE()

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

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

min.n.obs.per.samp

minimul 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 Whether to show progress

n.cores

numeric Number of cores for parallelization

name

string Field name where the test results are stored

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. Get most changed genes


Method getMostChangedGenes()

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

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

min.z

numeric (default=0.5)

min.lfc

numeric (default=1)

max.score

numeric (default=20)

cell.subset

(default=NULL)

excluded.genes

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

included.genes

(default=NULL)

name

string Field name where the test results are stored

Returns

results Estimate Cluster-free Expression Shift


Method estimateClusterFreeExpressionShifts()

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 (default=NULL)

n.permutations

numeric (default=500)

verbose

boolean Whether to show progress

n.cores

numeric Number of cores for parallelization

min.edge.weight

numeric (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. Performs graph smoothing of the cluster-free DE Z-scores


Method smoothClusterFreeZScores()

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 (default=1000)

smoothing

beta parameter of the heatFilter. (default=20)

filter

graph filter function. (default=NULL)

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".

excluded.genes

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

n.cores

numeric Number of cores for parallelization

verbose

boolean Whether to show progress

name

string Field name where the test results are stored

...

parameters forwarded to smoothSignalOnGraph

exluded.genes

(default=NULL)

Returns

Sparse matrix of smoothed Z-scores. Results are also stored in the cluster.free.de$z.smoothed field. Estimate Gene Programs based on cluster-free Z-scores on a subsample of cells using fabia. # TODO: update it


Method estimateGenePrograms()

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

numeric Number of cores for parallelization

verbose

boolean Whether to show progress

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 usin fabia biclustering.

  • bi.clusts fabia biclustering information, result of the fabia::extractBic call Plot gene program scores


Method plotGeneProgramScores()

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

Plot gene program genes


Method plotGeneProgramGenes()

Usage
Cacoa$plotGeneProgramGenes(
  program.id,
  name = "gene.programs",
  ordering = c("similarity", "loading"),
  max.genes = 9,
  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)

plots

character string (default="z.adj")

...

additional parameters passed to plotGeneExpressionComparison()

Returns

plotGeneExpressionComparison Plot cluster-free expression shift z-scores


Method plotClusterFreeExpressionShifts()

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 Plot most changed genes


Method plotMostChangedGenes()

Usage
Cacoa$plotMostChangedGenes(
  n.top.genes,
  method = "z",
  min.z = 0.5,
  min.lfc = 1,
  max.score = 20,
  cell.subset = NULL,
  excluded.genes = NULL,
  ...
)
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

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

...

additional parameters input to self$plotGeneExpressionComparison()

Returns

plot of the most changed genes via plotGeneExpressionComparison() Plot gene expression comparison


Method plotGeneExpressionComparison()

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,
  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

(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 Get condition per cell


Method getConditionPerCell()

Usage
Cacoa$getConditionPerCell()
Returns

conditions per cell Get joint count matrix


Method getJointCountMatrix()

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

boolean (default=FALSE)

raw

boolean (default=TRUE)

Returns

joint count matrix Get GO environment


Method getGOEnvironment()

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)

verbose

boolean Whether to show progress

ignore.cache

(default=NULL)

Returns

GO environment


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.


kharchenkolab/cacoa documentation built on May 10, 2022, 3:42 a.m.