[Bioperl-l] problems converting bsml to another file type
Clancy, Kevin
kclancy at informaxinc.com
Mon Apr 14 02:22:26 EDT 2003
Dear All
I am working with BioPerl-1.2.1, with ActiveState Perl 5.6.1, build 635 on Windows 2000. I am running the code snippet, which is included in the Bio::SeqIO::bsml pod, that tests the conversion of a file of a particular type to bsml and back again. I am simply using data files from the BioPerl t/data directory.
When I run the snippet, the conversion to bsml is fine - the expected out.bsml file is created and looks like it is compliant with the standard. However, the script is unable to reverse the process, and produces the following error message:
Can't locate object method "create_sequence" via package "Bio::Seq::Seqfactory"
(perhaps you forgot to load "Bio::Seq::SeqFactory"?) at D:/Perl/site/lib/Bio|SeqIO\bsml.pm line 181, <GEN0> line 78.
Looking at the line in bsml.pm, it is part of subroutine next_seq() and has the following code at that line:
my $bioSeq = $self->sequence_factory->create(-verbose =>$self->verbose());
Running perl -w bptutorial.pl 100 Bio::SeqIO::bsml, there is no sign of a create_sequence method in bsml.pm or any of its dependent modules.
I am including the code snippet for reference below. Any help would be appreciated.
Sincerely
Kevin Clancy
Kevin Clancy, PhD
Senior Bioinformatics Scientist
InforMax: Invitrogen Life Science Software
phone: 720 746 3707
email: kclancy at informaxinc.com
433 Park Point Drive, Suite 275
Golden, CO 80401
#!/usr/bin/perl
use strict;
use Bio::SeqIO;
# Tests preservation of details during round-trip conversion:
# $readformat -> BSML -> $readformat
my $tempspot = "./bsmltemp"; # temp folder to hold generated files
my $readfile = "test.genbank"; # The name of the file you want to test
my $readformat = "genbank"; # The format of the file being tested system "mkdir $tempspot"
# unless (-d $tempspot);
# Make Seq object from the $readfile
my $biostream = Bio::SeqIO->new( -file => "$readfile" );
my $seq = $biostream->next_seq(); # Write BSML from SeqObject
my $bsmlout = Bio::SeqIO->new( -format => 'bsml',
-file => ">$tempspot/out.bsml");
warn "\nBSML written to $tempspot/out.bsml\n";
$bsmlout->write_seq($seq);
# Need to kill object for following code to work... Why is this so?
$bsmlout = ""; # Make Seq object from BSML
my $bsmlin = Bio::SeqIO->new( -file => "$tempspot/out.bsml",
-format => 'bsml');
my $seq2 = $bsmlin->next_seq(); # Write format back from Seq Object
my $genout = Bio::SeqIO->new( -format => $readformat,
-file => ">$tempspot/out.$readformat");
$genout->write_seq($seq2);
warn "$readformat written to $tempspot/out.$readformat\n";
More information about the Bioperl-l
mailing list