X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fdatamodel%2FAlignment.java;fp=src%2Fjalview%2Fdatamodel%2FAlignment.java;h=7f97f335ca21ec40cfacb6574470f6064d85f58f;hb=b303b657375dee5ac79e2f52ef96803652a2fbd1;hp=a2a152ad79e7d0a2e8ce251bc0d5acc5a9671d6b;hpb=3659ecfe7bb17dd25a0a6b5c94a7d9dab4525136;p=jalview.git diff --git a/src/jalview/datamodel/Alignment.java b/src/jalview/datamodel/Alignment.java index a2a152a..7f97f33 100755 --- a/src/jalview/datamodel/Alignment.java +++ b/src/jalview/datamodel/Alignment.java @@ -20,16 +20,10 @@ */ package jalview.datamodel; -import jalview.analysis.AlignmentUtils; -import jalview.datamodel.AlignedCodonFrame.SequenceToSequenceMapping; -import jalview.io.FastaFile; -import jalview.util.Comparison; -import jalview.util.LinkedIdentityHashSet; -import jalview.util.MessageManager; - import java.util.ArrayList; import java.util.Arrays; import java.util.BitSet; +import java.util.Collection; import java.util.Collections; import java.util.Enumeration; import java.util.HashSet; @@ -40,6 +34,13 @@ import java.util.Map; import java.util.Set; import java.util.Vector; +import jalview.analysis.AlignmentUtils; +import jalview.datamodel.AlignedCodonFrame.SequenceToSequenceMapping; +import jalview.io.FastaFile; +import jalview.util.Comparison; +import jalview.util.LinkedIdentityHashSet; +import jalview.util.MessageManager; + /** * Data structure to hold and manipulate a multiple sequence alignment */ @@ -1652,8 +1653,10 @@ public class Alignment implements AlignmentI, AutoCloseable public Iterable findAnnotations(SequenceI seq, String calcId, String label) { - return AlignmentAnnotation.findAnnotations( - Arrays.asList(getAlignmentAnnotation()), seq, calcId, label); + return annotations == null ? null + : AlignmentAnnotation.findAnnotations( + Arrays.asList(getAlignmentAnnotation()), seq, calcId, + label); } @Override @@ -2032,4 +2035,68 @@ public class Alignment implements AlignmentI, AutoCloseable } } + //// + //// Contact Matrix Holder Boilerplate + //// + ContactMapHolder cmholder = new ContactMapHolder(); + + @Override + public Collection getContactMaps() + { + return cmholder.getContactMaps(); + } + + @Override + public ContactMatrixI getContactMatrixFor(AlignmentAnnotation ann) + { + return cmholder.getContactMatrixFor(ann); + } + + @Override + public ContactListI getContactListFor(AlignmentAnnotation _aa, int column) + { + ContactListI cl = cmholder.getContactListFor(_aa, column); + if (cl == null && _aa.groupRef != null) + { + cl = _aa.groupRef.getContactListFor(_aa, column); + } + if (cl == null && _aa.sequenceRef != null) + { + int spos = _aa.sequenceRef.findPosition(column); + if (spos >= _aa.sequenceRef.getStart() + && spos <= 1 + _aa.sequenceRef.getEnd()) + { + cl = _aa.sequenceRef.getContactListFor(_aa, spos); + if (cl == null && _aa.sequenceRef.getDatasetSequence() != null) + { + _aa.sequenceRef.getDatasetSequence().getContactListFor(_aa, spos); + } + } + } + return cl; + } + + @Override + public AlignmentAnnotation addContactList(ContactMatrixI cm) + { + AlignmentAnnotation aa = cmholder.addContactList(cm); + + Annotation _aa[] = new Annotation[getWidth()]; + Annotation dummy = new Annotation(0.0f); + for (int i = 0; i < _aa.length; _aa[i++] = dummy) + { + ; + } + aa.annotations = _aa; + addAnnotation(aa); + return aa; + } + + @Override + public void addContactListFor(AlignmentAnnotation annotation, + ContactMatrixI cm) + { + cmholder.addContactListFor(annotation, cm); + + } }