Comments (10)
Try:
draw(eh + hp, split = partitions, main_heatmap = "test")
draw(ht_logfc + eh + hp, split = partitions, main_heatmap = "test")
Without specifying main_heatmap
, row orders of all heatmaps are determined by the first numeric heatmap.
from enrichedheatmap.
It's working to correct the color of the top annotation when I add the main_heatmap = "test"
parameter (i.e.: The topmost line is gold, the second one is black and the last one is blue), but I would like to keep the ordering based on the fold change heatmap.
The heatmap section of the 2nd example is what I am expecting. It's the top annotation that should be identical to the 1st heatmap based on the signal strength in each partition:
Thank you very much for your help!
from enrichedheatmap.
Do you think it could be a bug or am I missing something?
from enrichedheatmap.
Hi, here the colors (col = col_blind
) defined in
ha <- HeatmapAnnotation(lines = anno_enriched(gp = gpar(col = col_blind),
axis_param = list(facing = "inside")))
The order of the colors will not be automatically adjusted according to how row clusters are arranged.
In other words, the first color in col_blind
(which is black) always corresponds to the first row clusters (which has low signal in the center).
In following two heatmaps:
You can see in the left one, the first row-cluster has intermediate signal, which represents in the top annotation as the black line between the brown and blue lines. And in the right heatmap, the first row--cluster has the lowest signal, which represents as the black line which is the lowest in the top annotation.
The colors of lines in the top annotation have no relation to the colors of the "partition" row annotation.
You need to adjust the line colors manually.
from enrichedheatmap.
Thank you for your explanation.
If I understand correctly, the heatmap is first clustered, then it will be splitted based on the order that the partitions values are found from top to bottom.
Is there a way to force the order of the splitted section of the heatmap? Would it be possible to have the CHD4 section at the top in the 2nd heatmap while keeping the ordering based on the fold changes for each section?
from enrichedheatmap.
Or would it be possible to for a color to be associated with a specific value from the partition? Like in the example, is there a way to force the partition with the "Gfi1" value from the partitions
vector to be blue?
In other words, is it possible to know which color will be used for the partition section of the heatmap before the actual clustering of the matrices?
In my example, there is a very obvious difference between each section of the heatmap that allows me to see that the colors are not matching in the partition section compared to the top annotation. But if the difference was more subtle, I could miss it and keep incorrect colors.
My main goal here is to see which curve from the top annotation corresponds to which section of the splitted heatmap. The partition section of the heatmap seemed the most straightforward approach, but maybe there is an alternative?
from enrichedheatmap.
The order of row-clusters can be controlled by setting the splitting variable partitions
as a factor where the levels of the factor controls the order of row-clusters:
# note the ordering is from top to bottom
partition = factor(partition, levels = c("CDH4", "CHD4/Gfi1", "Cfi4"))
from enrichedheatmap.
Sorry for the delay, I was away for the last weeks.
I tried using factors as you said but it did not influence the ordering of the row-clusters:
library(EnrichedHeatmap)
library(circlize)
library(ggthemes)
library(magrittr)
load("test.RData")
partitions <- factor(partitions, levels = c("CHD4", "CHD4/Gfi1", "Gfi1"))
set.seed(99841)
col_blind <- colorblind_pal()(length(unique(partitions)))
m <- normalizeToMatrix(test_cov, peaks, value_column = "score",
extend = 5000, mean_mode = "w0",w = 100)
ha <- HeatmapAnnotation(lines = anno_enriched(gp = gpar(col = col_blind),
axis_param = list(facing = "inside")))
eh <- EnrichedHeatmap(m, name = "test", column_title = "test",
top_annotation = ha)
ht_logfc <- Heatmap(logfc, name = "Fold Change", show_row_dend = FALSE,
width = unit(1, "cm"))
hp <- Heatmap(partitions, col = structure(col_blind), name = "",
show_row_names = FALSE, width = grid::unit(3, "mm"))
draw(ht_logfc + eh + hp, split = partitions)
from enrichedheatmap.
Sorry for the late reply. I was on vocation.
In your code, the first heatmap which is the log2fold change heatmap controls the row clustering and ordering. Rows are clustered and the three row-slices are also clustered. To make the row slice order exact as c("CHD4", "CHD4/Gfi1", "Gfi1")
, you need to turn off the clustering on the row slices:
ht_logfc <- Heatmap(logfc, name = "Fold Change", show_row_dend = FALSE,
cluster_row_slices = FALSE,
width = unit(1, "cm"))
If you update the package from GitHub, you can also specify cluster_row_slices
in draw()
function which directly controls the corresponding argument for the main heatmap.
draw(ht_logfc + eh + hp, split = partitions, cluster_row_slices = FALSE)
from enrichedheatmap.
Yes, it does correct the problem. I did not realize there was also a clustering on the row_slices. Thank you for your answers.
Cheers!
from enrichedheatmap.
Related Issues (20)
- strand information HOT 1
- Filtering matrices by range name HOT 5
- Visualize multiple target regions in one graph HOT 2
- How To? color top annotation lines by row_split variable? HOT 3
- to-do-list
- speed up normalizeToMatrix HOT 2
- color for anno_enriched HOT 2
- Empty matrix HOT 1
- remove failed_rows from matrix HOT 1
- Set order to row_split HOT 1
- Strandness information of signal and targte GRanges seems ignored in the calculation of normalizeToMatrix HOT 1
- strange plot Enrichedheatmap
- Strange subscript out of bounds error HOT 1
- how to show partition names at the leftmost when setting 3rd heatmap as main_heatmap HOT 1
- same y-aixs for concatenated heatmap HOT 2
- Collapsing replicates
- Scale two heatmaps with EnrichedHeatmap HOT 1
- Modification of the position of color bar
- enriched heatmap cut rows
- only use exons as target HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from enrichedheatmap.