[Bioperl-l] Issues on Bio::Tools::Primer3->next_primer

Roy Chaudhuri roy.chaudhuri at gmail.com
Tue Jul 29 17:51:37 UTC 2008


Hi John.

There is a bug in there, sorry for misunderstanding your earlier post 
(although for future reference it is helpful if you can include a 
minimal runnable script that illustrates the problem). 
Bio::Tools::Run::Primer3 assumes the existence of a wrapped Bio::Seq 
object, which it copies to the returned Bio::Tools::Primer3 object. If 
you specify your sequence by means of add_target(SEQUENCE=>$seq), rather 
than by providing a Bio::Seq object, then the wrapped Bio::Seq object is 
undefined, leading to an error since next_primer checks for its existence.

I've noted the bug in Bugzilla. I tried to upload a patch for 
Bio::Tools::Run::Primer3 but there seems to be a problem with the system 
(reported to support at open-bio.org). The patch (probably mangled by 
e-mail line wrapping) is:

379a380,383
 >               elsif (uc($key) eq "SEQUENCE") {
 >                   # Add seqobject if not present, since it is checked 
for by Bio::Tools::Primer3->next_primer()
 > 
$self->{'seqobject'}=Bio::Seq->new(-seq=>$args{$key}) if not 
defined($self->{'seqobject'});
 >               }


Roy.
--
Dr. Roy Chaudhuri
Department of Veterinary Medicine
University of Cambridge, U.K.


John M.C. Ma wrote:
> Hi Roy,
> 
> Maybe I wasn't clear with my script fragment, I used Bioperl to run 
> Primer3. The following is as much Primer3-related as I can get:
> 
> use Bio::Tools::Run::Primer3;
> use Bio::Tools::Primer3;
> [snips other use declarations and Ensembl scripts]
> my $primer3_handle=Bio::Tools::Run::Primer3->new(-path=>'[Primer3 path]');
> /*%gene_info is a hash that stores sequence information*/
> $primer3_handle->add_targets('SEQUENCE'=>$gene_info{src_seq},
> 'PRIMER_SEQUENCE_ID'=>$gene_info{name},
> 'TARGET'=>$gene_info{exon_boundaries},
> [snips other options] )
> my $primer3_results=$primer3_handle->run();
> $primer_test=$primer3_results->next_primer;
> 
> On Tue, Jul 29, 2008 at 5:26 AM, Roy Chaudhuri <roy.chaudhuri at gmail.com 
> <mailto:roy.chaudhuri at gmail.com>> wrote:
> 
>     Hi John,
> 
>     I'm not sure if you want to run Primer3 using BioPerl, or just use
>     BioPerl to parse an existing Primer3 output file.
> 
>     For the former you need to specify a target using the -seq argument
>     when you create your Bio::Tools::Run::Primer3 object (the argument
>     value should be a Bio::Seq object). It's also possible to add the
>     sequence between the new() and run() methods using add_targets(),
>     but you snipped out that section so I can't tell if you did that and
>     there is some other problem. The run() method does not seem to check
>     if a target sequence is present, hence you only get an error when
>     you call next_primer() on the returned Bio::Tools::Primer3 object.
> 
>     If you just want to parse an existing Primer3 output file then you
>     need to use Bio::Tools::Primer3, specifying the path to the ouput
>     file using the -file argument to new(). The documentation to
>     Bio::Tools::Run::Primer3:
>     http://search.cpan.org/~sendu/bioperl-run/Bio/Tools/Run/Primer3.pm#new()
>     <http://search.cpan.org/%7Esendu/bioperl-run/Bio/Tools/Run/Primer3.pm#new%28%29>
>     suggests that you can also provide a -file argument in that module,
>     but there doesn't seem to be any evidence of that in the code.
> 
> 
>     Hope this helps.
>     Roy.
>     --
>     Dr. Roy Chaudhuri
>     Department of Veterinary Medicine
>     University of Cambridge, U.K.
> 
>         I am trying a generic script to parse outputs for Primer3
>         results from
>         Bio::Tools::Run::Primer3:
> 
>         use Bio::Tools::Run::Primer3;
>         use Bio::Tools::Primer3;
>         use Bio::Seq::PrimedSeq;
>         [...]
>         my $primer3_handle=Bio::Tools::Run::Primer3->new(-path=>'foobar');
>         [...]
>         my $primer3_results=$primer3_handle->run();
>         my $primer_test=$primer3_results->next_primer;
>         [...]
> 
>         Which is similar to what was on the docs, but when Perl gives
>         the following
>         error at running next_primer:
> 
>         ------------- EXCEPTION: Bio::Root::Exception -------------
>         MSG: No target sequence
>         STACK: Error::throw
>         STACK: Bio::Root::Root::throw
>         /usr/lib/perl5/site_perl/5.10.0/Bio/Root/Root.pm:359
>         STACK: Bio::Tools::Primer3::next_primer
>         /usr/lib/perl5/site_perl/5.10.0/Bio/Tools/Primer3.pm:306
>         STACK: /home/johnma/workspace/NCBI-test/NCBI-test.pl:208
>         -----------------------------------------------------------
> 
>         Whereas line 208 is the line that contained the next_primer.
> 
>         I tried to access the results manually by primer_results() and
>         hard-calling
>         fields, but the output of primer_results() is a hash and not
>         very convenient
>         for further processing. Is there a way that I can go back to
>         next_primer...?
> 
>         Cheers,
> 
>         John
>         _______________________________________________
>         Bioperl-l mailing list
>         Bioperl-l at lists.open-bio.org <mailto:Bioperl-l at lists.open-bio.org>
>         http://lists.open-bio.org/mailman/listinfo/bioperl-l
> 
> 
> 




More information about the Bioperl-l mailing list