@@ -165,14 +165,14 @@ public static JSONObject buildCodonJuggle(
165165 */
166166 public static JSONObject buildVerify (
167167 final String filenameSequences ,
168- final String constraintsFilename ,
168+ Vendor vendor ,
169169 final String sequencePatternsFilename )
170170 throws BOOSTClientException , IOException {
171171
172172 //---------------------------------
173173 // verify the given values
174174 ParameterValueVerifier .verifyFilename (JSONKeys .SEQUENCE_INFORMATION , filenameSequences );
175- ParameterValueVerifier .verifyFilename ( JSONKeys . CONSTRAINTS_INFORMATION , constraintsFilename );
175+ ParameterValueVerifier .verifyNull ( BOOSTConstants . VENDOR , vendor );
176176 // the sequence patterns filename is optional
177177 if (null != sequencePatternsFilename && !sequencePatternsFilename .trim ().isEmpty ()) {
178178 ParameterValueVerifier .verifyFilename (JSONKeys .PATTERN_INFORMATION , sequencePatternsFilename );
@@ -202,14 +202,172 @@ public static JSONObject buildVerify(
202202
203203 //---------------------------------
204204 // CONSTRAINTS
205- requestData .put (JSONKeys .CONSTRAINTS_INFORMATION ,
206- RequestBuilder .buildConstraints (constraintsFilename ));
205+ requestData .put (JSONKeys .VENDOR_NAME , vendor );
207206 //---------------------------------
208207
209208
210209 return requestData ;
211210 }
212211
212+
213+ /**
214+ *
215+ * @param sequencesFilename ... the name of the file that contains the sequences
216+ * @param type ... the type of the sequences, i.e. DNA, RNA, Protein
217+ * @param bCodingSequences ... if the sequences are encoded in a format that does not
218+ * support sequence feature annotations and if bCoding sequences is set to true,
219+ * then are all sequences are treated as coding sequences. If the sequences are
220+ * encoded in a format that does support sequence feature annotations, then the
221+ * bCodingSequences flag is ignored.
222+ * @param vendor ... the name of commercial synthesis provider
223+ * @param strategy ... the codon replacement strategy
224+ * @param codonUsageTableFilename ... the name of the file that contains the codon
225+ * usage table
226+ *
227+ * @throws BOOSTClientException
228+ */
229+ public static JSONObject buildPolish (
230+ final String sequencesFilename ,
231+ boolean bCodingSequences ,
232+ Vendor vendor ,
233+ Strategy strategy ,
234+ final FileFormat outputFormat ,
235+ final String codonUsageTable )
236+ throws BOOSTClientException {
237+
238+ //-------------------------------------
239+ // verify the given values
240+ ParameterValueVerifier .verifyFilename (BOOSTConstants .INPUT_FILENAME , sequencesFilename );
241+ ParameterValueVerifier .verifyNull (BOOSTConstants .VENDOR , vendor );
242+ try {
243+ ParameterValueVerifier .verifyFilename (BOOSTConstants .CODON_USAGE_TABLE , codonUsageTable );
244+ } catch (Exception e ) {}
245+ ParameterValueVerifier .verifyNull (BOOSTConstants .OUTPUT_FORMAT , outputFormat );
246+ ParameterValueVerifier .verifyNull (BOOSTConstants .STRATEGY , strategy );
247+ //----------------------------------------
248+
249+ JSONObject modifiedData = new JSONObject ();
250+
251+ //-----------------------------------------
252+ //JOB INFORMATION
253+ modifiedData .put (JSONKeys .JOB_INFORMATION ,
254+ RequestBuilder .buildJobInformation (BOOSTFunctions .POLISH ));
255+ //-----------------------------------------
256+
257+ // sequence information
258+ modifiedData .put (JSONKeys .SEQUENCE_INFORMATION ,
259+ RequestBuilder .buildSequenceData (sequencesFilename , SequenceType .DNA , bCodingSequences ));
260+ //-----------------------------------------
261+
262+ // constraints
263+ modifiedData .put (JSONKeys .VENDOR_NAME , vendor );
264+ //------------------------------------------
265+
266+ // modification information
267+ modifiedData .put (JSONKeys .MODIFICATION_INFORMATION ,
268+ RequestBuilder .buildModificationData (strategy , codonUsageTable ));
269+ //-------------------------------------------
270+
271+ // output information
272+ modifiedData .put (JSONKeys .OUTPUT_INFORMATION ,
273+ RequestBuilder .buildOutputData (outputFormat ));
274+ //-------------------------------------------------
275+
276+
277+ return modifiedData ;
278+ }
279+
280+ /**
281+ * The buildPartation wraps all required information for
282+ * BOOST's dna partition functionality into a JSON representation
283+ *
284+ * @return a JSONObject that represents the input values
285+ *
286+ * @throws BOOSTClientException ... if any given value is NULL or any given String value is empty
287+ * */
288+
289+ public static JSONObject buildPartation (
290+ final String sequenceFileName ,
291+ final String fivePrimeVectorOverlap ,
292+ final String threePrimeVectorOverlap ,
293+ String minLengthBB ,
294+ String maxLengthBB ,
295+ String minOverlapGC ,
296+ String optOverlapGC ,
297+ String maxOverlapGC ,
298+ String minOverlapLength ,
299+ String optOverlapLength ,
300+ String maxOverlapLength )
301+ throws BOOSTClientException {
302+
303+ //verify the values
304+ ParameterValueVerifier .verifyFilename (BOOSTConstants .INPUT_FILENAME , sequenceFileName );
305+ ParameterValueVerifier .verifyValue (BOOSTConstants .FIVE_PRIME_VECTOR_OVERLAP , fivePrimeVectorOverlap );
306+ ParameterValueVerifier .verifyValue (BOOSTConstants .THREE_PRIME_VECTOR_OVERLAP , threePrimeVectorOverlap );
307+ ParameterValueVerifier .verifyValue (BOOSTConstants .MIN_BB_LENGTH , minLengthBB );
308+ ParameterValueVerifier .verifyValue (BOOSTConstants .MAX_BB_LENGTH , maxLengthBB );
309+ ParameterValueVerifier .verifyValue (BOOSTConstants .MIN_OVERLAP_GC , minOverlapGC );
310+ ParameterValueVerifier .verifyValue (BOOSTConstants .OPT_OVERLAP_GC , optOverlapGC );
311+ ParameterValueVerifier .verifyValue (BOOSTConstants .MAX_OVERLAP_GC , maxOverlapGC );
312+ ParameterValueVerifier .verifyValue (BOOSTConstants .MIN_OVERLAP_LENGTH , minOverlapGC );
313+ ParameterValueVerifier .verifyValue (BOOSTConstants .OPT_OVERLAP_LENGTH , optOverlapGC );
314+ ParameterValueVerifier .verifyValue (BOOSTConstants .MAX_OVERLAP_LENGTH , maxOverlapLength );
315+
316+ //----------------------------------------------
317+
318+ // build the JSON representation of the input values
319+ JSONObject partationData = new JSONObject ();
320+
321+ //----------------------------------------------
322+
323+
324+ // JOB INFORMATION
325+ partationData .put (JSONKeys .JOB_INFORMATION ,
326+ RequestBuilder .buildJobInformation (BOOSTFunctions .PARTITION ));
327+ //----------------------------------------------
328+
329+
330+ // sequence information
331+ partationData .put (JSONKeys .SEQUENCE_INFORMATION ,
332+ RequestBuilder .buildSequenceData (sequenceFileName , SequenceType .DNA , false ));
333+
334+ // partition information
335+ partationData .put (JSONKeys .PARTITIONING_INFORMATION ,
336+ RequestBuilder .buildPartitionData (sequenceFileName , fivePrimeVectorOverlap ,
337+ threePrimeVectorOverlap , minLengthBB , maxLengthBB , minOverlapGC , optOverlapGC ,
338+ maxOverlapGC , minOverlapLength , optOverlapLength , maxOverlapLength ));
339+
340+
341+ return partationData ;
342+
343+ }
344+
345+ private static JSONObject buildPartitionData (final String sequenceFileName ,
346+ final String fivePrimeVectorOverlap , final String threePrimeVectorOverlap ,
347+ String minLengthBB , String maxLengthBB , String minOverlapGC , String optOverlapGC ,
348+ String maxOverlapGC , String minOverlapLength , String optOverlapLength , String maxOverlapLength ){
349+
350+ JSONObject partationData = new JSONObject ();
351+ //JSONObject subPartationData = new JSONObject();
352+ partationData .put (JSONKeys .FIVE_PRIME_VECTOR_OVERLAP , fivePrimeVectorOverlap );
353+ partationData .put (JSONKeys .THREE_PRIME_VECTOR_OVERLAP , threePrimeVectorOverlap );
354+ partationData .put (JSONKeys .MAX_BB_LENGTH , maxLengthBB );
355+ partationData .put (JSONKeys .MIN_BB_LENGTH , minLengthBB );
356+ partationData .put (JSONKeys .MAX_OVERLAP_GC , maxOverlapGC );
357+ partationData .put (JSONKeys .BATCH , "" );
358+ partationData .put (JSONKeys .MIN_OVERLAP_GC , minOverlapGC );
359+ partationData .put (JSONKeys .MAX_OVERLAP_LENGTH , maxOverlapLength );
360+ partationData .put (JSONKeys .OPT_OVERLAP_GC , optOverlapGC );
361+ partationData .put (JSONKeys .OPT_OVERLAP_LENGTH , optOverlapLength );
362+ partationData .put (JSONKeys .MIN_OVERLAP_LENGTH , minOverlapLength );
363+
364+ JSONObject partationParameters = new JSONObject ();
365+ partationParameters .put (JSONKeys .PARTITIONING_INFORMATION , partationData );
366+
367+ return partationData ;
368+ }
369+
370+
213371 /**
214372 *
215373 * @param function
0 commit comments