+ if (jaa.graph == AlignmentAnnotation.CONTACT_MAP)
+ {
+ if (annotation.getContactmatrix() != null
+ && annotation.getContactmatrix().size() > 0)
+ {
+ for (MatrixType xmlmat : annotation.getContactmatrix())
+ {
+ if (PAEContactMatrix.PAEMATRIX.equals(xmlmat.getType()))
+ {
+ if (!xmlmat.getRows().equals(xmlmat.getCols()))
+ {
+ Console.error("Can't handle non square PAE Matrices");
+ }
+ else
+ {
+ float[][] elements = ContactMatrix
+ .fromFloatStringToContacts(xmlmat.getElements(),
+ xmlmat.getCols().intValue(),
+ xmlmat.getRows().intValue());
+ jalview.util.MapList mapping = null;
+ if (xmlmat.getMapping() != null)
+ {
+ MapListType m = xmlmat.getMapping();
+ // Mapping m = dr.getMapping();
+ int fr[] = new int[m.getMapListFrom().size() * 2];
+ Iterator<MapListFrom> from = m.getMapListFrom()
+ .iterator();// enumerateMapListFrom();
+ for (int _i = 0; from.hasNext(); _i += 2)
+ {
+ MapListFrom mf = from.next();
+ fr[_i] = mf.getStart();
+ fr[_i + 1] = mf.getEnd();
+ }
+ int fto[] = new int[m.getMapListTo().size() * 2];
+ Iterator<MapListTo> to = m.getMapListTo().iterator();// enumerateMapListTo();
+ for (int _i = 0; to.hasNext(); _i += 2)
+ {
+ MapListTo mf = to.next();
+ fto[_i] = mf.getStart();
+ fto[_i + 1] = mf.getEnd();
+ }
+
+ mapping = new jalview.util.MapList(fr, fto,
+ m.getMapFromUnit().intValue(),
+ m.getMapToUnit().intValue());
+ }
+ List<BitSet> newgroups = new ArrayList<BitSet>();
+ if (xmlmat.getGroups().size() > 0)
+ {
+ for (String sgroup : xmlmat.getGroups())
+ {
+ newgroups.add(deStringifyBitset(sgroup));
+ }
+ }
+ String nwk = xmlmat.getNewick().size() > 0
+ ? xmlmat.getNewick().get(0)
+ : null;
+ if (xmlmat.getNewick().size() > 1)
+ {
+ Console.log.info(
+ "Ignoring additional clusterings for contact matrix");
+ }
+ String treeMethod = xmlmat.getTreeMethod();
+ double thresh = xmlmat.getCutHeight() != null
+ ? xmlmat.getCutHeight()
+ : 0;
+ GroupSet grpset = new GroupSet();
+ grpset.restoreGroups(newgroups, treeMethod, nwk, thresh);
+ PAEContactMatrix newpae = new PAEContactMatrix(
+ jaa.sequenceRef, mapping, elements, grpset);
+ jaa.sequenceRef.addContactListFor(jaa, newpae);
+ }
+ }
+ else
+ {
+ Console.error("Ignoring CONTACT_MAP annotation with type "
+ + xmlmat.getType());
+ }
+ }
+ }
+ }
+