Making a heatmap with long format data
0
0
Entering edit mode
4.2 years ago
zizigolu ★ 4.3k

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 • 848 views
ADD COMMENT
1
Entering edit mode

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 REPLY
0
Entering edit mode

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 REPLY

Login before adding your answer.

Traffic: 1320 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6