This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Genome Diagram in R

I want to create a genome diagram of a virus. I would like to show the name and position of the genes. I found there is a package called Genome Diagram in Biopython which can do that. But I was not able to use if because of the dependency issues also I am not very good at Python.

Is there any package in R/Bioconductor that would let me create genome or plasmid diagrams if I supply nucleotide position as input ?

r

Thank you. I will check them.

1 answer

An example with a package I just found, gggenes. The data is in a data frame called hoarc:

hoarc
                                  molecule start  end          gene  strand direction
1 Haloarcula hispanica pleomorphic virus 1     1 2352       unknown forward         1
2 Haloarcula hispanica pleomorphic virus 1  2435 2794       unknown forward         1
3 Haloarcula hispanica pleomorphic virus 1  2794 3195           VP3 forward         1
4 Haloarcula hispanica pleomorphic virus 1  2794 3195 VP4 precursor forward         1
5 Haloarcula hispanica pleomorphic virus 1  4805 5356       unknown forward         1
6 Haloarcula hispanica pleomorphic virus 1  5353 6201         gene6 forward         1
7 Haloarcula hispanica pleomorphic virus 1  6348 7340         gene7 forward         1
8 Haloarcula hispanica pleomorphic virus 1  7188 7811         gene8 reverse        -1

To plot:

library(ggplot2)
library(gggenes)
ggplot(subset(hoarc, molecule == "Haloarcula hispanica pleomorphic virus 1"),
       aes(xmin = start, xmax = end, y = molecule, fill = gene, forward = direction)) +
  geom_gene_arrow()

Haloarcula

It is not pretty right now, but with ggplot2 you have plenty of options to customize the plot to your needs.

Thank you @h.mon. I will play with it. I guess I will be able to modify this according to my need.

Hey, hello! Just found this thread, I'm a bit late to the party. Am trying to annotate gene clusters that encode for antagonistic compounds in S. xylosus, and have this cute little cluster that I'm trying to represent for my PhD chapter. I'm checking your commands cause I'm kind of struggling with the molecule command and I wonder where in my system I could find the hoarc dataframe with this detailed info. If you still remember about this stuff, please kindly let me know!

Log in to answer this question.