
Plot a heatmap
plot_heatmap.Rdplot_heatmap generates a heatmap of all or selected features for DEP or DEG data.
Usage
# S4 method for SummarizedExperiment
plot_heatmap(
  object,
  type = c("centered", "contrast"),
  manual_contrast = NULL,
  kmeans = FALSE,
  k = 6,
  color = c("RdBu", "RdYlBu", "RdYlGn", "BrBG", "PiYG", "PRGn", "PuOr", "RdGy",
    "Spectral"),
  col_limit = 6,
  indicate = NULL,
  row_font_size = 6,
  col_font_size = 10,
  clustering_distance = c("euclidean", "maximum", "manhattan", "canberra", "binary",
    "minkowski", "pearson", "spearman", "kendall", "gower"),
  split_order = NULL,
  label_few_peptide_rows = FALSE,
  chooseToshow = NULL,
  plot = TRUE,
  seed = 42,
  ...
)
# S4 method for DEGdata
plot_heatmap(
  object,
  type = c("centered", "contrast"),
  manual_contrast = NULL,
  kmeans = FALSE,
  k = 6,
  color = c("RdBu", "RdYlBu", "RdYlGn", "BrBG", "PiYG", "PRGn", "PuOr", "RdGy",
    "Spectral"),
  col_limit = 6,
  indicate = NULL,
  row_font_size = 6,
  col_font_size = 10,
  clustering_distance = c("euclidean", "maximum", "manhattan", "canberra", "binary",
    "minkowski", "pearson", "spearman", "kendall", "gower"),
  split_order = NULL,
  label_few_peptide_rows = FALSE,
  chooseToshow = NULL,
  plot = TRUE,
  seed = 42,
  ...
)Arguments
- object
- SummarizedExperiment or DEGDdata object for which differentially enriched proteins are annotated (output from - test_diff()and- add_rejections()).
- type
- type 'contrast' or 'centered', The type of data scaling used for plotting. Either the fold change ('contrast') or the centered log2-intensity ('centered'). 
- manual_contrast
- Character. Only plot significant proteins in certain contrasts. 
- kmeans
- Logical(1), Whether or not to perform k-means clustering. 
- k
- Integer(1), Sets the number of k-means clusters, k must less than row of heatmap 
- color
- Character(1), sets the color panel (from RColorBrewer). It can be a palette name in "RdBu", "RdYlBu", "RdYlGn", "BrBG", "PiYG", "PRGn", "PuOr", "RdGy", "Spectral". 
- col_limit
- Integer(1), Sets the outer limits of the color scale. 
- indicate
- Character, Sets additional annotation on the top of the heatmap based on columns from the experimental design (colData). Only applicable to type = 'centered'. 
- row_font_size
- Integer(1), Font size of row name 
- col_font_size
- Integer(1), Font size of columns label. 
- clustering_distance
- Character(1)."euclidean", "maximum", "manhattan", "canberra", "binary", "minkowski", "pearson", "spearman", "kendall" or "gower", Or a Function used to calculate clustering distance (for proteins and samples). Based on - Heatmapand- daisy.
- split_order
- a integer vector in 1:k. The order of cluster slices in the heatmap. If NULL, slices order is based clustering distance. Work if Kmeans = TRUE. 
- label_few_peptide_rows
- Logic(1) If TRUE, label proteins with few peptide by color. Proteins with only one peptide show a purple name in heatmap, with two peptide show a blue name. 
- chooseToshow
- Character vector of the chosen proteins/peptides names. If is not null, only plot the chosen proteins/peptides in it 
- plot
- Logical(1) If - TRUE(default) the heatmap is produced. Otherwise (if- FALSE), the data which the heatmap is based on are returned.
- seed
- Integer(1), the random seed that effect kmeans cluster in heatmap. Preset a seed could a repeatable cluster result. 
- ...
- Other parameters to - Heatmap.
Value
return a heatmap (generated by Heatmap) or a data.frame if plot = F.
Examples
# Load example
data(Silicosis_pg)
data <- Silicosis_pg
data_unique <- make_unique(data, "Gene.names", "Protein.IDs", delim = ";")
# Differential test
ecols <- grep("LFQ.", colnames(data_unique))
se <- make_se_parse(data_unique, ecols,mode = "delim")
filt <- filter_se(se, thr = 0, fraction = 0.4, filter_formula = ~ Reverse != "+" & Potential.contaminant!="+")
#> filter base on missing number is <= 0 in at least one condition.
#> filter base on missing number fraction < 0.4 in each row
#> filter base on giving formula 
norm <- normalize_vsn(filt)
#> vsn2: 8762 x 20 matrix (1 stratum). 
#> Please use 'meanSdPlot' to verify the fit.
imputed <- impute(norm, fun = "MinProb", q = 0.05)
#> Imputing along margin 2 (samples/columns).
#> [1] 0.3026531
diff <- test_diff(imputed, type = "manual", control  = c("PBS"), fdr.type = "Storey's qvalue")
#> Error in test_diff(imputed, type = "manual", control = c("PBS"), fdr.type = "Storey's qvalue"): run test_diff(type = 'manual') with a 'test' argument
dep <- add_rejections(diff, alpha = 0.01,lfc = 2)
#> Error in (function (classes, fdef, mtable) {    methods <- .findInheritedMethods(classes, fdef, mtable)    if (length(methods) == 1L)         return(methods[[1L]])    else if (length(methods) == 0L) {        cnames <- paste0("\"", vapply(classes, as.character,             ""), "\"", collapse = ", ")        stop(gettextf("unable to find an inherited method for function %s for signature %s",             sQuote(fdef@generic), sQuote(cnames)), domain = NA)    }    else stop("Internal error in finding inherited methods; didn't return a unique method",         domain = NA)})(list(structure("standardGeneric", package = "methods")), new("nonstandardGenericFunction",     .Data = function (diff, alpha = 0.05, lfc = 1, thresholdmethod = "intersect",         curvature = 1, x0_fold = 2, ...)     {        standardGeneric("add_rejections")    }, generic = structure("add_rejections", package = "DEP2"),     package = "DEP2", group = list(), valueClass = character(0),     signature = c("diff", "alpha", "lfc", "thresholdmethod",     "curvature", "x0_fold"), default = NULL, skeleton = (function (diff,         alpha = 0.05, lfc = 1, thresholdmethod = "intersect",         curvature = 1, x0_fold = 2, ...)     stop(gettextf("invalid call in method dispatch to '%s' (no default method)",         "add_rejections"), domain = NA))(diff, alpha, lfc, thresholdmethod,         curvature, x0_fold, ...)), <environment>): unable to find an inherited method for function ‘add_rejections’ for signature ‘"standardGeneric"’
# Heatmap
plot_heatmap(dep)
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'object' in selecting a method for function 'plot_heatmap': object 'dep' not found