[Bioperl-l] clustalw

Sendu Bala bix at sendu.me.uk
Tue Mar 6 10:30:32 EST 2007

Luba Pardo wrote:
> I am sorry if my questions are too simple or if this is something I 
> should not be asking.

They're not too simple, and certainly are appropriate for the Bioperl 
mailing list. You should keep your replies on the list as well so others 
have an opportunity to answer them.

> I have 8 sequences in Fasta format. The format is exactly the same as in 
> other files (e.g.  the ones provided in the examples), and I got the 
> same error.

For the code you gave earlier, again you will need to update the 
Clustalw module. Download it from the website and replace your existing 
copy. If you need help with that, ask and I'm sure someone can give 

> Regarding the tree and the footprinting, well, I need the alignment 
> (together with the tree) to use the PALM software. I did not have the 
> way to see whether I needed to use CSV, sorry for that too.
> Indeed, I tried even simpler things like this:
> #use strict;
> use warnings;
> BEGIN {$ENV{CLUSTALDIR} = '/home/luba/bin/clustalx1.82.linux/';}
> use Bio::SeqIO;
> use Bio::Tools::Run::Alignment::Clustalw;
> use Bio::AlignIO;
> my $seq1 = new Bio::PrimarySeq(-seq =>                    
>                      -id => 'seq1');
> my $seq2 = new Bio::PrimarySeq( -seq =>                    
>                        -id => 'seq2');
> my $factory = new Bio::Tools::Run::Alignment::Clustalw('ktuple' => 2,
>                                  'matrix' => 'BLOSUM');
> my $aln = $factory->align([$seq1,$seq2]);
> my $alignout ->write_aln($aln);
> print " $alignout is the alignment\n";
> but it did not work either.

Look at the error message you get. It would have said something like 
'Can't call method "write_aln" on an undefined value at ...'

You're trying to call the method write_aln() on something that doesn't 
exist ($alignout). You need to create $alignout first as an instance of 
an object that has a write_aln() method, then you can call the method.
write_aln() belongs to Bio::AlignIO, so do:

my $alignout = Bio::AlignIO->new(-format => 'clustalw',
                                  -file => ">test.aln");

The alignment will now be in the file 'test.aln'.

More information about the Bioperl-l mailing list