13  Amino acid sequences

library(rtemis.draw)

Attaching package: 'rtemis.draw'
The following object is masked from 'package:graphics':

    Axis
library(rtemis.a3)
  .:rtemis.a3 0.6.0 🧬 aarch64-apple-darwin23

draw_a3() shows an amino acid sequence as a continuous, folded path. An A3 object from rtemis.a3 holds the sequence and its annotations together. Use this view to locate sites and regions in sequence context.

13.1 Draw a sequence

Start with a short illustrative peptide. This sequence is used only to explain the plotting API; it does not represent a characterized protein:

peptide <- "MARGKKIGYSAPRQTKEAIEKLAEAGVEVKGTS"
sequence <- create_A3(sequence = peptide)
sequence_chart <- draw_a3(
  sequence, n_per_row = 11L, position_every = 5L,
  title = "A peptide sequence"
)
sequence_chart

Follow the connecting line from residue 1: successive rows reverse direction. Each letter is an amino acid’s one-letter code. Position labels count from one; hover a residue to see its position and full amino acid name. n_per_row controls the wrapping, and position_every controls how frequently positions are labeled.

13.2 Add sites and regions

Annotations can mark single positions or inclusive ranges. Here we add hypothetical features to the same sequence: a candidate motif, a binding site, two phosphorylation sites, and a cleavage position. These are plotting examples, not biological findings:

annotated <- create_A3(
  sequence = peptide,
  region = list(
    Motif = annotation_range(rbind(c(5L, 13L)))
  ),
  site = list(
    Binding = annotation_position(18L)
  ),
  ptm = list(
    Phosphorylation = annotation_position(c(10L, 32L))
  ),
  processing = list(
    Cleavage = annotation_position(22L)
  )
)

annotation_chart <- draw_a3(
  annotated, n_per_row = 11L, position_every = 5L,
  title = "Sites in sequence context"
)
annotation_chart

The motif appears as a colored band. Site outlines, modification markers, and processing triangles distinguish the other annotations. Click a named legend entry to hide or restore its layer; hover a marker for its annotation details. Annotations remain in a vertical column at the upper right, matching rtemislive. The diagram reserves space for the annotation names and keeps their family headings together.

For a longer sequence, choose n_per_row for the intended display width. A smaller value gives fewer residues per row and more rows. The diagram scales its markers and labels to fit; extra height helps when many rows are needed.

13.3 Save a figure

Export the same annotated object as an SVG with vector text and marks:

save_drawing(annotation_chart, "peptide-annotations.svg",
             width = 850, height = 600)

See Exporting visualizations for export formats and Configuration objects for storing reusable chart settings.

13.4 Start from a sequence and annotation vectors

draw_protein() adapts sequence strings and named residue positions to the same A3 drawing. Region positions retain gaps between contiguous runs:

draw_protein("MAEPRQEFEVMEDHAGTYGLGDRK",
  site = list(Active = c(5L, 17L)), region = list(Domain = 3:10),
  ptm = list(Phosphorylation = 2L))

Local JSON records and A3 objects are also accepted. Fetch accession records explicitly with rtemis.a3 before drawing; a sequence string is treated as data.

© 2026 E.D. Gennatas