import java.util.Collection;
import java.util.Collections;
import java.util.Enumeration;
-import java.util.HashMap;
import java.util.HashSet;
import java.util.Hashtable;
import java.util.Iterator;
}
}
- Map<Object, ContactMatrixI> contactmaps = new HashMap<>();
+ ////
+ //// Contact Matrix Holder Boilerplate
+ ////
+ ContactMapHolder cmholder = new ContactMapHolder();
@Override
public Collection<ContactMatrixI> getContactMaps()
{
- if (contactmaps != null && contactmaps.size() > 0)
- {
- return contactmaps.values();
- }
- return Collections.EMPTY_LIST;
+ return cmholder.getContactMaps();
}
@Override
public ContactListI getContactListFor(AlignmentAnnotation _aa, int column)
{
- ContactMatrixI cm = contactmaps.get(_aa.annotationId);
- if (cm == null)
- {
- return null;
- }
- return cm.getContactList(column);
+ return cmholder.getContactListFor(_aa, column);
}
@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)
{
;
}
- 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());
- }
+ aa.annotations = _aa;
addAnnotation(aa);
return aa;
}
*/
package jalview.datamodel;
-import java.util.Collection;
import java.util.Hashtable;
import java.util.List;
import java.util.Map;
*/
public HiddenColumns propagateInsertions(SequenceI profileseq,
AlignmentView input);
-
- /**
- * resolve a contact list instance (if any) associated with the annotation row
- * and column position
- *
- * @param _aa
- * @param column
- * @return
- */
- ContactListI getContactListFor(AlignmentAnnotation _aa, int column);
-
- AlignmentAnnotation addContactList(ContactMatrixI cm);
-
- Collection<ContactMatrixI> getContactMaps();
}
*/
package jalview.datamodel;
-public interface AnnotatedCollectionI extends SequenceCollectionI
+public interface AnnotatedCollectionI
+ extends SequenceCollectionI, ContactMapHolderI
{
/**
--- /dev/null
+package jalview.datamodel;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+public class ContactMapHolder implements ContactMapHolderI
+{
+
+ Map<Object, ContactMatrixI> contactmaps = new HashMap<>();
+
+ @Override
+ public Collection<ContactMatrixI> getContactMaps()
+ {
+ if (contactmaps != null && contactmaps.size() > 0)
+ {
+ return contactmaps.values();
+ }
+ return Collections.EMPTY_LIST;
+ }
+
+ @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)
+ {
+ AlignmentAnnotation aa = new AlignmentAnnotation("Contact Matrix",
+ "Contact Matrix", new Annotation[0]);
+ 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());
+ }
+ return aa;
+ }
+}
--- /dev/null
+package jalview.datamodel;
+
+import java.util.Collection;
+
+public interface ContactMapHolderI
+{
+ /**
+ * resolve a contact list instance (if any) associated with the annotation row
+ * and column position
+ *
+ * @param _aa
+ * @param column
+ * @return
+ */
+ ContactListI getContactListFor(AlignmentAnnotation _aa, int column);
+
+ AlignmentAnnotation addContactList(ContactMatrixI cm);
+
+ Collection<ContactMatrixI> getContactMaps();
+
+}
*/
package jalview.datamodel;
-import jalview.analysis.AlignSeq;
-import jalview.datamodel.features.SequenceFeatures;
-import jalview.datamodel.features.SequenceFeaturesI;
-import jalview.util.Comparison;
-import jalview.util.DBRefUtils;
-import jalview.util.MapList;
-import jalview.util.StringUtils;
-
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.Iterator;
import java.util.Vector;
import fr.orsay.lri.varna.models.rna.RNA;
+import jalview.analysis.AlignSeq;
+import jalview.datamodel.features.SequenceFeatures;
+import jalview.datamodel.features.SequenceFeaturesI;
+import jalview.util.Comparison;
+import jalview.util.DBRefUtils;
+import jalview.util.MapList;
+import jalview.util.StringUtils;
/**
*
// otherwise, sequence was completely hidden
return 0;
}
+
+ ////
+ //// Contact Matrix Holder Boilerplate
+ ////
+ ContactMapHolder cmholder = new ContactMapHolder();
+
+ @Override
+ public Collection<ContactMatrixI> getContactMaps()
+ {
+ return cmholder.getContactMaps();
+ }
+
+ @Override
+ public ContactListI getContactListFor(AlignmentAnnotation _aa, int column)
+ {
+ return cmholder.getContactListFor(_aa, column);
+ }
+
+ @Override
+ public AlignmentAnnotation addContactList(ContactMatrixI cm)
+ {
+ AlignmentAnnotation aa = cmholder.addContactList(cm);
+
+ Annotation _aa[] = new Annotation[getLength()];
+ Annotation dummy = new Annotation(0.0f);
+ for (int i = 0; i < _aa.length; _aa[i++] = dummy)
+ {
+ ;
+ }
+ aa.annotations = _aa;
+ addAlignmentAnnotation(aa);
+ return aa;
+ }
+
}
*/
package jalview.datamodel;
-import jalview.analysis.AAFrequency;
-import jalview.analysis.Conservation;
-import jalview.renderer.ResidueShader;
-import jalview.renderer.ResidueShaderI;
-import jalview.schemes.ColourSchemeI;
-
import java.awt.Color;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collection;
import java.util.List;
import java.util.Map;
+import jalview.analysis.AAFrequency;
+import jalview.analysis.Conservation;
+import jalview.renderer.ResidueShader;
+import jalview.renderer.ResidueShaderI;
+import jalview.schemes.ColourSchemeI;
+
/**
* Collects a set contiguous ranges on a set of sequences
*
{
return (startRes <= apos && endRes >= apos) && sequences.contains(seq);
}
+
+ ////
+ //// Contact Matrix Holder Boilerplate
+ ////
+ ContactMapHolder cmholder = new ContactMapHolder();
+
+ @Override
+ public Collection<ContactMatrixI> getContactMaps()
+ {
+ return cmholder.getContactMaps();
+ }
+
+ @Override
+ public ContactListI getContactListFor(AlignmentAnnotation _aa, int column)
+ {
+ return cmholder.getContactListFor(_aa, column);
+ }
+
+ @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;
+ // TODO passing annotations back to context to be added
+ return aa;
+ }
}
*/
package jalview.datamodel;
-import jalview.datamodel.Sequence.DBModList;
-import jalview.datamodel.features.SequenceFeaturesI;
-import jalview.util.MapList;
-import jalview.ws.params.InvalidArgumentException;
-
import java.util.BitSet;
import java.util.Iterator;
import java.util.List;
import java.util.Vector;
import fr.orsay.lri.varna.models.rna.RNA;
+import jalview.datamodel.Sequence.DBModList;
+import jalview.datamodel.features.SequenceFeaturesI;
+import jalview.util.MapList;
+import jalview.ws.params.InvalidArgumentException;
/**
* Methods for manipulating a sequence, its metadata and related annotation in
* @author $author$
* @version $Revision$
*/
-public interface SequenceI extends ASequenceI
+public interface SequenceI extends ASequenceI, ContactMapHolderI
{
/**
* Set the display name for the sequence