+ @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)
+ {
+
+ SequenceFeature[] sfs = entry.getSequenceFeatures();
+ for (int si = 0; si < sfs.length; si++)
+ {
+ SequenceFeature sf[] = (mp != null) ? mp.locateFeature(sfs[si])
+ : new SequenceFeature[] { new SequenceFeature(sfs[si]) };
+ if (sf != null && sf.length > 0)
+ {
+ for (int sfi = 0; sfi < sf.length; sfi++)
+ {
+ addSequenceFeature(sf[sfi]);
+ }
+ }
+ }
+ }
+
+ // transfer PDB entries
+ if (entry.getAllPDBEntries() != null)
+ {
+ Enumeration e = entry.getAllPDBEntries().elements();
+ while (e.hasMoreElements())
+ {
+ PDBEntry pdb = (PDBEntry) e.nextElement();
+ addPDBId(pdb);
+ }
+ }
+ // transfer database references
+ DBRefEntry[] entryRefs = entry.getDBRefs();
+ if (entryRefs != null)
+ {
+ for (int r = 0; r < entryRefs.length; r++)
+ {
+ DBRefEntry newref = new DBRefEntry(entryRefs[r]);
+ if (newref.getMap() != null && mp != null)
+ {
+ // remap ref using our local mapping
+ }
+ // we also assume all version string setting is done by dbSourceProxy
+ /*
+ * if (!newref.getSource().equalsIgnoreCase(dbSource)) {
+ * newref.setSource(dbSource); }
+ */
+ addDBRef(newref);
+ }
+ }
+ }
+
+ /**
+ * @return The index (zero-based) on this sequence in the MSA. It returns
+ * {@code -1} if this information is not available.
+ */
+ @Override
+ public int getIndex()
+ {
+ return index;
+ }
+
+ /**
+ * Defines the position of this sequence in the MSA. Use the value {@code -1}
+ * if this information is undefined.
+ *
+ * @param The
+ * position for this sequence. This value is zero-based (zero for
+ * this first sequence)
+ */
+ @Override
+ public void setIndex(int value)
+ {
+ index = value;
+ }
+
+ @Override
+ public void setRNA(RNA r)
+ {
+ rna = r;
+ }
+
+ @Override
+ public RNA getRNA()
+ {
+ return rna;
+ }
+
+ @Override
+ public List<AlignmentAnnotation> getAlignmentAnnotations(String calcId,
+ String label)
+ {
+ List<AlignmentAnnotation> result = new ArrayList<AlignmentAnnotation>();
+ if (this.annotation != null)
+ {
+ for (AlignmentAnnotation ann : annotation)
+ {
+ if (ann.calcId != null && ann.calcId.equals(calcId)
+ && ann.label != null && ann.label.equals(label))
+ {
+ result.add(ann);
+ }
+ }
+ }
+ return result;
+ }
+
+ @Override
+ public String toString()
+ {
+ return getDisplayId(false);
+ }
+
+ @Override
+ public PDBEntry getPDBEntry(String pdbIdStr)
+ {
+ if (getDatasetSequence() != null)
+ {
+ return getDatasetSequence().getPDBEntry(pdbIdStr);
+ }
+ if (pdbIds == null)
+ {
+ return null;
+ }
+ List<PDBEntry> entries = getAllPDBEntries();
+ for (PDBEntry entry : entries)
+ {
+ if (entry.getId().equalsIgnoreCase(pdbIdStr))
+ {
+ return entry;
+ }
+ }
+ return null;
+ }