- Document doc = Jsoup.parse(htmlData.toString());
- Element content = doc.getElementById("seqData");
-
- String alignmentJsonString = content.val();
-
- new JSONFile().parse(alignmentJsonString);
-
- // JSONParser jsonParser = new JSONParser();
- // JSONObject alignmentJsonObj = (JSONObject) jsonParser
- // .parse(alignmentJsonString);
- // JSONArray seqJsonArray = (JSONArray) alignmentJsonObj.get("seqs");
- // String bioJsColourScheme = (String) alignmentJsonObj
- // .get("globalColorScheme");
- // cs = getJalviewColorScheme(bioJsColourScheme);
- //
- // for (Iterator<JSONObject> sequenceIter = seqJsonArray.iterator();
- // sequenceIter
- // .hasNext();)
- // {
- // JSONObject sequence = sequenceIter.next();
- // String sequcenceString = sequence.get("seq").toString();
- // Sequence seq = new Sequence(sequence.get("name").toString(),
- // sequcenceString, Integer.valueOf(sequence.get("start")
- // .toString()), Integer.valueOf(sequence.get("end")
- // .toString()));
- //
- // JSONArray jsonSeqArray = (JSONArray) sequence.get("features");
- // SequenceFeature[] retrievedSeqFeatures = getJalviewSequenceFeatures(
- // jsonSeqArray, seq);
- // if (retrievedSeqFeatures != null)
- // {
- // seq.setSequenceFeatures(retrievedSeqFeatures);
- // }
- // seqs.add(seq);
- //
- // }
+ if (content == null)
+ {
+ errormessage = "The html document is not embedded with BioJSON data";
+ throw new IOException(errormessage);
+ }
+ JSONFile jsonFile = new JSONFile().parse(new StringReader(
+ contentFromDiv ? content.text() : content.val()));
+ this.seqs = jsonFile.getSeqs();
+ this.seqGroups = jsonFile.getSeqGroups();
+ this.annotations = jsonFile.getAnnotations();
+ this.showSeqFeatures = jsonFile.isShowSeqFeatures();
+ this.globalColourScheme = jsonFile.getGlobalColourScheme();
+ this.hiddenSequences = jsonFile.getHiddenSequences();
+ this.hiddenColumns = jsonFile.getHiddenColumns();
+ this.displayedFeatures = jsonFile.getDisplayedFeatures();