*/
package jalview.datamodel;
-import jalview.analysis.AAFrequency;
-import jalview.analysis.Conservation;
-import jalview.renderer.ResidueShader;
-import jalview.renderer.ResidueShaderI;
-import jalview.schemes.ColourSchemeI;
-import jalview.ws.params.InvalidArgumentException;
-
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
*
/**
* group members
*/
- private List<SequenceI> sequences = new ArrayList<>();
+ private List<SequenceI> sequences;
/**
* representative sequence for this group (if any)
private int startRes = 0;
/**
- * end column (base 0)
+ * end column (base 0)
*/
private int endRes = 0;
{
groupName = "JGroup:" + this.hashCode();
cs = new ResidueShader();
+ sequences = new ArrayList<>();
}
/**
displayBoxes = seqsel.displayBoxes;
displayText = seqsel.displayText;
colourText = seqsel.colourText;
-
+
startRes = seqsel.startRes;
endRes = seqsel.endRes;
cs = new ResidueShader((ResidueShader) seqsel.cs);
}
}
+ /**
+ * Constructor that copies the given list of sequences
+ *
+ * @param seqs
+ */
+ public SequenceGroup(List<SequenceI> seqs)
+ {
+ this();
+ this.sequences.addAll(seqs);
+ }
+
public boolean isShowSequenceLogo()
{
return showSequenceLogo;
for (int i = 0, ipos = 0; i < inorder.length; i++)
{
SequenceI seq = inorder[i];
- SequenceI seqipos = seqs[ipos] = seq.getSubSequence(startRes, endRes + 1);
+ SequenceI seqipos = seqs[ipos] = seq.getSubSequence(startRes,
+ endRes + 1);
if (seqipos != null)
{
- seqipos.setDescription(seq.getDescription());
- seqipos.getDBRefsFrom(seq);
- seqipos.setSequenceFeatures(seq.getSequenceFeatures());
- if (seq.getDatasetSequence() != null)
- {
- seqipos.setDatasetSequence(seq.getDatasetSequence());
- }
-
if (seq.getAnnotation() != null)
{
AlignmentAnnotation[] alann = align.getAlignmentAnnotation();
newannot.restrict(startRes, endRes);
newannot.setSequenceRef(seqs[ipos]);
newannot.adjustForAlignment();
+ ContactMatrixI cm = seq.getContactMatrixFor(seq.getAnnotation()[a]);
+ if (cm!=null)
+ {
+ seqs[ipos].addContactListFor(newannot, cm);
+ }
seqipos.addAlignmentAnnotation(newannot);
}
}
public void setStartRes(int newStart)
{
int before = startRes;
- startRes= Math.max(0,newStart); // sanity check for negative start column positions
- changeSupport.firePropertyChange(SEQ_GROUP_CHANGED, before, startRes);
-
-
+ startRes = Math.max(0, newStart); // sanity check for negative start column
+ // positions
+ changeSupport.firePropertyChange(SEQ_GROUP_CHANGED, before, startRes);
}
{
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 ContactMatrixI getContactMatrixFor(AlignmentAnnotation ann)
+ {
+ return cmholder.getContactMatrixFor(ann);
+ }
+
+ @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;
+ }
+
+ @Override
+ public void addContactListFor(AlignmentAnnotation annotation,
+ ContactMatrixI cm)
+ {
+ cmholder.addContactListFor(annotation, cm);
+ }
+
}