| Title: | Time-course Differential Expression analysis of omics data |
|---|---|
| Description: | TiDEomics provides tools for time-course omics data analysis, focusing on differential expression across multiple experimental groups (>2 conditions). The package implements workflows for quality control, data processing, and analysis of temporal patterns, enabling integrated analysis of all groups in addition to pairwise comparisons. It supports datasets with missing values, including mass spectrometry-based proteomics, and operates on SummarizedExperiment objects to ensure compatibility with the Bioconductor ecosystem. |
| Authors: | Tianen He [aut, cre] (ORCID: <https://orcid.org/0000-0001-6864-0723>) |
| Maintainer: | Tianen He <[email protected]> |
| License: | GPL (>= 2) |
| Version: | 0.99.1 |
| Built: | 2026-06-09 16:41:18 UTC |
| Source: | https://github.com/BiocStaging/TiDEomics |
Calculate randomness p-value, maximum fold change along time course, and ratio of expressed time points for each feature in each group, based on the mean of replicates at each time point.
calc_feature_property(se_obj_merged_list, threshold = NULL)calc_feature_property(se_obj_merged_list, threshold = NULL)
se_obj_merged_list |
A list of SummarizedExperiment objects created
by |
threshold |
A numeric value to determine whether a feature is "expressed" in samples. (default is NULL, meaning any non-NA value is considered expressed). |
A list of SummarizedExperiment objects, each corresponding to one group, with updated rowData containing the following columns: Feature, Group, Exp_threshold, T_exp (number of time points with values > Exp_threshold), T_total (total number of time points), P_trend (p-value from Bartels' test for randomness against a trend), Max_FC (maximum fold change across time points), Max_FC_time (difference between the time points at which maximum and minimum expression occur; positive if max occurs after min, negative otherwise), Exp_ratio (T_exp / T_total).
data("example") example_obj <- normalise_to_start(example_obj) example_obj_list <- split_groups(example_obj) example_obj_merged_list <- merge_replicates(example_obj_list) example_obj_merged_list <- calc_feature_property(example_obj_merged_list, threshold = 0) property_random_fc <- summarise_feature_property(example_obj_merged_list)data("example") example_obj <- normalise_to_start(example_obj) example_obj_list <- split_groups(example_obj) example_obj_merged_list <- merge_replicates(example_obj_list) example_obj_merged_list <- calc_feature_property(example_obj_merged_list, threshold = 0) property_random_fc <- summarise_feature_property(example_obj_merged_list)
Calculate mean and standard deviation for each group and time point
calc_mean_sd(se_obj)calc_mean_sd(se_obj)
se_obj |
A SummarizedExperiment object with assays containing expression data. The first assay should be the original data, and the second (if present) should be normalized data. |
A list containing two data frames: one for original values and one for normalized values (if available). Each data frame includes columns for Mean, SD, Group, Time, and Feature.
data("example") table_mean_sd_list <- calc_mean_sd(example_obj) table_mean_sd <- table_mean_sd_list$norm0 plot_trend(table_mean_sd, features = sample(unique(table_mean_sd$Feature), 4))data("example") table_mean_sd_list <- calc_mean_sd(example_obj) table_mean_sd <- table_mean_sd_list$norm0 plot_trend(table_mean_sd, features = sample(unique(table_mean_sd$Feature), 4))
Check format of input data and sample annotation, create a SummarizedExperiment object
create_input(data, sample_ann, subject_col = NULL)create_input(data, sample_ann, subject_col = NULL)
data |
A data frame with rows as features (e.g., genes, proteins) and columns as samples. The first column should contain feature identifiers (e.g., gene symbols) and named as 'Feature'. The data should have been log transformed (and normalised if needed). Missing values are allowed in some of the downstream analyses. |
sample_ann |
A data frame containing sample annotations with required columns: 'Sample', 'Group', and 'Time'. 'Replicate' and 'Batch' are optional columns and will be auto-generated if not provided. 'Time', 'Replicate' and 'Batch' should be numeric. |
subject_col |
Optional: name of a column in |
A SummarizedExperiment object containing the input data and sample annotations.
data <- data.frame(Feature = c("Gene1", "Gene2"), Sample1 = c(1, 2), Sample2 = c(3, 4)) sample_ann <- data.frame( Sample = c("Sample1", "Sample2"), Group = c("A", "A"), Time = c(0, 1), Replicate = c(1, 1), Batch = c(1, 1) ) se_obj <- create_input(data, sample_ann)data <- data.frame(Feature = c("Gene1", "Gene2"), Sample1 = c(1, 2), Sample2 = c(3, 4)) sample_ann <- data.frame( Sample = c("Sample1", "Sample2"), Group = c("A", "A"), Time = c(0, 1), Replicate = c(1, 1), Batch = c(1, 1) ) se_obj <- create_input(data, sample_ann)
Differential expression analysis between groups at each time point by limma. The function compares each pair of groups at each time point, and returns a nested list of DE analysis results for each pair of groups and each time point including all features, as well as a list of filtered DE results for each pair of groups based on the specified thresholds including only significant features. The function can also plot the number of DE features between groups over time.
DE_between_group( se_obj, group = NULL, filter = NULL, assay = c(1, 2), adjP_thres = 0.05, logFC_thres = 1, trend = FALSE, plot = TRUE, fontsize = 8 )DE_between_group( se_obj, group = NULL, filter = NULL, assay = c(1, 2), adjP_thres = 0.05, logFC_thres = 1, trend = FALSE, plot = TRUE, fontsize = 8 )
se_obj |
A SummarizedExperiment object |
group |
(Optional) A character vector specifying which group to be compared to. If NULL, all groups in the 'Group' column will be compared to. (default is NULL) |
filter |
(Optional) Minimum number of replicates required in both conditions for a feature to be tested. If NULL, the minimum number of replicates across all groups and time points will be used. (default is NULL) |
assay |
Assay index to use, where 1 is the original data and 2 is normalised to time 0 (if available) (default is 1) |
adjP_thres |
(Optional) Threshold for adjusted p-value to consider a feature as differentially expressed (default is 0.05) |
logFC_thres |
(Optional) Threshold for log2 fold change to consider a feature as differentially expressed (default is 1) |
trend |
(Optional) Logical, passed to |
plot |
(Optional) Whether to plot the number of DE features between groups over time (default is TRUE) |
fontsize |
(Optional) Font size for the plot (default is 8) |
Only time points present in both groups are compared. No multiple-testing
correction is applied across the pairwise group-by-time comparisons; each
comparison is independent. Apply your own correction (e.g.,
stats::p.adjust()) across combined results if needed.
A list containing two elements: 'all_list' is a nested list of DE results for each pair of groups and each time point including all features; 'de_list' is a list of filtered DE results for each pair of groups based on the specified thresholds including only significant features.
data("example") example_obj <- normalise_to_start(example_obj) DE_between_group_out <- DE_between_group(example_obj, assay = 2)data("example") example_obj <- normalise_to_start(example_obj) DE_between_group_out <- DE_between_group(example_obj, assay = 2)
Differential expression analysis between time points within each group by limma
DE_between_time( se_obj, group = NULL, filter = NULL, assay = c(1, 2), adjP_thres = 0.05, logFC_thres = 1, trend = FALSE, fontsize = 8 )DE_between_time( se_obj, group = NULL, filter = NULL, assay = c(1, 2), adjP_thres = 0.05, logFC_thres = 1, trend = FALSE, fontsize = 8 )
se_obj |
A SummarizedExperiment object created by |
group |
(Optional) A character vector specifying which groups to analyse. If NULL, all groups in the 'Group' column will be used. (default is NULL) |
filter |
(Optional) Minimum number of replicates required in both conditions for a feature to be tested. If NULL, the minimum number of replicates across all groups and time points will be used. (default is NULL) |
assay |
Assay index to use, where 1 is the original data and 2 is normalised to time 0 (if available) (default is 1) |
adjP_thres |
(Optional) Threshold for adjusted p-value to consider a feature as differentially expressed (default is 0.05) |
logFC_thres |
(Optional) Threshold for log2 fold change to consider a feature as differentially expressed (default is 1) |
trend |
(Optional) Logical, passed to |
fontsize |
(Optional) Font size for the heatmap of DE numbers (default is 8) |
A list containing two elements: 'all_list' is a nested list of DE results for each group and time point comparison including all features; 'de_list' is a nested list of filtered DE results based on the specified thresholds including only significant features.
data("example") example_obj <- normalise_to_start(example_obj) DE_between_time_out <- DE_between_time(example_obj, assay = 1) plot_DE_between_time(example_obj, de_list = DE_between_time_out$de_list, fontsize = 8, value = TRUE, nrow = 1, heatmap_width = 3)data("example") example_obj <- normalise_to_start(example_obj) DE_between_time_out <- DE_between_time(example_obj, assay = 1) plot_DE_between_time(example_obj, de_list = DE_between_time_out$de_list, fontsize = 8, value = TRUE, nrow = 1, heatmap_width = 3)
Variance decomposition by linear mixed models (LMM), to estimate
the contribution of Group and Time to the variance of each feature.
Modified from PALMO::lmeVariance() function.
Group and Time are always included as random effects. The formula is extended automatically based on colData:
Subject column present: adds (1|Subject) to model between-subject
differences
interaction = TRUE: adds (1|Group:Time) (or (1|Subject:Time)
when Subject present) to capture interaction variance. Requires >= 2
replicates per combination. Default: FALSE.
Output always includes: Group, Time, Residual. Subject is included when present. All values are percentages of total variance.
Allow using original data or data normalised to time point 0.
decomp_variance( se_obj, features = NULL, fixed_effect_var = NULL, interaction = FALSE, assay = c(1, 2), core = 1 )decomp_variance( se_obj, features = NULL, fixed_effect_var = NULL, interaction = FALSE, assay = c(1, 2), core = 1 )
se_obj |
A SummarizedExperiment object created by |
features |
A vector of features to include. If NULL, all features. |
fixed_effect_var |
Column names to include as fixed effects
(regressed out, not appearing as variance components). Default is
|
interaction |
Logical. If TRUE, adds |
assay |
1 for original data, or 2 for data normalised to time 0 |
core |
Number of cores for parallel processing (default: 1) |
A data frame with variance decomposition results (percentages).
https://github.com/aifimmunology/PALMO/blob/main/R/lmeVariance.R
data("example") example_obj <- normalise_to_start(example_obj) var_decomp <- decomp_variance(example_obj, assay = 1) plot_variance(var_decomp, rank = "Time", top_n = 20)data("example") example_obj <- normalise_to_start(example_obj) var_decomp <- decomp_variance(example_obj, assay = 1) plot_variance(var_decomp, rank = "Time", top_n = 20)
Gene ontology enrichment analysis of multiple gene sets with clusterProfiler, allowing for using different or same background genes for each gene set
enrichGO_list( gene_list, keyType = "SYMBOL", OrgDb, universe = NULL, universe_list = NULL, pAdjustMethod = "BH", pvalueCutoff = 0.05, qvalueCutoff = 0.05, category = NULL, simplify = FALSE, simplify_cutoff = 0.7, simplify_by = "p.adjust", simplify_select_fun = min, simplify_measure = "Wang", ... )enrichGO_list( gene_list, keyType = "SYMBOL", OrgDb, universe = NULL, universe_list = NULL, pAdjustMethod = "BH", pvalueCutoff = 0.05, qvalueCutoff = 0.05, category = NULL, simplify = FALSE, simplify_cutoff = 0.7, simplify_by = "p.adjust", simplify_select_fun = min, simplify_measure = "Wang", ... )
gene_list |
A named list of gene vectors, or a data.frame
with |
keyType |
(Optional) Available options are
|
OrgDb |
Organism database, e.g. org.Hs.eg.db, org.Mm.eg.db |
universe |
Background genes for all input gene sets,
used if |
universe_list |
Background genes for each input gene set,
a list of gene vectors with the same names as |
pAdjustMethod |
(Optional) Parameter of |
pvalueCutoff |
(Optional) Parameter of |
qvalueCutoff |
(Optional) Parameter of |
category |
(Optional) GO category to analyze (default is all three of BP, MF, CC) |
simplify |
(Optional) Whether to simplify the GO terms by removing
redundant terms with |
simplify_cutoff |
(Optional) Parameter of |
simplify_by |
(Optional) Parameter of |
simplify_select_fun |
(Optional) Parameter of
|
simplify_measure |
(Optional) Parameter of
|
... |
additional arguments passed to |
A nested list of GO enrichment results with sublists:
'all' including all terms and 'simplified' including simplified terms
(if simplify = TRUE), both containing further sublists
for each GO category (BP, MF, CC).
library(magrittr) library(org.Mm.eg.db) library(clusterProfiler) data(example_net) # select two modules for demonstration example_module <- WGCNA_module(example_net) %>% dplyr::filter(Module %in% c("1", "2")) # set cutoff to 1 to show all results for demonstration example_go_list = enrichGO_list(example_module, OrgDb = org.Mm.eg.db, universe = example_module$Feature, pvalueCutoff = 1, qvalueCutoff = 1, category = "BP", simplify = FALSE) # plot_GO(example_go_list$all, plot_dotplot = TRUE, # plot_emapplot = FALSE, plot_cnetplot = FALSE)library(magrittr) library(org.Mm.eg.db) library(clusterProfiler) data(example_net) # select two modules for demonstration example_module <- WGCNA_module(example_net) %>% dplyr::filter(Module %in% c("1", "2")) # set cutoff to 1 to show all results for demonstration example_go_list = enrichGO_list(example_module, OrgDb = org.Mm.eg.db, universe = example_module$Feature, pvalueCutoff = 1, qvalueCutoff = 1, category = "BP", simplify = FALSE) # plot_GO(example_go_list$all, plot_dotplot = TRUE, # plot_emapplot = FALSE, plot_cnetplot = FALSE)
Gene ontology enrichment analysis of a ranked gene list with clusterProfiler. Genes can be ranked by variance decomposition results.
enrichGO_rank( rank_table, gene_rank_by, OrgDb, keyType = "SYMBOL", go_rank_by = "p.adjust", category = NULL, pvalueCutoff = 0.05, pAdjustMethod = "BH", ... )enrichGO_rank( rank_table, gene_rank_by, OrgDb, keyType = "SYMBOL", go_rank_by = "p.adjust", category = NULL, pvalueCutoff = 0.05, pAdjustMethod = "BH", ... )
rank_table |
A data frame with at least two columns: 'Feature' for gene
names and one or more columns of variables for ranking the genes,
e.g. output of |
gene_rank_by |
Variable in |
OrgDb |
Organism database, e.g. org.Hs.eg.db, org.Mm.eg.db |
keyType |
(Optional) Available options are
|
go_rank_by |
(Optional) Variable in the GO enrichment result to rank the GO terms by (default is "p.adjust", other options include "pvalue", "qvalue", "NES", "setSize", "enrichmentScore", etc.) |
category |
(Optional) GO category to analyze (default is all three of BP, MF, CC) |
pvalueCutoff |
(Optional) Parameter of |
pAdjustMethod |
(Optional) Parameter of |
... |
additional arguments passed to |
A list of gseaResult objects containing the GSEA results
library(org.Mm.eg.db) data("example") example_obj <- normalise_to_start(example_obj) var_decomp <- decomp_variance(example_obj, assay = 1) example_go_rank <- enrichGO_rank(var_decomp, gene_rank_by = "Time", OrgDb = org.Mm.eg.db, keyType = "SYMBOL", category = "BP") enrichplot::gseaplot2(example_go_rank$BP, geneSetID = 1:2)library(org.Mm.eg.db) data("example") example_obj <- normalise_to_start(example_obj) var_decomp <- decomp_variance(example_obj, assay = 1) example_go_rank <- enrichGO_rank(var_decomp, gene_rank_by = "Time", OrgDb = org.Mm.eg.db, keyType = "SYMBOL", category = "BP") enrichplot::gseaplot2(example_go_rank$BP, geneSetID = 1:2)
Enrichment analysis of multiple gene sets against databases from enrichR (e.g. DSigDB for drug signatures, ChEA for TF targets, KEGG for pathways, DrugBank for drug targets).
enrichR_list( gene_list, databases = c("DSigDB", "DrugMatrix"), site = "Enrichr", universe = NULL, universe_list = NULL, pvalueCutoff = 0.05, include_overlap = FALSE )enrichR_list( gene_list, databases = c("DSigDB", "DrugMatrix"), site = "Enrichr", universe = NULL, universe_list = NULL, pvalueCutoff = 0.05, include_overlap = FALSE )
gene_list |
A named list of gene vectors, or a data.frame
with |
databases |
Character vector of enrichR database names to query.
Available databases can be checked with |
site |
enrichR site to query. See |
universe |
Background genes for all input gene sets,
used if |
universe_list |
Background genes for each input gene set,
a list of gene vectors with the same names as |
pvalueCutoff |
Adjusted p-value cutoff for filtering enriched terms (default: 0.05) |
include_overlap |
Parameter passed to |
Multiple testing: P-values are adjusted (Benjamini–Hochberg) independently for each module within each database. No correction is applied across databases or across modules.
Requires an internet connection.
A named list of data.frames, one per database. Each data.frame
has columns Cluster, Description, p.adjust
(Adjusted.P.value from enrichR output),
Combined.Score, Genes, and any additional
columns returned by the enrichR API. Compatible with
plot_modules_h(enrich_list = result, enrich_category = "DSigDB").
data(example_net) library(dplyr) example_module <- WGCNA_module(example_net) %>% dplyr::filter(Module %in% c("1", "2")) # Use high pvalueCutoff for demonstration # enrichr_out <- enrichR_list(example_module, # databases = c("KEGG_2019_Mouse"), # universe = example_module$Feature, pvalueCutoff = 0.5)data(example_net) library(dplyr) example_module <- WGCNA_module(example_net) %>% dplyr::filter(Module %in% c("1", "2")) # Use high pvalueCutoff for demonstration # enrichr_out <- enrichR_list(example_module, # databases = c("KEGG_2019_Mouse"), # universe = example_module$Feature, pvalueCutoff = 0.5)
run_WGCNA() output object for runnable examplesCode for producing the data is available in run_WGCNA() examples
data(example_net)data(example_net)
A list including WGCNA module assignments, module eigengenes, dendrogram, input data, sample information, and parameters used
GSE263759
A subset of data_obj <- create_input(data = tutorial_data, sample_ann = tutorial_sample_info) for use in runnable examples
in function documentation.
data(example)data(example)
A SummarizedExperiment object with assays of 100 rows and 40 columns, colData of 40 rows and 5 columns:
tutorial_sample_info
tutorial_data first 100 rows, "Feature" column as rownames
Code for preparing the data is available in data-raw/tutorial_input.R
GSE263759
run_Trendy output object for runnable examplesCode for preparing the data is available in run_Trendy() examples
data(example_res_list)data(example_res_list)
A nested list, each element is a list with Trendy results for one group
GSE263759
Extract features with different segment trends from trendy segmented regression results summary
extract_segment_trends(trendy.summary)extract_segment_trends(trendy.summary)
trendy.summary |
A data frame, output of |
A nested list of features grouped by their segment trend patterns within each group.
data("example") example_obj <- normalise_to_start(example_obj) example_obj_list <- split_groups(example_obj) example_obj_merged_list <- merge_replicates(example_obj_list) example_obj_merged_list <- calc_feature_property(example_obj_merged_list, threshold = 0) # no missing value in the example dataset, so imputation is not necessary example_obj_merged_imp_list <- impute_groups(example_obj_merged_list) # "untreated" group has only 3 time points, so Trendy analysis will not # be performed for this group # example_res_list <- run_Trendy(example_obj_merged_imp_list, maxK = 1, # minNumInSeg = 2, meanCut = 0) data("example_res_list") plot_segments(example_obj_merged_imp_list, example_res_list, feature = c("Mctp1")) plot_breakpoints(example_res_list) trendy_summary <- summarise_Trendy(example_res_list) trendy_list <- extract_segment_trends(trendy_summary)data("example") example_obj <- normalise_to_start(example_obj) example_obj_list <- split_groups(example_obj) example_obj_merged_list <- merge_replicates(example_obj_list) example_obj_merged_list <- calc_feature_property(example_obj_merged_list, threshold = 0) # no missing value in the example dataset, so imputation is not necessary example_obj_merged_imp_list <- impute_groups(example_obj_merged_list) # "untreated" group has only 3 time points, so Trendy analysis will not # be performed for this group # example_res_list <- run_Trendy(example_obj_merged_imp_list, maxK = 1, # minNumInSeg = 2, meanCut = 0) data("example_res_list") plot_segments(example_obj_merged_imp_list, example_res_list, feature = c("Mctp1")) plot_breakpoints(example_res_list) trendy_summary <- summarise_Trendy(example_res_list) trendy_list <- extract_segment_trends(trendy_summary)
Get the custom color palette set by set_custom_palette.
If no custom palette has been set, the function will return a default
color palette based on the number of groups specified in the
groups argument.
get_custom_palette(groups)get_custom_palette(groups)
groups |
A character vector of group names for which to retrieve the colors from the custom palette. |
A named vector of colors corresponding to the specified group names.
get_custom_palette(c("untreated", "IFNbeta"))get_custom_palette(c("untreated", "IFNbeta"))
Identify features that are unique to selected groups (present
in those groups but not in any others) and annotate them with gene names
using the clusterProfiler::bitr() function. The function also provides an
option to perform Gene Ontology (GO) enrichment analysis on the identified
unique features using the enrichGO_list() function and visualize the
results with a dot plot.
group_specific_features( property_random_fc, groups = NULL, filter_ratio = 0.5, group_pct = 1, genename = TRUE, GO = TRUE, OrgDb = NULL, keytype = NULL, ... )group_specific_features( property_random_fc, groups = NULL, filter_ratio = 0.5, group_pct = 1, genename = TRUE, GO = TRUE, OrgDb = NULL, keytype = NULL, ... )
property_random_fc |
A data frame containing the results of the
|
groups |
A character vector of group names to be compared. If NULL, all groups in the input data will be used (default is NULL). |
filter_ratio |
A numeric value between 0 and 1 specifying the minimum proportion of expressed time points (minimum Exp_ratio) for a feature to be considered present (default is 0.5, meaning that a feature must have >=50% values > threshold in a group (>= 0.5 Exp_ratio) to be considered present in that group). |
group_pct |
A numeric value between 0 and 1 specifying the percentage of groups in which a feature must be present. (default is 1, meaning that a feature must be present in all specified groups). |
genename |
A logical value indicating whether to output a table of
gene names. If TRUE, the function will use the |
GO |
A logical value indicating whether to perform Gene Ontology
(GO) enrichment analysis on the identified unique features. If TRUE, the
function will use the |
OrgDb |
An OrgDb object from the |
keytype |
A character string specifying the type of gene identifiers
used in the row names of the assay data (e.g., "SYMBOL", "ENTREZID",
"ENSEMBL"). This will be used for gene annotation with the
|
... |
Additional arguments to be passed to the |
A character vector of features that are identified as unique to
the specified groups based on the filtering criteria. If genename is
TRUE, a table of gene names corresponding to the unique features will be
printed. If GO is TRUE, a dot plot of GO enrichment results for the unique
features will be printed.
data("example") example_obj <- normalise_to_start(example_obj) example_obj_list <- split_groups(example_obj) example_obj_merged_list <- merge_replicates(example_obj_list) example_obj_merged_list <- calc_feature_property(example_obj_merged_list, threshold = 0) property_random_fc <- summarise_feature_property(example_obj_merged_list) group_specific_features(property_random_fc, groups = c("untreated"), genename = FALSE, GO = FALSE)data("example") example_obj <- normalise_to_start(example_obj) example_obj_list <- split_groups(example_obj) example_obj_merged_list <- merge_replicates(example_obj_list) example_obj_merged_list <- calc_feature_property(example_obj_merged_list, threshold = 0) property_random_fc <- summarise_feature_property(example_obj_merged_list) group_specific_features(property_random_fc, groups = c("untreated"), genename = FALSE, GO = FALSE)
Impute missing values for each group of samples in a list of SummarizedExperiment objects. By default, replaces NA with the minimum non-NA value per group / subject. A custom function can be supplied for other strategies.
The input samples can contain replicates, or merged replicates (mean of replicates).
impute_groups(se_obj_list, fun = min, impute_by = c("group", "subject"))impute_groups(se_obj_list, fun = min, impute_by = c("group", "subject"))
se_obj_list |
A list of SummarizedExperiment objects, created by
|
fun |
Function applied to the non-NA values to generate the
replacement value. Default: |
impute_by |
|
A list of SummarizedExperiment objects with missing values imputed. Each object corresponds to one group of samples.
data("example") example_obj <- normalise_to_start(example_obj) example_obj_list <- split_groups(example_obj) example_obj_merged_list <- merge_replicates(example_obj_list) example_obj_merged_imp_list <- impute_groups(example_obj_merged_list)data("example") example_obj <- normalise_to_start(example_obj) example_obj_list <- split_groups(example_obj) example_obj_merged_list <- merge_replicates(example_obj_list) example_obj_merged_imp_list <- impute_groups(example_obj_merged_list)
Merge SummarizedExperiment object of different groups into one
merge_groups(se_obj_list)merge_groups(se_obj_list)
se_obj_list |
A list of SummarizedExperiment objects, such as output of
|
A SummarizedExperiment object containing all samples from the input list. The 'Group' column in the colData will indicate the group of each sample. New sample names will be prefixed with the group name.
data("example") example_obj <- normalise_to_start(example_obj) example_obj_list <- split_groups(example_obj) example_obj_merged_list <- merge_replicates(example_obj_list) example_obj_merged <- merge_groups(example_obj_merged_list)data("example") example_obj <- normalise_to_start(example_obj) example_obj_list <- split_groups(example_obj) example_obj_merged_list <- merge_replicates(example_obj_list) example_obj_merged <- merge_groups(example_obj_merged_list)
Calculate mean of replicates for each feature at each time point for each group.
When a Subject column is present, merging is done in two stages:
Average replicates within each Group-Subject-Time combination.
Average across subjects within each Group-Time combination. This gives equal weight to each subject regardless of replicate count.
Without a Subject column, all samples at the same Group-Time are averaged together in a single step.
merge_replicates(se_obj_list)merge_replicates(se_obj_list)
se_obj_list |
A list of SummarizedExperiment objects created by
|
A list of SummarizedExperiment objects containing the mean of replicates for each feature at each time point for each group. Each object in the list corresponds to one group of samples.
data("example") example_obj <- normalise_to_start(example_obj) example_obj_list <- split_groups(example_obj) example_obj_merged_list <- merge_replicates(example_obj_list) example_obj_merged <- merge_groups(example_obj_merged_list)data("example") example_obj <- normalise_to_start(example_obj) example_obj_list <- split_groups(example_obj) example_obj_merged_list <- merge_replicates(example_obj_list) example_obj_merged <- merge_groups(example_obj_merged_list)
Normalise to starting time point, to make the mean of starting time point samples 0.
Two modes are available:
by_subject = FALSE (default): computes the group-level mean at the
first non-NA time point per feature and subtracts it. All samples within
a group share the same baseline.
by_subject = TRUE: computes each subject's value at the first non-NA
time point per feature and subtracts that subject-specific baseline.
Removes between-subject baseline differences. Use when each subject has
their own initial condition. Requires a Subject column in colData.
normalise_to_start(se_obj, by_subject = FALSE)normalise_to_start(se_obj, by_subject = FALSE)
se_obj |
A SummarizedExperiment object created by |
by_subject |
If FALSE (default), use group-level baseline. If TRUE, use subject-level baseline (requires Subject column in colData). |
A SummarizedExperiment object with normalised data in the second assay slot.
data("example") example_obj <- normalise_to_start(example_obj) example_obj_list <- split_groups(example_obj) example_obj_merged_list <- merge_replicates(example_obj_list) example_obj_merged <- merge_groups(example_obj_merged_list)data("example") example_obj <- normalise_to_start(example_obj) example_obj_list <- split_groups(example_obj) example_obj_merged_list <- merge_replicates(example_obj_list) example_obj_merged <- merge_groups(example_obj_merged_list)
Plot breakpoint distribution among time points for each group
plot_breakpoints(res_list, group = NULL, fontsize = 8, ...)plot_breakpoints(res_list, group = NULL, fontsize = 8, ...)
res_list |
A list of the Trendy analysis results, output of
|
group |
(Optional) A character vector of group names to be plotted. If NULL, all groups in the input list will be used (default is NULL) |
fontsize |
(Optional) Font size for the plot (default is 8) |
... |
Additional arguments to be passed to |
A plot showing the distribution of breakpoints over time for each specified group
data("example_res_list") plot_breakpoints(example_res_list)data("example_res_list") plot_breakpoints(example_res_list)
Plot correlation matrix between samples as a heatmap
plot_cor_matrix( se_obj, use = "pairwise.complete.obs", method = c("spearman", "pearson", "kendall"), label_group = TRUE, label_time = TRUE, label_rep = TRUE, label_batch = TRUE, show_rownames = FALSE, show_colnames = FALSE, fontsize = 8, cellwidth = 1, cellheight = 1, title = "Correlation between samples", ... )plot_cor_matrix( se_obj, use = "pairwise.complete.obs", method = c("spearman", "pearson", "kendall"), label_group = TRUE, label_time = TRUE, label_rep = TRUE, label_batch = TRUE, show_rownames = FALSE, show_colnames = FALSE, fontsize = 8, cellwidth = 1, cellheight = 1, title = "Correlation between samples", ... )
se_obj |
A SummarizedExperiment object created by |
use |
Parameter of |
method |
Parameter of |
label_group |
Whether to label Group (default is TRUE) |
label_time |
Whether to label Time (default is TRUE) |
label_rep |
Whether to label Replicate (default is TRUE) |
label_batch |
Whether to label Batch (default is TRUE) |
show_rownames |
Whether to show row names in the heatmap (default is FALSE) |
show_colnames |
Whether to show column names in the heatmap (default is FALSE) |
fontsize |
Font size for the heatmap and annotations (default is 8) |
cellwidth |
Cell width for the heatmap (default is 1) |
cellheight |
Cell height for the heatmap (default is 1) |
title |
Title of the heatmap (default is "Correlation between samples") |
... |
Additional arguments to be passed to |
A heatmap showing the correlation between samples.
data("example") plot_cor_matrix(example_obj)data("example") plot_cor_matrix(example_obj)
Plot the distribution of coefficient of variation (CV) for each feature with replicates. The CV is calculated as the standard deviation divided by the mean of the abundance values.
Note: CV is only meaningful for positive-valued data.
plot_cv(se_obj, fontsize = 8)plot_cv(se_obj, fontsize = 8)
se_obj |
A SummarizedExperiment object, produced by |
fontsize |
(Optional) An integer specifying the font size for the plot (default is 8). |
A plot showing the distribution of coefficient of variation (CV) for each feature, grouped by Time and Group. If there are no replicates, a message will be printed indicating that CV cannot be calculated.
data("example") plot_cv(example_obj)data("example") plot_cv(example_obj)
Plot the number of differentially expressed features between time points within each group with heatmaps
plot_DE_between_time( se_obj, de_list, value = TRUE, fontsize = 8, nrow = 1, heatmap_width = 4, heatmap_unit = "cm" )plot_DE_between_time( se_obj, de_list, value = TRUE, fontsize = 8, nrow = 1, heatmap_width = 4, heatmap_unit = "cm" )
se_obj |
A SummarizedExperiment object containing the data and metadata, with a "Time" column in the colData indicating the time points of the samples |
de_list |
Output of |
value |
Whether to display the actual number of DE features in each heatmap cell (default is TRUE) |
fontsize |
Font size for the heatmap displaying the number of DE features between time points (default is 8) |
nrow |
Number of rows for arranging the heatmaps (default is 1) |
heatmap_width |
Width of each heatmap (default is 4) |
heatmap_unit |
Unit for the heatmap width (default is "cm") |
One heatmap per group showing the number of DE features between time points for each group, with the same scale across groups for easy comparison. The heatmap cells are annotated with the actual number of DE features.
data("example") example_obj <- normalise_to_start(example_obj) DE_between_time_out <- DE_between_time(example_obj, assay = 1) plot_DE_between_time(example_obj, de_list = DE_between_time_out$de_list, fontsize = 8, value = TRUE, nrow = 1, heatmap_width = 3)data("example") example_obj <- normalise_to_start(example_obj) DE_between_time_out <- DE_between_time(example_obj, assay = 1) plot_DE_between_time(example_obj, de_list = DE_between_time_out$de_list, fontsize = 8, value = TRUE, nrow = 1, heatmap_width = 3)
This function generates density plots to visualise the distribution of abundance values across samples. The user can choose to facet the plot by "Group", "Time", or "Sample" to compare distributions across different conditions or samples. If no faceting variable is specified, a single density plot will be generated for all samples combined.
plot_distribution(se_obj, facet_by = NULL, fontsize = 8)plot_distribution(se_obj, facet_by = NULL, fontsize = 8)
se_obj |
A SummarizedExperiment object, produced by |
facet_by |
(Optional) A character string specifying the variable to facet the plot by. It can be one of "Group", "Time", or "Sample". If NULL, no faceting will be applied and a single density plot will be generated for all samples (default is NULL). |
fontsize |
(Optional) An integer specifying the font size for the plot (default is 8). |
A plot showing the density distribution of abundance values, optionally faceted by the specified variable.
data("example") plot_distribution(example_obj) plot_distribution(example_obj, facet_by = "Group")data("example") plot_distribution(example_obj) plot_distribution(example_obj, facet_by = "Group")
Visualization of GO enrichment analysis with dotplot, cnetplot, or emapplot in clusterProfiler
plot_GO( go_list, plot_dotplot = FALSE, plot_cnetplot = FALSE, plot_emapplot = FALSE, showCategory_dotplot = 5, showCategory_cnetplot = 5, showCategory_emapplot = 5, fontsize = 8, label = "features", ... )plot_GO( go_list, plot_dotplot = FALSE, plot_cnetplot = FALSE, plot_emapplot = FALSE, showCategory_dotplot = 5, showCategory_cnetplot = 5, showCategory_emapplot = 5, fontsize = 8, label = "features", ... )
go_list |
A list of enriched GO results, output from |
plot_dotplot |
Whether to plot dotplot (default is TRUE) |
plot_cnetplot |
Whether to plot cnetplot (default is FALSE) |
plot_emapplot |
Whether to plot emapplot (default is FALSE) |
showCategory_dotplot |
showCategory parameter of
|
showCategory_cnetplot |
showCategory parameter of
|
showCategory_emapplot |
showCategory parameter of
|
fontsize |
Font size for the plots (default is 8) |
label |
Title for the plots (default is "genes") |
... |
Additional parameters to pass to the plotting functions
|
A series of plots visualizing the GO enrichment results.
library(magrittr) library(org.Mm.eg.db) data(example_net) # select two modules for demonstration example_module <- WGCNA_module(example_net) %>% dplyr::filter(Module %in% c("1", "2")) # set cutoff to 1 to show all results for demonstration example_go_list = enrichGO_list(example_module, OrgDb = org.Mm.eg.db, universe = example_module$Feature, pvalueCutoff = 1, qvalueCutoff = 1, category = "BP", simplify = FALSE) plot_GO(example_go_list$all, plot_dotplot = TRUE, plot_emapplot = FALSE, plot_cnetplot = FALSE)library(magrittr) library(org.Mm.eg.db) data(example_net) # select two modules for demonstration example_module <- WGCNA_module(example_net) %>% dplyr::filter(Module %in% c("1", "2")) # set cutoff to 1 to show all results for demonstration example_go_list = enrichGO_list(example_module, OrgDb = org.Mm.eg.db, universe = example_module$Feature, pvalueCutoff = 1, qvalueCutoff = 1, category = "BP", simplify = FALSE) plot_GO(example_go_list$all, plot_dotplot = TRUE, plot_emapplot = FALSE, plot_cnetplot = FALSE)
Plot the number of identified features (i.e., features with non-missing values) for each sample, with a dashed line indicating the average number across all samples.
plot_ID(se_obj, fontsize = 8, signif = FALSE, ...)plot_ID(se_obj, fontsize = 8, signif = FALSE, ...)
se_obj |
A SummarizedExperiment object, produced by |
fontsize |
(Optional) An integer specifying the font size for the plot (default is 8). |
signif |
(Optional) A logical value indicating whether to perform significance testing between groups and add significance annotations to the plot (default is FALSE). |
... |
Additional arguments to be passed to |
A plot showing the ID number for each sample, with a dashed line indicating the average number across all samples.
# simulate data with random missing values na_data <- matrix(rnorm(1000), nrow = 100, ncol = 100) na_data[sample(length(na_data), size = 1000)] <- NA na_data <- data.frame(Feature = paste0("Feature", 1:100), na_data) colnames(na_data)[-1] <- paste0("Sample", 1:100) na_obj <- create_input(na_data, data.frame(Sample = paste0("Sample", 1:100), Time = rep(rep(1:10, each = 5), 2), Group = rep(c("A", "B"), each = 50), Replicate = rep(1:5, 20))) plot_ID(na_obj) plot_missing(na_obj)# simulate data with random missing values na_data <- matrix(rnorm(1000), nrow = 100, ncol = 100) na_data[sample(length(na_data), size = 1000)] <- NA na_data <- data.frame(Feature = paste0("Feature", 1:100), na_data) colnames(na_data)[-1] <- paste0("Sample", 1:100) na_obj <- create_input(na_data, data.frame(Sample = paste0("Sample", 1:100), Time = rep(rep(1:10, each = 5), 2), Group = rep(c("A", "B"), each = 50), Replicate = rep(1:5, 20))) plot_ID(na_obj) plot_missing(na_obj)
Plot the ratio of missing values for each sample, with a dashed line indicating the global missing value rate across all samples.
plot_missing(se_obj, fontsize = 8, signif = FALSE, ...)plot_missing(se_obj, fontsize = 8, signif = FALSE, ...)
se_obj |
A SummarizedExperiment object, produced by |
fontsize |
(Optional) An integer specifying the font size for the plot (default is 8). |
signif |
(Optional) A logical value indicating whether to perform significance testing between groups and add significance annotations to the plot (default is FALSE). |
... |
Additional arguments to be passed to |
A plot showing the missing value rate for each sample, with a dashed line indicating the global missing value rate across all samples.
# simulate data with random missing values na_data <- matrix(rnorm(1000), nrow = 100, ncol = 100) na_data[sample(length(na_data), size = 1000)] <- NA na_data <- data.frame(Feature = paste0("Feature", 1:100), na_data) colnames(na_data)[-1] <- paste0("Sample", 1:100) na_obj <- create_input(na_data, data.frame(Sample = paste0("Sample", 1:100), Time = rep(rep(1:10, each = 5), 2), Group = rep(c("A", "B"), each = 50), Replicate = rep(1:5, 20))) plot_ID(na_obj) plot_missing(na_obj)# simulate data with random missing values na_data <- matrix(rnorm(1000), nrow = 100, ncol = 100) na_data[sample(length(na_data), size = 1000)] <- NA na_data <- data.frame(Feature = paste0("Feature", 1:100), na_data) colnames(na_data)[-1] <- paste0("Sample", 1:100) na_obj <- create_input(na_data, data.frame(Sample = paste0("Sample", 1:100), Time = rep(rep(1:10, each = 5), 2), Group = rep(c("A", "B"), each = 50), Replicate = rep(1:5, 20))) plot_ID(na_obj) plot_missing(na_obj)
Plot WGCNA modules' heatmaps, mean expression profiles, and enrichment terms, aligned horizontally.
Different from running WGCNA, the input data should have the replicates merged, instead of having multiple samples per group, time and feature (gene).
If certain time points are missing in some groups, NA values are added.
plot_modules_h( module, se_obj_merged, scale = TRUE, assay = 2, ylabel = "Log2 abundance", suffix = "", device = "png", save = NULL, profile_width = 3, profile_link_width = 1, enrich_list = NULL, enrich_category = "BP", enrich_rank_by = "p.adjust", enrich_top_n = 3, fontsize = 8, heatmap_width = 8, heatmap_height = 8, width = 16, height = 12, res = 300 )plot_modules_h( module, se_obj_merged, scale = TRUE, assay = 2, ylabel = "Log2 abundance", suffix = "", device = "png", save = NULL, profile_width = 3, profile_link_width = 1, enrich_list = NULL, enrich_category = "BP", enrich_rank_by = "p.adjust", enrich_top_n = 3, fontsize = 8, heatmap_width = 8, heatmap_height = 8, width = 16, height = 12, res = 300 )
module |
A data frame with columns "Feature" and "Module" |
se_obj_merged |
A SummarizedExperiment object, with one value for each
feature at each time point in each group (replicates merged). The colData of
the object should contain columns "Sample", "Group", and "Time". The object
can be produced by |
scale |
Whether to scale the data (z-score) across samples for each feature (default is TRUE) |
assay |
The assay index in the SummarizedExperiment object to use (default is 2, time 0 normalised data) |
ylabel |
Y axis label prefix (default is "Abundance") |
suffix |
Suffix for the saved image file name (default is an empty string) |
device |
Image file format(s) for saving. Can be a character
vector with one or more of |
save |
Directory to save the plot, no saving if is NULL (default is NULL) |
profile_width |
Width of the mean expression profile plot (default is 3 (cm)) |
profile_link_width |
Width of the link in cm between heatmap and mean expression profile plot (default is 1) |
enrich_list |
A named list of enrichment results for WGCNA modules,
as produced by |
enrich_category |
Name of the enrichment category to display
(default is |
enrich_rank_by |
Column name to rank enrichment terms by
(default is |
enrich_top_n |
Number of top enrichment terms to display per module (default is 3) |
fontsize |
Font size (default is 8) |
heatmap_width |
Width of the heatmap body in cm (default is 8) |
heatmap_height |
Height of the heatmap body in cm (default is 8) |
width |
Width of the saved image (default is 16 (cm)) |
height |
Height of the saved image (default is 12 (cm)) |
res |
Resolution of the saved image (except pdf format) (default is 300 (ppi)) |
A combined plot of heatmap, mean expression profile, and enrichment terms for each WGCNA module
https://github.com/junjunlab/ClusterGVis
library(magrittr) library(org.Mm.eg.db) data(example) example_obj <- normalise_to_start(example_obj) example_obj_list <- split_groups(example_obj) example_obj_merged_list <- merge_replicates(example_obj_list) example_obj_merged <- merge_groups(example_obj_merged_list) data(example_net) # select two modules for demonstration example_module <- WGCNA_module(example_net) %>% dplyr::filter(Module %in% c("1", "2")) # set cutoff to 1 to show all results for demonstration example_go_list = enrichGO_list(example_module, OrgDb = org.Mm.eg.db, universe = example_module$Feature, pvalueCutoff = 1, qvalueCutoff = 1, category = "BP", simplify = FALSE) # plot_GO(example_go_list$all, plot_dotplot = TRUE, # plot_emapplot = FALSE, plot_cnetplot = FALSE) plot_modules_h(example_module %>% dplyr::filter(Module != '0'), example_obj_merged, scale = TRUE, ylabel = "Z-score of log2 expression", enrich_list = example_go_list$all, enrich_category = "BP", heatmap_width = 6, heatmap_height = 4)library(magrittr) library(org.Mm.eg.db) data(example) example_obj <- normalise_to_start(example_obj) example_obj_list <- split_groups(example_obj) example_obj_merged_list <- merge_replicates(example_obj_list) example_obj_merged <- merge_groups(example_obj_merged_list) data(example_net) # select two modules for demonstration example_module <- WGCNA_module(example_net) %>% dplyr::filter(Module %in% c("1", "2")) # set cutoff to 1 to show all results for demonstration example_go_list = enrichGO_list(example_module, OrgDb = org.Mm.eg.db, universe = example_module$Feature, pvalueCutoff = 1, qvalueCutoff = 1, category = "BP", simplify = FALSE) # plot_GO(example_go_list$all, plot_dotplot = TRUE, # plot_emapplot = FALSE, plot_cnetplot = FALSE) plot_modules_h(example_module %>% dplyr::filter(Module != '0'), example_obj_merged, scale = TRUE, ylabel = "Z-score of log2 expression", enrich_list = example_go_list$all, enrich_category = "BP", heatmap_width = 6, heatmap_height = 4)
Plot WGCNA modules' mean expression profiles and heatmaps, align vertically.
Different from running WGCNA, the input data should have the replicates merged, instead of having multiple samples per group, time and feature (gene).
If certain time points are missing in some groups, NA values are added.
plot_modules_v( module, se_obj_merged, scale = TRUE, assay = 2, ylabel = "Log2 abundance normalised to Time 0", suffix = "", device = "png", save = NULL, width = 12, height = 8, height_ratio = 2, fontsize = 8, res = 300 )plot_modules_v( module, se_obj_merged, scale = TRUE, assay = 2, ylabel = "Log2 abundance normalised to Time 0", suffix = "", device = "png", save = NULL, width = 12, height = 8, height_ratio = 2, fontsize = 8, res = 300 )
module |
A data frame with columns "Feature" and "Module" |
se_obj_merged |
A SummarizedExperiment object, with one value for each
feature at each time point in each group (replicates merged). The colData of
the object should contain columns "Sample", "Group", and "Time". The object
can be produced by |
scale |
Whether to scale the data (z-score) across samples for each feature (default is TRUE) |
assay |
The assay index in the SummarizedExperiment object to use (default is 2, time 0 normalised data) |
ylabel |
Y axis label prefix (default is "Abundance") |
suffix |
Suffix for the saved image file name (default is an empty string) |
device |
Image file format(s) for saving. Can be a character
vector, e.g. |
save |
Directory to save the plot, no saving if is NULL (default is NULL) |
width |
Width of the saved image (default is 12 (cm)) |
height |
Height of the saved image (default is 8 (cm)) |
height_ratio |
Ratio of height of heatmap to the line plot (default is 2) |
fontsize |
Font size (default is 8) |
res |
Resolution of the saved image (except pdf format) (default is 300 (ppi)) |
Two plots aligned vertically by groups: the top one is a line plot of module feature mean expression profiles, the bottom one is a heatmap of feature expression across time points.
library(magrittr) data(example) example_obj <- normalise_to_start(example_obj) example_obj_list <- split_groups(example_obj) example_obj_merged_list <- merge_replicates(example_obj_list) example_obj_merged <- merge_groups(example_obj_merged_list) data(example_net) example_module <- WGCNA_module(example_net) plot_modules_v(example_module %>% dplyr::filter(Module != '0'), example_obj_merged, scale = TRUE, ylabel = "Z-score of log2 (expression)", height_ratio = 2, fontsize = 6)library(magrittr) data(example) example_obj <- normalise_to_start(example_obj) example_obj_list <- split_groups(example_obj) example_obj_merged_list <- merge_replicates(example_obj_list) example_obj_merged <- merge_groups(example_obj_merged_list) data(example_net) example_module <- WGCNA_module(example_net) plot_modules_v(example_module %>% dplyr::filter(Module != '0'), example_obj_merged, scale = TRUE, ylabel = "Z-score of log2 (expression)", height_ratio = 2, fontsize = 6)
Plot principal component analysis (PCA), using features without missing values
The samples are coloured by Group and sized by Time. Ellipses are drawn for each Group.
plot_pca( se_obj, plot = TRUE, plot_screeplot = TRUE, plot_loadings = TRUE, plot_morepc = TRUE, morepc = seq(1, 5), pc1 = 1, pc2 = 2, circle = FALSE, xlim_min = NULL, xlim_max = NULL, ylim_min = NULL, ylim_max = NULL, fontsize = 8, assay = 1 )plot_pca( se_obj, plot = TRUE, plot_screeplot = TRUE, plot_loadings = TRUE, plot_morepc = TRUE, morepc = seq(1, 5), pc1 = 1, pc2 = 2, circle = FALSE, xlim_min = NULL, xlim_max = NULL, ylim_min = NULL, ylim_max = NULL, fontsize = 8, assay = 1 )
se_obj |
A SummarizedExperiment object created by |
plot |
Logical, whether to plot PCA and other plots (default is TRUE) |
plot_screeplot |
Logical, whether to plot screeplot with
|
plot_loadings |
Logical, whether to plot loadings with
|
plot_morepc |
Logical, whether to plot pairs of more PCs with
|
morepc |
A numeric vector of PCs to plot in the pairs plot (default is 1:5) |
pc1 |
Numeric, which PC to use for the x-axis (default is 1) |
pc2 |
Numeric, which PC to use for the y-axis (default is 2) |
circle |
Logical, whether to draw circles (ellipses) around samples of each group (default is FALSE) |
xlim_min |
Minimum x-axis limit when drawing ellipses (default 1.5*min PC1) |
xlim_max |
Maximum x-axis limit when drawing ellipses (default 1.5*max PC1) |
ylim_min |
Minimum y-axis limit when drawing ellipses (default 1.5*min PC2) |
ylim_max |
Maximum y-axis limit when drawing ellipses (default 1.5*max PC2) |
fontsize |
Font size for the PCA plot (default is 8) |
assay |
Assay index to use, where 1 is the original data and 2 is normalised to time 0 (if available) (default is 1) |
A PCA plot showing the distribution of samples, other plots provided by PCAtools package, and PCAtools output object for custom plotting.
data("example") PC = plot_pca(example_obj, morepc = seq(1, 3))data("example") PC = plot_pca(example_obj, morepc = seq(1, 3))
Plot principal component analysis (PCA) results in 3D. This
function takes the output PCA object of the plot_pca function and
visualizes the samples in a 3D space defined by the specified principal
components.
The samples are coloured by Group and sized by Time.
plot_pca_3D(pca, pcs = seq(1, 3))plot_pca_3D(pca, pcs = seq(1, 3))
pca |
A PCA object returned by the |
pcs |
A numeric vector specifying which three principal components to plot (default is 1:3) |
An interactive 3D PCA plot showing the distribution of samples in the space defined by the specified principal components. The samples are coloured by Group and sized by Time.
data("example") PC = plot_pca(example_obj, morepc = seq(1, 3)) plot_pca_3D(PC, pcs = seq(1, 3))data("example") PC = plot_pca(example_obj, morepc = seq(1, 3)) plot_pca_3D(PC, pcs = seq(1, 3))
Plot PCA with arrows indicating trajectory over time, for a single group.
plot_pca_arrows( se_obj, circle = TRUE, arrow = TRUE, pc1 = 1, pc2 = 2, fontsize = 8, assay = 1 )plot_pca_arrows( se_obj, circle = TRUE, arrow = TRUE, pc1 = 1, pc2 = 2, fontsize = 8, assay = 1 )
se_obj |
A SummarizedExperiment object (single group). |
circle |
Logical, whether to draw ellipses around samples of each time point (default: TRUE). |
arrow |
Logical, whether to draw arrows indicating the trajectory over time (default: TRUE). |
pc1 |
Principal component for the x-axis (default: 1). |
pc2 |
Principal component for the y-axis (default: 2). |
fontsize |
Base font size (default: 8). |
assay |
Assay index to use, where 1 is the original data and 2 is normalised to time 0 (if available) (default: 1). |
A PCA plot coloured by Time, with optional ellipses and trajectory arrows.
data("example") plot_pca_arrows(example_obj[, example_obj$Group == "IFNbeta"])data("example") plot_pca_arrows(example_obj[, example_obj$Group == "IFNbeta"])
Plot PCA for each group separately, with optional circles
around time points and arrows indicating trajectory over time. Accepts
either a SummarizedExperiment object or a list of them (from
split_groups()).
plot_pca_by_group( se_obj, circle = TRUE, arrow = TRUE, pc1 = 1, pc2 = 2, nrow = 1, fontsize = 8, assay = 1, legend_pos = "right" )plot_pca_by_group( se_obj, circle = TRUE, arrow = TRUE, pc1 = 1, pc2 = 2, nrow = 1, fontsize = 8, assay = 1, legend_pos = "right" )
se_obj |
A SummarizedExperiment object, or a named list of them
(e.g. from |
circle |
Logical, whether to draw ellipses around samples of each time point (default: TRUE). |
arrow |
Logical, whether to draw arrows indicating the trajectory over time (default: TRUE). |
pc1 |
Principal component for the x-axis (default: 1). |
pc2 |
Principal component for the y-axis (default: 2). |
nrow |
Number of rows for arranging the plots (default: 1). |
fontsize |
Base font size (default: 8). |
assay |
Assay index to use, where 1 is the original data and 2 is normalised to time 0 (if available) (default: 1). |
legend_pos |
Legend position (default: "right"). |
A series of PCA plots showing the distribution of samples in each group, coloured by Time.
data("example") plot_pca_by_group(example_obj, circle = TRUE, arrow = TRUE) # Also accepts a list from split_groups() example_obj_list <- split_groups(example_obj) plot_pca_by_group(example_obj_list)data("example") plot_pca_by_group(example_obj, circle = TRUE, arrow = TRUE) # Also accepts a list from split_groups() example_obj_list <- split_groups(example_obj) plot_pca_by_group(example_obj_list)
Plot segmented regression results for specified features
in each group, using the Trendy::plotFeature() function. The input is
a list of SummarizedExperiment objects with no missing values and a list
of Trendy analysis results for each group.
plot_segments( se_obj_imp_list, res_list, feature, group = NULL, nrow = NULL, ... )plot_segments( se_obj_imp_list, res_list, feature, group = NULL, nrow = NULL, ... )
se_obj_imp_list |
A list of SummarizedExperiment objects with no missing values |
res_list |
A list of the Trendy analysis results, output of
|
feature |
A character vector of feature names to be plotted |
group |
A character vector of group names to be analysed. If NULL, all groups in the input list will be used (default is NULL) |
nrow |
Number of rows in the plot layout. If NULL and multiple features are provided, it will be set to half the number of features (rounded up) (default is NULL) |
... |
Additional arguments to be passed to the |
Plots of the segmented regression fits for the specified features in each group.
data("example") example_obj <- normalise_to_start(example_obj) example_obj_list <- split_groups(example_obj) example_obj_merged_list <- merge_replicates(example_obj_list) example_obj_merged_list <- calc_feature_property(example_obj_merged_list, threshold = 0) # no missing value in the example dataset, so imputation is not necessary example_obj_merged_imp_list <- impute_groups(example_obj_merged_list) data("example_res_list") plot_segments(example_obj_merged_imp_list, example_res_list, feature = c("Mctp1"))data("example") example_obj <- normalise_to_start(example_obj) example_obj_list <- split_groups(example_obj) example_obj_merged_list <- merge_replicates(example_obj_list) example_obj_merged_list <- calc_feature_property(example_obj_merged_list, threshold = 0) # no missing value in the example dataset, so imputation is not necessary example_obj_merged_imp_list <- impute_groups(example_obj_merged_list) data("example_res_list") plot_segments(example_obj_merged_imp_list, example_res_list, feature = c("Mctp1"))
Plot trend of feature abundances / expression over time by
mean and standard deviation (SD) for each group. Accepts either a
SummarizedExperiment object (computing mean/SD internally via
calc_mean_sd()) or a pre-computed table from
calc_mean_sd().
plot_trend( se_obj, assay = 1, groups = NULL, features, title = "Feature", ylab = "Abundance", errorbar = TRUE, fontsize = 8 )plot_trend( se_obj, assay = 1, groups = NULL, features, title = "Feature", ylab = "Abundance", errorbar = TRUE, fontsize = 8 )
se_obj |
A SummarizedExperiment object, or a data.frame from
|
assay |
Assay index when |
groups |
Groups to be plotted, if NULL, all groups will be used (default is NULL) |
features |
Features to be plotted, if NULL, an error will be raised |
title |
Title of the plot (default is "Feature") |
ylab |
Y axis label of the plot (default is "Abundance") |
errorbar |
Whether to plot error bars (default is TRUE) |
fontsize |
Font size for the plot (default is 8) |
Plot of feature abundances over time by mean and SD
data("example") plot_trend(example_obj, features = sample(rownames(example_obj), 4))data("example") plot_trend(example_obj, features = sample(rownames(example_obj), 4))
Plot UMAP of samples, using features without missing values
The UMAP plots are labelled by Group, Time, Replicate (if more than 1), Batch (if more than 1), and number of identified features (non-missing values).
plot_umap( se_obj, seed = 1234, plot = TRUE, plot_ID = FALSE, circle = FALSE, xlim_min = NULL, xlim_max = NULL, ylim_min = NULL, ylim_max = NULL, umap_neighbors = NULL, fontsize = 8, assay = 1 )plot_umap( se_obj, seed = 1234, plot = TRUE, plot_ID = FALSE, circle = FALSE, xlim_min = NULL, xlim_max = NULL, ylim_min = NULL, ylim_max = NULL, umap_neighbors = NULL, fontsize = 8, assay = 1 )
se_obj |
A SummarizedExperiment object created by |
seed |
Random seed for UMAP (default is 1234) |
plot |
Whether to plot the figures (default is TRUE) |
plot_ID |
Whether to include a UMAP plot coloured by number of identified features (default is FALSE) |
circle |
Logical, whether to draw circles (ellipses) around samples of each group (default is FALSE) |
xlim_min |
Minimum x-axis limit when drawing ellipses (default 1.5*min UMAP x) |
xlim_max |
Maximum x-axis limit when drawing ellipses (default 1.5*max UMAP x) |
ylim_min |
Minimum y-axis limit when drawing ellipses (default 1.5*min UMAP y) |
ylim_max |
Maximum y-axis limit when drawing ellipses (default 1.5*max UMAP y) |
umap_neighbors |
UMAP n_neighbors parameter (default is selected by
|
fontsize |
Font size for the plot (default is 8) |
assay |
Assay index to use, where 1 is the original data and 2 is normalised to time 0 (if available) (default is 1) |
A UMAP plot showing the distribution of samples. And a data frame containing UMAP coordinates and sample annotations for custom plotting.
data("example") umap_layout <- plot_umap(example_obj)data("example") umap_layout <- plot_umap(example_obj)
Plot UMAP for each group separately. Accepts either a
SummarizedExperiment object or a named list of them (from
split_groups()).
plot_umap_by_group( se_obj, seed = 1234, nrow = 1, umap_neighbors = NULL, fontsize = 8, assay = 1, legend_pos = "right" )plot_umap_by_group( se_obj, seed = 1234, nrow = 1, umap_neighbors = NULL, fontsize = 8, assay = 1, legend_pos = "right" )
se_obj |
A SummarizedExperiment object, or a named list of them
(e.g. from |
seed |
Random seed for UMAP (default: 1234). |
nrow |
Number of rows for arranging the plots (default: 1). |
umap_neighbors |
UMAP n_neighbors parameter (default: auto-selected based on sample count). |
fontsize |
Base font size (default: 8). |
assay |
Assay index to use, where 1 is the original data and 2 is normalised to time 0 (if available) (default: 1). |
legend_pos |
Legend position (default: "right"). |
A series of UMAP plots showing the distribution of samples in each group, coloured by Time.
data("example") plot_umap_by_group(example_obj) # Also accepts a list from split_groups() example_obj_list <- split_groups(example_obj) plot_umap_by_group(example_obj_list)data("example") plot_umap_by_group(example_obj) # Also accepts a list from split_groups() example_obj_list <- split_groups(example_obj) plot_umap_by_group(example_obj_list)
Based on PALMO::variancefeaturePlot() function
plot_variance( var_decomp, rank = "Group", features = NULL, top_n = 20, show_ylab = TRUE, fontsize = 8 )plot_variance( var_decomp, rank = "Group", features = NULL, top_n = 20, show_ylab = TRUE, fontsize = 8 )
var_decomp |
A data frame output from |
rank |
Rank the plot by selected variable (default is "Group") |
features |
Features to be plotted (default is NULL) |
top_n |
Top n features ranked by |
show_ylab |
Whether to show y axis text (default is TRUE) |
fontsize |
Font size for the plot (default is 8) |
A stacked bar plot showing the percentage of variance explained
by each model component (Group, Time, Residual, plus Subject and
interaction terms when present). Features
are ranked by the specified rank variable (Group or Time) and only the
top n features are plotted if features is not specified.
data("example") example_obj <- normalise_to_start(example_obj) var_decomp <- decomp_variance(example_obj, assay = 1) plot_variance(var_decomp, rank = "Time", top_n = 20)data("example") example_obj <- normalise_to_start(example_obj) var_decomp <- decomp_variance(example_obj, assay = 1) plot_variance(var_decomp, rank = "Time", top_n = 20)
This function creates a volcano plot to visualize
the results of differential expression (DE) analysis performed by
DE_between_group() or DE_between_time(). The plot displays
log2 fold change on the x-axis and -log10 adjusted p-value on the
y-axis, with DE features highlighted based on specified thresholds.
If no thresholds are provided, the function will use the thresholds that
were applied when running DE_between_group() or DE_between_time().
plot_volcano( DE_out, group1, group2, time, group, time1, time2, logFC_thres = NULL, adjP_thres = NULL, label = FALSE, fontsize = 8, ... )plot_volcano( DE_out, group1, group2, time, group, time1, time2, logFC_thres = NULL, adjP_thres = NULL, label = FALSE, fontsize = 8, ... )
DE_out |
Output from |
group1 |
(Required for |
group2 |
(Required for |
time |
(Required for |
group |
(Required for |
time1 |
(Required for |
time2 |
(Required for |
logFC_thres |
(Optional) Log2 fold change threshold for
highlighting DE features, default is NULL (using threshold when
|
adjP_thres |
(Optional) Adjusted p-value threshold for
highlighting DE features, default is NULL (using threshold when
|
label |
(Optional) Whether to label names of DE features on the plot (default is FALSE) |
fontsize |
(Optional) Font size for the plot (default is 8) |
... |
Additional arguments for ggrepel::geom_text_repel() when label = TRUE |
A volcano plot of DE results
data("example") example_obj <- normalise_to_start(example_obj) DE_between_group_out <- DE_between_group(example_obj, assay = 2) plot_volcano(DE_between_group_out, group1 = "untreated", group2 = "IFNbeta", time = 24, logFC_thres = 0.5, adjP_thres = 0.05, label = TRUE)data("example") example_obj <- normalise_to_start(example_obj) DE_between_group_out <- DE_between_group(example_obj, assay = 2) plot_volcano(DE_between_group_out, group1 = "untreated", group2 = "IFNbeta", time = 24, logFC_thres = 0.5, adjP_thres = 0.05, label = TRUE)
Plot WGCNA module eigengenes and module-group/time correlations
based on output of run_WGCNA()
plot_WGCNA(net, fontsize = 8)plot_WGCNA(net, fontsize = 8)
net |
WGCNA network object output by |
fontsize |
Font size for plots (default is 8) |
Plots of WGCNA module dendrogram, module eigengenes, pairwise scatterplots of eigengenes, clustering of module eigengenes, and module-trait correlation heatmap
https://github.com/edo98811/WGCNA_official_documentation/blob/main/FemaleLiver-03-relateModsToExt.R
data("example") example_obj <- normalise_to_start(example_obj) # wgcna_input <- prepare_WGCNA(example_obj, assay = 2, powers = seq(1, 30), # networkType = "signed", RsquaredCut = 0.8) # wgcna_input$fitIndices # picked_power <- wgcna_input$powerEstimate # example_net <- run_WGCNA(wgcna_input, # power = picked_power, # minModuleSize = 10, # only 100 genes in the example data # numericLabels = TRUE) data("example_net") plot_WGCNA(example_net, fontsize = 8)data("example") example_obj <- normalise_to_start(example_obj) # wgcna_input <- prepare_WGCNA(example_obj, assay = 2, powers = seq(1, 30), # networkType = "signed", RsquaredCut = 0.8) # wgcna_input$fitIndices # picked_power <- wgcna_input$powerEstimate # example_net <- run_WGCNA(wgcna_input, # power = picked_power, # minModuleSize = 10, # only 100 genes in the example data # numericLabels = TRUE) data("example_net") plot_WGCNA(example_net, fontsize = 8)
Prepare input data for WGCNA (format, QC), then choose the appropriate soft thresholding power for network construction, by analysing scale free topology with different soft thresholding powers.
prepare_WGCNA( se_obj, assay = 2, networkType = "signed", RsquaredCut = 0.8, MeanConnectivity = 100, powers = NULL, fontsize = 8, ... )prepare_WGCNA( se_obj, assay = 2, networkType = "signed", RsquaredCut = 0.8, MeanConnectivity = 100, powers = NULL, fontsize = 8, ... )
se_obj |
A SummarizedExperiment object. Data
normalised to time point 0 can be in the second assay slot, created by
|
assay |
Which assay slot of the SummarizedExperiment object to use
for WGCNA input (default is 2, which is where the time 0 normalised data is
stored by |
networkType |
(Optional) Parameter of |
RsquaredCut |
(Optional) Parameter of |
MeanConnectivity |
(Optional) Line of mean connectivity (default is 100) |
powers |
(Optional) Parameter of |
fontsize |
Base font size for diagnostic plots (default: 8). |
... |
Additional parameters to be passed to |
A list containing results of the scale-free topology
fit indices with different powers, suggested power, network type and prepared
input data used for reuse in run_WGCNA()
https://github.com/edo98811/WGCNA_official_documentation/
data("example") example_obj <- normalise_to_start(example_obj) wgcna_input <- prepare_WGCNA(example_obj, assay = 2, powers = seq(1, 30), networkType = "signed", RsquaredCut = 0.8) wgcna_input$fitIndices picked_power <- wgcna_input$powerEstimate # example_net <- run_WGCNA(wgcna_input, # power = picked_power, # minModuleSize = 10, # only 100 genes in the example data # numericLabels = TRUE) # plot_WGCNA(example_net, fontsize = 8)data("example") example_obj <- normalise_to_start(example_obj) wgcna_input <- prepare_WGCNA(example_obj, assay = 2, powers = seq(1, 30), networkType = "signed", RsquaredCut = 0.8) wgcna_input$fitIndices picked_power <- wgcna_input$powerEstimate # example_net <- run_WGCNA(wgcna_input, # power = picked_power, # minModuleSize = 10, # only 100 genes in the example data # numericLabels = TRUE) # plot_WGCNA(example_net, fontsize = 8)
Run segmented regression analysis with Trendy on imputed data for multiple groups of samples in a list of SummarizedExperiment objects. The results will be returned in a list format. Each element in the list corresponds to one group of samples and contains the Trendy analysis results for that group.
If the feature parameter is not specified, all features expressed in at
least minExp time points in each group will be included in the analysis
for the
group. calc_feature_property() should be run before imputation to
calculate the expression ratio for each feature in each group.
Missing values can be
imputed after calc_feature_property() using the impute_groups() function.
If a group has less than 4 time points are available, Trendy analysis cannot be performed and NULL will be returned for the group.
run_Trendy( se_obj_imp_list, group = NULL, feature = NULL, minExp = 0.5, maxK = 1, meanCut = 0, minNumInSeg = 3, NCores = 1, ... )run_Trendy( se_obj_imp_list, group = NULL, feature = NULL, minExp = 0.5, maxK = 1, meanCut = 0, minNumInSeg = 3, NCores = 1, ... )
se_obj_imp_list |
A list of SummarizedExperiment objects with no missing values |
group |
A character vector of group names to be analysed. If NULL, all groups in the input list will be used (default is NULL) |
feature |
A character vector of feature names to be included in the
analysis. If NULL, all features with expression ratio (Exp_ratio) >= minExp
will be
used, based on results of |
minExp |
Minimum expression ratio for a feature to be included in the analysis (default is 0.5) |
maxK |
Parameter of |
meanCut |
Parameter of |
minNumInSeg |
Parameter of |
NCores |
Number of cores to use for parallel processing (default is 1) |
... |
Additional arguments to be passed to the |
A list of Trendy analysis results, including the fitted model parameters and statistics for each feature in each group.
data("example") example_obj <- normalise_to_start(example_obj) example_obj_list <- split_groups(example_obj) example_obj_merged_list <- merge_replicates(example_obj_list) example_obj_merged_list <- calc_feature_property(example_obj_merged_list, threshold = 0) # no missing value in the example dataset, so imputation is not necessary example_obj_merged_imp_list <- impute_groups(example_obj_merged_list) # "untreated" group has only 3 time points, so Trendy analysis will not be # performed for this group example_res_list <- run_Trendy(example_obj_merged_imp_list, maxK = 1, minNumInSeg = 2, meanCut = 0) # usethis::use_data(example_res_list) # plot_segments(example_obj_merged_imp_list, example_res_list, # feature = c("Mctp1")) # plot_breakpoints(example_res_list) # trendy_summary <- summarise_Trendy(example_res_list) # trendy_list <- extract_segment_trends(trendy_summary)data("example") example_obj <- normalise_to_start(example_obj) example_obj_list <- split_groups(example_obj) example_obj_merged_list <- merge_replicates(example_obj_list) example_obj_merged_list <- calc_feature_property(example_obj_merged_list, threshold = 0) # no missing value in the example dataset, so imputation is not necessary example_obj_merged_imp_list <- impute_groups(example_obj_merged_list) # "untreated" group has only 3 time points, so Trendy analysis will not be # performed for this group example_res_list <- run_Trendy(example_obj_merged_imp_list, maxK = 1, minNumInSeg = 2, meanCut = 0) # usethis::use_data(example_res_list) # plot_segments(example_obj_merged_imp_list, example_res_list, # feature = c("Mctp1")) # plot_breakpoints(example_res_list) # trendy_summary <- summarise_Trendy(example_res_list) # trendy_list <- extract_segment_trends(trendy_summary)
Run WGCNA based on output of prepare_WGCNA(), to
identify co-expression modules of features with WGCNA::blockwiseModules()
run_WGCNA(wgcna_input, power, numericLabels = TRUE, ...)run_WGCNA(wgcna_input, power, numericLabels = TRUE, ...)
wgcna_input |
A list output by |
power |
Soft-thresholding power to be used in
|
numericLabels |
Whether to use numeric labels for modules in the output (default is TRUE) |
... |
Additional parameters to be passed to |
The built network and parameters of WGCNA::blockwiseModules(),
and the input data and sample information for use in plot_WGCNA().
https://github.com/edo98811/WGCNA_official_documentation/blob/main/FemaleLiver-03-relateModsToExt.R
data("example") example_obj <- normalise_to_start(example_obj) wgcna_input <- prepare_WGCNA(example_obj, assay = 2, powers = seq(1, 30), networkType = "signed", RsquaredCut = 0.8) wgcna_input$fitIndices picked_power <- wgcna_input$powerEstimate example_net <- run_WGCNA(wgcna_input, power = picked_power, minModuleSize = 10, # only 100 genes in the example data numericLabels = TRUE) # plot_WGCNA(example_net, fontsize = 8) # use_data(example_net)data("example") example_obj <- normalise_to_start(example_obj) wgcna_input <- prepare_WGCNA(example_obj, assay = 2, powers = seq(1, 30), networkType = "signed", RsquaredCut = 0.8) wgcna_input$fitIndices picked_power <- wgcna_input$powerEstimate example_net <- run_WGCNA(wgcna_input, power = picked_power, minModuleSize = 10, # only 100 genes in the example data numericLabels = TRUE) # plot_WGCNA(example_net, fontsize = 8) # use_data(example_net)
Set a custom color palette for groups to use in all subsequent plotting functions that support custom palettes.
set_custom_palette(palette)set_custom_palette(palette)
palette |
A named vector where names correspond to group names
and values are the corresponding colors (e.g., |
The function does not return a value but sets the custom palette as an option that can be accessed by other plotting functions. The palette will be stored in the R session options under the name "custom.palette".
custom_palette <- c("untreated" = "#1b9e77", "IFNbeta" = "#d95f02", "IFNgamma" = "#7570b3", "LPS" = "#e7298a") set_custom_palette(custom_palette)custom_palette <- c("untreated" = "#1b9e77", "IFNbeta" = "#d95f02", "IFNgamma" = "#7570b3", "LPS" = "#e7298a") set_custom_palette(custom_palette)
Split SummarizedExperiment object by groups
split_groups(se_obj)split_groups(se_obj)
se_obj |
A SummarizedExperiment object created by |
A list of SummarizedExperiment objects for each group in the input object. Each object in the list corresponds to one group of samples.
data("example") example_obj <- normalise_to_start(example_obj) example_obj_list <- split_groups(example_obj) example_obj_merged_list <- merge_replicates(example_obj_list) example_obj_merged <- merge_groups(example_obj_merged_list)data("example") example_obj <- normalise_to_start(example_obj) example_obj_list <- split_groups(example_obj) example_obj_merged_list <- merge_replicates(example_obj_list) example_obj_merged <- merge_groups(example_obj_merged_list)
This function takes a list of merged SummarizedExperiment
objects, which are the output of the calc_feature_property() function,
and summarizes the feature properties across all groups. It extracts the
row data from each SummarizedExperiment object, combines them into a
single data frame, and returns this summary data frame. Each row in the
resulting data frame represents a feature, and the columns contain the
properties of that feature for each group, including the feature name,
group name, proportion of NA values for that feature in that group,
randomness p-value, and maximum fold change over time.
summarise_feature_property(se_obj_merged_list)summarise_feature_property(se_obj_merged_list)
se_obj_merged_list |
A list of merged |
A data frame summarizing the feature properties across all groups, with each row representing a feature and columns containing the properties including the feature name, group name, and the proportion of NA values for that feature in that group, randomness p-value, and maximum fold change over time.
data("example") example_obj <- normalise_to_start(example_obj) example_obj_list <- split_groups(example_obj) example_obj_merged_list <- merge_replicates(example_obj_list) example_obj_merged_list <- calc_feature_property(example_obj_merged_list, threshold = 0) property_random_fc <- summarise_feature_property(example_obj_merged_list)data("example") example_obj <- normalise_to_start(example_obj) example_obj_list <- split_groups(example_obj) example_obj_merged_list <- merge_replicates(example_obj_list) example_obj_merged_list <- calc_feature_property(example_obj_merged_list, threshold = 0) property_random_fc <- summarise_feature_property(example_obj_merged_list)
Summarise module patterns by integrating WGCNA output with Trendy results
summarise_module_pattern(module, trendy_summary, print_top_n = TRUE, top_n = 5)summarise_module_pattern(module, trendy_summary, print_top_n = TRUE, top_n = 5)
module |
A data frame with columns "Feature" and "Module" |
trendy_summary |
A data frame of trendy results, output of
|
print_top_n |
Whether to output the top n patterns per module as text (default is TRUE) |
top_n |
Number of top patterns to show per module when |
A list of data frames, each data frame shows the pattern counts in a module
data("example_res_list") trendy_summary <- summarise_Trendy(example_res_list) data(example_net) example_module <- WGCNA_module(example_net) summarise_module_pattern(example_module, trendy_summary)data("example_res_list") trendy_summary <- summarise_Trendy(example_res_list) data(example_net) example_module <- WGCNA_module(example_net) summarise_module_pattern(example_module, trendy_summary)
Summarise Trendy results into data frame
summarise_Trendy(res_list, ...)summarise_Trendy(res_list, ...)
res_list |
A list of Trendy analysis results, output of |
... |
Additional arguments to be passed to the |
A data frame of summary results of Trendy, including breakpoints, segment slopes and p-values for each fitted feature in each group. A "Pattern" column is added to show the combination of segment trends (up, down, stable) for each feature.
data("example") example_obj <- normalise_to_start(example_obj) example_obj_list <- split_groups(example_obj) example_obj_merged_list <- merge_replicates(example_obj_list) example_obj_merged_list <- calc_feature_property(example_obj_merged_list, threshold = 0) # no missing value in the example dataset, so imputation is not necessary example_obj_merged_imp_list <- impute_groups(example_obj_merged_list) # "untreated" group has only 3 time points, so Trendy analysis will not be # performed for this group # example_res_list <- run_Trendy(example_obj_merged_imp_list, maxK = 1, # minNumInSeg = 2, meanCut = 0) data("example_res_list") plot_segments(example_obj_merged_imp_list, example_res_list, feature = c("Mctp1")) plot_breakpoints(example_res_list) trendy_summary <- summarise_Trendy(example_res_list) trendy_list <- extract_segment_trends(trendy_summary)data("example") example_obj <- normalise_to_start(example_obj) example_obj_list <- split_groups(example_obj) example_obj_merged_list <- merge_replicates(example_obj_list) example_obj_merged_list <- calc_feature_property(example_obj_merged_list, threshold = 0) # no missing value in the example dataset, so imputation is not necessary example_obj_merged_imp_list <- impute_groups(example_obj_merged_list) # "untreated" group has only 3 time points, so Trendy analysis will not be # performed for this group # example_res_list <- run_Trendy(example_obj_merged_imp_list, maxK = 1, # minNumInSeg = 2, meanCut = 0) data("example_res_list") plot_segments(example_obj_merged_imp_list, example_res_list, feature = c("Mctp1")) plot_breakpoints(example_res_list) trendy_summary <- summarise_Trendy(example_res_list) trendy_list <- extract_segment_trends(trendy_summary)
A minimal theme used by all TiDEomics plotting functions, built on
theme_minimal(). Exported so users can apply it to their own plots
for consistent styling.
theme_custom(base_size = 8, panel_border = FALSE, legend_position = "right")theme_custom(base_size = 8, panel_border = FALSE, legend_position = "right")
base_size |
Base font size (default: 8). |
panel_border |
Logical, whether to draw a border around the panel (default: FALSE). |
legend_position |
Legend position (default: "right"). |
A ggplot2 theme object.
library(ggplot2) ggplot(mtcars, aes(wt, mpg)) + geom_point() + theme_custom(base_size = 10)library(ggplot2) ggplot(mtcars, aes(wt, mpg)) + geom_point() + theme_custom(base_size = 10)
A subset of GSE263759 data set published in Integrated time-series analysis and high-content CRISPR screening delineate the dynamics of macrophage immune regulation
data(tutorial_data)data(tutorial_data)
A data.frame with 500 rows and 41 variables:
Feature ID, e.g. gene symbols
Expression values for each sample
Code for preparing the data is available in data-raw/tutorial_input.R
Ensembl IDs were mapped to symbols, genes with all zero counts were excluded.
Use time 0 untreated samples for other groups' time 0.
Include "untreated", "IFNbeta", "IFNgamma", "LPS" groups.
Sample 500 random genes.
GSE263759
A subset of GSE263759 data set published in Integrated time-series analysis and high-content CRISPR screening delineate the dynamics of macrophage immune regulation
data(tutorial_sample_info)data(tutorial_sample_info)
A data.frame with 40 rows and 5 variables:
Sample ID
Experimental group (untreated, different treatments)
Time point
Replicate ID for each group and time point
Batch information
Code for preparing the data is available in data-raw/tutorial_input.R
Ensembl IDs were mapped to symbols, genes with all zero counts were excluded.
Use time 0 untreated samples for other groups' time 0.
Include "untreated", "IFNbeta", "IFNgamma", "LPS" groups.
Sample 500 random genes.
GSE263759
Converts the module assignments from run_WGCNA() output
into two-column data.frame with Feature and Module columns,
expected by plot_modules_v(),
plot_modules_h(), summarise_module_pattern(), and all enrichment
functions.
WGCNA_module(net, exclude_grey = FALSE)WGCNA_module(net, exclude_grey = FALSE)
net |
The output of |
exclude_grey |
Logical. If |
A data.frame with columns Feature (character) and Module
(factor with sorted levels). When exclude_grey = TRUE,
grey/unassigned features are excluded.
data(example_net) module <- WGCNA_module(example_net)data(example_net) module <- WGCNA_module(example_net)