[Bioperl-l] configuration problem with Bio::Tools::Run::Alignment::ClustalW

Huansheng Xu huansheng.xu at gmail.com
Sun Apr 22 10:15:44 EDT 2012


Hi,

I am a postdoc fellow at Massachusetts General Hospital in Boston. I am
writing to seek help with the Bio::Tools::Run::Alignment::ClustalW module
available at the BioPerl website.

I tried to align some DNA sequences contained in a FASTA file with the
module embeded in a propram (as shown below), but got stuck there. The
program works very well for protein sequences. I think maybe I need to
configure the module specifically for DNA, but I do not know how to do
that.

Could you take a look and let me know how to do the configuration? Thanks a
lot!

Best,
Huansheng Xu

--------------------------------------------------------------------------------------------------------------------------------------------------------------------

#! /usr/bin/perl

use Bio::Perl;
use Bio::SearchIO;
use Bio::AlignIO;
use Bio::Tools::Run::Alignment::Clustalw;
use warnings;
use strict;

my $filename = $ARGV[0];
die "Usage: $0 <fasta file name>\n" unless $filename;
die "File $filename not found.\n" unless -f $filename;

# Read the list of raw sequences from the file you feed the program
my $fh = Bio::SeqIO->newFh(-file=>$filename, -format=>'fasta');
my @seq_array=<$fh>;

# pass the parameters and generate a factory to run the alignmnet wiht
ClustalW
my @params = ('ktuple' => 2, 'matrix' => 'BLOSUM');
@params = ('ktuple' => 2, 'dnamatrix' => 'IUB') if ($seq_array[0]->alphabet
eq 'dna');
my $factory = Bio::Tools::Run::Alignment::Clustalw->new(@params);


my $seq_array_ref = \@seq_array;
my $aln = $factory->align($seq_array_ref);

# create a new AlignIO object
my $out = Bio::AlignIO->new(-file=> ">$filename.aln", -format=> 'clustalw');
$out->write_aln($aln);


More information about the Bioperl-l mailing list