0

I have a species and gene dataset like this:

Example Gene Dataset

How do I draw gene neighbourhood diagram where each gene would be represented as a rectangle with arrowhead pointing in right or left direction based on the orientation column? Each rectangle must be of equal size regardless of the start and stop coordinates of the gene, although the genes must be in order according to the coordinates. The species name must be written on the left side. The gene name must be written in the centre of each respective rectangles and each gene must be coloured uniquely based on their label.

I tried using the gggenes package:

ggplot(example_genes, aes(xmin = start, xmax = end, y = molecule, fill = gene, 
                          forward = orientation)) +
  geom_gene_arrow() +
  facet_wrap(~ molecule, scales = "free", ncol = 1) +
  scale_fill_brewer(palette = "Set3") +
  theme_genes()

Result:

Example result

But it draws gene of unequal size which makes it harder to label it. It also leaves a huge gap between each gene.

user438383
  • 5,716
  • 8
  • 28
  • 43
Rohan Nath
  • 47
  • 4
  • 3
    Can you please provide your data in an easy-to-paste form? – Roman Luštrik Dec 16 '22 at 08:43
  • Hi Rohan. Welcome to the stack. Please take the [tour] if you haven't already. You're more likely to get an answer to this question if you can provide a [minimal, reprodubile example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example). – Captain Hat Dec 16 '22 at 09:26

0 Answers0