[Bioperl-l] Help for using Clustalw.pm

James Wasmuth james.wasmuth at ed.ac.uk
Wed Jul 28 12:34:34 EDT 2004


Ooops. the next_aln method is for AlignIO, which allows one to read in 
an alignment. It is used to create an SimpleAlign object, but you 
already have one, so I think that

$out->write_aln($aln);

instead of the while loop is the way forward.

-james



Sun, Jian wrote:

>Dear James;
>   Thanks again. I added the scipts code you presented in last message to myine as shown below, but still have some probelm:
> 
>******************************************************************
>#!C:\Perl\bin\perl.exe
># 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.
>Jane
> 
>________________________________
>
>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.
>
>or
>
>2.
>
>$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.
>
>-james
>
>
>
>
>
>  
>

-- 
I like nonsense, it wakes up the brain cells.
		-- Dr. Seuss

Blaxter Nematode Genomics Group  |
School of Biological Sciences    |
Ashworth Laboratories            | tel: +44 131 650 7403
University of Edinburgh          | web: www.nematodes.org
Edinburgh                        |
EH9 3JT                          |
UK                               |	




More information about the Bioperl-l mailing list