Skip to content

Latest commit

 

History

History
57 lines (43 loc) · 977 Bytes

identical.md

File metadata and controls

57 lines (43 loc) · 977 Bytes

Goalign: toolkit and api for alignment manipulation

API

identical

Telling whether two alignments are identical

package main

import (
	"bufio"
	"fmt"
	"io"

	"github.com/evolbioinfo/goalign/align"
	"github.com/evolbioinfo/goalign/io/fasta"
	"github.com/evolbioinfo/goalign/io/utils"
)

func main() {
	var fi, fi2 io.Closer
	var r, r2 *bufio.Reader
	var err error
	var al, al2 align.Alignment

	/* First Alignment*/

	/* Get reader (plain text or gzip) */
	if fi, r, err = utils.GetReader("align.fa"); err != nil {
		panic(err)
	}

	/* Parse Fasta */
	if al, err = fasta.NewParser(r).Parse(); err != nil {
		panic(err)
	}
	fi.Close()

	/* Second Alignments */

	/* Get reader (plain text or gzip) */
	if fi2, r2, err = utils.GetReader("align2.fa"); err != nil {
		panic(err)
	}

	/* Parse Fasta */
	if al2, err = fasta.NewParser(r2).Parse(); err != nil {
		panic(err)
	}
	fi2.Close()

	/* Printing unaligned sequences */
	fmt.Println(al.Identical(al2))
}