[Bioperl-l] ace to msf format?

Wes Barris wes.barris at csiro.au
Mon Sep 1 01:29:13 EDT 2003


Jason Stajich wrote:

> Each Contig is a Bio::Align::AlignI - so in theory you can manipulate
> them as if they are Bio::SimpleAlign objects.  Robson can clarify if there
> are any caveats there.
> 
> 
> But you want to do this to have access to each contig in the scaffold:
> foreach my $contig ( $scaffold->all_contigs ) {
>  # process Bio::Assembly::Contig object here
> }

Thanks Jason, that makes sense.  Perhaps I'm missing something obvious
but I am getting an error when treating each contig as a Bio::SimpleAlign
object.  Here is my code:

#!/usr/local/bin/perl -w
#
use strict;
use Bio::Assembly::IO;
use Bio::AlignIO;
#
my $usage = "Usage: $0 <infile.ace>\n";
my $infile = shift or die $usage;

my $io = new Bio::Assembly::IO(-file=>$infile, -format=>'ace');
my $assembly = $io->next_assembly;

foreach my $contig ($assembly->all_contigs()) {
    my $name = "cn".$contig->id;
    print("$name\n");
    my $outstream = new Bio::AlignIO(-format=>'msf', -file=>">$name");
    $outstream->write_aln($contig);
    undef $outstream;
    }

And here is the runtime error:

cn1
Use of uninitialized value in hash element at 
/usr/lib/perl5/site_perl/5.6.1/Bio/Assembly/Contig.pm line 1305, <GEN0> line 33990.
Use of uninitialized value in hash element at 
/usr/lib/perl5/site_perl/5.6.1/Bio/Assembly/Contig.pm line 1305, <GEN0> line 33990.
Can't call method "alphabet" on an undefined value at 
/usr/lib/perl5/site_perl/5.6.1/Bio/AlignIO/msf.pm line 180, <GEN0> line 33990.

I am using bioperl-1.2.2.


> 
> Your code below is calling it in scalar context which will just have $aln
> being set to the length of the returned array.
> 
> -jason
> 
> On Mon, 1 Sep 2003, Wes Barris wrote:
> 
> 
>>Brian Osborne wrote:
>>
>>
>>>Wes,
>>>
>>>I don't think this is possible in Bioperl. To put it more generally, AlignIO
>>>can't accommodate Assembly objects currently. AlignIO is the module that
>>>takes in a variety of alignment formats and interconverts them, analogous to
>>>SeqIO. I'll be corrected if I'm wrong.
>>>
>>>Brian O.
>>
>>I am kind of new to this so I could be wrong but isn't an Assembly a group
>>of alignments?  So, from one assemble, a group of alignments could be
>>generated?
>>
>>
>>>-----Original Message-----
>>>From: bioperl-l-bounces at portal.open-bio.org
>>>[mailto:bioperl-l-bounces at portal.open-bio.org]On Behalf Of Wes Barris
>>>Sent: Thursday, August 28, 2003 7:58 PM
>>>To: Bioperl Mailing List
>>>Subject: [Bioperl-l] ace to msf format?
>>>
>>>Can anyone give me a hint as to how I could use bioperl to read in
>>>an ACE assembly and write out an MSF formatted alignment?  This shows
>>>what I have figured out so far:
>>>
>>>#!/usr/local/bin/perl -w
>>>#
>>>use strict;
>>>use Bio::Assembly::IO;
>>>#
>>>my $usage = "Usage: $0 <infile.ace>\n";
>>>my $infile = shift or die $usage;
>>>
>>>my $io = new Bio::Assembly::IO(-file=>$infile, -format=>'ace');
>>>my $assembly = $io->next_assembly;
>>>
>>>my $aln = $assembly->all_contigs();
>>>
>>>--
>>>Wes Barris
>>>E-Mail: Wes.Barris at csiro.au
>>>
>>>
>>>_______________________________________________
>>>Bioperl-l mailing list
>>>Bioperl-l at portal.open-bio.org
>>>http://portal.open-bio.org/mailman/listinfo/bioperl-l
>>>
>>
>>
>>
> 
> --
> Jason Stajich
> Duke University
> jason at cgt.mc.duke.edu


-- 
Wes Barris
E-Mail: Wes.Barris at csiro.au



More information about the Bioperl-l mailing list