X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fdatamodel%2FAlignment.java;h=9825bff3e4d88df91faadbba669e0a1acc318a30;hb=fbfbbe26bee37143d5279fe4d254a5a89c96b021;hp=c4098e26594753f3caa175ca4ae6922e41e0856f;hpb=17e4ea278bc9a5fb280db1252ce78b7a295215f5;p=jalview.git diff --git a/src/jalview/datamodel/Alignment.java b/src/jalview/datamodel/Alignment.java index c4098e2..9825bff 100755 --- a/src/jalview/datamodel/Alignment.java +++ b/src/jalview/datamodel/Alignment.java @@ -32,6 +32,7 @@ import java.util.Arrays; import java.util.BitSet; import java.util.Collections; import java.util.Enumeration; +import java.util.HashMap; import java.util.HashSet; import java.util.Hashtable; import java.util.Iterator; @@ -195,7 +196,7 @@ public class Alignment implements AlignmentI, AutoCloseable { synchronized (sequences) { - + if (i > -1 && i < sequences.size()) { return sequences.get(i); @@ -716,7 +717,7 @@ public class Alignment implements AlignmentI, AutoCloseable public int getWidth() { int maxLength = -1; - + for (int i = 0; i < sequences.size(); i++) { maxLength = Math.max(maxLength, getSequenceAt(i).getLength()); @@ -1914,12 +1915,11 @@ public class Alignment implements AlignmentI, AutoCloseable @Override public boolean setHiddenColumns(HiddenColumns cols) { - boolean changed = cols == null ? hiddenCols != null - : !cols.equals(hiddenCols); - hiddenCols = cols; - return changed; + boolean changed = cols == null ? hiddenCols != null + : !cols.equals(hiddenCols); + hiddenCols = cols; + return changed; } - @Override public void setupJPredAlignment() { @@ -2032,4 +2032,42 @@ public class Alignment implements AlignmentI, AutoCloseable } } + Map contactmaps = new HashMap<>(); + @Override + public + ContactListI getContactListFor(AlignmentAnnotation _aa, int column) + { + ContactMatrixI cm = contactmaps.get(_aa.annotationId); + if (cm == null) + { + return null; + } + return cm.getContactList(column); + } + + @Override + public AlignmentAnnotation addContactList(ContactMatrixI cm) + { + Annotation _aa[] = new Annotation[getWidth()]; + Annotation dummy = new Annotation(0.0f); + for (int i = 0; i < _aa.length; _aa[i++] = dummy) + { + ; + } + AlignmentAnnotation aa = new AlignmentAnnotation("Contact Matrix", + "Contact Matrix", _aa); + aa.graph = AlignmentAnnotation.CUSTOMRENDERER; + aa.graphMin = cm.getMin(); + aa.graphMax = cm.getMax(); + aa.editable = false; + // aa.autoCalculated = true; + contactmaps.put(aa.annotationId, cm); + // TODO: contact matrices could be intra or inter - more than one refseq possible! + if (cm.hasReferenceSeq()) + { + aa.setSequenceRef(cm.getReferenceSeq()); + } + addAnnotation(aa); + return aa; + } }