Package msa

import "github.com/TuftsBCB/io/msa"
Overview
Index

Overview ▾

Package msa reads and writes multiple sequence alignments in FASTA, A2M or A3M formats.

func Read

func Read(reader io.Reader) (seq.MSA, error)

Read will read a single MSA from the input, where the input can be formatted in A2M or A3M formats. Sequences are read until io.EOF.

If you need to read FASTA aligned format, use ReadFasta.

func ReadFasta

func ReadFasta(reader io.Reader) (seq.MSA, error)

Read will read a single MSA from the input, where the input can be formatted in FASTA format. Sequences are read until io.EOF.

If you need to read A2M or A3M aligned formats, use Read.

func ReadStockholm

func ReadStockholm(r io.Reader) (seq.MSA, error)

ReadStockholm reads an MSA from a Stockholm formatted file. Note that features are completely ignored. This reader only checks for the Stockholm header (and version), and then slurps up the sequence data into an MSA.

func ReadStockholmTrusted

func ReadStockholmTrusted(r io.Reader) (seq.MSA, error)

ReadStockholmTrusted is the same as ReadStockholm, except it does not check if each residue is valid. This may be faster.

func ReadTrusted

func ReadTrusted(reader io.Reader) (seq.MSA, error)

ReadTrusted will read a single MSA from trusted input, where the input can be formatted/ in A2M or A3M formats. Sequences are read until io.EOF.

"Trust" in this context means that the input doesn't contain any illegal characters in the sequence. Trusting the input should be faster.

If you need to read FASTA aligned format, use ReadTrustedFasta.

func ReadTrustedFasta

func ReadTrustedFasta(reader io.Reader) (seq.MSA, error)

ReadTrustedFasta will read a single MSA from trusted input, where the input can be formatted/ in FASTA format. Sequences are read until io.EOF.

"Trust" in this context means that the input doesn't contain any illegal characters in the sequence. Trusting the input should be faster.

If you need to read A2M or A3M aligned formats, use ReadTrusted.

func WriteA2M

func WriteA2M(w io.Writer, msa seq.MSA) error

WriteA2M writes a multiple sequence alignment to the output in A2M format. A2M format uses upper case characters to indicate matches, lower case and '.' characters to indicate insertions, and '-' characters to indicate deletions.

func WriteA3M

func WriteA3M(w io.Writer, msa seq.MSA) error

WriteA3M writes a multiple sequence alignment to the output in A3M format. A3M format uses upper case characters to indicate matches, lower case characters to indicate insertions, and '-' characters to indicate deletions.

A3M format is a more compact way to write an MSA than FASTA or A2M.

func WriteFasta

func WriteFasta(w io.Writer, msa seq.MSA) error

WriteFasta writes a multiple sequence alignment to the output in aligned FASTA format. Aligned FASTA format uses upper case characters to indicate matches, lower case characters to indicate insertions, and '-' characters to indicate deletions/insertions.

func WriteStockholm

func WriteStockholm(w io.Writer, msa seq.MSA) error

WriteStockholm writes the given MSA to the writer in the Stockholm format. This does not write any features. It only creates a minimal valid Stockholm file with the header (and version) along with the sequences (names and residues).