Dear all!
I have plot my data to make gene position in chromosome using chromoMap.
here
chr_file

chr_anot
and these are my scripts
library(chromoMap)
col.set = c("purple", "#4CBB17","#0096FF", "blue", "brown")
chr.data <- read.csv("chr_file.csv", header=T)
anno.data <- read.csv("chr_anot.csv", header = T)
chromoMap(list(chr.data),list(anno.data), labels = T, data_based_color_map = T,
data_color = list(c(col.set)))
I got the result like this
I would like to set every gene with different color and add the legend.
I have tried to run like this
chromoMap("chromosome_file.txt","annotation_file.txt",
data_based_color_map = T,
data_type = "categorical",
data_colors = list(c("orange","yellow")))
however, It doesnt work.
Any idea? Please help me.
Thank you
Hello @amira_ndi ,
In order to set a different color for each gene, you just need to pass a 5th data column (please see the input format in docs). In your case, you could just pass the names of the genes like:
anno.data <- cbind.data.frame(anno.data,Category=anno.data$element)
and you can set the color for each gene. Also, you can use the legend = T argument to show the legends for your plot.
here is example code:
chromoMap(list(chr.data),list(anno.data),
# labelling arguments
labels = T,
label_font = 12,
label_angle = -55,
# group annotation arguments
data_based_color_map = T,
data_type = "categorical",
data_colors = list(c("red2","yellow3","blue2","orange3","purple","green2")),
# for the legend
legend = T,
#adjusting the legend along y-axis
lg_y = 250,
#increasing canvas width for legend
canvas_width = 600,
#playing with plot properties
text_font_size = 12,
chr_color = c("#d3d3d3"))
I hope that was helpful!
Thanks & regards,
Lakshay