1 package jalview.datamodel;
3 import java.util.Collection;
4 import java.util.Collections;
5 import java.util.HashMap;
8 public class ContactMapHolder implements ContactMapHolderI
11 Map<Object, ContactMatrixI> contactmaps = new HashMap<>();
14 public Collection<ContactMatrixI> getContactMaps()
16 if (contactmaps != null && contactmaps.size() > 0)
18 return contactmaps.values();
20 return Collections.EMPTY_LIST;
24 public ContactListI getContactListFor(AlignmentAnnotation _aa, int column)
26 ContactMatrixI cm = contactmaps.get(_aa.annotationId);
31 return cm.getContactList(column);
35 public AlignmentAnnotation addContactList(ContactMatrixI cm)
37 AlignmentAnnotation aa = new AlignmentAnnotation("Contact Matrix",
38 "Contact Matrix", new Annotation[0]);
39 aa.graph = AlignmentAnnotation.CUSTOMRENDERER;
40 aa.graphMin = cm.getMin();
41 aa.graphMax = cm.getMax();
43 // aa.autoCalculated = true;
44 contactmaps.put(aa.annotationId, cm);
45 // TODO: contact matrices could be intra or inter - more than one refseq
47 if (cm.hasReferenceSeq())
49 aa.setSequenceRef(cm.getReferenceSeq());
55 public ContactMatrixI getContactMatrixFor(AlignmentAnnotation ann)
57 return contactmaps == null ? null : contactmaps.get(ann.annotationId);
61 public void addContactListFor(AlignmentAnnotation annotation,
64 contactmaps.put(annotation.annotationId, cm);