Skip to contents

Reads a multiple sequence alignment (MSA) file and computes a coordinate mapping from alignment positions to original sequence positions. This mapping is essential for projecting genomic features (e.g., splice junctions) between species through the alignment.

Usage

loadMSA(geneID = NULL, path = NULL)

Arguments

geneID

Character vector. Gene identifier(s) to extract from the MSA. Names must match sequence headers in the FASTA file. If NULL (default), all sequences are loaded.

path

Character. Path to the alignment file (FASTA format).

Value

A list with two components:

msa

DNAMultipleAlignment object containing the (sub)set of aligned sequences.

reference

Named list of integer vectors (one per sequence). Each vector maps alignment column positions to original sequence coordinates. Gap positions are NA.

Details

The reference mapping allows conversion between coordinate systems:

  • Alignment → Sequence: reference[[geneID]][aln_pos] gives the original sequence position at alignment column aln_pos, or NA if that position is a gap.

  • Sequence → Alignment: which(reference[[geneID]] == seq_pos) gives the alignment column for sequence position seq_pos.

This is used internally by findOSJ to project splice junction coordinates across species through the MSA.