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.ContactRange;
12 import jalview.datamodel.SequenceI;
14 public class PAEContactMatrix implements ContactMatrixI
17 SequenceI refSeq=null;
18 int maxrow=0,maxcol=0;
19 int[] indices1,indices2;
23 @SuppressWarnings("unchecked")
24 public PAEContactMatrix(SequenceI _refSeq, Map<String, Object> pae_obj) throws Exception
27 while (refSeq.getDatasetSequence()!=null)
29 refSeq=refSeq.getDatasetSequence();
31 // convert the lists to primitive arrays and store
32 int length = _refSeq.getEnd()-_refSeq.getStart()+1;
34 // assume indices are with respect to range defined by _refSeq on the dataset refSeq
35 Iterator<Long> rows = ((List<Long>)pae_obj.get("residue1")).iterator();
36 Iterator<Long> cols = ((List<Long>)pae_obj.get("residue2")).iterator();
37 Iterator<Double> scores = ((List<Double>)pae_obj.get("distance")).iterator();
39 elements=new float[length][length];
40 while (scores.hasNext()) {
41 float escore=scores.next().floatValue();
42 int row=rows.next().intValue();
43 int col=cols.next().intValue();
52 elements[row-1][col-1]=escore;
55 maxscore = ((Double) pae_obj.get("max_predicted_aligned_error")).floatValue();
59 public ContactListI getContactList(final int _column)
62 return new ContactListImpl(new ContactListProviderI()
65 public int getContactHeight()
71 public double getContactAt(int column)
73 if (column<0 || column>=elements[_column].length)
77 // TODO Auto-generated method stub
78 return elements[_column][column];
96 public boolean hasReferenceSeq()
98 return (refSeq!=null);
102 public SequenceI getReferenceSeq()