[RT 58464] patching to allow file names with spaces
[bioperl-run.git] / lib / Bio / Tools / Run / Primer3.pm
blob46e8ef2d8e69b131cde76aca542737156458b647
1 # $Id$
3 # This is the original copyright statement. I have relied on Chad's module
4 # extensively for this module.
6 # Copyright (c) 1997-2001 bioperl, Chad Matsalla. All Rights Reserved.
7 # This module is free software; you can redistribute it and/or
8 # modify it under the same terms as Perl itself.
10 # Copyright Chad Matsalla
12 # You may distribute this module under the same terms as perl itself
13 # POD documentation - main docs before the code
15 # But I have modified lots of it, so I guess I should add:
17 # Copyright (c) 2003 bioperl, Rob Edwards. All Rights Reserved.
18 # This module is free software; you can redistribute it and/or
19 # modify it under the same terms as Perl itself.
21 # Copyright Rob Edwards
23 # You may distribute this module under the same terms as perl itself
24 # POD documentation - main docs before the code
26 =head1 NAME
28 Bio::Tools::Run::Primer3 - Create input for and work with the output
29 from the program primer3
31 =head1 SYNOPSIS
33 Bio::Tools::Primer3 creates the input files needed to design primers
34 using primer3 and provides mechanisms to access data in the primer3
35 output files.
37 This module provides a bioperl interface to the program primer3. See
38 http://frodo.wi.mit.edu/primer3/primer3_code.html for
39 details and to download the software. This module only works for
40 primer3 release 1 but is not guaranteed to work with earlier versions.
42 # design some primers.
43 # the output will be put into temp.out
44 use Bio::Tools::Run::Primer3;
45 use Bio::SeqIO;
47 my $seqio = Bio::SeqIO->new(-file=>'data/dna1.fa');
48 my $seq = $seqio->next_seq;
49 my $primer3 = Bio::Tools::Run::Primer3->new(-seq => $seq,
50 -outfile => "temp.out",
51 -path => "/usr/bin/primer3_core");
53 # or after the fact you can change the program_name
54 $primer3->program_name('my_suprefast_primer3');
56 unless ($primer3->executable) {
57 print STDERR "primer3 can not be found. Is it installed?\n";
58 exit(-1)
61 # what are the arguments, and what do they mean?
62 my $args = $primer3->arguments;
64 print "ARGUMENT\tMEANING\n";
65 foreach my $key (keys %{$args}) {print "$key\t", $$args{$key}, "\n"}
67 # set the maximum and minimum Tm of the primer
68 $primer3->add_targets('PRIMER_MIN_TM'=>56, 'PRIMER_MAX_TM'=>90);
70 # design the primers. This runs primer3 and returns a
71 # Bio::Tools::Run::Primer3 object with the results
72 $results = $primer3->run;
74 # see the Bio::Tools::Run::Primer3 pod for
75 # things that you can get from this. For example:
77 print "There were ", $results->number_of_results, " primers\n";
79 Bio::Tools::Run::Primer3 creates the input files needed to design primers
80 using primer3 and provides mechanisms to access data in the primer3
81 output files.
83 This module provides a bioperl interface to the program primer3. See
84 http://www-genome.wi.mit.edu/genome_software/other/primer3.html for
85 details and to download the software.
87 This module is based on one written by Chad Matsalla
88 (bioinformatics1@dieselwurks.com). I have ripped some of his code, and
89 added a lot of my own. I hope he is not mad at me!
91 =head1 FEEDBACK
93 =head2 Mailing Lists
95 User feedback is an integral part of the evolution of this and other
96 Bioperl modules. Send your comments and suggestions preferably to one
97 of the Bioperl mailing lists. Your participation is much appreciated.
99 bioperl-l@bioperl.org - General discussion
100 http://www.bioperl.org/MailList.html - About the mailing lists
102 =head2 Support
104 Please direct usage questions or support issues to the mailing list:
106 I<bioperl-l@bioperl.org>
108 rather than to the module maintainer directly. Many experienced and
109 reponsive experts will be able look at the problem and quickly
110 address it. Please include a thorough description of the problem
111 with code and data examples if at all possible.
113 =head2 Reporting Bugs
115 Report bugs to the Bioperl bug tracking system to help us keep track
116 the bugs and their resolution. Bug reports can be submitted via the
117 web:
119 http://bugzilla.open-bio.org/
121 =head1 AUTHOR
123 Rob Edwards
125 redwards@utmem.edu
127 Based heavily on work of Chad Matsalla
129 bioinformatics1@dieselwurks.com
131 =head1 CONTRIBUTORS
133 Shawn Hoon shawnh-at-stanford.edu
134 Jason Stajich jason-at-bioperl.org
135 Brian Osborne osborne1-at-optonline.net
137 =head1 SEE ALSO
139 L<Bio::Tools::Primer3>
141 =head1 APPENDIX
143 The rest of the documentation details each of the object methods.
144 Internal methods are usually preceded with a _
146 =cut
148 # Let the code begin...
151 package Bio::Tools::Run::Primer3;
153 use vars qw(@ISA);
154 use strict;
155 use Bio::Root::Root;
156 use Bio::Tools::Primer3;
157 use Bio::Tools::Run::WrapperBase;
158 use File::Spec;
160 use vars qw($AUTOLOAD @ISA @PRIMER3_PARAMS $PROGRAMNAME %OK_FIELD);
162 @ISA = qw(Bio::Root::Root Bio::Tools::Run::WrapperBase);
165 BEGIN {
166 $PROGRAMNAME = 'primer3';
167 @PRIMER3_PARAMS=qw( PROGRAM EXCLUDED_REGION INCLUDED_REGION
168 PRIMER_COMMENT PRIMER_DNA_CONC PRIMER_EXPLAIN_FLAG PRIMER_FILE_FLAG
169 PRIMER_FIRST_BASE_INDEX PRIMER_GC_CLAMP
170 PRIMER_INTERNAL_OLIGO_DNA_CONC PRIMER_INTERNAL_OLIGO_EXCLUDED_REGION
171 PRIMER_INTERNAL_OLIGO_INPUT PRIMER_INTERNAL_OLIGO_MAX_GC
172 PRIMER_INTERNAL_OLIGO_MAX_MISHYB PRIMER_INTERNAL_OLIGO_MAX_POLY_X
173 PRIMER_INTERNAL_OLIGO_MAX_SIZE PRIMER_INTERNAL_OLIGO_MAX_TM
174 PRIMER_INTERNAL_OLIGO_MIN_GC PRIMER_INTERNAL_OLIGO_MIN_QUALITY
175 PRIMER_INTERNAL_OLIGO_MIN_SIZE PRIMER_INTERNAL_OLIGO_MIN_TM
176 PRIMER_INTERNAL_OLIGO_MISHYB_LIBRARY
177 PRIMER_INTERNAL_OLIGO_OPT_GC_PERCENT PRIMER_INTERNAL_OLIGO_OPT_SIZE
178 PRIMER_INTERNAL_OLIGO_OPT_TM PRIMER_INTERNAL_OLIGO_SALT_CONC
179 PRIMER_INTERNAL_OLIGO_SELF_ANY PRIMER_INTERNAL_OLIGO_SELF_END
180 PRIMER_IO_WT_COMPL_ANY PRIMER_IO_WT_COMPL_END PRIMER_IO_WT_END_QUAL
181 PRIMER_IO_WT_GC_PERCENT_GT PRIMER_IO_WT_GC_PERCENT_LT
182 PRIMER_IO_WT_NUM_NS PRIMER_IO_WT_REP_SIM PRIMER_IO_WT_SEQ_QUAL
183 PRIMER_IO_WT_SIZE_GT PRIMER_IO_WT_SIZE_LT PRIMER_IO_WT_TM_GT
184 PRIMER_IO_WT_TM_LT PRIMER_LEFT_INPUT PRIMER_LIBERAL_BASE
185 PRIMER_MAX_DIFF_TM PRIMER_MAX_END_STABILITY PRIMER_MAX_GC
186 PRIMER_MAX_MISPRIMING PRIMER_MAX_POLY_X PRIMER_MAX_SIZE PRIMER_MAX_TM
187 PRIMER_MIN_END_QUALITY PRIMER_MIN_GC PRIMER_MIN_QUALITY
188 PRIMER_MIN_SIZE PRIMER_MIN_TM PRIMER_MISPRIMING_LIBRARY
189 PRIMER_NUM_NS_ACCEPTED PRIMER_NUM_RETURN PRIMER_OPT_GC_PERCENT
190 PRIMER_OPT_SIZE PRIMER_OPT_TM PRIMER_PAIR_MAX_MISPRIMING
191 PRIMER_PAIR_WT_COMPL_ANY PRIMER_PAIR_WT_COMPL_END
192 PRIMER_PAIR_WT_DIFF_TM PRIMER_PAIR_WT_IO_PENALTY
193 PRIMER_PAIR_WT_PRODUCT_SIZE_GT PRIMER_PAIR_WT_PRODUCT_SIZE_LT
194 PRIMER_PAIR_WT_PRODUCT_TM_GT PRIMER_PAIR_WT_PRODUCT_TM_LT
195 PRIMER_PAIR_WT_PR_PENALTY PRIMER_PAIR_WT_REP_SIM PRIMER_PICK_ANYWAY
196 PRIMER_PICK_INTERNAL_OLIGO PRIMER_PRODUCT_MAX_TM
197 PRIMER_PRODUCT_MIN_TM PRIMER_PRODUCT_OPT_SIZE PRIMER_PRODUCT_OPT_TM
198 PRIMER_PRODUCT_SIZE_RANGE PRIMER_QUALITY_RANGE_MAX
199 PRIMER_QUALITY_RANGE_MIN PRIMER_RIGHT_INPUT PRIMER_SALT_CONC
200 PRIMER_SELF_ANY PRIMER_SELF_END PRIMER_SEQUENCE_ID
201 PRIMER_SEQUENCE_QUALITY PRIMER_START_CODON_POSITION PRIMER_TASK
202 PRIMER_WT_COMPL_ANY PRIMER_WT_COMPL_END PRIMER_WT_END_QUAL
203 PRIMER_WT_END_STABILITY PRIMER_WT_GC_PERCENT_GT
204 PRIMER_WT_GC_PERCENT_LT PRIMER_WT_NUM_NS PRIMER_WT_POS_PENALTY
205 PRIMER_WT_REP_SIM PRIMER_WT_SEQ_QUAL PRIMER_WT_SIZE_GT
206 PRIMER_WT_SIZE_LT PRIMER_WT_TM_GT PRIMER_WT_TM_LT SEQUENCE TARGET
207 PRIMER_DEFAULT_PRODUCT
208 PRIMER_DEFAULT_SIZE
209 PRIMER_INSIDE_PENALTY
210 PRIMER_INTERNAL_OLIGO_MAX_TEMPLATE_MISHYB
211 PRIMER_OUTSIDE_PENALTY
212 PRIMER_LIB_AMBIGUITY_CODES_CONSENSUS
213 PRIMER_MAX_TEMPLATE_MISPRIMING
214 PRIMER_PAIR_MAX_TEMPLATE_MISPRIMING
215 PRIMER_PAIR_WT_TEMPLATE_MISPRIMING
216 PRIMER_WT_TEMPLATE_MISPRIMING
219 foreach my $attr (@PRIMER3_PARAMS) {$OK_FIELD{$attr}++}
222 sub AUTOLOAD {
223 my $self = shift;
224 my $attr = $AUTOLOAD;
225 $attr =~ s/.*:://;
226 $attr = uc $attr;
227 $self->throw("Unallowed parameter: $attr !") unless $OK_FIELD{$attr};
228 $self->{$attr} = shift if @_;
229 return $self->{$attr};
233 =head2 new()
235 Title : new()
236 Usage : my $primer3 = Bio::Tools::Run::Primer3->new(-file=>$file) to read
237 a primer3 output file.
238 my $primer3 = Bio::Tools::Run::Primer3->new(-seq=>sequence object)
239 design primers against sequence
240 Function: Start primer3 working and adds a sequence. At the moment it
241 will not clear out the old sequence, but I suppose it should.
242 Returns : Does not return anything. If called with a filename will allow
243 you to retrieve the results
244 Args : -seq (optional) Bio::Seq object of sequence. This is required
245 to run primer3 but can be added later with add_targets()
246 -outfile file name to output results to (can also be added
247 with $primer3->outfile_name
248 -path path to primer3 executable, including program name, e.g.
249 "/usr/bin/primer3_core". This can also be set with program_name
250 and program_dir
251 -verbose (optional) set verbose output
252 Notes :
254 =cut
257 sub new {
258 my($class,%args) = @_;
259 my $self = $class->SUPER::new(%args);
260 $self->io->_initialize_io();
262 $self->program_name($args{-program}) if defined $args{'-program'};
264 if ($args{'-verbose'}) {$self->{'verbose'}=1}
265 if ($args{'-seq'}) {
266 $self->{'seqobject'}=$args{'-seq'};
267 my @input;
268 push (@input, ("PRIMER_SEQUENCE_ID=".$self->{'seqobject'}->id),
269 ("SEQUENCE=".$self->{'seqobject'}->seq));
270 $self->{'primer3_input'}=\@input;
272 if ($args{'-outfile'}) {$self->{_outfilename}=$args{'-outfile'}}
273 if ($args{'-path'}) {
275 my (undef,$path,$prog) = File::Spec->splitpath($args{'-path'});
277 # For Windows system, $path better (Letter disk not truncated)
278 if ( $^O =~ m{mswin}i ) {
279 require File::Basename;
280 $path = File::Basename::dirname( $args{'-path'} );
281 $prog = File::Basename::basename( $args{'-path'} );
284 $self->program_dir($path);
285 $self->program_name($prog);
287 return $self;
290 =head2 program_name
292 Title : program_name
293 Usage : $primer3->program_name()
294 Function: holds the program name
295 Returns: string
296 Args : None
298 =cut
300 sub program_name {
301 my $self = shift;
302 return $self->{'program_name'} = shift @_ if @_;
303 return $self->{'program_name'} if $self->{'program_name'};
304 for (qw(primer3 primer3_core)) {
305 if ($self->io->exists_exe($_)) {
306 $PROGRAMNAME = $_;
307 last;
310 # don't set permanently, use global
311 return $PROGRAMNAME;
314 =head2 program_dir
316 Title : program_dir
317 Usage : $primer3->program_dir($dir)
318 Function: returns the program directory, which may also be obtained from ENV variable.
319 Returns : string
320 Args :
322 =cut
324 sub program_dir {
325 my ($self, $dir) = @_;
326 if ($dir) {
327 $self->{'program_dir'}=$dir;
330 # we need to stop here if we know what the answer is, otherwise we can
331 # never set it and then call it later
332 return $self->{'program_dir'} if $self->{'program_dir'};
334 if ($ENV{PRIMER3}) {
335 $self->{'program_dir'} = Bio::Root::IO->catfile($ENV{PRIMER3});
336 } else {
337 $self->{'program_dir'} = Bio::Root::IO->catfile('usr','local','bin');
340 return $self->{'program_dir'}
344 =head2 add_targets()
346 Title : add_targets()
347 Usage : $primer3->add_targets(key=>value)
348 Function: Add any legal value to the input command line.
349 Returns : Returns the number of arguments added.
350 Args : Use $primer3->arguments to find a list of all the values
351 that are allowed, or see the primer3 docs.
352 Notes : This will only do limited error checking at the moment,
353 but it should work.
355 =cut
358 sub add_targets {
359 my ($self, %args)=@_;
360 my $added_args; # a count of what we have added.
361 my $inputarray = $self->{'primer3_input'};
362 foreach my $key (keys %args) {
363 # we will allow them to add a sequence before checking for arguments
364 if ((uc($key) eq "-SEQ") || (uc($key) eq "-SEQUENCE")) {
365 # adding a new sequence. We need to separate them with an =
366 $self->{'seqobject'}=$args{$key};
367 if (defined $$inputarray[0]) {push (@$inputarray, "=")}
368 push (@$inputarray, ("PRIMER_SEQUENCE_ID=".
369 $self->{'seqobject'}->id),("SEQUENCE=".$self->{'seqobject'}->seq));
370 next;
373 unless ($self->{'no_param_checks'}) {
374 unless ($OK_FIELD{$key}) {
375 $self->warn("Parameter $key is not a valid Primer3 parameter");
376 next}
379 if (uc($key) eq "INCLUDED_REGION") {
380 # this must be a comma separated start, length.
381 my $sequencelength;
382 # we don't have a length, hence we need to add the length of the
383 # sequence less the start.
384 foreach my $input (@$inputarray) {
385 if ($input =~ /SEQUENCE=(.*)/) {$sequencelength=length($1)}
388 if (!$args{$key}) {$args{$key}="0," . $sequencelength}
389 elsif ($args{$key} !~ /\,/) {
390 my $length_of_included = $sequencelength-$args{$key};
391 $args{$key} .= ",".$length_of_included;
394 elsif (uc($key) eq "PRIMER_MIN_SIZE") {
395 # minimum size must be less than MAX size and greater than zero
396 if (exists $args{"PRIMER_MAX_SIZE"}) {
397 unless ($args{"PRIMER_MAX_SIZE"} > $args{"PRIMER_MIN_SIZE"}) {
398 $self->warn('Maximum primer size (PRIMER_MAX_SIZE) must be greater than minimum primer size (PRIMER_MIN_SIZE)');
401 if ($args{$key} < 0) {
402 $self->warn('Minimum primer size (PRIMER_MIN_SIZE) must be greater than 0');
405 elsif ($key eq "PRIMER_MAX_SIZE") {
406 if ($args{$key}>35) {$self->warn('Maximum primer size (PRIMER_MAX_SIZE) must be less than 35')}
408 elsif (uc($key) eq "SEQUENCE") {
409 # Add seqobject if not present, since it is checked for by Bio::Tools::Primer3->next_primer()
410 $self->{'seqobject'}=Bio::Seq->new(-seq=>$args{$key}) if not defined($self->{'seqobject'});
413 # need a check to see whether this is already in the array
414 # and finally add the argument to the list.
416 my $toadd=uc($key)."=".$args{$key};
417 my $replaced; # don't add it if it is replacing something!
418 my @new_array;
419 foreach my $input (@$inputarray) {
420 my ($array_key, $array_value) = split '=', $input;
421 if (uc($array_key) eq uc($key)) {push @new_array, $toadd; $replaced=1}
422 else {push @new_array, $input}
424 unless ($replaced) {push @new_array, $toadd}
425 @$inputarray=@new_array;
427 if ($self->{'verbose'}) {print STDERR "Updated ",
428 uc($key), " to $args{$key}\n"}
429 $added_args++;
432 $self->{'primer3_input'}=$inputarray;
433 return $added_args;
436 =head2 run()
438 Title : run()
439 Usage : $primer3->run();
440 Function: Run the primer3 program with the arguments that you have supplied.
441 Returns : A Bio::Tools::Primer3 object containing the results.
442 Args : None.
443 Note : See the Bio::Tools::Primer3 documentation for those functions.
445 =cut
447 sub run {
448 my($self) = @_;
449 my $executable = $self->executable;
450 my $input = $self->{'primer3_input'};
451 unless ($executable && -e $executable) {
452 $self->throw("Executable was not found. Do not know where primer3 is!") if !$executable;
453 $self->throw("$executable was not found. Do not know where primer3 is!");
454 exit(-1);
457 # note that I write this to a temp file because we need both read
458 # and write access to primer3, therefore,
459 # we can't use a simple pipe.
461 if ($self->{'verbose'}) {print STDERR "TRYING\n",
462 join "\n", @{$self->{'primer3_input'}}, "=\n"}
464 # make a temporary file and print the instructions to it.
465 my ($temphandle, $tempfile) = $self->io->tempfile;
466 print $temphandle join "\n", @{$self->{'primer3_input'}}, "=\n";
467 close($temphandle);
469 my $executable_command = $executable;
470 if ( $executable =~ m{^[^\'\"]+(.+)[^\'\"]+$} ) {
471 $executable_command = "\"$executable\" < \"$tempfile\"|";
474 open (RESULTS, $executable_command) || $self->throw("Can't open RESULTS");
475 if ($self->{'_outfilename'}) {
476 # I can't figure out how to use either of these to write the results out.
477 # neither work, what am I doing wrong or missing in the docs?
478 # $self->{output}=$self->_initialize_io(-file=>$self->{'outfile'});
479 # $self->{output}=$self->io;
480 # OK, for now, I will just do it myself, because I need this to
481 # check the parser :)
482 open (OUT, ">".$self->{'_outfilename'}) ||
483 $self->throw("Can't open ".$self->{'_outfilename'}." for writing");
486 my @results;
487 while (<RESULTS>) {
488 if ($self->{'_outfilename'}) {
489 # this should work, but isn't
490 #$self->{output}->_print($_);
491 print OUT $_;
493 chomp;
494 next if( $_ eq '='); # skip over bolderio record terminator
495 my ($return, $value) = split('=',$_);
496 $self->{'results'}->{$return} = $value;
498 close RESULTS;
500 # close the output file
501 if ($self->{'_outfilename'}) {
502 close OUT;
505 $self->cleanup;
506 # convert the results to individual results
507 $self->{results_obj} = Bio::Tools::Primer3->new;
508 $self->{results_obj}->_set_variable('results', $self->{results});
509 $self->{results_obj}->_set_variable('seqobject', $self->{seqobject});
511 # Bio::Tools::Primer3::_separate needs a hash of the primer3 arguments,
512 # with the arg as the key and the value as the value (surprise!).
513 my %input_hash = map {split '='} @{$self->{'primer3_input'}};
514 $self->{results_obj}->_set_variable('input_options', \%input_hash);
515 $self->{results_separated}= $self->{results_obj}->_separate();
516 return $self->{results_obj};
519 =head2 arguments()
521 Title : arguments()
522 Usage : $hashref = $primer3->arguments();
523 Function: Describes the options that you can set through Bio::Tools::Run::Primer3,
524 with a brief (one line) description of what they are and their
525 default values
526 Returns : A string (if an argument is supplied) or a reference to a hash.
527 Args : If supplied with an argument will return a string of its
528 description.
529 If no arguments are supplied, will return all the arguments as a
530 reference to a hash
531 Notes : Much of this is taken from the primer3 README file, and you should
532 read that file for a more detailed description.
534 =cut
536 sub arguments {
537 my ($self, $required) = @_;
538 unless ($self->{'input_options'}) {$self->_input_args}
539 if ($required) {return ${$self->{'input_options'}}{'$required'}}
540 else {return $self->{'input_options'}}
543 =head2 version
545 Title : version
546 Usage : $v = $prog->version();
547 Function: Determine the version number of the program
548 Example :
549 Returns : float or undef
550 Args : none
552 =cut
554 sub version {
555 my ($self) = @_;
556 return unless my $exe = $self->executable;
557 if (!defined $self->{'_progversion'}) {
558 my $string = `$exe -about 2>&1`;
559 my $v;
560 if ($string =~ m{primer3\s+release\s+([\d\.]+)}) {
561 $self->{'_progversion'} = $1;
564 return $self->{'_progversion'} || undef;
567 =head2 _input_args()
569 Title : _input_args()
570 Usage : an internal method to set the input arguments for Primer3
571 Function: Define a hash with keys for each of the input arguments and values
572 as a short one line description
573 Returns : A reference to a hash.
574 Args : None.
575 Notes : Much of this is taken from the primer3 README file, and you should
576 read that file for a more detailed description.
578 =cut
580 sub _input_args {
581 my($self) = shift;
582 # just return functions that we can set and what they are
583 my %hash=(
584 'PRIMER_SEQUENCE_ID'=>'(string, optional) an id. Optional. Note must be present if PRIMER_FILE_FLAG is set',
585 'SEQUENCE'=>'(nucleotide sequence, REQUIRED) The sequence itself. Cannot contain newlines',
586 'INCLUDED_REGION'=>'(interval, optional) Where to pick primers from. In form <start>,<length>. Based on zero indexing!',
587 'TARGET'=>'(interval list, default empty) Regions that must be included in the product. The value should be a space-separated list of <start>,<length>',
588 'EXCLUDED_REGION'=>'(interval list, default empty) Regions that must NOT be included in the product. The value should be a space-separated list of <start>,<length>',
589 'PRIMER_COMMENT'=>'(string) This is ignored, so we will just save, and return it',
590 'PRIMER_SEQUENCE_QUALITY'=>'(quality list, default empty) A list of space separated integers with one per base. Could adapt a Phred object to this.',
591 'PRIMER_LEFT_INPUT'=>'(nucleotide sequence, default empty) If you know the left primer sequence, put it here',
592 'PRIMER_RIGHT_INPUT'=>'(nucleotide sequence, default empty) If you know the right primer sequence, put it here',
593 'PRIMER_START_CODON_POSITION'=>'(int, default -1000000) Location of known start codons for designing in frame primers.',
594 'PRIMER_PICK_ANYWAY'=>'boolean, default 0) Pick a primer, even if we have violated some constraints.',
595 'PRIMER_MISPRIMING_LIBRARY'=>'(string, optional) A file containing sequences to avoid amplifying. Should be fasta format, but see primer3 docs for constraints.',
596 'PRIMER_MAX_MISPRIMING'=>'(decimal,9999.99, default 12.00) Weighting for PRIMER_MISPRIMING_LIBRARY',
597 'PRIMER_PAIR_MAX_MISPRIMING'=>'(decimal,9999.99, default 24.00 Weighting for PRIMER_MISPRIMING_LIBRARY',
598 'PRIMER_PRODUCT_MAX_TM'=>'(float, default 1000000.0) The maximum allowed Tm of the product.',
599 'PRIMER_PRODUCT_MIN_TM'=>'(float, default -1000000.0) The minimum allowed Tm of the product',
600 'PRIMER_EXPLAIN_FLAG'=>'(boolean, default 0) If set it will print a bunch of information out.',
601 'PRIMER_PRODUCT_SIZE_RANGE'=>'(size range list, default 100-300) space separated list of product sizes eg <a>-<b> <x>-<y>',
603 'PRIMER_DEFAULT_PRODUCT' => '(size range list, default 100-300)',
604 'PRIMER_PICK_INTERNAL_OLIGO'=>'(boolean, default 0) if set, a hybridization probe will be selected',
605 'PRIMER_GC_CLAMP'=>'(int, default 0) Number of Gs and Cs at the 3 prime end.',
606 'PRIMER_OPT_SIZE'=>'(int, default 20) Optimal primer size. Primers will be close to this value in length',
607 'PRIMER_DEFAULT_SIZE' => '(int, default 20)',
608 'PRIMER_MIN_SIZE'=>'(int, default 18) Minimum size. Must be 0 < PRIMER_MIN_SIZE < PRIMER_MAX_SIZE ',
609 'PRIMER_MAX_SIZE'=>'(int, default 27) Maximum size. Must be < 35.',
610 'PRIMER_OPT_TM'=>'(float, default 60.0C) Optimum Tm of a primer.',
611 'PRIMER_MIN_TM'=>'(float, default 57.0C) Minimum Tm of a primer',
612 'PRIMER_MAX_TM'=>'(float, default 63.0C) Maximum Tm of a primer',
613 'PRIMER_MAX_DIFF_TM'=>'(float, default 100.0C) acceptable difference in Tms',
614 'PRIMER_MIN_GC'=>'(float, default 20.0%) Minimum allowable GCs',
615 'PRIMER_OPT_GC_PERCENT'=>'(float, default 50.0%) Optimal GCs',
616 'PRIMER_MAX_GC'=>'(float, default 80.0%) Maximum allowable GCs',
617 'PRIMER_SALT_CONC'=>'(float, default 50.0 mM) Salt concentration required for Tm calcs.',
618 'PRIMER_DNA_CONC'=>'(float, default 50.0 nM) DNA concentration required for Tm calcs. ',
619 'PRIMER_NUM_NS_ACCEPTED'=>'(int, default 0) Maximum number of unknown bases (N) allowable in any primer.',
620 'PRIMER_SELF_ANY'=>'(decimal,9999.99, default 8.00) Maximum aligment score for within and between primers when checking for hairpin loops',
621 'PRIMER_SELF_END'=>'(decimal 9999.99, default 3.00) Maximum aligment score for within and between primers when checking for primer dimers',
622 'PRIMER_FILE_FLAG'=>'(boolean, default 0) Output <sequence_id>.for and <sequence_id>.rev with all acceptable forward and reverse primers',
623 'PRIMER_MAX_POLY_X'=>'(int, default 5) The maximum allowable length of a mononucleotide repeat.',
624 'PRIMER_LIBERAL_BASE'=>'(boolean, default 0) Use IUPAC codes (well, just change them to N). Note must also set PRIMER_NUM_NS_ACCEPTED',
625 'PRIMER_NUM_RETURN'=>'(int, default 5) Number of primers to return',
626 'PRIMER_FIRST_BASE_INDEX'=>'(int, default 0) Index of the first base. Do not change this or allow it to be changed, as we will have to mess with subseqs and whatnot.',
627 'PRIMER_MIN_QUALITY'=>'(int, default 0) Minimum sequence quality calculated from PRIMER_SEQUENCE_QUALITY',
628 'PRIMER_MIN_END_QUALITY'=>'(int, default 0) Minimum sequence quality calculated from PRIMER_SEQUENCE_QUALITY at 5 prime 5 bases',
629 'PRIMER_QUALITY_RANGE_MIN'=>'(int, default 0) Minimum sequence quality calculated from PRIMER_SEQUENCE_QUALITY',
630 'PRIMER_QUALITY_RANGE_MAX'=>'(int, default 100) Maximum sequence quality calculated from PRIMER_SEQUENCE_QUALITY',
631 'PRIMER_MAX_END_STABILITY'=>'(float 999.9999, default 100.0) Maximum stability for the five 3 prime bases of a primer. Bigger numbers mean more stable 3 prime ends.',
632 'PRIMER_PRODUCT_OPT_TM'=>'(float, default 0.0) Optimum melting temperature for the PCR product. 0 means no optimum.',
633 'PRIMER_PRODUCT_OPT_SIZE'=>'(int, default 0) Optimum size for the PCR product. 0 means no optimum.',
634 'PRIMER_TASK'=>'(string, default pick_pcr_primers) Choose from pick_pcr_primers, pick_pcr_primers_and_hyb_probe, pick_left_only, pick_right_only, pick_hyb_probe_only',
635 'PRIMER_WT_TM_GT'=>'(float, default 1.0) Penalty weight for primers with Tm over PRIMER_OPT_TM.',
636 'PRIMER_WT_TM_LT'=>'(float, default 1.0) Penalty weight for primers with Tm under PRIMER_OPT_TM.',
637 'PRIMER_WT_SIZE_LT'=>'(float, default 1.0) Penalty weight for primers shorter than PRIMER_OPT_SIZE.',
638 'PRIMER_WT_SIZE_GT'=>'(float, default 1.0) Penalty weight for primers longer than PRIMER_OPT_SIZE.',
639 'PRIMER_WT_GC_PERCENT_LT'=>'(float, default 1.0) Penalty weight for primers with GC percent greater than PRIMER_OPT_GC_PERCENT.',
640 'PRIMER_WT_GC_PERCENT_GT'=>'(float, default 1.0) Penalty weight for primers with GC percent greater than PRIMER_OPT_GC_PERCENT.',
641 'PRIMER_WT_COMPL_ANY'=>'(float, default 0.0)',
642 'PRIMER_WT_COMPL_END'=>'(float, default 0.0)',
643 'PRIMER_WT_NUM_NS'=>'(float, default 0.0)',
644 'PRIMER_WT_REP_SIM'=>'(float, default 0.0)',
645 'PRIMER_WT_SEQ_QUAL'=>'(float, default 0.0)',
646 'PRIMER_WT_END_QUAL'=>'(float, default 0.0)',
647 'PRIMER_WT_POS_PENALTY'=>'(float, default 0.0)',
648 'PRIMER_WT_END_STABILITY'=>'(float, default 0.0)',
649 'PRIMER_PAIR_WT_PR_PENALTY'=>'(float, default 1.0)',
650 'PRIMER_PAIR_WT_IO_PENALTY'=>'(float, default 0.0)',
651 'PRIMER_PAIR_WT_DIFF_TM'=>'(float, default 0.0)',
652 'PRIMER_PAIR_WT_COMPL_ANY'=>'(float, default 0.0)',
653 'PRIMER_PAIR_WT_COMPL_END'=>'(float, default 0.0)',
654 'PRIMER_PAIR_WT_PRODUCT_TM_LT'=>'(float, default 0.0)',
655 'PRIMER_PAIR_WT_PRODUCT_TM_GT'=>'(float, default 0.0)',
656 'PRIMER_PAIR_WT_PRODUCT_SIZE_GT'=>'(float, default 0.0)',
657 'PRIMER_PAIR_WT_PRODUCT_SIZE_LT'=>'(float, default 0.0)',
658 'PRIMER_PAIR_WT_REP_SIM'=>'(float, default 0.0)',
659 'PRIMER_INTERNAL_OLIGO_EXCLUDED_REGION'=>'(interval list, default empty) Internal oligos must ignore these regions',
660 'PRIMER_INTERNAL_OLIGO_INPUT'=>'(nucleotide sequence, default empty) Known sequence of an internal oligo',
661 'PRIMER_INTERNAL_OLIGO_OPT_SIZE'=>'(int, default 20)',
662 'PRIMER_INTERNAL_OLIGO_MIN_SIZE'=>'(int, default 18)',
663 'PRIMER_INTERNAL_OLIGO_MAX_SIZE'=>'(int, default 27)',
664 'PRIMER_INTERNAL_OLIGO_OPT_TM'=>'(float, default 60.0 degrees C)',
665 'PRIMER_INTERNAL_OLIGO_OPT_GC_PERCENT'=>'(float, default 50.0%)',
666 'PRIMER_INTERNAL_OLIGO_MIN_TM'=>'(float, default 57.0 degrees C)',
667 'PRIMER_INTERNAL_OLIGO_MAX_TM'=>'(float, default 63.0 degrees C)',
668 'PRIMER_INTERNAL_OLIGO_MIN_GC'=>'(float, default 20.0%)',
669 'PRIMER_INTERNAL_OLIGO_MAX_GC'=>'(float, default 80.0%)',
670 'PRIMER_INTERNAL_OLIGO_SALT_CONC'=>'(float, default 50.0 mM)',
671 'PRIMER_INTERNAL_OLIGO_DNA_CONC'=>'(float, default 50.0 nM)',
672 'PRIMER_INTERNAL_OLIGO_SELF_ANY'=>'(decimal 9999.99, default 12.00)',
673 'PRIMER_INTERNAL_OLIGO_MAX_POLY_X'=>'(int, default 5)',
674 'PRIMER_INTERNAL_OLIGO_SELF_END'=>'(decimal 9999.99, default 12.00)',
675 'PRIMER_INTERNAL_OLIGO_MISHYB_LIBRARY'=>'(string, optional)',
676 'PRIMER_INTERNAL_OLIGO_MAX_MISHYB'=>'(decimal,9999.99, default 12.00)',
677 'PRIMER_INTERNAL_OLIGO_MIN_QUALITY'=>'(int, default 0)',
678 'PRIMER_IO_WT_TM_GT'=>'(float, default 1.0)',
679 'PRIMER_IO_WT_TM_LT'=>'(float, default 1.0)',
680 'PRIMER_IO_WT_GC_PERCENT_GT'=>'(float, default 1.0)',
681 'PRIMER_IO_WT_GC_PERCENT_LT'=>'(float, default 1.0)',
682 'PRIMER_IO_WT_SIZE_LT'=>'(float, default 1.0)',
683 'PRIMER_IO_WT_SIZE_GT'=>'(float, default 1.0)',
684 'PRIMER_IO_WT_COMPL_ANY'=>'(float, default 0.0)',
685 'PRIMER_IO_WT_COMPL_END'=>'(float, default 0.0)',
686 'PRIMER_IO_WT_NUM_NS'=>'(float, default 0.0)',
687 'PRIMER_IO_WT_REP_SIM'=>'(float, default 0.0)',
688 'PRIMER_IO_WT_SEQ_QUAL'=>'(float, default 0.0)',
689 'PRIMER_IO_WT_END_QUAL'=>'(float, default 0.0)',
690 'PRIMER_INSIDE_PENALTY' => '(float, default -1.0)',
691 'PRIMER_INTERNAL_OLIGO_MAX_TEMPLATE_MISHYB' => '(decimal 9999.99, default 12.00)',
692 'PRIMER_OUTSIDE_PENALTY' => '(float, default 0.0)',
693 'PRIMER_LIB_AMBIGUITY_CODES_CONSENSUS' => '(boolean, default 1)',
694 'PRIMER_MAX_TEMPLATE_MISPRIMING' => '(decimal,9999.99, default -1.00)',
695 'PRIMER_PAIR_MAX_TEMPLATE_MISPRIMING' => '(decimal,9999.99, default -1.00)',
696 'PRIMER_PAIR_WT_TEMPLATE_MISPRIMING' => '(float, default 0.0)',
697 'PRIMER_WT_TEMPLATE_MISPRIMING' => '(float, default 0.0)'
699 $self->{'input_options'}=\%hash;
700 return \%hash;