1 package jalview.ws.datamodel.alphafold;
3 import java.util.Iterator;
7 import jalview.datamodel.ContactListI;
8 import jalview.datamodel.ContactListImpl;
9 import jalview.datamodel.ContactListProviderI;
10 import jalview.datamodel.ContactMatrixI;
11 import jalview.datamodel.SequenceI;
13 public class PAEContactMatrix implements ContactMatrixI
16 SequenceI refSeq = null;
18 int maxrow = 0, maxcol = 0;
20 int[] indices1, indices2;
26 @SuppressWarnings("unchecked")
27 public PAEContactMatrix(SequenceI _refSeq, Map<String, Object> pae_obj)
31 while (refSeq.getDatasetSequence() != null)
33 refSeq = refSeq.getDatasetSequence();
35 // convert the lists to primitive arrays and store
36 int length = _refSeq.getEnd() - _refSeq.getStart() + 1;
38 // assume indices are with respect to range defined by _refSeq on the
40 Iterator<Long> rows = ((List<Long>) pae_obj.get("residue1")).iterator();
41 Iterator<Long> cols = ((List<Long>) pae_obj.get("residue2")).iterator();
42 Iterator<Double> scores = ((List<Double>) pae_obj.get("distance"))
45 elements = new float[length][length];
46 while (scores.hasNext())
48 float escore = scores.next().floatValue();
49 int row = rows.next().intValue();
50 int col = cols.next().intValue();
59 elements[row - 1][col - 1] = escore;
62 maxscore = ((Double) pae_obj.get("max_predicted_aligned_error"))
67 public ContactListI getContactList(final int _column)
69 if (_column < 0 || _column >= elements.length)
74 return new ContactListImpl(new ContactListProviderI()
77 public int getContactHeight()
83 public double getContactAt(int column)
85 if (column < 0 || column >= elements[_column].length)
89 // TODO Auto-generated method stub
90 return elements[_column][column];
102 public float getMax()
108 public boolean hasReferenceSeq()
110 return (refSeq != null);
114 public SequenceI getReferenceSeq()