From cf3e8343ced61a995515cb96e2c638f26dc813b9 Mon Sep 17 00:00:00 2001 From: James Procter Date: Tue, 18 Jul 2023 16:17:12 +0100 Subject: [PATCH] JAL-3855 PAE matrices are transposed on import from JSON so returned contact vectors correspond to errors predicted when superposing at a given column position --- .../ws/datamodel/alphafold/PAEContactMatrix.java | 36 ++++++++++++++++---- 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/src/jalview/ws/datamodel/alphafold/PAEContactMatrix.java b/src/jalview/ws/datamodel/alphafold/PAEContactMatrix.java index c822ef4..22884f1 100644 --- a/src/jalview/ws/datamodel/alphafold/PAEContactMatrix.java +++ b/src/jalview/ws/datamodel/alphafold/PAEContactMatrix.java @@ -21,6 +21,21 @@ import jalview.util.MapList; import jalview.util.MapUtils; import jalview.ws.dbsources.EBIAlfaFold; +/** + * routines and class for holding predicted alignment error matrices as produced + * by alphafold et al. + * + * getContactList(column) returns the vector of predicted alignment errors for + * reference position given by column getElementAt(column, i) returns the + * predicted superposition error for the ith position when column is used as + * reference + * + * Many thanks to Ora Schueler Furman for noticing that earlier development + * versions did not show the PAE oriented correctly + * + * @author jprocter + * + */ public class PAEContactMatrix extends MappableContactMatrix implements ContactMatrixI { @@ -129,17 +144,18 @@ public class PAEContactMatrix extends Object d = scores.next(); if (d instanceof Double) { - elements[row][col++] = ((Double) d).longValue(); + elements[col][row] = ((Double) d).longValue(); } else { - elements[row][col++] = (float) ((Long) d).longValue(); + elements[col][row] = (float) ((Long) d).longValue(); } - if (maxscore < elements[row][col - 1]) + if (maxscore < elements[col][row]) { - maxscore = elements[row][col - 1]; + maxscore = elements[col][row]; } + col++; } row++; col = 0; @@ -180,7 +196,7 @@ public class PAEContactMatrix extends cols = ((List) pae_obj.get("residue2")).iterator(); Iterator scores = ((List) pae_obj.get("distance")) .iterator(); - elements = new float[maxrow][maxcol]; + elements = new float[maxcol][maxrow]; while (scores.hasNext()) { float escore = scores.next().floatValue(); @@ -194,13 +210,17 @@ public class PAEContactMatrix extends { maxcol = col; } - elements[row - 1][col - 1] = escore; + elements[col - 1][row-1] = escore; } maxscore = ((Double) MapUtils.getFirst(pae_obj, "max_predicted_aligned_error", "max_pae")).floatValue(); } + /** + * getContactList(column) @returns the vector of predicted alignment errors + * for reference position given by column + */ @Override public ContactListI getContactList(final int column) { @@ -235,6 +255,10 @@ public class PAEContactMatrix extends }); } + /** + * getElementAt(column, i) @returns the predicted superposition error for the + * ith position when column is used as reference + */ @Override protected double getElementAt(int _column, int i) { -- 1.7.10.2