Skip to contents

Plot an amino acid sequence with multiple site and/or region annotations.

Usage

draw_protein(
  x,
  site = NULL,
  region = NULL,
  ptm = NULL,
  clv = NULL,
  variant = NULL,
  disease_variants = NULL,
  n_per_row = NULL,
  main = NULL,
  main_xy = c(0.055, 0.975),
  main_xref = "paper",
  main_yref = "paper",
  main_xanchor = "middle",
  main_yanchor = "top",
  layout = c("simple", "grid", "1curve", "2curve"),
  show_markers = TRUE,
  show_labels = TRUE,
  font_size = 18,
  label_col = NULL,
  scatter_mode = "markers+lines",
  marker_size = 28,
  marker_col = NULL,
  marker_alpha = 1,
  marker_symbol = "circle",
  line_col = NULL,
  line_alpha = 1,
  line_width = 2,
  show_full_names = TRUE,
  region_scatter_mode = "markers+lines",
  region_style = 3,
  region_marker_size = marker_size,
  region_marker_alpha = 0.6,
  region_marker_symbol = "circle",
  region_line_dash = "solid",
  region_line_shape = "line",
  region_line_smoothing = 1,
  region_line_width = 1,
  region_line_alpha = 0.6,
  theme = rtemis_theme,
  region_palette = rtemis_palette,
  region_outline_only = FALSE,
  region_outline_pad = 2,
  region_pad = 0.35,
  region_fill_alpha = 0.1666666,
  region_fill_shape = "line",
  region_fill_smoothing = 1,
  bpadcx = 0.5,
  bpadcy = 0.5,
  site_marker_size = marker_size,
  site_marker_symbol = marker_symbol,
  site_marker_alpha = 1,
  site_border_width = 1.5,
  site_palette = rtemis_palette,
  variant_col = "#FA6E1E",
  disease_variant_col = "#E266AE",
  showlegend_ptm = TRUE,
  ptm_col = NULL,
  ptm_symbol = "circle",
  ptm_offset = 0.12,
  ptm_pad = 0.35,
  ptm_marker_size = marker_size/4.5,
  clv_col = NULL,
  clv_symbol = "triangle-down",
  clv_offset = 0.12,
  clv_pad = 0.35,
  clv_marker_size = marker_size/4,
  annotate_position_every = 10,
  annotate_position_alpha = 0.5,
  annotate_position_ay = -0.4 * marker_size,
  position_font_size = font_size - 6,
  legend_xy = c(0.97, 0.954),
  legend_xanchor = "left",
  legend_yanchor = "top",
  legend_orientation = "v",
  legend_col = NULL,
  legend_bg = "#FFFFFF00",
  legend_border_col = "#FFFFFF00",
  legend_borderwidth = 0,
  legend_group_gap = 0,
  margin = list(b = 0, l = 0, t = 0, r = 0, pad = 0),
  showgrid_x = FALSE,
  showgrid_y = FALSE,
  automargin_x = TRUE,
  automargin_y = TRUE,
  xaxis_autorange = TRUE,
  yaxis_autorange = "reversed",
  scaleanchor_y = "x",
  scaleratio_y = 1,
  hoverlabel_align = "left",
  displayModeBar = TRUE,
  modeBar_file_format = "svg",
  scrollZoom = TRUE,
  filename = NULL,
  file_width = 1320,
  file_height = 990,
  file_scale = 1,
  width = NULL,
  height = NULL,
  verbosity = 1L,
  ...
)

Arguments

x

Character vector: amino acid sequence (1-letter abbreviations) OR a3 object OR Character: path to JSON file OR Character: UniProt accession number.

site

Named list of lists with indices of sites. These will be highlighted by coloring the border of markers.

region

Named list of lists with indices of regions. These will be highlighted by coloring the markers and lines of regions using the palette colors.

ptm

List of post-translational modifications.

clv

List of cleavage sites.

variant

List of variant information.

disease_variants

List of disease variant information.

n_per_row

Integer: Number of amino acids to show per row.

main

Character: Main title.

main_xy

Numeric vector, length 2: x and y coordinates for title. e.g. if main_xref and main_yref are "paper": c(0.055, .975) is top left, c(.5, .975) is top and middle.

main_xref

Character: xref for title.

main_yref

Character: yref for title.

main_xanchor

Character: xanchor for title.

main_yanchor

Character: yanchor for title.

layout

Character: "1curve", "grid": type of layout to use.

show_markers

Logical: If TRUE, show amino acid markers.

show_labels

Logical: If TRUE, annotate amino acids with elements.

font_size

Integer: Font size for labels.

label_col

Color for labels.

scatter_mode

Character: Mode for scatter plot.

marker_size

Integer: Size of markers.

marker_col

Color for markers.

marker_alpha

Numeric: Alpha for markers.

marker_symbol

Character: Symbol for markers.

line_col

Color for lines.

line_alpha

Numeric: Alpha for lines.

line_width

Numeric: Width for lines.

show_full_names

Logical: If TRUE, show full names of amino acids.

region_scatter_mode

Character: Mode for scatter plot.

region_style

Integer: Style for regions.

region_marker_size

Integer: Size of region markers.

region_marker_alpha

Numeric: Alpha for region markers.

region_marker_symbol

Character: Symbol for region markers.

region_line_dash

Character: Dash for region lines.

region_line_shape

Character: Shape for region lines.

region_line_smoothing

Numeric: Smoothing for region lines.

region_line_width

Numeric: Width for region lines.

region_line_alpha

Numeric: Alpha for region lines.

theme

Character: Theme to use: Run themes() for available themes.

region_palette

Named list of colors for regions.

region_outline_only

Logical: If TRUE, only show outline of regions.

region_outline_pad

Numeric: Padding for region outline.

region_pad

Numeric: Padding for region.

region_fill_alpha

Numeric: Alpha for region fill.

region_fill_shape

Character: Shape for region fill.

region_fill_smoothing

Numeric: Smoothing for region fill.

bpadcx

Numeric: Padding for region border.

bpadcy

Numeric: Padding for region border.

site_marker_size

Integer: Size of site markers.

site_marker_symbol

Character: Symbol for site markers.

site_marker_alpha

Numeric: Alpha for site markers.

site_border_width

Numeric: Width for site borders.

site_palette

Named list of colors for sites.

variant_col

Color for variants.

disease_variant_col

Color for disease variants.

showlegend_ptm

Logical: If TRUE, show legend for PTMs.

ptm_col

Named list of colors for PTMs.

ptm_symbol

Character: Symbol for PTMs.

ptm_offset

Numeric: Offset for PTMs.

ptm_pad

Numeric: Padding for PTMs.

ptm_marker_size

Integer: Size of PTM markers.

clv_col

Color for cleavage site annotations.

clv_symbol

Character: Symbol for cleavage site annotations.

clv_offset

Numeric: Offset for cleavage site annotations.

clv_pad

Numeric: Padding for cleavage site annotations.

clv_marker_size

Integer: Size of cleavage site annotation markers.

annotate_position_every

Integer: Annotate every nth position.

annotate_position_alpha

Numeric: Alpha for position annotations.

annotate_position_ay

Numeric: Y offset for position annotations.

position_font_size

Integer: Font size for position annotations.

legend_xy

Numeric vector, length 2: x and y coordinates for legend.

legend_xanchor

Character: xanchor for legend.

legend_yanchor

Character: yanchor for legend.

legend_orientation

Character: Orientation for legend.

legend_col

Color for legend.

legend_bg

Color for legend background.

legend_border_col

Color for legend border.

legend_borderwidth

Numeric: Width for legend border.

legend_group_gap

Numeric: Gap between legend groups.

margin

List: Margin settings.

showgrid_x

Logical: If TRUE, show x grid.

showgrid_y

Logical: If TRUE, show y grid.

automargin_x

Logical: If TRUE, use automatic margin for x axis.

automargin_y

Logical: If TRUE, use automatic margin for y axis.

xaxis_autorange

Logical: If TRUE, use automatic range for x axis.

yaxis_autorange

Character: If TRUE, use automatic range for y axis.

scaleanchor_y

Character: Scale anchor for y axis.

scaleratio_y

Numeric: Scale ratio for y axis.

hoverlabel_align

Character: Alignment for hover label.

displayModeBar

Logical: If TRUE, display mode bar.

modeBar_file_format

Character: File format for mode bar.

scrollZoom

Logical: If TRUE, enable scroll zoom.

filename

Character: File name to save plot.

file_width

Integer: Width for saved file.

file_height

Integer: Height for saved file.

file_scale

Numeric: Scale for saved file.

width

Integer: Width for plot.

height

Integer: Height for plot.

verbosity

Integer: Verbosity level.

...

Additional arguments to pass to the theme function.

Value

A plotly object

Author

EDG

Examples

if (FALSE) { # \dontrun{
tau <- seqinr::read.fasta("https://rest.uniprot.org/uniprotkb/P10636.fasta",
  seqtype = "AA"
)
draw_protein(as.character(tau[[1]]))

# or directly using the UniProt accession number:
draw_protein("P10636")
} # }