From: Ben Soares Date: Mon, 6 Mar 2023 20:43:45 +0000 (+0000) Subject: JAL-629 Fix null AlignPanel. More descriptive label of pAE Matrix allows 'Add referen... X-Git-Tag: Release_2_11_4_0~459 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=8fce85002e6f6a5957dc95662c6a3d80fcce8e82;p=jalview.git JAL-629 Fix null AlignPanel. More descriptive label of pAE Matrix allows 'Add reference annotation' to be enabled for subsequent PDB+PAE files. --- diff --git a/src/jalview/datamodel/ContactMapHolder.java b/src/jalview/datamodel/ContactMapHolder.java index 5849374..a555a17 100644 --- a/src/jalview/datamodel/ContactMapHolder.java +++ b/src/jalview/datamodel/ContactMapHolder.java @@ -44,7 +44,7 @@ public class ContactMapHolder implements ContactMapHolderI aa.graphMin = cm.getMin(); aa.graphMax = cm.getMax(); aa.editable = false; - aa.calcId=cm.getType(); + aa.calcId = cm.getType(); contactmaps.put(aa.annotationId, cm); // TODO: contact matrices could be intra or inter - more than one refseq diff --git a/src/jalview/gui/StructureChooser.java b/src/jalview/gui/StructureChooser.java index 29551b8..3fce931 100644 --- a/src/jalview/gui/StructureChooser.java +++ b/src/jalview/gui/StructureChooser.java @@ -1276,7 +1276,7 @@ public class StructureChooser extends GStructureChooser selectedSequence = userSelectedSeq; String pdbFilename = selectedPdbFileName; - StructureChooser.openStructureFileForSequence(ssm, sc, null, + StructureChooser.openStructureFileForSequence(ssm, sc, ap, selectedSequence, true, pdbFilename, tft, paeFilename); } SwingUtilities.invokeLater(new Runnable() diff --git a/src/jalview/ws/datamodel/alphafold/PAEContactMatrix.java b/src/jalview/ws/datamodel/alphafold/PAEContactMatrix.java index 48071bd..d1a2e9d 100644 --- a/src/jalview/ws/datamodel/alphafold/PAEContactMatrix.java +++ b/src/jalview/ws/datamodel/alphafold/PAEContactMatrix.java @@ -38,12 +38,13 @@ public class PAEContactMatrix implements ContactMatrixI } length = _refSeq.getEnd() - _refSeq.getStart() + 1; } + @SuppressWarnings("unchecked") public PAEContactMatrix(SequenceI _refSeq, Map pae_obj) { setRefSeq(_refSeq); // convert the lists to primitive arrays and store - + if (!MapUtils.containsAKey(pae_obj, "predicted_aligned_error", "pae")) { parse_version_1_pAE(pae_obj); @@ -54,32 +55,35 @@ public class PAEContactMatrix implements ContactMatrixI parse_version_2_pAE(pae_obj); } } + /** * construct a sequence associated PAE matrix directly from a float array + * * @param _refSeq * @param matrix */ public PAEContactMatrix(SequenceI _refSeq, float[][] matrix) { setRefSeq(_refSeq); - maxcol=0; - for (float[] row:matrix) + maxcol = 0; + for (float[] row : matrix) { - if (row.length>maxcol) + if (row.length > maxcol) { - maxcol=row.length; + maxcol = row.length; } - maxscore=row[0]; - for (float f:row) + maxscore = row[0]; + for (float f : row) { - if (maxscore> scoreRows = ((List>) MapUtils - .getFirst(pae_obj, "predicted_aligned_error", "pae")) - ; + .getFirst(pae_obj, "predicted_aligned_error", "pae")); elements = new float[scoreRows.size()][scoreRows.size()]; int row = 0, col = 0; - for (List scoreRow:scoreRows) + for (List scoreRow : scoreRows) { Iterator scores = scoreRow.iterator(); while (scores.hasNext()) @@ -107,7 +110,7 @@ public class PAEContactMatrix implements ContactMatrixI if (d instanceof Double) elements[row][col++] = ((Double) d).longValue(); else - elements[row][col++] = (float) ((Long)d).longValue(); + elements[row][col++] = (float) ((Long) d).longValue(); } row++; col = 0; @@ -172,7 +175,7 @@ public class PAEContactMatrix implements ContactMatrixI @Override public int getContactHeight() { - return maxcol-1; + return maxcol - 1; } @Override @@ -220,20 +223,26 @@ public class PAEContactMatrix implements ContactMatrixI @Override public String getAnnotLabel() { - return "pAE Matrix"; + StringBuilder label = new StringBuilder("pAE Matrix"); + if (this.getReferenceSeq() != null) + label.append(":").append(this.getReferenceSeq().getDisplayId(false)); + return label.toString(); } - public static final String PAEMATRIX="PAE_MATRIX"; + public static final String PAEMATRIX = "PAE_MATRIX"; + @Override public String getType() { return PAEMATRIX; } + @Override public int getWidth() { return length; } + @Override public int getHeight() {