import jalview.datamodel.ContactListProviderI;
import jalview.datamodel.ContactMatrixI;
import jalview.datamodel.SequenceI;
+import jalview.util.MapUtils;
public class PAEContactMatrix implements ContactMatrixI
{
@SuppressWarnings("unchecked")
public PAEContactMatrix(SequenceI _refSeq, Map<String, Object> pae_obj)
- throws Exception
{
refSeq = _refSeq;
while (refSeq.getDatasetSequence() != null)
// convert the lists to primitive arrays and store
length = _refSeq.getEnd() - _refSeq.getStart() + 1;
- if (!pae_obj.containsKey("predicted_aligned_error"))
+ if (!MapUtils.containsAKey(pae_obj, "predicted_aligned_error", "pae"))
{
parse_version_1_pAE(pae_obj);
return;
{
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();
+ maxscore = ((Double) MapUtils.getFirst(pae_obj,
+ "max_predicted_aligned_error", "max_pae")).floatValue();
+ Iterator<List<Long>> scoreRows = ((List<List<Long>>) MapUtils
+ .getFirst(pae_obj, "predicted_aligned_error", "pae"))
+ .iterator();
int row = 0, col = 0;
while (scoreRows.hasNext())
{
Iterator<Long> scores = scoreRows.next().iterator();
while (scores.hasNext())
{
- elements[row][col++] = scores.next();
+ Object d = scores.next();
+ if (d instanceof Double)
+ elements[row][col++] = ((Double) d).longValue();
+ else
+ elements[row][col++] = (float) d;
}
row++;
col = 0;
elements[row - 1][col - 1] = escore;
}
- maxscore = ((Double) pae_obj.get("max_predicted_aligned_error"))
- .floatValue();
+ maxscore = ((Double) MapUtils.getFirst(pae_obj,
+ "max_predicted_aligned_error", "max_pae")).floatValue();
}
@Override
return refSeq;
}
+ @Override
+ public String getAnnotDescr()
+ {
+ return "Predicted Alignment Error for " + refSeq.getName();
+ }
+
+ @Override
+ public String getAnnotLabel()
+ {
+ return "pAE Matrix";
+ }
}