SequenceI refSeq = null;
+ /**
+ * the length that refSeq is expected to be (excluding gaps, of course)
+ */
+ int length;
+
int maxrow = 0, maxcol = 0;
int[] indices1, indices2;
refSeq = refSeq.getDatasetSequence();
}
// convert the lists to primitive arrays and store
- int length = _refSeq.getEnd() - _refSeq.getStart() + 1;
+ 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;
+ }
+ }
+ /**
+ * v1 format got ditched 28th July 2022 see
+ * https://alphafold.ebi.ac.uk/faq#:~:text=We%20updated%20the%20PAE%20JSON%20file%20format%20on%2028th%20July%202022
+ *
+ * @param pae_obj
+ */
+ private void parse_version_1_pAE(Map<String, Object> pae_obj)
+ {
// assume indices are with respect to range defined by _refSeq on the
// dataset refSeq
Iterator<Long> rows = ((List<Long>) pae_obj.get("residue1")).iterator();