draw_chains: Create ggplot2 object with protein chains from feature...

View source: R/geoms.R

draw_chainsR Documentation

Create ggplot2 object with protein chains from feature database

Description

draw_chains uses the dataframe containing the protein features to plot the chains, the full length proteins. It creates the basic plot element by determining the length of the longest protein. The ggplot2 function geom_rect is then used to draw each of the protein chains proportional to their number of amino acids (length).

Usage

draw_chains(p, data = data,
    outline = "black", fill = "grey",
    label_chains = TRUE, labels = data[data$type == "CHAIN",]$entryName,
    size = 0.5, alpha = 1.0, label_size = 4)

Arguments

p

ggplot2 object ideally created with draw_canvas.

data

Dataframe of one or more rows with the following column names: 'type', 'description', 'begin', 'end', 'length', 'accession', 'entryName', 'taxid', 'order'. Must contain a minimum of one "CHAIN" as data$type.

outline

Colour of the outline of each chain.

fill

Colour of the fill of each chain.

label_chains

Option to label chains or not.

labels

Vector with source of names for the chains. EntryName used as default but can be changed.

size

Size of the outline of the chains.

alpha

Transparency of the rectangles representing the chains.

label_size

Size of the text used for labels.

Value

A ggplot2 object either in the plot window or as an object.

Examples

# combines with draw_canvas to plot and label chains.
data("five_rel_data")
p <- draw_canvas(five_rel_data)
draw_chains(p, five_rel_data)

# draws five chains with different colours to default
data("five_rel_data")
p <- draw_canvas(five_rel_data)
draw_chains(p, five_rel_data,
    label_chains = FALSE,
    fill = "red",
    outline = "grey")


brennanpincardiff/drawProteins documentation built on March 8, 2024, 8:15 a.m.