Learn R Programming

TCGAbiolinks (version 1.2.5)

TCGAvisualize_Heatmap: Heatmap with more sensible behavior using heatmap.plus

Description

Heatmap with more sensible behavior using heatmap.plus

Usage

TCGAvisualize_Heatmap(data, col.metadata, row.metadata, col.colors = NULL, row.colors = NULL, show_column_names = FALSE, show_row_names = FALSE, cluster_rows = FALSE, cluster_columns = FALSE, sortCol, title, type = "expression", scale = "none", heatmap.legend.color.bar = "continuous")

Arguments

data
The object to with the heatmap data (expression, methylation)
col.metadata
Metadata for the columns (samples). It should have on of the following columns: barcode (28 characters) column to match with the samples. It will also work with "bcr_patient_barcode"(12 chars),"patient"(12 chars),"sample"(16 chars) columns but as one patient might have more than one sample, this coul lead to errors in the annotation. The code will throw a warning in case two samples are from the same patient.
row.metadata
Metadata for the rows genes (expression) or probes (methylation)
col.colors
A list of names colors
row.colors
A list of named colors
show_column_names
Show column names names? Dafault: FALSE
show_row_names
Show row names? Dafault: FALSE
cluster_rows
Cluster rows ? Dafault: FALSE
cluster_columns
Cluster columns ? Dafault: FALSE
sortCol
Name of the column to be used to sort the columns
title
Title of the plot
type
Select the colors of the heatmap values. Possible values are "expression" (default), "methylation"
scale
Use z-score to make the heatmap? If we want to show differences between genes, it is good to make Z-score by samples (force each sample to have zero mean and standard deviation=1). If we want to show differences between samples, it is good to make Z-score by genes (force each gene to have zero mean and standard deviation=1). Possibilities: "row", "col". Default "none"
heatmap.legend.color.bar
Heatmap legends values type. Options: "continuous", "disctrete

Value

Heatmap plotted in the device

Examples

Run this code
 row.mdat <- matrix(c("FALSE","FALSE",
                     "TRUE","TRUE",
                     "FALSE","FALSE",
                     "TRUE","FALSE",
                     "FALSE","TRUE"
                ),
              nrow = 5, ncol = 2, byrow = TRUE,
              dimnames = list(
                  c("probe1", "probe2","probe3","probe4","probe5"),
                  c("duplicated", "Enhancer region")))
dat <- matrix(c(0.3,0.2,0.3,1,1,0.1,1,1,0, 0.8,1,0.7,0.7,0.3,1),
             nrow = 5, ncol = 3, byrow = TRUE,
               dimnames = list(
               c("probe1", "probe2","probe3","probe4","probe5"),
               c("TCGA-DU-6410",
                 "TCGA-DU-A5TS",
                 "TCGA-HT-7688")))

mdat <- data.frame(patient=c("TCGA-DU-6410","TCGA-DU-A5TS","TCGA-HT-7688"),
                   Sex=c("Male","Female","Male"),
                   COCCluster=c("coc1","coc1","coc1"),
                   IDHtype=c("IDHwt","IDHMut-cod","IDHMut-noncod"))

TCGAvisualize_Heatmap(dat,
                    col.metadata = mdat,
                    row.metadata = row.mdat,
                    row.colors = list(duplicated = c("FALSE" = "pink",
                                                     "TRUE"="green"),
                                     "Enhancer region" = c("FALSE" = "purple",
                                                            "TRUE"="grey")),
                    col.colors = list(Sex = c("Male" = "blue", "Female"="red"),
                                      COCCluster=c("coc1"="grey"),
                                      IDHtype=c("IDHwt"="cyan",
                                      "IDHMut-cod"="tomato"
                                      ,"IDHMut-noncod"="gold")),
                    type = "methylation",
                    show_row_names=TRUE)
if (!(is.null(dev.list()["RStudioGD"]))){dev.off()}

Run the code above in your browser using DataLab