Skip to contents
Chapters and reference

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

Reads one alignment file. Whitespace wrapping is removed by the FASTA reader; gaps and case remain unchanged. Records must have equal width. Does not run an aligner or infer strand, genomic origins, mismatch classes or CDS phase.

Usage

R · Example code
read_aligned_fasta(
  file,
  alphabet,
  source_data = NULL,
  source_file = FALSE,
  circular = FALSE
)

Arguments

file

A single local aligned FASTA path; no multi-alignment concatenation.

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) and strand ("+" or "-"). Optional source_accver declares a different source ID; optional character sequence supplies the full forward source for verification. Coordinates must remain positive exact integers. Input metadata is retained in the ggchord_conversion attribute.

source_file

Logical. Also retain .source_file on each character row.

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

The long frame from as_ggchord_alignment(), with the physical FASTA header .source_line, optional .source_file, and import provenance.

Examples

R · Example code
result <- read_aligned_fasta("examples/alignment/opuntia-aligned.fasta", "DNA")
head(result)
#>                           accver alignment_column
#> 1 gi|6273285|gb|AF191659.1|AF191                1
#> 2 gi|6273285|gb|AF191659.1|AF191                2
#> 3 gi|6273285|gb|AF191659.1|AF191                3
#> 4 gi|6273285|gb|AF191659.1|AF191                4
#> 5 gi|6273285|gb|AF191659.1|AF191                5
#> 6 gi|6273285|gb|AF191659.1|AF191                6
#>                    source_accver source_position symbol is_gap strand alphabet
#> 1 gi|6273285|gb|AF191659.1|AF191               1      T  FALSE      +      DNA
#> 2 gi|6273285|gb|AF191659.1|AF191               2      A  FALSE      +      DNA
#> 3 gi|6273285|gb|AF191659.1|AF191               3      T  FALSE      +      DNA
#> 4 gi|6273285|gb|AF191659.1|AF191               4      A  FALSE      +      DNA
#> 5 gi|6273285|gb|AF191659.1|AF191               5      C  FALSE      +      DNA
#> 6 gi|6273285|gb|AF191659.1|AF191               6      A  FALSE      +      DNA
#>   sequence_unit source_verified .source_row .source_line
#> 1            bp           FALSE           1            1
#> 2            bp           FALSE           1            1
#> 3            bp           FALSE           1            1
#> 4            bp           FALSE           1            1
#> 5            bp           FALSE           1            1
#> 6            bp           FALSE           1            1

Search documentation

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