[Bioperl-l] Help for using Clustalw.pm

Sun, Jian jsun at utdallas.edu
Wed Jul 28 12:19:37 EDT 2004

Dear James;
   Thanks again. I added the scipts code you presented in last message to myine as shown below, but still have some probelm:
# To install in web, make a directory to hold your Perl modules in web space
use lib "C:\Perl\lib";
use FileIO;
use SeqFileIO;
use IO::String;
use CGI qw/:standard/;
use Bio::Perl;
use Bio::Tools::Run::Alignment::Clustalw;
use Bio::SimpleAlign;
use Bio::AlignIO;
use strict;
use warnings;
my @params = ('ktuple' => 2, 'matrix' => 'BLOSUM');
  my $factory = Bio::Tools::Run::Alignment::Clustalw->new(@params);
  my $ktuple = 3;
  $factory->ktuple($ktuple);  # change the parameter before executing
  my $str = Bio::SeqIO->new(-file=> 'Clustseq.fa', '-format' => 'Fasta');
 my @seq_array =();
  while ( my $seq = $str->next_seq() ) {push (@seq_array, $seq) ;}
  my $seq_array_ref = \@seq_array;  
# where @seq_array is an array of Bio::Seq objects
  my $aln = $factory->align($seq_array_ref);
  #print "\nThe alignment result is : ", $aln;
  #$aln is a SimpleAlign object 
my $out = Bio::AlignIO->new(-file => ">aln.out",
                           -format => 'msf');
while ( my $single = $aln->next_aln() ) { $out->write_aln($single); }
The error message I get is:
"Clutalw run successfully and some result information displayed...."
GCG-Alignment file created [c:\....\temp\7i0vb1kph6]
cannot locate object method "next_aln" via package "Bio::SimpleAlign" (perhaps
you forgot top load "Bio::SimpleAlign"?) at test728.pl line 40.

While it is obviously that I have already load the Bio::SimpleAlign by
use Bio::SimpleAlign 
as shown above at the source code part.
What's the problem again here?
Thank you in advance.

From: James Wasmuth [mailto:james.wasmuth at ed.ac.uk]
Sent: Tue 7/27/2004 11:41 AM
To: James Wasmuth
Cc: Sun, Jian; bioperl-l at bioperl.org
Subject: Re: [Bioperl-l] Help for using Clustalw.pm

 I'm not sure whether $ENV{CLUSTALDIR} does not work because you're
working in Windows.  Anyone have an idea?

As for keeping the output, there's two ways:

1. in the params use the 'outfile' => something.aln

I think its 'outfile'. You'll need to check with the clustalw
documentaion as to the commandline option to specify the name of the
outfile. Sorry I can't remember.



$factory = Bio::Tools::Run::Alignment::Clustalw->new(@params);
$aln = $factory->align($inputfilename);

#$aln is a SimpleAlign object which you can write to file.

$out = Bio::AlignIO->new(-file => ">outputfilename",
                           -format => 'msf');

while ( my $single = $aln->next_aln() ) { $out->write_aln($single); }

I think this should work. Let me know if it doesn't. It's been a while
since I've used these.


More information about the Bioperl-l mailing list