How to draw a box instead of box arrow of a specific gene and how to colour it with specific colour rest of other genes
shakti83kumar opened this issue · 3 comments
Hi Sir,
I am Shakti Kumar from India. I want to dispaly flanking regions (left and right) of gene with box with specific colour rest of sorrounded genes. Kindly provide me the solution.
Thanks in advance,
Shakti Kumar
THSTI, India
Hi Shakti, I don't quite understand what you want. Could you draw a picture of what you want the plot to look like and upload it please?
Thanks Wilkox Sir,
Sorry for late response.
Sir, I want to draw a box (not arrow box) to flanking regions of a genomic island for example cagPAI and rest og genes between these flanking sequence by arrow box. My second query is I have genome but genes of cagPAI reside different contigs, then how can I draw with break between two contigs as I shown in picture attached bellow
Hi Shakti, sorry it's taken me so long to get back to this issue. You can draw boxes instead of arrows with geom_gene_arrow()
by setting the arrowhead_height
to the same as arrow_body_height
(the default is 3 mm), and arrowhead_width
to 0 mm:
library(tidyverse)
library(gggenes)
genes <- example_genes %>% filter(str_detect(gene, "^gen"))
flanking_regions <- example_genes %>% filter(str_detect(gene, "^prot"))
ggplot(mapping = aes(xmin = start, xmax = end, y = molecule, fill = gene)) +
geom_gene_arrow(data = genes) +
geom_gene_arrow(data = flanking_regions, arrowhead_height = grid::unit(3, "mm"),
arrowhead_width = grid::unit(0, "mm")) +
facet_wrap(~ molecule, scales = "free", ncol = 1) +
scale_fill_brewer(palette = "Set3") +
theme_genes()
Created on 2020-11-19 by the reprex package (v0.3.0)
For the second part of your question, unfortunately I don't know of any way to make axis breaks in a ggplot2 plot.