Hello friends,
I try many ways to plot a heatmap. I do not know why I don't get any pattern and my heatmap looks very messy with randomly spread up and down regulated genes.
Please help me. I used winscaled z-score for this.
this is the code:
rdata <- read.table("my_data.txt", header = TRUE, row.names = 1, stringsAsFactors = FALSE)
library(pheatmap)
# Create metadata
sample_org <- data.frame(row.names = colnames(rdata), c(rep("0", 66), rep("1", 66)))
colnames(sample_org) <- c("Group")
mat <- as(rdata, "matrix")
## Set colours
my_colour = list(
Group = c("0" = "blue", "1" = "yellow"))
pheatmap(mat, symbreaks = FALSE,cluster_cols = FALSE,
cluster_rows = TRUE, color = colorRampPalette(c("#f71616","#f71616","white",
"#1919d4", "#1919d4"))(100),annotation_col = sample_org, annotation_colors = my_colour)
rna-seq
Your heatmap reflects your data. If your data does not have a pattern, your heatmap won't. Do you have an expected pattern that you see in the data?
Yes, there should be a clear pattern between patients and normal people. Also differential gene expression analysis showed that these genes are significantly differentially expressed.
Is there any problem with clustering in my code?
Are you again plotting the raw data that are neither normalized nor log2-transformed as here? heatmap in R Where in the code do you Z-score the data? Did you normalize and log the data? What is
winscaled?I have HT-seq count data, and I calculated z-score of them (to normalize data), I tried this but I did not get pattern on heatmap. Then I winscaled the z-score (any expression value >3 changed to 3, any expression value <-3 changed to -3). I used this data (winscaled z-score) in heatmap. still no pattern. I did not do log
That doesn't sound like scaling, it just sounds like setting arbitrary min/max limits. Heatmaps generally always look better on log-normalized data. You can then set
scale="row"in the pheatmap call to actually generate z-scores, which is what gives those nice blocky chunks that everybody wants.So, you mean I do log2 transformation and then scale ="row" instead of using z-score of winscaled z-score?