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

Description Usage Arguments Value Examples

View source: R/geoms.R

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

1
2
3
4
draw_chains(p, data = data,
    outline = "black", fill = "grey",
    label_chains = TRUE, labels = data[data$type == "CHAIN",]$entryName,
    size = 0.5, 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.

label_size

Size of the text used for labels.

Value

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# 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")

drawProteins documentation built on Nov. 8, 2020, 5:25 p.m.