+ length = _refSeq.getEnd() - _refSeq.getStart() + 1;
+
+ if (!pae_obj.containsKey("predicted_aligned_error"))
+ {
+ parse_version_1_pAE(pae_obj);
+ return;
+ }
+ else
+ {
+ parse_version_2_pAE(pae_obj);
+ }
+ }
+
+ /**
+ * parse a sane JSON representation of the pAE
+ *
+ * @param pae_obj
+ */
+ private void parse_version_2_pAE(Map<String, Object> pae_obj)
+ {
+ elements = new float[length][length];
+ // this is never going to be reached by the integer rounding.. or is it ?
+ maxscore = ((Double) pae_obj.get("max_predicted_aligned_error"))
+ .floatValue();
+ Iterator<List<Long>> scoreRows = ((List<List<Long>>) pae_obj
+ .get("predicted_aligned_error")).iterator();
+ int row = 0, col = 0;
+ while (scoreRows.hasNext())
+ {
+ Iterator<Long> scores = scoreRows.next().iterator();
+ while (scores.hasNext())
+ {
+ elements[row][col++] = scores.next();
+ }
+ row++;
+ col = 0;
+ }
+ }