X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fdatamodel%2FContactMapHolder.java;h=45c0d18773e044d9705a8eec53174c71c977a03d;hb=eb3e681d6e82ccdd5d312d1981dfb306e7f479f0;hp=584937424e2b5f183049e5410d0151067a099ed5;hpb=335e6b12c126bcb6825cd3f66422677db7cd91c7;p=jalview.git diff --git a/src/jalview/datamodel/ContactMapHolder.java b/src/jalview/datamodel/ContactMapHolder.java index 5849374..45c0d18 100644 --- a/src/jalview/datamodel/ContactMapHolder.java +++ b/src/jalview/datamodel/ContactMapHolder.java @@ -3,8 +3,11 @@ package jalview.datamodel; import java.util.Collection; import java.util.Collections; import java.util.HashMap; +import java.util.HashSet; import java.util.Map; +import jalview.ws.datamodel.MappableContactMatrixI; + public class ContactMapHolder implements ContactMapHolderI { @@ -15,7 +18,9 @@ public class ContactMapHolder implements ContactMapHolderI { if (contactmaps != null && contactmaps.size() > 0) { - return contactmaps.values(); + // defensive copy, and return non redundant set of ContactMatrixI + // instances + return new HashSet(contactmaps.values()); } return Collections.EMPTY_LIST; } @@ -28,6 +33,14 @@ public class ContactMapHolder implements ContactMapHolderI { return null; } + if (cm instanceof MappableContactMatrixI) + { + if (_aa.sequenceRef != null) + { + return ((MappableContactMatrixI) cm) + .getMappableContactList(_aa.sequenceRef, column); + } + } // TODO: could resolve sequence position to column position here // TODO: what about for complexes - where contactMatrix may involve two or // more sequences @@ -44,14 +57,14 @@ 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 // possible! - if (cm.hasReferenceSeq()) + if (cm instanceof MappableContactMatrixI) { - aa.setSequenceRef(cm.getReferenceSeq()); + aa.setSequenceRef(((MappableContactMatrixI) cm).getReferenceSeq()); } return aa; } @@ -72,8 +85,15 @@ public class ContactMapHolder implements ContactMapHolderI annotation.editable = false; annotation.graph = AlignmentAnnotation.CONTACT_MAP; annotation.calcId = cm.getType(); - annotation.label = cm.getAnnotLabel(); - annotation.description = cm.getAnnotDescr(); + if (annotation.label == null || "".equals(annotation.label)) + { + annotation.label = cm.getAnnotLabel(); + + } + if (annotation.description == null || "".equals(annotation.description)) + { + annotation.description = cm.getAnnotDescr(); + } contactmaps.put(annotation.annotationId, cm); } }