I am using R for the first time. I'm trying to use ggplot2 to make an arrow genome map and I am having trouble with a few of the details. Here is a snippet of the data:
genome start end gene colour
A 11638 12786 fadA6 #04E762
A 12798 13454 fadE31 #04E762
A 13529 14341 fadE32 #04E762
A 14342 15541 fadE33 #FB5607
A 15627 17168 cyp142 #FB5607
And the code I currently have:
library(ggplot2)
library(gggenes)
ggplot(REXAMPLE3, aes(xmin = start, xmax = end, y = genome, fill = gene)) +
geom_gene_arrow() +
geom_gene_label(aes(label = gene)) +
facet_wrap(~ genome, scales = "free", ncol = 1) +
scale_fill_brewer(palette = "Set3")+
theme(legend.position="none")
I need to colour the genes by function (e.g. green for side chain degradation) but I only know how to colour them individually with
gene1="colour"
. Is there a way to define the colour of each gene with a column in the dataset?Is there a way to make the labels go above the gene instead of within the arrow?
Which aes do I change to make the genes look less 'cramped'?
Thank you in advance for any help. It's hard to know what to google when you're completely new to the program.