Skip to content

Commit 35cd53d

Browse files
author
eoberortner
committed
bug-fix in sending SBOLDocument to BOOST API
1 parent ab89328 commit 35cd53d

3 files changed

Lines changed: 29 additions & 20 deletions

File tree

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

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -464,16 +464,24 @@ public static JSONObject buildSequenceData(final SBOLDocument designSequences, S
464464
// sequence information
465465
JSONObject sequenceData = new JSONObject();
466466

467-
// reading from SBOL document
468-
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
469-
SBOLWriter.write(designSequences, outputStream);
470-
String designDoc = outputStream.toString("UTF-8");
471-
472-
// put its content into the JSON object
473-
if(designDoc != null && !designDoc.isEmpty()) {
474-
sequenceData.put(JSONKeys.TEXT, designSequences);
475-
}
467+
// write the SBOLDocument to a String
468+
try (
469+
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
470+
) {
476471

472+
SBOLWriter.write(designSequences, outputStream);
473+
String designDoc = outputStream.toString("UTF-8");
474+
475+
System.out.println(designDoc);
476+
477+
// put its content into the JSON object
478+
if(designDoc != null && !designDoc.isEmpty()) {
479+
sequenceData.put(JSONKeys.TEXT, designDoc);
480+
}
481+
482+
} catch(Exception e) {
483+
throw new BOOSTClientException(e.getMessage());
484+
}
477485

478486
// sequence type
479487
JSONArray types = new JSONArray();

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public class BOOSTResources {
99
// // BOOST prod
1010
// public static String BOOST_REST_URL = "https://boost.jgi.doe.gov/rest";
1111

12-
// BOOST dev
12+
// // BOOST dev
1313
public static String BOOST_REST_URL = "https://boost.jgi.doe.gov/Dev/rest";
1414

1515
// local

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

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public static void main(String[] args)
4141
System.out.println(jsonPredefinedHosts.toString(4));
4242
}catch(NullPointerException e) {
4343
System.out.println(e.getMessage() + " Error in jsonPredefinedHosts");
44+
System.exit(1);
4445
}
4546

4647
// set the target namespace
@@ -62,16 +63,16 @@ public static void main(String[] args)
6263
//
6364
//
6465
// codon juggle
65-
// String codonJuggleJobUUID = client.codonJuggle(
66-
// "./data/codon_juggle.sbol.xml", // input sequences
67-
// false, // exclusively 5'-3' coding sequences
68-
// Strategy.MostlyUsed, // codon selection strategy
69-
// "Saccharomyces cerevisiae", // predefined host
70-
// FileFormat.SBOL); // output format
71-
// if(null != codonJuggleJobUUID) {
72-
// jobUUIDs.add(codonJuggleJobUUID);
73-
// System.out.println("Data for codon Juggling :" + codonJuggleJobUUID );
74-
// }
66+
String codonJuggleJobUUID = client.codonJuggle(
67+
"./data/codon_juggle.sbol.xml", // input sequences
68+
false, // exclusively 5'-3' coding sequences
69+
Strategy.Balanced, // codon selection strategy
70+
"Saccharomyces cerevisiae", // predefined host
71+
FileFormat.SBOL); // output format
72+
if(null != codonJuggleJobUUID) {
73+
jobUUIDs.add(codonJuggleJobUUID);
74+
System.out.println("Data for codon Juggling :" + codonJuggleJobUUID );
75+
}
7576

7677
// // verify against DNA synthesis constraints and sequence patterns
7778
// String dnaVarificationJobUUID = client.dnaVarification(

0 commit comments

Comments
 (0)