+ 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[] 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;
+ }
+ }
+
+ @Override
+ public HiddenMarkovModel getHMM()
+ {
+ return hmm;
+ }
+
+ @Override
+ public void setHMM(HiddenMarkovModel hmm)
+ {
+ this.hmm = hmm;
+ }
+
+ @Override
+ public void updateHMMMapping()
+ {
+ int node = 1;
+ int column = 0;
+ hmm.emptyNodeLookup();
+ for (char residue : sequence)
+ {
+ if (!Comparison.isGap(residue))
+ {
+ hmm.setAlignmentColumn(node, column);
+ node++;
+ }
+ column++;
+ }
+
+ }
+
+ @Override
+ public boolean isHMMConsensusSequence()
+ {
+ return isHMMConsensusSequence;
+ }
+
+ @Override
+ public void setIsHMMConsensusSequence(boolean isHMMConsensusSequence)
+ {
+ this.isHMMConsensusSequence = isHMMConsensusSequence;
+ }
+
+ @Override
+ public boolean hasHMMAnnotation()
+ {
+ return hasInfo;
+ }
+
+ @Override
+ public void setHasInfo(boolean status)
+ {
+ hasInfo = true;
+ }
+
+ @Override
+ public int getPreviousPosition()