Chapters and reference
Complete canonical API text; task articles explain the workflows. Usage guide

Adapt aligned characters with exact source positions
Source:R/data-alignment.R
as_ggchord_alignment.RdAccepts an existing alignment, never computes one. Equal character counts
are necessary but do not establish homology. Each input character has an
alignment_column; - and . are retained gaps with missing
source_position. Case and ambiguous symbols are retained. Lowercase
characters consume positions: this is not an A3M insertion parser.
Usage
R · Example code
as_ggchord_alignment(sequences, alphabet, source_data = NULL, circular = FALSE)Arguments
- sequences
Named character vector of aligned strings, or a data frame with unique
accverand charactersequence. All strings must have the same positive width and each record must contain a nongap symbol.- alphabet
Explicit
"DNA","RNA"or"AA". IUPAC nucleotide ambiguity codes and protein ambiguity/rare-residue codes are accepted;*is accepted only for AA. The alphabet is never guessed.- source_data
Optional data frame with one row per alignment
accver,start(first nongap source coordinate) andstrand("+"or"-"). Optionalsource_accverdeclares a different source ID; optional charactersequencesupplies the full forward source for verification. Coordinates must remain positive exact integers. Input metadata is retained in theggchord_conversionattribute.- circular
Explicit logical declaration that every source is circular, default FALSE. Requires source_data with full source_length or full sequence. Coordinates wrap at that length in the declared strand direction; nongap characters may cover at most one complete tour. Adds source_circular and source_length columns. A circular plot never activates this conversion.
Value
An ordinary long data frame containing accver, alignment_column,
source_accver, source_position, symbol, is_gap, strand, alphabet,
sequence_unit, source_verified and .source_row. Conversion provenance
retains the original input and normalized source metadata. No identity,
consensus, translation, phase or full sequence length is inferred.
source_verified records whether the record's nongap characters were
checked, including on its gap rows; it is not independent biological
confirmation of the supplied source.
Details
Without source_data, positions count from one in each ungapped input
fragment on the forward strand. They are not complete-genome coordinates.
Optional source metadata declares the first nongap position and direction.
Negative-strand positions decrease. Already aligned strings must be in
alignment orientation: they are never automatically reversed. If a full
source string is supplied, characters are verified against that string;
DNA/RNA use the complement on the negative strand, AA only reverses order.
Missing full source strings mean unverified characters, not invented data.
Examples
R · Example code
# Explicit synthetic format example, not a biological alignment claim.
aligned <- as_ggchord_alignment(c(A = "AC-G", B = "ACTG"), "DNA")
aligned
#> accver alignment_column source_accver source_position symbol is_gap strand
#> 1 A 1 A 1 A FALSE +
#> 2 A 2 A 2 C FALSE +
#> 3 A 3 A NA - TRUE +
#> 4 A 4 A 3 G FALSE +
#> 5 B 1 B 1 A FALSE +
#> 6 B 2 B 2 C FALSE +
#> 7 B 3 B 3 T FALSE +
#> 8 B 4 B 4 G FALSE +
#> alphabet sequence_unit source_verified .source_row
#> 1 DNA bp FALSE 1
#> 2 DNA bp FALSE 1
#> 3 DNA bp FALSE 1
#> 4 DNA bp FALSE 1
#> 5 DNA bp FALSE 2
#> 6 DNA bp FALSE 2
#> 7 DNA bp FALSE 2
#> 8 DNA bp FALSE 2