import jalview.schemes.*;
/**
- * DOCUMENT ME!
- *
+ * Collects a set contiguous ranges on a set of sequences
* @author $author$
* @version $Revision$
*/
Vector aaFrequency;
boolean displayBoxes = true;
boolean displayText = true;
- boolean colourText = true;
+ boolean colourText = false;
private Vector sequences = new Vector();
int width = -1;
/**
* Creates a new SequenceGroup object.
*
- * @param sequences DOCUMENT ME!
- * @param groupName DOCUMENT ME!
- * @param scheme DOCUMENT ME!
- * @param displayBoxes DOCUMENT ME!
- * @param displayText DOCUMENT ME!
- * @param colourText DOCUMENT ME!
- * @param start DOCUMENT ME!
- * @param end DOCUMENT ME!
+ * @param sequences
+ * @param groupName
+ * @param scheme
+ * @param displayBoxes
+ * @param displayText
+ * @param colourText
+ * @param start first column of group
+ * @param end last column of group
*/
public SequenceGroup(Vector sequences, String groupName,
ColourSchemeI scheme, boolean displayBoxes,
int iSize = sequences.size();
SequenceI[] seqs = new SequenceI[iSize];
SequenceI[] inorder = getSequencesInOrder(align);
-
- for (int i = 0; i < iSize; i++)
+
+ for (int i = 0,ipos=0; i < inorder.length; i++)
{
SequenceI seq = inorder[i];
- seqs[i] = seq.getSubSequence(startRes, endRes+1);
-
- seqs[i].setDescription(seq.getDescription());
- seqs[i].setDBRef(seq.getDBRef());
- seqs[i].setSequenceFeatures(seq.getSequenceFeatures());
- if (seq.getDatasetSequence() != null)
+ seqs[ipos] = seq.getSubSequence(startRes, endRes+1);
+ if (seqs[ipos]!=null)
{
- seqs[i].setDatasetSequence(seq.getDatasetSequence());
- }
+ seqs[ipos].setDescription(seq.getDescription());
+ seqs[ipos].setDBRef(seq.getDBRef());
+ seqs[ipos].setSequenceFeatures(seq.getSequenceFeatures());
+ if (seq.getDatasetSequence() != null)
+ {
+ seqs[ipos].setDatasetSequence(seq.getDatasetSequence());
+ }
- if (seq.getAnnotation() != null)
- {
- for (int a = 0; a < seq.getAnnotation().length; a++)
+ if (seq.getAnnotation() != null)
{
- AlignmentAnnotation newannot = new AlignmentAnnotation(seq.getAnnotation()[a]);
- newannot.restrict(startRes, endRes);
- newannot.setSequenceRef(seqs[i]);
- newannot.adjustForAlignment();
- seqs[i].addAlignmentAnnotation(newannot);
+ AlignmentAnnotation[] alann = align.getAlignmentAnnotation();
+ // Only copy annotation that is either a score or referenced by the alignment's annotation vector
+ for (int a = 0; a < seq.getAnnotation().length; a++)
+ {
+ AlignmentAnnotation tocopy = seq.getAnnotation()[a];
+ if (alann!=null)
+ {
+ boolean found=false;
+ for (int pos=0;pos<alann.length; pos++)
+ {
+ if (alann[pos]==tocopy)
+ {
+ found=true;
+ break;
+ }
+ }
+ if (!found)
+ continue;
+ }
+ AlignmentAnnotation newannot = new AlignmentAnnotation(seq
+ .getAnnotation()[a]);
+ newannot.restrict(startRes, endRes);
+ newannot.setSequenceRef(seqs[ipos]);
+ newannot.adjustForAlignment();
+ seqs[ipos].addAlignmentAnnotation(newannot);
+ }
}
+ ipos++;
+ } else {
+ iSize--;
}
}
-
+ if (iSize!=inorder.length)
+ {
+ SequenceI[] nseqs = new SequenceI[iSize];
+ System.arraycopy(seqs, 0, nseqs, 0, iSize);
+ seqs = nseqs;
+ }
return seqs;
}
}
/**
- * DOCUMENT ME!
+ * Add s to this sequence group
*
- * @param s DOCUMENT ME!
- * @param recalc DOCUMENT ME!
+ * @param s alignment sequence to be added
+ * @param recalc true means Group's conservation should be recalculated
*/
public void addSequence(SequenceI s, boolean recalc)
{
}
/**
- * DOCUMENT ME!
+ * calculate residue conservation for group
*/
public void recalcConservation()
{