Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bradyajohnston/plasmapr
Creating plasmid maps inside ggplot.
https://github.com/bradyajohnston/plasmapr
Last synced: 6 days ago
JSON representation
Creating plasmid maps inside ggplot.
- Host: GitHub
- URL: https://github.com/bradyajohnston/plasmapr
- Owner: BradyAJohnston
- License: other
- Created: 2021-02-10T22:36:22.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2024-12-03T15:06:30.000Z (3 months ago)
- Last Synced: 2025-02-06T18:23:25.103Z (13 days ago)
- Language: R
- Homepage: https://bradyajohnston.github.io/plasmapR/
- Size: 10.5 MB
- Stars: 83
- Watchers: 4
- Forks: 7
- Open Issues: 10
-
Metadata Files:
- Readme: README.Rmd
- License: LICENSE
Awesome Lists containing this project
README
---
output: github_document
---```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
knitr::opts_chunk$set(
fig.path = "man/figures/",
fig.width = 7,
fig.height = 7,
dpi = 300
)
```# plasmapR
[](https://app.codecov.io/gh/bradyajohnston/plasmapR?branch=main)
[](https://github.com/bradyajohnston/plasmapR/actions/workflows/R-CMD-check.yaml)
This is an R package for making plasmid maps using `{ggplot2}`.
## Installation
> 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.```{r, eval=FALSE}
# install.packages("devtools")
devtools::install_github("bradyajohnston/plasmapr")
```## Example
`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.
```{r example-plasmid, dev='ragg_png'}
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.
```{r}
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`](https://wilkox.org/gggenes/) package.
```{r}
#| fig-height: 3
#| message: false
#| warning: false
dat[dat$type == "CDS", ] |>
plot_plasmid(name = NULL) +
ggplot2::coord_cartesian() +
ggplot2::scale_y_continuous(limits = NULL)
```## A {ggplot2} Object
The result of the call is just a {ggplot2} plot, which you can further customise
to your liking with themes, etc.
```{r example-theme, dev='ragg_png'}
fl <- system.file('extdata', '20.gb', package = "plasmapR")plt <- fl |>
read_gb() |>
plot_plasmid()plt + ggplot2::theme_bw()
```