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

Read existing MAF blocks with exact source characters
Source:R/data-genome-alignment.R
read_maf.RdOptional Biopython Bio.Align parses local MAF through an explicitly selected Python environment. No alignment is computed. Full source IDs, lengths, block scores, coordinate matrices and original text remain traceable. Empty components and quality/context lines remain in source text/parser metadata; no characters or relations are invented for absent components. Zero-length s components are listed in report$unplaced_components. They do not acquire source positions or links; an empty first anchor is not replaced by another component implicitly.
Usage
R · Example code
read_maf(
file = NULL,
files = NULL,
alphabet = "DNA",
python = "python3",
source_file = FALSE
)Arguments
- file
Optional local path vector or glob patterns, before files.
- files
Optional additional MAF paths or patterns.
- alphabet
Declared DNA, RNA or AA alphabet, default "DNA".
- python
Existing interpreter with optional Biopython, default "python3".
- source_file
Add .source_file to alignment/ribbon rows, default FALSE.
Value
A list with seq_data (declared full lengths), ribbon_data, alignment cells and report. Source indices and original decoder metadata remain in the report. No pident or read support is manufactured.
Details
Each block's first component is the query anchor, paired with every other nonempty component. No all-pairs clique or Identity is inferred. Source positions come from the decoder's forward zero-based boundary matrix and are converted once to directional one-based inclusive endpoints. Negative rows decrease from their true forward source coordinate, not the offset on the reverse-complement string. Blocks and input files are separate contexts.
Alignment cells reuse as_ggchord_alignment(). Original symbols and gaps
are retained; gaps have missing source positions. Full lengths do not verify
source characters independently, so source_verified stays FALSE. Filter
.source_input and source_block before column lookup or drawing a character
panel: alignment columns restart at one in each block. No blocks are joined,
renumbered or promoted to complete source sequences.
Examples
R · Example code
python <- Sys.getenv("ALIGNMENT_PYTHON", "python3")
available <- identical(suppressWarnings(system2(python,
c("-c", shQuote("import Bio")), stdout = FALSE, stderr = FALSE)), 0L)
if (available) {
result <- read_maf("examples/genome-alignments/ucsc_mm9_chr10.maf", alphabet = "DNA", python = python)
head(result$alignment)
} else {
"Optional Biopython parser is unavailable; no parsed result was computed."
}
#> [1] "Optional Biopython parser is unavailable; no parsed result was computed."