[Bioperl-l] How do you add a consensus to AlignIO?

Wes Barris wes.barris at csiro.au
Wed Aug 27 19:57:04 EDT 2003


Hi,

I am trying to write a bioperl clustalw to msf converter.  I also want
to add a consensus sequence to the alignment.  Here is my code:

#!/usr/local/bin/perl -w
#
use strict;
use Bio::AlignIO;
use Bio::SeqIO;

my $usage = "Usage: $0 <infile.txt> <outfile.msf>\n";
my $infile = shift or die $usage;
my $outfile = shift or die $usage;

my $instream  = new Bio::AlignIO(-format=>'clustalw', -file=>$infile);
my $outstream = new Bio::AlignIO(-format=>'msf',      -file=>">$outfile");
my $aln = $instream->next_aln();
my $consensus = new Bio::Seq(-seq=>$aln->consensus_string(), -id=>'btcn1000');

$aln->id('alignment.msf');      # set the alignment name
$aln->set_displayname_flat();   # remove the /start-end from the names
$aln->add_seq($consensus);      # add the consensus sequence

$outstream->write_aln($aln);

When I run this, I get this error:

wes at bioserver> clustaltomsf.pl j.aln j.msf

------------- EXCEPTION Bio::Seq -------------
MSG: Unable to process non locatable sequences [
STACK Bio::SimpleAlign::add_seq /usr/lib/perl5/site_perl/5.6.1/Bio/SimpleAlign.pm:245
STACK toplevel clustaltomsf.pl:18

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

Can anyone tell me what I am doing wrong?  What is a non locatable sequence?
How do I make a locatable one?
-- 
Wes Barris
E-Mail: Wes.Barris at csiro.au




More information about the Bioperl-l mailing list