+ @Override
+ public List<DBRefEntry> getPrimaryDBRefs()
+ {
+ if (datasetSequence != null)
+ {
+ return datasetSequence.getPrimaryDBRefs();
+ }
+ if (dbrefs == null || dbrefs.length == 0)
+ {
+ return Collections.emptyList();
+ }
+ synchronized (dbrefs)
+ {
+ List<DBRefEntry> primaries = new ArrayList<DBRefEntry>();
+ DBRefEntry[] tmp = new DBRefEntry[1];
+ for (DBRefEntry ref : dbrefs)
+ {
+ if (!ref.isPrimaryCandidate())
+ {
+ continue;
+ }
+ if (ref.hasMap())
+ {
+ MapList mp = ref.getMap().getMap();
+ if (mp.getFromLowest() > start || mp.getFromHighest() < end)
+ {
+ // map only involves a subsequence, so cannot be primary
+ continue;
+ }
+ }
+ // whilst it looks like it is a primary ref, we also sanity check type
+ if (DBRefUtils.getCanonicalName(DBRefSource.PDB).equals(
+ DBRefUtils.getCanonicalName(ref.getSource())))
+ {
+ // PDB dbrefs imply there should be a PDBEntry associated
+ // TODO: tighten PDB dbrefs
+ // formally imply Jalview has actually downloaded and
+ // parsed the pdb file. That means there should be a cached file
+ // handle on the PDBEntry, and a real mapping between sequence and
+ // extracted sequence from PDB file
+ PDBEntry pdbentry = getPDBEntry(ref.getAccessionId());
+ if (pdbentry != null && pdbentry.getFile() != null)
+ {
+ primaries.add(ref);
+ }
+ continue;
+ }
+ // check standard protein or dna sources
+ tmp[0] = ref;
+ DBRefEntry[] res = DBRefUtils.selectDbRefs(!isProtein(), tmp);
+ if (res != null && res[0] == tmp[0])
+ {
+ primaries.add(ref);
+ continue;
+ }
+ }
+ return primaries;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public List<SequenceFeature> findFeatures(int from, int to,
+ String... types)
+ {
+ if (datasetSequence != null)
+ {
+ return datasetSequence.findFeatures(from, to, types);
+ }
+ return sequenceFeatureStore.findFeatures(from, to, types);
+ }