// 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). func WriteStockholm(w io.Writer, msa seq.MSA) error { var err error pf := func(format string, v ...interface{}) { if err != nil { return } _, err = fmt.Fprintf(w, format, v...) } pf("# STOCKHOLM 1.0\n") for row := 0; row < len(msa.Entries) && err == nil; row++ { s := msa.GetA2M(row) pf("%s %s\n", s.Name, s.Residues) } pf("//\n") return err }
// 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 WriteA2M(w io.Writer, msa seq.MSA) error { formatter := func(row int) seq.Sequence { return msa.GetA2M(row) } return write(w, msa, formatter) }