Description Usage Arguments Details Value Examples
Show table of results for top (most highly significant) clusters or cluster-marker combinations
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
res |
Output object from either the |
d_counts |
(Optional) |
d_medians |
(Optional) |
order |
Whether to order results by values in column |
order_by |
Name of column to use to order rows by values, if |
all |
Whether to display all clusters or cluster-marker combinations (instead of
top |
top_n |
Number of clusters or cluster-marker combinations to display (if |
show_counts |
Whether to display cluster cell counts by sample (from
|
show_props |
Whether to display cluster cell count proportions by sample
(calculated from |
show_meds |
Whether to display median expression values for each cluster-marker
combination (from |
show_logFC |
Whether to display log fold change (logFC) values. Default = FALSE. |
show_all_cols |
Whether to display all columns from output object (e.g. logFC, logCPM, LR, etc.) Default = FALSE. |
sort_cols |
Whether to sort columns of counts, proportions, and medians; by levels
of factor |
format_vals |
Whether to display rounded values in numeric columns. This improves readability of the summary table, but should not be used when exact numeric values are required for subsequent steps (e.g. plotting). Default = FALSE. |
digits |
Number of significant digits to show, if |
Summary function to display table of results for top (most highly significant) detected clusters or cluster-marker combinations.
The differential testing functions return results in the form of p-values and adjusted
p-values for each cluster (DA tests) or cluster-marker combination (DS tests), which
can be used to rank the clusters or cluster-marker combinations by their evidence for
differential abundance or differential states. The p-values and adjusted p-values are
stored in the rowData
of the output SummarizedExperiment
object
generated by the testing functions.
This function displays a summary table of results. By default, the top_n
clusters or cluster-marker combinations are shown, ordered by adjusted p-values.
Optionally, cluster counts, proportions, and median expression by cluster-marker
combination can also be included. The format_vals
and digits
arguments
can be used to display rounded values to improve readability of the summary table.
Returns a DataFrame
table of results for the top_n
clusters or cluster-marker combinations, ordered by values in column order_by
(default: adjusted p-values). Optionally, cluster counts, proportions, and median
expression by cluster-marker combination are also included.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | # For a complete workflow example demonstrating each step in the 'diffcyt' pipeline,
# see the package vignette.
# Function to create random data (one sample)
d_random <- function(n = 20000, mean = 0, sd = 1, ncol = 20, cofactor = 5) {
d <- sinh(matrix(rnorm(n, mean, sd), ncol = ncol)) * cofactor
colnames(d) <- paste0("marker", sprintf("%02d", 1:ncol))
d
}
# Create random data (without differential signal)
set.seed(123)
d_input <- list(
sample1 = d_random(),
sample2 = d_random(),
sample3 = d_random(),
sample4 = d_random()
)
# Add differential abundance (DA) signal
ix_DA <- 801:900
ix_cols_type <- 1:10
d_input[[3]][ix_DA, ix_cols_type] <- d_random(n = 1000, mean = 2, ncol = 10)
d_input[[4]][ix_DA, ix_cols_type] <- d_random(n = 1000, mean = 2, ncol = 10)
# Add differential states (DS) signal
ix_DS <- 901:1000
ix_cols_DS <- 19:20
d_input[[1]][ix_DS, ix_cols_type] <- d_random(n = 1000, mean = 3, ncol = 10)
d_input[[2]][ix_DS, ix_cols_type] <- d_random(n = 1000, mean = 3, ncol = 10)
d_input[[3]][ix_DS, c(ix_cols_type, ix_cols_DS)] <- d_random(n = 1200, mean = 3, ncol = 12)
d_input[[4]][ix_DS, c(ix_cols_type, ix_cols_DS)] <- d_random(n = 1200, mean = 3, ncol = 12)
experiment_info <- data.frame(
sample_id = factor(paste0("sample", 1:4)),
group_id = factor(c("group1", "group1", "group2", "group2")),
stringsAsFactors = FALSE
)
marker_info <- data.frame(
channel_name = paste0("channel", sprintf("%03d", 1:20)),
marker_name = paste0("marker", sprintf("%02d", 1:20)),
marker_class = factor(c(rep("type", 10), rep("state", 10)),
levels = c("type", "state", "none")),
stringsAsFactors = FALSE
)
# Create design matrix
design <- createDesignMatrix(experiment_info, cols_design = "group_id")
# Create contrast matrix
contrast <- createContrast(c(0, 1))
# Test for differential abundance (DA) of clusters (using default method 'diffcyt-DA-edgeR')
out_DA <- diffcyt(d_input, experiment_info, marker_info,
design = design, contrast = contrast,
analysis_type = "DA", method_DA = "diffcyt-DA-edgeR",
seed_clustering = 123, verbose = FALSE)
# Test for differential states (DS) within clusters (using default method 'diffcyt-DS-limma')
out_DS <- diffcyt(d_input, experiment_info, marker_info,
design = design, contrast = contrast,
analysis_type = "DS", method_DS = "diffcyt-DS-limma",
seed_clustering = 123, verbose = FALSE)
# Display results for top DA clusters
topTable(out_DA, format_vals = TRUE)
# Display results for top DS cluster-marker combinations
topTable(out_DS, format_vals = TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.