Chapters and reference
Module I · Multi-sequence relationships · Section 9 of 16
1.8 Chord: backbone geometry
On this page
Data preparation and settings (expand)
R · Example code
p_chord_backbone <- ggchord(seq_data = seq_data_example) +
geom_seq() +
geom_seq_label() +
coord_chord()1 Rotate the plot
R · Example code
p_chord_rotated <- p_chord_backbone + coord_chord(rotation = 90)
view_ggchord(p_chord_rotated, width = 7, height = 7, units = "in")
rotation sets the counterclockwise angle and defaults to 0°. With rotation = 90, the backbones and labels turn 90° from the default plot. Compare the position of the gaps with the default plot. Rotation can free space on one side for layout while preserving coordinate order within each sequence.
2 Increase the space between backbones
R · Example code
p_chord_gap <- ggchord(seq_data = seq_data_example) +
geom_seq(seq_gap = c("MT108731.1" = 0.12)) +
geom_seq_label() +
coord_chord()
view_ggchord(p_chord_gap, width = 7, height = 7, units = "in")
seq_gap controls the gap proportion between adjacent backbones. The default is 0.03. This example sets only the gap after MT108731.1 to 0.12. Other gaps retain 0.03. The last sequence’s gap closes the ring. Compare the space between adjacent arcs, then check that the longer sequence still has the longer arc.
3 Radius: move one arc inward
R · Example code
chord_radius <- c("MT118296.1" = 0.72)
p_chord_radius <- ggchord(seq_data = seq_data_example) +
geom_seq(seq_radius = chord_radius) +
geom_seq_label() +
coord_chord()
view_ggchord(p_chord_radius, width = 7, height = 7, units = "in")
The default radius is 1. Three arcs keep it and MT118296.1 uses 0.72. Compare with the default backbones. That arc sits closer to the centre and still ends at about 32,090 bp. Radius is a layout unit. Use the ticks to read sequence length.
4 Curvature: draw a straight backbone
R · Example code
chord_curvature <- c("MT118296.1" = 0)
p_chord_curvature <- ggchord(seq_data = seq_data_example) +
geom_seq(seq_curvature = chord_curvature) +
geom_seq_label() +
coord_chord()
view_ggchord(p_chord_curvature, width = 7, height = 7, units = "in")
seq_curvature = 1 draws a standard arc, 0 draws a straight backbone, and negative values bend in the opposite direction. The other three backbones keep the standard arc. To combine radius and curvature, try each setting separately before using both.