Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

msa2mat

Convert alignment to matrix


Description

Converts a FASTA formatted multiple alignment to a matrix.

Usage

msa2mat(msa)

Arguments

msa

A fasta object with a multiple alignment, see msalign'.

Details

This function converts the fasta object msa, containing a multiple alignment, to a matrix. This means each position in the alignment is a column in the matrix, and the content of the Header column of msa is used as rownames of theh matrix.

Such a matrix is useful for conversion to a DNAbin object that is used by the ape package for re-constructing phylogenetic trees.

Value

A matrix where each row is a vector of aligned bases/amino acids.

Author(s)

Lars Snipen.

See Also

Examples

msa.file <- file.path(path.package("microseq"),"extdata", "small.msa")
msa <- readFasta(msa.file)
msa.mat <- msa2mat(msa)  # to use with ape::as.DNAbin(msa.mat)

microseq

Basic Biological Sequence Handling

v2.1.4
GPL-2
Authors
Lars Snipen, Kristian Hovde Liland
Initial release
2021-01-25

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.