draw_chains | R Documentation |
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).
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)
p |
ggplot2 object ideally created with |
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. |
A ggplot2 object either in the plot window or as an object.
# 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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.