Skip to content

Commit 661af53

Browse files
committed
added partition method
1 parent b4a6fb2 commit 661af53

5 files changed

Lines changed: 155 additions & 0 deletions

File tree

src/main/java/gov/doe/jgi/boost/client/BOOSTClient.java

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,37 @@ public String dnaVarification(
238238
filenameSequences, vendor, sequencePatternsFilename));
239239
}
240240

241+
/**
242+
* The partition() method Partitioning of large DNA sequences into synthesizable
243+
* building blocks with partial overlaps for an efficient assembly.
244+
*
245+
* @throws BOOSTClientException
246+
* @throws BOOSTBackEndException
247+
*/
248+
249+
public String partition(
250+
String sequenceFileName,
251+
String fivePrimeVectorOverlap,
252+
String threePrimeVectorOverlap,
253+
String minLengthBB,
254+
String maxLengthBB,
255+
String minOverlapGC,
256+
String optOverlapGC,
257+
String maxOverlapGC,
258+
String minOverlapLength,
259+
String optOverlapLength,
260+
String maxOverlapLength)
261+
throws BOOSTClientException, BOOSTBackEndException {
262+
263+
// construct the request's JSON object
264+
JSONObject requestData = RequestBuilder.buildPartation(sequenceFileName, fivePrimeVectorOverlap,
265+
threePrimeVectorOverlap, minLengthBB, maxLengthBB, minOverlapGC, optOverlapGC, maxOverlapGC,
266+
minOverlapLength, optOverlapLength, maxOverlapLength);
267+
268+
return submitJob(requestData);
269+
}
270+
271+
241272
/**
242273
* The submitJob method submits a job to the BOOST back-end and returns
243274
* the UUID (as String) of the submitted job.

src/main/java/gov/doe/jgi/boost/client/RequestBuilder.java

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,97 @@ public static JSONObject buildPolish(
277277
return modifiedData;
278278
}
279279

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+
280371
/**
281372
*
282373
* @param function

src/main/java/gov/doe/jgi/boost/client/constants/BOOSTConstants.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,19 @@ public class BOOSTConstants {
1212
public static final String SEQUENCE_TYPE = "sequence_type";
1313
public static final String VENDOR = "vendor";
1414
public static final String STRATEGY = "strategy";
15+
16+
// partitioning-related keys
17+
public static final String PARTITIONING_INFORMATION = "partitioning-parameters";
18+
public static final String MIN_BB_LENGTH = "min-BB-length";
19+
public static final String MAX_BB_LENGTH = "max-BB-length";
20+
public static final String MIN_OVERLAP_GC = "min-overlap-GC";
21+
public static final String OPT_OVERLAP_GC = "opt-overlap-GC";
22+
public static final String MAX_OVERLAP_GC = "max-overlap-GC";
23+
public static final String MIN_OVERLAP_LENGTH = "min-overlap-length";
24+
public static final String OPT_OVERLAP_LENGTH = "opt-overlap-length";
25+
public static final String MAX_OVERLAP_LENGTH = "max-overlap-length";
26+
public static final String FIVE_PRIME_VECTOR_OVERLAP = "5-prime-vector-overlap";
27+
public static final String THREE_PRIME_VECTOR_OVERLAP = "3-prime-vector-overlap";
28+
public static final String BATCH = "batch";
1529

1630
}

src/main/java/gov/doe/jgi/boost/client/constants/JSONKeys.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ public class JSONKeys {
4949
public static final String MAX_OVERLAP_LENGTH = "max-overlap-length";
5050
public static final String FIVE_PRIME_VECTOR_OVERLAP = "5-prime-vector-overlap";
5151
public static final String THREE_PRIME_VECTOR_OVERLAP = "3-prime-vector-overlap";
52+
public static final String BATCH = "batch";
5253

5354
// output-related keys
5455
public static final String OUTPUT_INFORMATION = "output";

src/test/java/gov/doe/jgi/boost/client/DemoClient.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,24 @@ public static void main(String[] args)
8585
jobUUIDs.add(polishDNAJobUUID);
8686
}
8787

88+
// partitioning of DNA
89+
String partitiongDNAJobUUID = client.partition(
90+
"./data/dna.fasta", // input sequence
91+
"aaacccgggttt", // 5-prime-vector-overlap
92+
"tttgggcccaaa", // 3-prime-vector-overlap
93+
Integer.toString(15), // min-BB-length
94+
Integer.toString(3000), // max-BB-length
95+
Double.toString(4.0), // minimum overlap GC
96+
Double.toString(40.0), // optimum overlap GC
97+
Double.toString(62.0), // maximum overlap GC
98+
Integer.toString(5), // minimum overlap length
99+
Integer.toString(25), // optimum overlap length
100+
Integer.toString(30) // maximum overlap length
101+
);
102+
if (null != partitiongDNAJobUUID) {
103+
jobUUIDs.add(polishDNAJobUUID);
104+
}
105+
88106

89107
// for all jobs, we check their status
90108
for(String jobUUID : jobUUIDs) {

0 commit comments

Comments
 (0)