Skip to contents
Chapters and reference

Module II · Single-sequence circular maps · Section 5 of 12

2.4 Features, primers and restriction sites

Download R scriptIncludes preparation and every page step. File examples need the input bundle; preview and save calls are retained.
On this page
R · Example code
library(ggchord)
library(dplyr)
Data preparation and settings (expand)
R · Example code
library(ggchord)
library(dplyr)
finish_dna <- plasmid_example_pUC19
finish_seq <- finish_dna[c("accver", "length")]
finish_features <- head(find_common_features(finish_dna), 6)
finish_circle <- ggchord(finish_seq) + geom_seq() + coord_circular()
finish_labels <- finish_features |>
  mutate(anno = paste0(anno, " [", start, "-", end, " bp]"))
finish_feature_base <- finish_circle + geom_feature(data = finish_labels)

1 Generic shapes and the plasmid preset

On the same six source annotations, change only arrow to block. A block omits the directional arrow without changing strand. The third figure shows the combined geom_feature_plasmid preset: width=0.058, arrow_head_length=0.068, arrow_head_width=1.42 and plasmid Position. It changes several defaults and is not a single-parameter contrast. See shape choices and arrow/short-feature geometry.

R · Example code
p_comparefeaturearrow <- finish_circle + geom_feature(data = finish_features, shape = "arrow")
view_ggchord(p_comparefeaturearrow, width = 9, height = 8, units = "in")
Same six source annotations with generic arrow geometry.
Same six source annotations with generic arrow geometry. · Open full-resolution figure
R · Example code
p_comparefeatureblock <- finish_circle + geom_feature(data = finish_features, shape = "block")
view_ggchord(p_comparefeatureblock, width = 9, height = 8, units = "in")
Change only shape to block; source strand is retained without a directional arrow.
Change only shape to block; source strand is retained without a directional arrow. · Open full-resolution figure
R · Example code
p_comparefeaturepreset <- finish_circle + geom_feature_plasmid(data = finish_features)
view_ggchord(p_comparefeaturepreset, width = 9, height = 8, units = "in")
Plasmid preset changes head, width and placement defaults; this is a preset example, not a single-parameter contrast.
Plasmid preset changes head, width and placement defaults; this is a preset example, not a single-parameter contrast. · Open full-resolution figure

2 Share placement between overlapping features and labels

Compare identity versus a shared feature stack on the same six annotations. Pass the Position to both geometry and labels rather than moving text alone. position_feature_stack(spacing = 0.1, side = "strand", base_position = NULL) applies an optional base Position before allocating overlap lanes. position_plasmid() is a local preset; position_strand() applies signed offsets by biological strand. Inside/outside is not a substitute for strand evidence.

R · Example code
finish_position <- position_feature_stack(base_position = position_plasmid(), spacing = 0.1)
finish_stack_base <- ggchord(finish_seq) + geom_seq() + coord_circular()
R · Example code
finish_current_position <- position_identity()
p_comparepositionidentity <- finish_stack_base +
  geom_feature(data = finish_features, position = finish_current_position) +
  geom_feature_label_repel(data = finish_features, position = finish_current_position)
view_ggchord(p_comparepositionidentity, width = 9, height = 8, units = "in")
Actual overlapping annotations at their original common placement.
Actual overlapping annotations at their original common placement. · Open full-resolution figure
R · Example code
finish_current_position <- finish_position
p_comparepositionstack <- finish_stack_base +
  geom_feature(data = finish_features, position = finish_current_position) +
  geom_feature_label_repel(data = finish_features, position = finish_current_position)
view_ggchord(p_comparepositionstack, width = 9, height = 8, units = "in")
Replace only the shared Position; features and labels follow the same lanes.
Replace only the shared Position; features and labels follow the same lanes. · Open full-resolution figure

3 Replace input and continue

Change only double-line spacing to 0.04, then change the centre length_style size. Keep complete source lengths; do not infer them from maximum feature ends. For FASTA/GenBank/GFF3, check IDs and coordinates in formats. Continue with circular labels, primers, restriction sites and tracks. Preview at the figure dimensions and use the same width/height in ggsave.

Search documentation

↑ ↓ select · Enter open · Esc close; or browse by task. API and functions