[Bioperl-l] Bio::Factory::SequenceFactoryI SYNOPSIS example

Adam Sjøgren adsj at novozymes.com
Fri Apr 11 04:53:23 EDT 2008


  Hi.

I am trying to make Bio::SeqIO return objects of my own type (a small
extension of Bio::Seq::RichSeq), by setting -seqfactory. I am having a
little trouble creating the correct object to pass with -seqfactory:

Following the example given in SYNOPSIS of Bio::Factory::SequenceFactoryI,
I get this error:

 $ perl -e '
 >            use Bio::Seq::SeqFactory;
 >            my $seqbuilder = Bio::Seq::SeqFactory->new('type' => 'Bio::PrimarySeq');
 > 
 >            my $seq = $seqbuilder->create(-seq => 'ACTGAT',
 >                                          -display_id => 'exampleseq');
 > 
 >            print "seq is a ", ref($seq), "\n";
 > '

 ------------- EXCEPTION: Bio::Root::Exception -------------
 MSG: Can't locate type.pm in @INC (@INC contains: /z/bio/biotools/bioinfperlmodules/ /z/bio/adm/modules /etc/perl /usr/local/lib/perl/5.8.8 /usr/local/share/perl/5.8.8 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.8 /usr/share/perl/5.8 /usr/local/lib/site_perl .) at (eval 13) line 3.
 : Unrecognized Sequence type for SeqFactory 'type'
 STACK: Error::throw
 STACK: Bio::Root::Root::throw /usr/share/perl/5.8/Bio/Root/Root.pm:357
 STACK: Bio::Seq::SeqFactory::type /usr/share/perl/5.8/Bio/Seq/SeqFactory.pm:134
 STACK: Bio::Seq::SeqFactory::new /usr/share/perl/5.8/Bio/Seq/SeqFactory.pm:93
 STACK: -e:3
 -----------------------------------------------------------
 $ 

If I go "Bio::Seq::SeqFactory('Bio::PrimarySeq'=>1)" instead, for
instance, it seems to work:

 $ perl -e '
 >            use Bio::Seq::SeqFactory;
 >            my $seqbuilder = Bio::Seq::SeqFactory->new('Bio::PrimarySeq'=>1);
 > 
 >            my $seq = $seqbuilder->create(-seq => 'ACTGAT',
 >                                          -display_id => 'exampleseq');
 > 
 >            print "seq is a ", ref($seq), "\n";
 > '
 seq is a Bio::PrimarySeq
 $ 

I was about to write a patch for the pod, when I realized that I'd
better start by asking: Is this a buglet in the pod or the code?

  Best regards,

    Adam

-- 
                                                          Adam Sjøgren
                                                    adsj at novozymes.com


More information about the Bioperl-l mailing list