Question: Making a heatmap with long format data
0
gravatar for A
7 months ago by
A3.9k
A3.9k wrote:

Hi

I have a data frame of groups of my patients, genes and related pathways like

> dput(head(data))
structure(list(gene = c("CCL22", "CCL22", "CCL22", "CCL22", "CCL27", 
"CCL27"), value = c(6.64466666666667, 
6.62, 6.2688, 6.34074074074074, 2.076, 0.467727272727273), Pathway = c("Cytokine-cytokine receptor interaction", 
"Cytokine-cytokine receptor interaction", "Cytokine-cytokine receptor interaction", 
"Cytokine-cytokine receptor interaction", "Cytokine-cytokine receptor interaction", 
"Cytokine-cytokine receptor interaction")), row.names = c(NA, 
-6L), class = c("tbl_df", "tbl", "data.frame"))
> 
> length(unique(data$gene))
[1] 44
> unique(data$Pathway)
[1] "Cytokine-cytokine receptor interaction" "IL-17 signaling"                        "NF-kappa B signaling"                  
[4] "TNF signaling "                         "PI3K-Akt signaling "  


>    
> dim(data)
[1] 392   4
>

How can I create a heatmap like this

enter image description here

Where categories are my pathways and treatment my groups

R • 217 views
ADD COMMENTlink modified 7 months ago • written 7 months ago by A3.9k
1

You have two structures: data and dd. Understand the difference between the two.

Pick a heatmap package (preferably CoomplexHeatmap) and start by passing your data to a simple heatmap object, then add enhancements step by step.

Show us exactly what you've tried and where you need help, and we will be in a better position to help you.

ADD REPLYlink written 7 months ago by RamRS30k

Hello A!

It appears that your post has been cross-posted to another site: https://bioinformatics.stackexchange.com/questions/11374/converting-this-data-frame-to-a-heatmap

This is typically not recommended as it runs the risk of annoying people in both communities.

ADD REPLYlink written 7 months ago by RamRS30k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1563 users visited in the last hour