log2_FC: Compute FCs and log2-FCs.

Description Usage Arguments Value Author(s) See Also Examples

View source: R/log2_FC.R

Description

log2_FC extends the results obtained via distinct_test, by computing fold changes (FC) and log2-FC between conditions.

Usage

1
2
3
4
5
6
7
log2_FC(
  res,
  x,
  name_assays_expression = "cpm",
  name_group = "group_id",
  name_cluster = "cluster_id"
)

Arguments

res

a data.frame with results as returned from distinct_test.

x

a linkS4class{SummarizedExperiment} or a linkS4class{SingleCellExperiment} object.

name_assays_expression

a character ("cpm" by default), indicating the name of the assays(x) element which stores the expression data (i.e., assays(x)$name_assays_expression). We strongly encourage using normalized data, such as counts per million (CPM). Do not use logarithm transformed data to compute FCs.

name_group

a character ("group_id" by default), indicating the name of the colData(x) element which stores the group id of each cell (i.e., colData(x)$name_group).

name_cluster

a character ("cluster_id" by default), indicating the name of the colData(x) element which stores the cluster id of each cell (i.e., colData(x)$name_cluster).

Value

A data.frame object, extending the results in 'res'. Two additional columns are added: FC_group1/group2 and log2FC_group1/group2, inicating the FC and log2-FC of group1/group2. A FC > 1 (or log2FC > 0) indicates up-regulation of group1 (compared to group2); while a FC < 1 (or log2FC < 0) indicates down-regulation of group1 (compared to group2).

Author(s)

Simone Tiberi simone.tiberi@uzh.ch

See Also

distinct_test, top_results

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# load pre-computed results (obtaines via `distinct_test`)
data("res", package = "distinct")
# load the input data:
data("Kang_subset", package = "distinct")

# We can optionally add the fold change (FC) and log2-FC between groups:
res = log2_FC(res = res,
  x = Kang_subset, 
  name_assays_expression = "cpm",
  name_group = "stim",
  name_cluster = "cell")

# Visualize significant results:
head(top_results(res))

distinct documentation built on Nov. 8, 2020, 8:20 p.m.