seedlot upload with accession synonyms. seedlot upload works to update existing seedlots
[sgn.git] / lib / SGN / Controller / Primer3.pm
blobe389ef9a84d917c686d28377c0add33e90fbdc01
1 package SGN::Controller::Primer3;
3 =head1 NAME
5 Primer3 picks primers for PCR reactions, considering as criteria: oligonucleotide melting temperature, size, GC content, primer-dimer possibilities, PCR product size, positional contraints within the source (template) sequence, possibilities for ectopic priming (amplifying the wrong sequence), and many other contraints.
7 =cut
9 use Moose;
10 use namespace::autoclean;
11 use YAML::Any qw/LoadFile/;
13 use URI::FromHash 'uri';
14 use List::Compare;
15 use File::Temp qw / tempfile /;
16 use File::Slurp;
18 use DBI;
19 use HTML::FormFu;
21 BEGIN { extends 'Catalyst::Controller' }
23 =head1 PUBLIC ACTIONS
25 =head2 index
27 Public path: /primer3/create
29 Display a Primer3 input form.
31 =cut
33 sub create :Path('/primer3/') :Args(0) {
34 my ( $self, $c ) = @_;
35 my $form = HTML::FormFu->new(LoadFile($c->path_to(qw{forms primer3 formfu_create.yaml})));
37 # Set the template
38 $c->stash(template => 'primer3/primer3form.mas',
39 form => $form);
43 =head2
45 Submit input and return results.
47 =cut
49 sub update :Path('/primer3/update') :Args(0) {
50 my ($self, $c) = @_;
52 # Get all parameters from the form and store them in their respective variables.
53 my $SEQUENCE_EXCLUDED_REGION = $c->request->params->{SEQUENCE_EXCLUDED_REGION};
54 my $SEQUENCE_INCLUDED_REGION = $c->request->params->{SEQUENCE_INCLUDED_REGION};
55 my $SEQUENCE_PRIMER_REVCOMP = $c->request->params->{SEQUENCE_PRIMER_REVCOMP};
56 my $SEQUENCE_FORCE_LEFT_END = $c->request->params->{SEQUENCE_FORCE_LEFT_END};
57 my $SEQUENCE_INTERNAL_EXCLUDED_REGION = $c->request->params->{SEQUENCE_INTERNAL_EXCLUDED_REGION};
58 my $SEQUENCE_QUALITY = $c->request->params->{SEQUENCE_QUALITY};
59 my $SEQUENCE_FORCE_LEFT_START = $c->request->params->{SEQUENCE_FORCE_LEFT_START};
60 my $SEQUENCE_INTERNAL_OLIGO = $c->request->params->{SEQUENCE_INTERNAL_OLIGO};
61 my $SEQUENCE_START_CODON_POSITION = $c->request->params->{SEQUENCE_START_CODON_POSITION};
62 my $SEQUENCE_FORCE_RIGHT_END = $c->request->params->{SEQUENCE_FORCE_RIGHT_END};
63 my $SEQUENCE_OVERLAP_JUNCTION_LIST = $c->request->params->{SEQUENCE_OVERLAP_JUNCTION_LIST};
64 my $SEQUENCE_TARGET = $c->request->params->{SEQUENCE_TARGET};
65 my $SEQUENCE_FORCE_RIGHT_START = $c->request->params->{SEQUENCE_FORCE_RIGHT_START};
66 my $SEQUENCE_PRIMER = $c->request->params->{SEQUENCE_PRIMER};
67 my $SEQUENCE_TEMPLATE = $c->request->params->{SEQUENCE_TEMPLATE};
68 my $SEQUENCE_ID = $c->request->params->{SEQUENCE_ID};
69 my $SEQUENCE_PRIMER_PAIR_OK_REGION_LIST = $c->request->params->{SEQUENCE_PRIMER_PAIR_OK_REGION_LIST};
70 my $PRIMER_DNA_CONC = $c->request->params->{PRIMER_DNA_CONC};
71 my $PRIMER_LIB_AMBIGUITY_CODES_CONSENSUS = $c->request->params->{PRIMER_LIB_AMBIGUITY_CODES_CONSENSUS};
72 my $PRIMER_PAIR_WT_PRODUCT_SIZE_GT = $c->request->params->{PRIMER_PAIR_WT_PRODUCT_SIZE_GT};
73 my $PRIMER_DNTP_CONC = $c->request->params->{PRIMER_DNTP_CONC};
74 my $PRIMER_LOWERCASE_MASKING = $c->request->params->{PRIMER_LOWERCASE_MASKING};
75 my $PRIMER_PAIR_WT_PRODUCT_SIZE_LT = $c->request->params->{PRIMER_PAIR_WT_PRODUCT_SIZE_LT};
76 my $PRIMER_EXPLAIN_FLAG = $c->request->params->{PRIMER_EXPLAIN_FLAG};
77 my $PRIMER_MAX_END_GC = $c->request->params->{PRIMER_MAX_END_GC};
78 my $PRIMER_PAIR_WT_PRODUCT_TM_GT = $c->request->params->{PRIMER_PAIR_WT_PRODUCT_TM_GT};
79 my $PRIMER_FIRST_BASE_INDEX = $c->request->params->{PRIMER_FIRST_BASE_INDEX};
80 my $PRIMER_MAX_END_STABILITY = $c->request->params->{PRIMER_MAX_END_STABILITY};
81 my $PRIMER_PAIR_WT_PRODUCT_TM_LT = $c->request->params->{PRIMER_PAIR_WT_PRODUCT_TM_LT};
82 my $PRIMER_GC_CLAMP = $c->request->params->{PRIMER_GC_CLAMP};
83 my $PRIMER_MAX_GC = $c->request->params->{PRIMER_MAX_GC};
84 my $PRIMER_PAIR_WT_PR_PENALTY = $c->request->params->{PRIMER_PAIR_WT_PR_PENALTY};
85 my $PRIMER_INSIDE_PENALTY = $c->request->params->{PRIMER_INSIDE_PENALTY};
86 my $PRIMER_MAX_HAIRPIN_TH = $c->request->params->{PRIMER_MAX_HAIRPIN_TH};
87 my $PRIMER_PAIR_WT_TEMPLATE_MISPRIMING = $c->request->params->{PRIMER_PAIR_WT_TEMPLATE_MISPRIMING};
88 my $PRIMER_INTERNAL_DNA_CONC = $c->request->params->{PRIMER_INTERNAL_DNA_CONC};
89 my $PRIMER_MAX_LIBRARY_MISPRIMING = $c->request->params->{PRIMER_MAX_LIBRARY_MISPRIMING};
90 my $PRIMER_PAIR_WT_TEMPLATE_MISPRIMING_TH = $c->request->params->{PRIMER_PAIR_WT_TEMPLATE_MISPRIMING_TH};
91 my $PRIMER_INTERNAL_DNTP_CONC = $c->request->params->{PRIMER_INTERNAL_DNTP_CONC};
92 my $PRIMER_MAX_NS_ACCEPTED = $c->request->params->{PRIMER_MAX_NS_ACCEPTED};
93 my $PRIMER_PICK_ANYWAY = $c->request->params->{PRIMER_PICK_ANYWAY};
94 my $PRIMER_INTERNAL_MAX_GC = $c->request->params->{PRIMER_INTERNAL_MAX_GC};
95 my $PRIMER_MAX_POLY_X = $c->request->params->{PRIMER_MAX_POLY_X};
96 my $PRIMER_PICK_INTERNAL_OLIGO = $c->request->params->{PRIMER_PICK_INTERNAL_OLIGO};
97 my $PRIMER_INTERNAL_MAX_HAIRPIN_TH = $c->request->params->{PRIMER_INTERNAL_MAX_HAIRPIN_TH};
98 my $PRIMER_MAX_SELF_ANY = $c->request->params->{PRIMER_MAX_SELF_ANY};
99 my $PRIMER_PICK_LEFT_PRIMER = $c->request->params->{PRIMER_PICK_LEFT_PRIMER};
100 my $PRIMER_INTERNAL_MAX_LIBRARY_MISHYB = $c->request->params->{PRIMER_INTERNAL_MAX_LIBRARY_MISHYB};
101 my $PRIMER_MAX_SELF_ANY_TH = $c->request->params->{PRIMER_MAX_SELF_ANY_TH};
102 my $PRIMER_PICK_RIGHT_PRIMER = $c->request->params->{PRIMER_PICK_RIGHT_PRIMER};
103 my $PRIMER_INTERNAL_MAX_NS_ACCEPTED = $c->request->params->{PRIMER_INTERNAL_MAX_NS_ACCEPTED};
104 my $PRIMER_MAX_SELF_END = $c->request->params->{PRIMER_MAX_SELF_END};
105 my $PRIMER_PRODUCT_MAX_TM = $c->request->params->{PRIMER_PRODUCT_MAX_TM};
106 my $PRIMER_INTERNAL_MAX_POLY_X = $c->request->params->{PRIMER_INTERNAL_MAX_POLY_X};
107 my $PRIMER_MAX_SELF_END_TH = $c->request->params->{PRIMER_MAX_SELF_END_TH};
108 my $PRIMER_PRODUCT_MIN_TM = $c->request->params->{PRIMER_PRODUCT_MIN_TM};
109 my $PRIMER_INTERNAL_MAX_SELF_ANY = $c->request->params->{PRIMER_INTERNAL_MAX_SELF_ANY};
110 my $PRIMER_MAX_SIZE = $c->request->params->{PRIMER_MAX_SIZE};
111 my $PRIMER_PRODUCT_OPT_SIZE = $c->request->params->{PRIMER_PRODUCT_OPT_SIZE};
112 my $PRIMER_INTERNAL_MAX_SELF_ANY_TH = $c->request->params->{PRIMER_INTERNAL_MAX_SELF_ANY_TH};
113 my $PRIMER_MAX_TEMPLATE_MISPRIMING = $c->request->params->{PRIMER_MAX_TEMPLATE_MISPRIMING};
114 my $PRIMER_PRODUCT_OPT_TM = $c->request->params->{PRIMER_PRODUCT_OPT_TM};
115 my $PRIMER_INTERNAL_MAX_SELF_END = $c->request->params->{PRIMER_INTERNAL_MAX_SELF_END};
116 my $PRIMER_MAX_TEMPLATE_MISPRIMING_TH = $c->request->params->{PRIMER_MAX_TEMPLATE_MISPRIMING_TH};
117 my $PRIMER_PRODUCT_SIZE_RANGE = $c->request->params->{PRIMER_PRODUCT_SIZE_RANGE};
118 my $PRIMER_INTERNAL_MAX_SELF_END_TH = $c->request->params->{PRIMER_INTERNAL_MAX_SELF_END_TH};
119 my $PRIMER_MAX_TM = $c->request->params->{PRIMER_MAX_TM};
120 my $PRIMER_QUALITY_RANGE_MAX = $c->request->params->{PRIMER_QUALITY_RANGE_MAX};
121 my $PRIMER_INTERNAL_MAX_SIZE = $c->request->params->{PRIMER_INTERNAL_MAX_SIZE};
122 my $PRIMER_MIN_3_PRIME_OVERLAP_OF_JUNCTION = $c->request->params->{PRIMER_MIN_3_PRIME_OVERLAP_OF_JUNCTION};
123 my $PRIMER_QUALITY_RANGE_MIN = $c->request->params->{PRIMER_QUALITY_RANGE_MIN};
124 my $PRIMER_MIN_5_PRIME_OVERLAP_OF_JUNCTION = $c->request->params->{PRIMER_MIN_5_PRIME_OVERLAP_OF_JUNCTION};
125 my $PRIMER_SALT_CORRECTIONS = $c->request->params->{PRIMER_SALT_CORRECTIONS};
126 my $PRIMER_MIN_END_QUALITY = $c->request->params->{PRIMER_MIN_END_QUALITY};
127 my $PRIMER_SALT_DIVALENT = $c->request->params->{PRIMER_SALT_DIVALENT};
128 my $PRIMER_INTERNAL_MAX_TM = $c->request->params->{PRIMER_INTERNAL_MAX_TM};
129 my $PRIMER_MIN_GC = $c->request->params->{PRIMER_MIN_GC};
130 my $PRIMER_SALT_MONOVALENT = $c->request->params->{PRIMER_SALT_MONOVALENT};
131 my $PRIMER_INTERNAL_MIN_GC = $c->request->params->{PRIMER_INTERNAL_MIN_GC};
132 my $PRIMER_MIN_LEFT_THREE_PRIME_DISTANCE = $c->request->params->{PRIMER_MIN_LEFT_THREE_PRIME_DISTANCE};
133 my $PRIMER_SEQUENCING_ACCURACY = $c->request->params->{PRIMER_SEQUENCING_ACCURACY};
134 my $PRIMER_INTERNAL_MIN_QUALITY = $c->request->params->{PRIMER_INTERNAL_MIN_QUALITY};
135 my $PRIMER_MIN_QUALITY = $c->request->params->{PRIMER_MIN_QUALITY};
136 my $PRIMER_SEQUENCING_INTERVAL = $c->request->params->{PRIMER_SEQUENCING_INTERVAL};
137 my $PRIMER_INTERNAL_MIN_SIZE = $c->request->params->{PRIMER_INTERNAL_MIN_SIZE};
138 my $PRIMER_MIN_RIGHT_THREE_PRIME_DISTANCE = $c->request->params->{PRIMER_MIN_RIGHT_THREE_PRIME_DISTANCE};
139 my $PRIMER_SEQUENCING_LEAD = $c->request->params->{PRIMER_SEQUENCING_LEAD};
140 my $PRIMER_INTERNAL_MIN_TM = $c->request->params->{PRIMER_INTERNAL_MIN_TM};
141 my $PRIMER_MIN_SIZE = $c->request->params->{PRIMER_MIN_SIZE};
142 my $PRIMER_SEQUENCING_SPACING = $c->request->params->{PRIMER_SEQUENCING_SPACING};
143 my $PRIMER_INTERNAL_MISHYB_LIBRARY = $c->request->params->{PRIMER_INTERNAL_MISHYB_LIBRARY};
144 my $PRIMER_MIN_THREE_PRIME_DISTANCE = $c->request->params->{PRIMER_MIN_THREE_PRIME_DISTANCE};
145 my $PRIMER_TASK = $c->request->params->{PRIMER_TASK};
146 my $PRIMER_INTERNAL_OPT_GC_PERCENT = $c->request->params->{PRIMER_INTERNAL_OPT_GC_PERCENT};
147 my $PRIMER_MIN_TM = $c->request->params->{PRIMER_MIN_TM};
148 my $PRIMER_THERMODYNAMIC_ALIGNMENT = $c->request->params->{PRIMER_THERMODYNAMIC_ALIGNMENT};
149 my $PRIMER_INTERNAL_OPT_SIZE = $c->request->params->{PRIMER_INTERNAL_OPT_SIZE};
150 my $PRIMER_MISPRIMING_LIBRARY = $c->request->params->{PRIMER_MISPRIMING_LIBRARY};
151 my $PRIMER_THERMODYNAMIC_PARAMETERS_PATH = $c->request->params->{PRIMER_THERMODYNAMIC_PARAMETERS_PATH};
152 my $PRIMER_INTERNAL_OPT_TM = $c->request->params->{PRIMER_INTERNAL_OPT_TM};
153 my $PRIMER_NUM_RETURN = $c->request->params->{PRIMER_NUM_RETURN};
154 my $PRIMER_TM_FORMULA = $c->request->params->{PRIMER_TM_FORMULA};
155 my $PRIMER_INTERNAL_SALT_DIVALENT = $c->request->params->{PRIMER_INTERNAL_SALT_DIVALENT};
156 my $PRIMER_OPT_GC_PERCENT = $c->request->params->{PRIMER_OPT_GC_PERCENT};
157 my $PRIMER_WT_END_QUAL = $c->request->params->{PRIMER_WT_END_QUAL};
158 my $PRIMER_INTERNAL_SALT_MONOVALENT = $c->request->params->{PRIMER_INTERNAL_SALT_MONOVALENT};
159 my $PRIMER_OPT_SIZE = $c->request->params->{PRIMER_OPT_SIZE};
160 my $PRIMER_WT_END_STABILITY = $c->request->params->{PRIMER_WT_END_STABILITY};
161 my $PRIMER_INTERNAL_WT_END_QUAL = $c->request->params->{PRIMER_INTERNAL_WT_END_QUAL};
162 my $PRIMER_OPT_TM = $c->request->params->{PRIMER_OPT_TM};
163 my $PRIMER_WT_GC_PERCENT_GT = $c->request->params->{PRIMER_WT_GC_PERCENT_GT};
164 my $PRIMER_INTERNAL_WT_GC_PERCENT_GT = $c->request->params->{PRIMER_INTERNAL_WT_GC_PERCENT_GT};
165 my $PRIMER_OUTSIDE_PENALTY = $c->request->params->{PRIMER_OUTSIDE_PENALTY};
166 my $PRIMER_WT_GC_PERCENT_LT = $c->request->params->{PRIMER_WT_GC_PERCENT_LT};
167 my $PRIMER_INTERNAL_WT_GC_PERCENT_LT = $c->request->params->{PRIMER_INTERNAL_WT_GC_PERCENT_LT};
168 my $PRIMER_PAIR_MAX_COMPL_ANY = $c->request->params->{PRIMER_PAIR_MAX_COMPL_ANY};
169 my $PRIMER_WT_HAIRPIN_TH = $c->request->params->{PRIMER_WT_HAIRPIN_TH};
170 my $PRIMER_INTERNAL_WT_HAIRPIN_TH = $c->request->params->{PRIMER_INTERNAL_WT_HAIRPIN_TH};
171 my $PRIMER_PAIR_MAX_COMPL_ANY_TH = $c->request->params->{PRIMER_PAIR_MAX_COMPL_ANY_TH};
172 my $PRIMER_WT_LIBRARY_MISPRIMING = $c->request->params->{PRIMER_WT_LIBRARY_MISPRIMING};
173 my $PRIMER_INTERNAL_WT_LIBRARY_MISHYB = $c->request->params->{PRIMER_INTERNAL_WT_LIBRARY_MISHYB};
174 my $PRIMER_PAIR_MAX_COMPL_END = $c->request->params->{PRIMER_PAIR_MAX_COMPL_END};
175 my $PRIMER_WT_NUM_NS = $c->request->params->{PRIMER_WT_NUM_NS};
176 my $PRIMER_INTERNAL_WT_NUM_NS = $c->request->params->{PRIMER_INTERNAL_WT_NUM_NS};
177 my $PRIMER_PAIR_MAX_COMPL_END_TH = $c->request->params->{PRIMER_PAIR_MAX_COMPL_END_TH};
178 my $PRIMER_WT_POS_PENALTY = $c->request->params->{PRIMER_WT_POS_PENALTY};
179 my $PRIMER_INTERNAL_WT_SELF_ANY = $c->request->params->{PRIMER_INTERNAL_WT_SELF_ANY};
180 my $PRIMER_PAIR_MAX_DIFF_TM = $c->request->params->{PRIMER_PAIR_MAX_DIFF_TM};
181 my $PRIMER_WT_SELF_ANY = $c->request->params->{PRIMER_WT_SELF_ANY};
182 my $PRIMER_INTERNAL_WT_SELF_ANY_TH = $c->request->params->{PRIMER_INTERNAL_WT_SELF_ANY_TH};
183 my $PRIMER_WT_SELF_ANY_TH = $c->request->params->{PRIMER_WT_SELF_ANY_TH};
184 my $PRIMER_INTERNAL_WT_SELF_END = $c->request->params->{PRIMER_INTERNAL_WT_SELF_END};
185 my $PRIMER_PAIR_MAX_LIBRARY_MISPRIMING = $c->request->params->{PRIMER_PAIR_MAX_LIBRARY_MISPRIMING};
186 my $PRIMER_WT_SELF_END = $c->request->params->{PRIMER_WT_SELF_END};
187 my $PRIMER_INTERNAL_WT_SELF_END_TH = $c->request->params->{PRIMER_INTERNAL_WT_SELF_END_TH};
188 my $PRIMER_PAIR_MAX_TEMPLATE_MISPRIMING = $c->request->params->{PRIMER_PAIR_MAX_TEMPLATE_MISPRIMING};
189 my $PRIMER_WT_SELF_END_TH = $c->request->params->{PRIMER_WT_SELF_END_TH};
190 my $PRIMER_INTERNAL_WT_SEQ_QUAL = $c->request->params->{PRIMER_INTERNAL_WT_SEQ_QUAL};
191 my $PRIMER_PAIR_MAX_TEMPLATE_MISPRIMING_TH = $c->request->params->{PRIMER_PAIR_MAX_TEMPLATE_MISPRIMING_TH};
192 my $PRIMER_WT_SEQ_QUAL = $c->request->params->{PRIMER_WT_SEQ_QUAL};
193 my $PRIMER_INTERNAL_WT_SIZE_GT = $c->request->params->{PRIMER_INTERNAL_WT_SIZE_GT};
194 my $PRIMER_PAIR_WT_COMPL_ANY = $c->request->params->{PRIMER_PAIR_WT_COMPL_ANY};
195 my $PRIMER_WT_SIZE_GT = $c->request->params->{PRIMER_WT_SIZE_GT};
196 my $PRIMER_INTERNAL_WT_SIZE_LT = $c->request->params->{PRIMER_INTERNAL_WT_SIZE_LT};
197 my $PRIMER_PAIR_WT_COMPL_ANY_TH = $c->request->params->{PRIMER_PAIR_WT_COMPL_ANY_TH};
198 my $PRIMER_WT_SIZE_LT = $c->request->params->{PRIMER_WT_SIZE_LT};
199 my $PRIMER_PAIR_WT_COMPL_END = $c->request->params->{PRIMER_PAIR_WT_COMPL_END};
200 my $PRIMER_WT_TEMPLATE_MISPRIMING = $c->request->params->{PRIMER_WT_TEMPLATE_MISPRIMING};
201 my $PRIMER_PAIR_WT_COMPL_END_TH = $c->request->params->{PRIMER_PAIR_WT_COMPL_END_TH};
202 my $PRIMER_WT_TEMPLATE_MISPRIMING_TH = $c->request->params->{PRIMER_WT_TEMPLATE_MISPRIMING_TH};
203 my $PRIMER_INTERNAL_WT_TM_GT = $c->request->params->{PRIMER_INTERNAL_WT_TM_GT};
204 my $PRIMER_PAIR_WT_DIFF_TM = $c->request->params->{PRIMER_PAIR_WT_DIFF_TM};
205 my $PRIMER_WT_TM_GT = $c->request->params->{PRIMER_WT_TM_GT};
206 my $PRIMER_INTERNAL_WT_TM_LT = $c->request->params->{PRIMER_INTERNAL_WT_TM_LT};
207 my $PRIMER_PAIR_WT_IO_PENALTY = $c->request->params->{PRIMER_PAIR_WT_IO_PENALTY};
208 my $PRIMER_WT_TM_LT = $c->request->params->{PRIMER_WT_TM_LT};
209 my $PRIMER_LIBERAL_BASE = $c->request->params->{PRIMER_LIBERAL_BASE};
210 my $PRIMER_PAIR_WT_LIBRARY_MISPRIMING = $c->request->params->{PRIMER_PAIR_WT_LIBRARY_MISPRIMING};
213 # Remove all non-alphabetic characters (makes FASTA input ok)
214 $SEQUENCE_TEMPLATE =~ s/[^a-zA-Z]*//g;
216 # Store Boulder-IO formatted input in text variable.
218 my $text = qq(SEQUENCE_EXCLUDED_REGION=$SEQUENCE_EXCLUDED_REGION
219 SEQUENCE_INCLUDED_REGION=$SEQUENCE_INCLUDED_REGION
220 SEQUENCE_PRIMER_REVCOMP=$SEQUENCE_PRIMER_REVCOMP
221 SEQUENCE_FORCE_LEFT_END=$SEQUENCE_FORCE_LEFT_END
222 SEQUENCE_INTERNAL_EXCLUDED_REGION=$SEQUENCE_INTERNAL_EXCLUDED_REGION
223 SEQUENCE_QUALITY=$SEQUENCE_QUALITY
224 SEQUENCE_FORCE_LEFT_START=$SEQUENCE_FORCE_LEFT_START
225 SEQUENCE_INTERNAL_OLIGO=$SEQUENCE_INTERNAL_OLIGO
226 SEQUENCE_START_CODON_POSITION=$SEQUENCE_START_CODON_POSITION
227 SEQUENCE_FORCE_RIGHT_END=$SEQUENCE_FORCE_RIGHT_END
228 SEQUENCE_OVERLAP_JUNCTION_LIST=$SEQUENCE_OVERLAP_JUNCTION_LIST
229 SEQUENCE_TARGET=$SEQUENCE_TARGET
230 SEQUENCE_FORCE_RIGHT_START=$SEQUENCE_FORCE_RIGHT_START
231 SEQUENCE_PRIMER=$SEQUENCE_PRIMER
232 SEQUENCE_TEMPLATE=$SEQUENCE_TEMPLATE
233 SEQUENCE_ID=$SEQUENCE_ID
234 SEQUENCE_PRIMER_PAIR_OK_REGION_LIST=$SEQUENCE_PRIMER_PAIR_OK_REGION_LIST
235 PRIMER_DNA_CONC=$PRIMER_DNA_CONC
236 PRIMER_LIB_AMBIGUITY_CODES_CONSENSUS=$PRIMER_LIB_AMBIGUITY_CODES_CONSENSUS
237 PRIMER_PAIR_WT_PRODUCT_SIZE_GT=$PRIMER_PAIR_WT_PRODUCT_SIZE_GT
238 PRIMER_DNTP_CONC=$PRIMER_DNTP_CONC
239 PRIMER_LOWERCASE_MASKING=$PRIMER_LOWERCASE_MASKING
240 PRIMER_PAIR_WT_PRODUCT_SIZE_LT=$PRIMER_PAIR_WT_PRODUCT_SIZE_LT
241 PRIMER_EXPLAIN_FLAG=$PRIMER_EXPLAIN_FLAG
242 PRIMER_MAX_END_GC=$PRIMER_MAX_END_GC
243 PRIMER_PAIR_WT_PRODUCT_TM_GT=$PRIMER_PAIR_WT_PRODUCT_TM_GT
244 PRIMER_FIRST_BASE_INDEX=$PRIMER_FIRST_BASE_INDEX
245 PRIMER_MAX_END_STABILITY=$PRIMER_MAX_END_STABILITY
246 PRIMER_PAIR_WT_PRODUCT_TM_LT=$PRIMER_PAIR_WT_PRODUCT_TM_LT
247 PRIMER_GC_CLAMP=$PRIMER_GC_CLAMP
248 PRIMER_MAX_GC=$PRIMER_MAX_GC
249 PRIMER_PAIR_WT_PR_PENALTY=$PRIMER_PAIR_WT_PR_PENALTY
250 PRIMER_INSIDE_PENALTY=$PRIMER_INSIDE_PENALTY
251 PRIMER_MAX_HAIRPIN_TH=$PRIMER_MAX_HAIRPIN_TH
252 PRIMER_PAIR_WT_TEMPLATE_MISPRIMING=$PRIMER_PAIR_WT_TEMPLATE_MISPRIMING
253 PRIMER_INTERNAL_DNA_CONC=$PRIMER_INTERNAL_DNA_CONC
254 PRIMER_MAX_LIBRARY_MISPRIMING=$PRIMER_MAX_LIBRARY_MISPRIMING
255 PRIMER_PAIR_WT_TEMPLATE_MISPRIMING_TH=$PRIMER_PAIR_WT_TEMPLATE_MISPRIMING_TH
256 PRIMER_INTERNAL_DNTP_CONC=$PRIMER_INTERNAL_DNTP_CONC
257 PRIMER_MAX_NS_ACCEPTED=$PRIMER_MAX_NS_ACCEPTED
258 PRIMER_PICK_ANYWAY=$PRIMER_PICK_ANYWAY
259 PRIMER_INTERNAL_MAX_GC=$PRIMER_INTERNAL_MAX_GC
260 PRIMER_MAX_POLY_X=$PRIMER_MAX_POLY_X
261 PRIMER_PICK_INTERNAL_OLIGO=$PRIMER_PICK_INTERNAL_OLIGO
262 PRIMER_INTERNAL_MAX_HAIRPIN_TH=$PRIMER_INTERNAL_MAX_HAIRPIN_TH
263 PRIMER_MAX_SELF_ANY=$PRIMER_MAX_SELF_ANY
264 PRIMER_PICK_LEFT_PRIMER=$PRIMER_PICK_LEFT_PRIMER
265 PRIMER_INTERNAL_MAX_LIBRARY_MISHYB=$PRIMER_INTERNAL_MAX_LIBRARY_MISHYB
266 PRIMER_MAX_SELF_ANY_TH=$PRIMER_MAX_SELF_ANY_TH
267 PRIMER_PICK_RIGHT_PRIMER=$PRIMER_PICK_RIGHT_PRIMER
268 PRIMER_INTERNAL_MAX_NS_ACCEPTED=$PRIMER_INTERNAL_MAX_NS_ACCEPTED
269 PRIMER_MAX_SELF_END=$PRIMER_MAX_SELF_END
270 PRIMER_PRODUCT_MAX_TM=$PRIMER_PRODUCT_MAX_TM
271 PRIMER_INTERNAL_MAX_POLY_X=$PRIMER_INTERNAL_MAX_POLY_X
272 PRIMER_MAX_SELF_END_TH=$PRIMER_MAX_SELF_END_TH
273 PRIMER_PRODUCT_MIN_TM=$PRIMER_PRODUCT_MIN_TM
274 PRIMER_INTERNAL_MAX_SELF_ANY=$PRIMER_INTERNAL_MAX_SELF_ANY
275 PRIMER_MAX_SIZE=$PRIMER_MAX_SIZE
276 PRIMER_PRODUCT_OPT_SIZE=$PRIMER_PRODUCT_OPT_SIZE
277 PRIMER_INTERNAL_MAX_SELF_ANY_TH=$PRIMER_INTERNAL_MAX_SELF_ANY_TH
278 PRIMER_MAX_TEMPLATE_MISPRIMING=$PRIMER_MAX_TEMPLATE_MISPRIMING
279 PRIMER_PRODUCT_OPT_TM=$PRIMER_PRODUCT_OPT_TM
280 PRIMER_INTERNAL_MAX_SELF_END=$PRIMER_INTERNAL_MAX_SELF_END
281 PRIMER_MAX_TEMPLATE_MISPRIMING_TH=$PRIMER_MAX_TEMPLATE_MISPRIMING_TH
282 PRIMER_PRODUCT_SIZE_RANGE=$PRIMER_PRODUCT_SIZE_RANGE
283 PRIMER_INTERNAL_MAX_SELF_END_TH=$PRIMER_INTERNAL_MAX_SELF_END_TH
284 PRIMER_MAX_TM=$PRIMER_MAX_TM
285 PRIMER_QUALITY_RANGE_MAX=$PRIMER_QUALITY_RANGE_MAX
286 PRIMER_INTERNAL_MAX_SIZE=$PRIMER_INTERNAL_MAX_SIZE
287 PRIMER_MIN_3_PRIME_OVERLAP_OF_JUNCTION=$PRIMER_MIN_3_PRIME_OVERLAP_OF_JUNCTION
288 PRIMER_QUALITY_RANGE_MIN=$PRIMER_QUALITY_RANGE_MIN
289 PRIMER_MIN_5_PRIME_OVERLAP_OF_JUNCTION=$PRIMER_MIN_5_PRIME_OVERLAP_OF_JUNCTION
290 PRIMER_SALT_CORRECTIONS=$PRIMER_SALT_CORRECTIONS
291 PRIMER_MIN_END_QUALITY=$PRIMER_MIN_END_QUALITY
292 PRIMER_SALT_DIVALENT=$PRIMER_SALT_DIVALENT
293 PRIMER_INTERNAL_MAX_TM=$PRIMER_INTERNAL_MAX_TM
294 PRIMER_MIN_GC=$PRIMER_MIN_GC
295 PRIMER_SALT_MONOVALENT=$PRIMER_SALT_MONOVALENT
296 PRIMER_INTERNAL_MIN_GC=$PRIMER_INTERNAL_MIN_GC
297 PRIMER_MIN_LEFT_THREE_PRIME_DISTANCE=$PRIMER_MIN_LEFT_THREE_PRIME_DISTANCE
298 PRIMER_SEQUENCING_ACCURACY=$PRIMER_SEQUENCING_ACCURACY
299 PRIMER_INTERNAL_MIN_QUALITY=$PRIMER_INTERNAL_MIN_QUALITY
300 PRIMER_MIN_QUALITY=$PRIMER_MIN_QUALITY
301 PRIMER_SEQUENCING_INTERVAL=$PRIMER_SEQUENCING_INTERVAL
302 PRIMER_INTERNAL_MIN_SIZE=$PRIMER_INTERNAL_MIN_SIZE
303 PRIMER_MIN_RIGHT_THREE_PRIME_DISTANCE=$PRIMER_MIN_RIGHT_THREE_PRIME_DISTANCE
304 PRIMER_SEQUENCING_LEAD=$PRIMER_SEQUENCING_LEAD
305 PRIMER_INTERNAL_MIN_TM=$PRIMER_INTERNAL_MIN_TM
306 PRIMER_MIN_SIZE=$PRIMER_MIN_SIZE
307 PRIMER_SEQUENCING_SPACING=$PRIMER_SEQUENCING_SPACING
308 PRIMER_INTERNAL_MISHYB_LIBRARY=$PRIMER_INTERNAL_MISHYB_LIBRARY
309 PRIMER_MIN_THREE_PRIME_DISTANCE=$PRIMER_MIN_THREE_PRIME_DISTANCE
310 PRIMER_TASK=$PRIMER_TASK
311 PRIMER_INTERNAL_OPT_GC_PERCENT=$PRIMER_INTERNAL_OPT_GC_PERCENT
312 PRIMER_MIN_TM=$PRIMER_MIN_TM
313 PRIMER_THERMODYNAMIC_ALIGNMENT=$PRIMER_THERMODYNAMIC_ALIGNMENT
314 PRIMER_INTERNAL_OPT_SIZE=$PRIMER_INTERNAL_OPT_SIZE
315 PRIMER_MISPRIMING_LIBRARY=$PRIMER_MISPRIMING_LIBRARY
316 PRIMER_THERMODYNAMIC_PARAMETERS_PATH=$PRIMER_THERMODYNAMIC_PARAMETERS_PATH
317 PRIMER_INTERNAL_OPT_TM=$PRIMER_INTERNAL_OPT_TM
318 PRIMER_NUM_RETURN=$PRIMER_NUM_RETURN
319 PRIMER_TM_FORMULA=$PRIMER_TM_FORMULA
320 PRIMER_INTERNAL_SALT_DIVALENT=$PRIMER_INTERNAL_SALT_DIVALENT
321 PRIMER_OPT_GC_PERCENT=$PRIMER_OPT_GC_PERCENT
322 PRIMER_WT_END_QUAL=$PRIMER_WT_END_QUAL
323 PRIMER_INTERNAL_SALT_MONOVALENT=$PRIMER_INTERNAL_SALT_MONOVALENT
324 PRIMER_OPT_SIZE=$PRIMER_OPT_SIZE
325 PRIMER_WT_END_STABILITY=$PRIMER_WT_END_STABILITY
326 PRIMER_INTERNAL_WT_END_QUAL=$PRIMER_INTERNAL_WT_END_QUAL
327 PRIMER_OPT_TM=$PRIMER_OPT_TM
328 PRIMER_WT_GC_PERCENT_GT=$PRIMER_WT_GC_PERCENT_GT
329 PRIMER_INTERNAL_WT_GC_PERCENT_GT=$PRIMER_INTERNAL_WT_GC_PERCENT_GT
330 PRIMER_OUTSIDE_PENALTY=$PRIMER_OUTSIDE_PENALTY
331 PRIMER_WT_GC_PERCENT_LT=$PRIMER_WT_GC_PERCENT_LT
332 PRIMER_INTERNAL_WT_GC_PERCENT_LT=$PRIMER_INTERNAL_WT_GC_PERCENT_LT
333 PRIMER_PAIR_MAX_COMPL_ANY=$PRIMER_PAIR_MAX_COMPL_ANY
334 PRIMER_WT_HAIRPIN_TH=$PRIMER_WT_HAIRPIN_TH
335 PRIMER_INTERNAL_WT_HAIRPIN_TH=$PRIMER_INTERNAL_WT_HAIRPIN_TH
336 PRIMER_PAIR_MAX_COMPL_ANY_TH=$PRIMER_PAIR_MAX_COMPL_ANY_TH
337 PRIMER_WT_LIBRARY_MISPRIMING=$PRIMER_WT_LIBRARY_MISPRIMING
338 PRIMER_INTERNAL_WT_LIBRARY_MISHYB=$PRIMER_INTERNAL_WT_LIBRARY_MISHYB
339 PRIMER_PAIR_MAX_COMPL_END=$PRIMER_PAIR_MAX_COMPL_END
340 PRIMER_WT_NUM_NS=$PRIMER_WT_NUM_NS
341 PRIMER_INTERNAL_WT_NUM_NS=$PRIMER_INTERNAL_WT_NUM_NS
342 PRIMER_PAIR_MAX_COMPL_END_TH=$PRIMER_PAIR_MAX_COMPL_END_TH
343 PRIMER_WT_POS_PENALTY=$PRIMER_WT_POS_PENALTY
344 PRIMER_INTERNAL_WT_SELF_ANY=$PRIMER_INTERNAL_WT_SELF_ANY
345 PRIMER_PAIR_MAX_DIFF_TM=$PRIMER_PAIR_MAX_DIFF_TM
346 PRIMER_WT_SELF_ANY=$PRIMER_WT_SELF_ANY
347 PRIMER_INTERNAL_WT_SELF_ANY_TH=$PRIMER_INTERNAL_WT_SELF_ANY_TH
348 PRIMER_WT_SELF_ANY_TH=$PRIMER_WT_SELF_ANY_TH
349 PRIMER_INTERNAL_WT_SELF_END=$PRIMER_INTERNAL_WT_SELF_END
350 PRIMER_PAIR_MAX_LIBRARY_MISPRIMING=$PRIMER_PAIR_MAX_LIBRARY_MISPRIMING
351 PRIMER_WT_SELF_END=$PRIMER_WT_SELF_END
352 PRIMER_INTERNAL_WT_SELF_END_TH=$PRIMER_INTERNAL_WT_SELF_END_TH
353 PRIMER_PAIR_MAX_TEMPLATE_MISPRIMING=$PRIMER_PAIR_MAX_TEMPLATE_MISPRIMING
354 PRIMER_WT_SELF_END_TH=$PRIMER_WT_SELF_END_TH
355 PRIMER_INTERNAL_WT_SEQ_QUAL=$PRIMER_INTERNAL_WT_SEQ_QUAL
356 PRIMER_PAIR_MAX_TEMPLATE_MISPRIMING_TH=$PRIMER_PAIR_MAX_TEMPLATE_MISPRIMING_TH
357 PRIMER_WT_SEQ_QUAL=$PRIMER_WT_SEQ_QUAL
358 PRIMER_INTERNAL_WT_SIZE_GT=$PRIMER_INTERNAL_WT_SIZE_GT
359 PRIMER_PAIR_WT_COMPL_ANY=$PRIMER_PAIR_WT_COMPL_ANY
360 PRIMER_WT_SIZE_GT=$PRIMER_WT_SIZE_GT
361 PRIMER_INTERNAL_WT_SIZE_LT=$PRIMER_INTERNAL_WT_SIZE_LT
362 PRIMER_PAIR_WT_COMPL_ANY_TH=$PRIMER_PAIR_WT_COMPL_ANY_TH
363 PRIMER_WT_SIZE_LT=$PRIMER_WT_SIZE_LT
364 PRIMER_PAIR_WT_COMPL_END=$PRIMER_PAIR_WT_COMPL_END
365 PRIMER_WT_TEMPLATE_MISPRIMING=$PRIMER_WT_TEMPLATE_MISPRIMING
366 PRIMER_PAIR_WT_COMPL_END_TH=$PRIMER_PAIR_WT_COMPL_END_TH
367 PRIMER_WT_TEMPLATE_MISPRIMING_TH=$PRIMER_WT_TEMPLATE_MISPRIMING_TH
368 PRIMER_INTERNAL_WT_TM_GT=$PRIMER_INTERNAL_WT_TM_GT
369 PRIMER_PAIR_WT_DIFF_TM=$PRIMER_PAIR_WT_DIFF_TM
370 PRIMER_WT_TM_GT=$PRIMER_WT_TM_GT
371 PRIMER_INTERNAL_WT_TM_LT=$PRIMER_INTERNAL_WT_TM_LT
372 PRIMER_PAIR_WT_IO_PENALTY=$PRIMER_PAIR_WT_IO_PENALTY
373 PRIMER_WT_TM_LT=$PRIMER_WT_TM_LT
374 PRIMER_LIBERAL_BASE=$PRIMER_LIBERAL_BASE
375 PRIMER_PAIR_WT_LIBRARY_MISPRIMING=$PRIMER_PAIR_WT_LIBRARY_MISPRIMING
379 my $filename = "primer3.txt";
380 my $tempdir = File::Spec->catfile($c->config->{basepath}, $c->tempfiles_subdir('primer3'), $filename);
383 my @text = split("\n", $text);
384 my $filteredtext;
385 foreach my $item (@text) {
386 if ($item !~ m/=$/) {
387 $filteredtext .= $item."\n";
390 $filteredtext .= "=";
392 write_file($tempdir, $filteredtext);
394 system("primer3_core < $tempdir > $tempdir.results");
396 open (RESULTS, "$tempdir.results");
397 my %results;
398 while (<RESULTS>) {
399 chomp;
400 my @stuff = split(/=/, $_);
401 $results{$stuff[0]} = $stuff[1];
403 close (RESULTS);
405 $c->stash(template => 'primer3/primer3results.mas',
406 resultshash => \%results
412 __PACKAGE__->meta->make_immutable;