I'm trying to plot a heatmap of my RNA seq data there's a 1847 rows containing the sample names at first row, the gene name at first column, other columns are the TPKM.
But the multiple arguments keep occur when I want to selectively label a few genes.
data <- read.csv("forheatmapUPchipvenny.csv", header = TRUE, row.names = 1, check.names = FALSE)
Selectively label genes
genes_of_interest <- c("abu-7", "abu-8", "abu-10", "abu-11")
Extract the TPKM values
expression_data <- data[, -1] # Exclude the first column
Scale the rows and compute Z-scores
scaled_data <- t(apply(expression_data, 1, scale))
Load the required packages
library(ComplexHeatmap)
library(RColorBrewer)
Create a color mapping for the heatmap
col_fun <- colorRampPalette(c("blue", "white", "red"))(100)
Create the heatmap with gene names as row names and sample names as column names
heatmap <- Heatmap(
scaled_data,
col = col_fun,
name = "Z-score",
row_dend_side = "left", # Position row dendrogram on the left side
row_names_side = "left", # Position row names on the left side
row_names_rot = 0, # Rotate row names horizontally
column_names_side = "top",
column_names_gp = gpar(fontsize = 6),
row_names = genes_of_interest,
top_annotation = ha # Add the row annotation to the heatmap
)
Then it return the error of Error in Heatmap(scaled_data, col = col_fun, name = "Z-score", row_dend_side = "left", :
argument 9 matches multiple formal arguments
How could I solve it?