knitr::opts_chunk$set(echo = TRUE) knitr::opts_chunk$set( fig.path = "man/figures/", fig.width = 7, fig.height = 7, dpi = 300 )
This is an R package for making plasmid maps using {ggplot2}
.
This package is still very early in development and the API may change. The parser for
.gb
files works most of the time but has not been tested extensively.
# install.packages("devtools") devtools::install_github("bradyajohnston/plasmapr")
plasmapR
provides functions for parsing and plotting .gb plasmid files.
Once a plasmid has been exported in Genbank format it can be parsed and plotted.
library(plasmapR) fl <- system.file('extdata', 'petm20.gb', package = "plasmapR") fl |> read_gb() |> plot_plasmid(name = "pETM-20")
Access the features by turning the plasmid into a data.frame.
fl <- system.file('extdata', 'petm20.gb', package = "plasmapR") plasmid <- fl |> read_gb() dat <- plasmid |> as.data.frame() head(dat) dat[dat$type == "CDS", ] |> plot_plasmid(name = "pETM-20")
It's not currently intended for linear display, but it can be used as such. I recommend checking out the gggenese
package.
#| fig-height: 3 #| message: false #| warning: false dat[dat$type == "CDS", ] |> plot_plasmid(name = NULL) + ggplot2::coord_cartesian() + ggplot2::scale_y_continuous(limits = NULL)
The result of the call is just a {ggplot2} plot, which you can further customise to your liking with themes, etc.
fl <- system.file('extdata', '20.gb', package = "plasmapR") plt <- fl |> read_gb() |> plot_plasmid() plt + ggplot2::theme_bw()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.