+ // Create a new, valid dataset sequence
+ SequenceI ds = seq;
+ ds.setSequence(AlignSeq.extractGaps(jalview.util.Comparison.GapChars, new String(sequence)));
+ setDatasetSequence(ds);
+ ds.setSequenceFeatures(getSequenceFeatures());
+ seq = this; // and return this sequence as the derived sequence.
+ }
+ }
+ return seq;
+ }
+
+ /* (non-Javadoc)
+ * @see jalview.datamodel.SequenceI#createDatasetSequence()
+ */
+ public SequenceI createDatasetSequence()
+ {
+ if (datasetSequence==null)
+ {
+ datasetSequence = new Sequence(getName(),
+ AlignSeq.extractGaps(
+ jalview.util.Comparison.GapChars,
+ getSequenceAsString()),
+ getStart(),
+ getEnd());
+ datasetSequence.setSequenceFeatures(getSequenceFeatures());
+ datasetSequence.setDescription(getDescription());
+ setSequenceFeatures(null);
+ // move database references onto dataset sequence
+ datasetSequence.setDBRef(getDBRef());
+ setDBRef(null);
+ }
+ return datasetSequence;
+ }
+ /* (non-Javadoc)
+ * @see jalview.datamodel.SequenceI#setAlignmentAnnotation(AlignmmentAnnotation[] annotations)
+ */
+ public void setAlignmentAnnotation(AlignmentAnnotation[] annotations)
+ {
+ if (annotation!=null) {
+ annotation.removeAllElements();
+ }
+ if (annotations!=null) {
+ for (int i=0; i<annotations.length; i++)
+ {
+ if (annotations[i]!=null)
+ addAlignmentAnnotation(annotations[i]);
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see jalview.datamodel.SequenceI#getAnnotation(java.lang.String)
+ */
+ public AlignmentAnnotation[] getAnnotation(String label)
+ {
+ if (annotation==null || annotation.size()==0)
+ {
+ return null;
+ }
+
+ Vector subset = new Vector();
+ Enumeration e = annotation.elements();
+ while (e.hasMoreElements())
+ {
+ AlignmentAnnotation ann = (AlignmentAnnotation) e.nextElement();
+ if (ann.label!=null && ann.label.equals(label))
+ {
+ subset.addElement(ann);