Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue assigning colors to negative values in gene expression heatmap #1220

Open
HanaBarrett opened this issue Nov 11, 2024 · 0 comments
Open

Comments

@HanaBarrett
Copy link

Please provide example datasets and the code you use. It will help me to understand your problem and help you!
I'm not sure what could be causing this issue since I am using a script that worked previously and the issue just developed. Basically, when I use ColorRamp2 to assign the colors to my gene expression values (cell_wall_genes) it doesn't seem to work correctly, so when I add the colors to the heatmap it causes an error.

Color assigning lines:
col = colorRamp2(c(-3, 0, 3), c("blue", "white", "red"))
cols1 <- brewer.pal(11, "Paired")

Short segment of dataset for reference:
Index,GeneID,Cell_wall_function,Notes,product_name,log2_FC,pvalue
7534,gene_7038,Other,,Fasciclin and related adhesion glycoproteins,5.164,0
10546,gene_9853,Chitin,,Chitin synthase-domain containing protein,-4.0,4.54E-10

Heatmap code:
log2FC2 <- as.matrix(subset(cell_wall_genes,select=c(Cell_wall_function,log2_FC)))
GeneID2 <- as.matrix(subset(cell_wall_genes,select=c(GeneID)))
rownames(log2FC2) = GeneID2

ht1 = Heatmap(log2FC2,Log2FC, name = "Expression",
row_order = sort(Cell_wall_function),
col = col,
row_km = 5,
show_row_names = TRUE,
show_column_names = FALSE)

draw(ht1, row_title = "Genes", column_title = "DEGs associated with cell wall remodeling (p<0.05)")

Error text comes up when I run the ht1= line:
Error in col2rgb(na_col, alpha = TRUE) :
numerical color values must be >= 0, found -4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant