Chapter 3. Alignments

Table of Contents

3.1. AlignIO
3.2. SimpleAlign
3.3. Code reading: protal2dna.

3.1. AlignIO

The Bio::AlignIO class is designed the same as the SeqIO class. Therefore format conversions can be done as following:

Example 3.1. Format conversions with AlignIO

(data)

#! /local/bin/perl -w

use strict;
use Bio::AlignIO;

my $inform = shift @ARGV || 'clustalw';
my $outform = shift @ARGV || 'fasta';

my $in  = Bio::AlignIO->newFh ( -fh => \*STDIN, -format => $inform );
my $out = Bio::AlignIO->newFh ( -fh => \*STDOUT, -format => $outform );

print $out $_ while <$in>;

	  

AlignIO class structure. Warning: some alignment formats are available only as input formats.

Figure 3.1. AlignIO Classes diagram