Package 'plasmapR'

Title: Create Plasmid Maps in R
Description: Create circular plasmid maps as ggplot objects. Allows for parsing of .gb files and the creation of plasmid maps. Features allowing for customisation of aesthetics, like regular ggplot plots.
Authors: Brady Johnston [aut, cre] (ORCID: <https://orcid.org/0000-0001-6301-2269>)
Maintainer: Brady Johnston <[email protected]>
License: MIT + file LICENSE
Version: 0.3.1
Built: 2026-06-05 06:34:43 UTC
Source: https://github.com/bradyajohnston/plasmapR

Help Index


Extract Features of a Plasmid as a DataFrame

Description

Extract Features of a Plasmid as a DataFrame

Usage

## S3 method for class 'plasmid'
as.data.frame(x, row.names, optional, ...)

Arguments

x

A list of class 'plasmid' from read_gb()

row.names

Ignored.

optional

Ignored.

...

Ignored.

Value

a DataFrame


Plot a Plasmid

Description

Create a {ggplot2} plot of a plasmid in polar coordinates. Extracts the features as a data.frame from the plasmid and uses these to construct arrows that are added to the plot.

Usage

plot_plasmid(plasmid, name = "Plasmid Name", label_wrap = 20)

Arguments

plasmid

A list of class 'plasmid' created through read_gb().

name

Name of the plasmid, to be shown in the center.

label_wrap

Passed to stringr::str_wrap() to wrap the long labels.

Value

A ggplot object.


Read a .gb GenBank File

Description

Read a .gb GenBank File

Usage

read_gb(file)

Arguments

file

File path or connection, that can be handled by readr::read_lines().

Value

a list of class 'plasmid' which can be further coerced for plotting.

Examples

fl <- system.file("extdata", "petm20.gb", package = "plasmapR")

fl |>
  read_gb() |>
  as.data.frame()

Custom Stat: Arrow

Description

This stat creates arrow shapes in a ggplot.

Usage

stat_arrow(
  mapping = NULL,
  data = NULL,
  geom = "polygon",
  position = "identity",
  na.rm = FALSE,
  show.legend = NA,
  inherit.aes = TRUE,
  ...,
  bp = 6000,
  arrowhead_size = 8
)

Arguments

mapping

The aesthetic mapping, usually constructed with aes().

data

The dataset to be used in the layer.

geom

The geometric object to use for the layer, default is "polygon".

position

Position adjustment, default is "identity".

na.rm

Should missing values be removed?

show.legend

Logical. Should this layer be included in the legends?

inherit.aes

Should inherit aesthetics from the parent plot?

...

Other arguments passed to layer().

bp

The base parameter for the arrow shape.

arrowhead_size

The size of the arrowhead.

Details

Used for drawing features for a plasmid that work in both cartesian and polad coordinate systems.

Value

A ggplot layer with arrow shapes.

Note

The bp parameter determines the base parameter of the arrow shape. The arrowhead_size parameter controls the size of the arrowhead.

See Also

geom_segment


Compute positions for an Arrow

Description

Compute positions for an Arrow

Usage

StatArrow

Format

An object of class StatArrow (inherits from Stat, ggproto, gg) of length 5.


Compute required values for labels

Description

Compute required values for labels

Usage

StatArrowLabel

Format

An object of class StatArrowLabel (inherits from StatArrow, Stat, ggproto, gg) of length 2.