+ @Override
+ 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);
+ }
+ }
+ if (subset.size() == 0)
+ {
+ return null;
+ }
+ AlignmentAnnotation[] anns = new AlignmentAnnotation[subset.size()];
+ int i = 0;
+ e = subset.elements();
+ while (e.hasMoreElements())
+ {
+ anns[i++] = (AlignmentAnnotation) e.nextElement();
+ }
+ subset.removeAllElements();
+ return anns;
+ }
+
+ @Override
+ public boolean updatePDBIds()
+ {
+ if (datasetSequence != null)
+ {
+ // TODO: could merge DBRefs
+ return datasetSequence.updatePDBIds();
+ }
+ if (dbrefs == null || dbrefs.length == 0)
+ {
+ return false;
+ }
+ Vector newpdb = new Vector();
+ for (int i = 0; i < dbrefs.length; i++)
+ {
+ if (DBRefSource.PDB.equals(dbrefs[i].getSource()))
+ {
+ PDBEntry pdbe = new PDBEntry();
+ pdbe.setId(dbrefs[i].getAccessionId());
+ if (pdbIds == null || pdbIds.size() == 0)
+ {
+ newpdb.addElement(pdbe);
+ }
+ else
+ {
+ Enumeration en = pdbIds.elements();
+ boolean matched = false;
+ while (!matched && en.hasMoreElements())
+ {
+ PDBEntry anentry = (PDBEntry) en.nextElement();
+ if (anentry.getId().equals(pdbe.getId()))
+ {
+ matched = true;
+ }
+ }
+ if (!matched)
+ {
+ newpdb.addElement(pdbe);
+ }
+ }
+ }
+ }
+ if (newpdb.size() > 0)
+ {
+ Enumeration en = newpdb.elements();
+ while (en.hasMoreElements())
+ {
+ addPDBId((PDBEntry) en.nextElement());
+ }
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public void transferAnnotation(SequenceI entry, Mapping mp)
+ {
+ if (datasetSequence != null)
+ {
+ datasetSequence.transferAnnotation(entry, mp);
+ return;
+ }
+ if (entry.getDatasetSequence() != null)
+ {
+ transferAnnotation(entry.getDatasetSequence(), mp);
+ return;
+ }
+ // transfer any new features from entry onto sequence
+ if (entry.getSequenceFeatures() != null)
+ {