2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ The Jalview Authors
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
21 package jalview.datamodel;
23 import jalview.analysis.AlignSeq;
24 import jalview.api.DBRefEntryI;
25 import jalview.datamodel.features.SequenceFeatures;
26 import jalview.datamodel.features.SequenceFeaturesI;
27 import jalview.util.Comparison;
28 import jalview.util.DBRefUtils;
29 import jalview.util.MapList;
30 import jalview.util.StringUtils;
32 import java.util.ArrayList;
33 import java.util.Arrays;
34 import java.util.BitSet;
35 import java.util.Collections;
36 import java.util.Enumeration;
37 import java.util.List;
38 import java.util.Vector;
40 import com.stevesoft.pat.Regex;
42 import fr.orsay.lri.varna.models.rna.RNA;
46 * Implements the SequenceI interface for a char[] based sequence object.
51 public class Sequence extends ASequence implements SequenceI
53 private static final Regex limitrx = new Regex(
54 "[/][0-9]{1,}[-][0-9]{1,}$");
56 private static final Regex endrx = new Regex("[0-9]{1,}$");
58 SequenceI datasetSequence;
62 private char[] sequence;
70 Vector<PDBEntry> pdbIds;
79 * This annotation is displayed below the alignment but the positions are tied
80 * to the residues of this sequence
82 * TODO: change to List<>
84 Vector<AlignmentAnnotation> annotation;
87 * The index of the sequence in a MSA
91 private SequenceFeatures sequenceFeatureStore;
94 * Creates a new Sequence object.
99 * string to form a possibly gapped sequence out of
101 * first position of non-gap residue in the sequence
103 * last position of ungapped residues (nearly always only used for
106 public Sequence(String name, String sequence, int start, int end)
109 initSeqAndName(name, sequence.toCharArray(), start, end);
112 public Sequence(String name, char[] sequence, int start, int end)
115 initSeqAndName(name, sequence, start, end);
119 * Stage 1 constructor - assign name, sequence, and set start and end fields.
120 * start and end are updated values from name2 if it ends with /start-end
127 protected void initSeqAndName(String name2, char[] sequence2, int start2,
131 this.sequence = sequence2;
143 .println("POSSIBLE IMPLEMENTATION ERROR: null sequence name passed to constructor.");
146 // Does sequence have the /start-end signature?
147 if (limitrx.search(name))
149 name = limitrx.left();
150 endrx.search(limitrx.stringMatched());
151 setStart(Integer.parseInt(limitrx.stringMatched().substring(1,
152 endrx.matchedFrom() - 1)));
153 setEnd(Integer.parseInt(endrx.stringMatched()));
157 void checkValidRange()
160 // http://issues.jalview.org/browse/JAL-774?focusedCommentId=11239&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-11239
163 for (int j = 0; j < sequence.length; j++)
165 if (!jalview.util.Comparison.isGap(sequence[j]))
184 * default constructor
188 sequenceFeatureStore = new SequenceFeatures();
192 * Creates a new Sequence object.
199 public Sequence(String name, String sequence)
201 this(name, sequence, 1, -1);
205 * Creates a new Sequence object with new AlignmentAnnotations but inherits
206 * any existing dataset sequence reference. If non exists, everything is
210 * if seq is a dataset sequence, behaves like a plain old copy
213 public Sequence(SequenceI seq)
215 this(seq, seq.getAnnotation());
219 * Create a new sequence object with new features, DBRefEntries, and PDBIds
220 * but inherits any existing dataset sequence reference, and duplicate of any
221 * annotation that is present in the given annotation array.
224 * the sequence to be copied
225 * @param alAnnotation
226 * an array of annotation including some associated with seq
228 public Sequence(SequenceI seq, AlignmentAnnotation[] alAnnotation)
231 initSeqFrom(seq, alAnnotation);
235 * does the heavy lifting when cloning a dataset sequence, or coping data from
236 * dataset to a new derived sequence.
239 * - source of attributes.
240 * @param alAnnotation
241 * - alignment annotation present on seq that should be copied onto
244 protected void initSeqFrom(SequenceI seq,
245 AlignmentAnnotation[] alAnnotation)
247 char[] oseq = seq.getSequence();
248 initSeqAndName(seq.getName(), Arrays.copyOf(oseq, oseq.length),
249 seq.getStart(), seq.getEnd());
251 description = seq.getDescription();
252 if (seq != datasetSequence)
254 setDatasetSequence(seq.getDatasetSequence());
258 * only copy DBRefs and seqfeatures if we really are a dataset sequence
260 if (datasetSequence == null)
262 if (seq.getDBRefs() != null)
264 DBRefEntry[] dbr = seq.getDBRefs();
265 for (int i = 0; i < dbr.length; i++)
267 addDBRef(new DBRefEntry(dbr[i]));
272 * make copies of any sequence features
274 for (SequenceFeature sf : seq.getSequenceFeatures())
276 addSequenceFeature(new SequenceFeature(sf));
280 if (seq.getAnnotation() != null)
282 AlignmentAnnotation[] sqann = seq.getAnnotation();
283 for (int i = 0; i < sqann.length; i++)
285 if (sqann[i] == null)
289 boolean found = (alAnnotation == null);
292 for (int apos = 0; !found && apos < alAnnotation.length; apos++)
294 found = (alAnnotation[apos] == sqann[i]);
299 // only copy the given annotation
300 AlignmentAnnotation newann = new AlignmentAnnotation(sqann[i]);
301 addAlignmentAnnotation(newann);
305 if (seq.getAllPDBEntries() != null)
307 Vector<PDBEntry> ids = seq.getAllPDBEntries();
308 for (PDBEntry pdb : ids)
310 this.addPDBId(new PDBEntry(pdb));
316 public void setSequenceFeatures(List<SequenceFeature> features)
318 if (datasetSequence != null)
320 datasetSequence.setSequenceFeatures(features);
323 sequenceFeatureStore = new SequenceFeatures(features);
327 public synchronized boolean addSequenceFeature(SequenceFeature sf)
329 if (sf.getType() == null)
331 System.err.println("SequenceFeature type may not be null: "
336 if (datasetSequence != null)
338 return datasetSequence.addSequenceFeature(sf);
341 return sequenceFeatureStore.add(sf);
345 public void deleteFeature(SequenceFeature sf)
347 if (datasetSequence != null)
349 datasetSequence.deleteFeature(sf);
353 sequenceFeatureStore.delete(sf);
363 public List<SequenceFeature> getSequenceFeatures()
365 if (datasetSequence != null)
367 return datasetSequence.getSequenceFeatures();
369 return sequenceFeatureStore.getAllFeatures();
373 public SequenceFeaturesI getFeatures()
375 return datasetSequence != null ? datasetSequence.getFeatures()
376 : sequenceFeatureStore;
380 public boolean addPDBId(PDBEntry entry)
384 pdbIds = new Vector<PDBEntry>();
389 for (PDBEntry pdbe : pdbIds)
391 if (pdbe.updateFrom(entry))
396 pdbIds.addElement(entry);
407 public void setPDBId(Vector<PDBEntry> id)
415 * @return DOCUMENT ME!
418 public Vector<PDBEntry> getAllPDBEntries()
420 return pdbIds == null ? new Vector<PDBEntry>() : pdbIds;
426 * @return DOCUMENT ME!
429 public String getDisplayId(boolean jvsuffix)
431 StringBuffer result = new StringBuffer(name);
434 result.append("/" + start + "-" + end);
437 return result.toString();
447 public void setName(String name)
456 * @return DOCUMENT ME!
459 public String getName()
471 public void setStart(int start)
479 * @return DOCUMENT ME!
482 public int getStart()
494 public void setEnd(int end)
502 * @return DOCUMENT ME!
513 * @return DOCUMENT ME!
516 public int getLength()
518 return this.sequence.length;
528 public void setSequence(String seq)
530 this.sequence = seq.toCharArray();
535 public String getSequenceAsString()
537 return new String(sequence);
541 public String getSequenceAsString(int start, int end)
543 return new String(getSequence(start, end));
547 public char[] getSequence()
555 * @see jalview.datamodel.SequenceI#getSequence(int, int)
558 public char[] getSequence(int start, int end)
564 // JBPNote - left to user to pad the result here (TODO:Decide on this
566 if (start >= sequence.length)
571 if (end >= sequence.length)
573 end = sequence.length;
576 char[] reply = new char[end - start];
577 System.arraycopy(sequence, start, reply, 0, end - start);
583 public SequenceI getSubSequence(int start, int end)
589 char[] seq = getSequence(start, end);
594 int nstart = findPosition(start);
595 int nend = findPosition(end) - 1;
596 // JBPNote - this is an incomplete copy.
597 SequenceI nseq = new Sequence(this.getName(), seq, nstart, nend);
598 nseq.setDescription(description);
599 if (datasetSequence != null)
601 nseq.setDatasetSequence(datasetSequence);
605 nseq.setDatasetSequence(this);
611 * Returns the character of the aligned sequence at the given position (base
612 * zero), or space if the position is not within the sequence's bounds
617 public char getCharAt(int i)
619 if (i >= 0 && i < sequence.length)
636 public void setDescription(String desc)
638 this.description = desc;
644 * @return DOCUMENT ME!
647 public String getDescription()
649 return this.description;
655 * @see jalview.datamodel.SequenceI#findIndex(int)
658 public int findIndex(int pos)
660 // returns the alignment position for a residue
663 // Rely on end being at least as long as the length of the sequence.
664 while ((i < sequence.length) && (j <= end) && (j <= pos))
666 if (!Comparison.isGap(sequence[i]))
674 if ((j == end) && (j < pos))
685 public int findPosition(int i)
689 int seqlen = sequence.length;
690 while ((j < i) && (j < seqlen))
692 if (!Comparison.isGap(sequence[j]))
707 public Range findPositions(int fromCol, int toCol)
710 * count residues before fromCol
714 int seqlen = sequence.length;
715 while (j < fromCol && j < seqlen)
717 if (!Comparison.isGap(sequence[j]))
725 * find first and last residues between fromCol and toCol
730 boolean foundFirst = false;
732 while (j <= toCol && j < seqlen)
734 if (!Comparison.isGap(sequence[j]))
751 * no residues in this range
757 * adjust for sequence start coordinate
759 firstPos += start - 1;
760 lastPos += start - 1;
762 return new Range(firstPos, lastPos);
766 * Returns an int array where indices correspond to each residue in the
767 * sequence and the element value gives its position in the alignment
769 * @return int[SequenceI.getEnd()-SequenceI.getStart()+1] or null if no
770 * residues in SequenceI object
773 public int[] gapMap()
775 String seq = jalview.analysis.AlignSeq.extractGaps(
776 jalview.util.Comparison.GapChars, new String(sequence));
777 int[] map = new int[seq.length()];
781 while (j < sequence.length)
783 if (!jalview.util.Comparison.isGap(sequence[j]))
795 public int[] findPositionMap()
797 int map[] = new int[sequence.length];
800 int seqlen = sequence.length;
804 if (!jalview.util.Comparison.isGap(sequence[j]))
815 public List<int[]> getInsertions()
817 ArrayList<int[]> map = new ArrayList<int[]>();
818 int lastj = -1, j = 0;
820 int seqlen = sequence.length;
823 if (jalview.util.Comparison.isGap(sequence[j]))
834 map.add(new int[] { lastj, j - 1 });
842 map.add(new int[] { lastj, j - 1 });
849 public BitSet getInsertionsAsBits()
851 BitSet map = new BitSet();
852 int lastj = -1, j = 0;
854 int seqlen = sequence.length;
857 if (jalview.util.Comparison.isGap(sequence[j]))
883 public void deleteChars(int i, int j)
885 int newstart = start, newend = end;
886 if (i >= sequence.length || i < 0)
891 char[] tmp = StringUtils.deleteChars(sequence, i, j);
892 boolean createNewDs = false;
893 // TODO: take a (second look) at the dataset creation validation method for
894 // the very large sequence case
895 int eindex = -1, sindex = -1;
896 boolean ecalc = false, scalc = false;
897 for (int s = i; s < j; s++)
899 if (jalview.schemes.ResidueProperties.aaIndex[sequence[s]] != 23)
909 sindex = findIndex(start) - 1;
914 // delete characters including start of sequence
915 newstart = findPosition(j);
916 break; // don't need to search for any more residue characters.
920 // delete characters after start.
923 eindex = findIndex(end) - 1;
928 // delete characters at end of sequence
929 newend = findPosition(i - 1);
930 break; // don't need to search for any more residue characters.
935 newend--; // decrease end position by one for the deleted residue
936 // and search further
942 // deletion occured in the middle of the sequence
943 if (createNewDs && this.datasetSequence != null)
945 // construct a new sequence
946 Sequence ds = new Sequence(datasetSequence);
947 // TODO: remove any non-inheritable properties ?
948 // TODO: create a sequence mapping (since there is a relation here ?)
949 ds.deleteChars(i, j);
950 datasetSequence = ds;
958 public void insertCharAt(int i, int length, char c)
960 char[] tmp = new char[sequence.length + length];
962 if (i >= sequence.length)
964 System.arraycopy(sequence, 0, tmp, 0, sequence.length);
969 System.arraycopy(sequence, 0, tmp, 0, i);
979 if (i < sequence.length)
981 System.arraycopy(sequence, i, tmp, index, sequence.length - i);
988 public void insertCharAt(int i, char c)
990 insertCharAt(i, 1, c);
994 public String getVamsasId()
1000 public void setVamsasId(String id)
1006 public void setDBRefs(DBRefEntry[] dbref)
1008 if (dbrefs == null && datasetSequence != null
1009 && this != datasetSequence)
1011 datasetSequence.setDBRefs(dbref);
1017 DBRefUtils.ensurePrimaries(this);
1022 public DBRefEntry[] getDBRefs()
1024 if (dbrefs == null && datasetSequence != null
1025 && this != datasetSequence)
1027 return datasetSequence.getDBRefs();
1033 public void addDBRef(DBRefEntry entry)
1035 if (datasetSequence != null)
1037 datasetSequence.addDBRef(entry);
1043 dbrefs = new DBRefEntry[0];
1046 for (DBRefEntryI dbr : dbrefs)
1048 if (dbr.updateFrom(entry))
1051 * found a dbref that either matched, or could be
1052 * updated from, the new entry - no need to add it
1059 * extend the array to make room for one more
1061 // TODO use an ArrayList instead
1062 int j = dbrefs.length;
1063 DBRefEntry[] temp = new DBRefEntry[j + 1];
1064 System.arraycopy(dbrefs, 0, temp, 0, j);
1065 temp[temp.length - 1] = entry;
1069 DBRefUtils.ensurePrimaries(this);
1073 public void setDatasetSequence(SequenceI seq)
1077 throw new IllegalArgumentException(
1078 "Implementation Error: self reference passed to SequenceI.setDatasetSequence");
1080 if (seq != null && seq.getDatasetSequence() != null)
1082 throw new IllegalArgumentException(
1083 "Implementation error: cascading dataset sequences are not allowed.");
1085 datasetSequence = seq;
1089 public SequenceI getDatasetSequence()
1091 return datasetSequence;
1095 public AlignmentAnnotation[] getAnnotation()
1097 return annotation == null ? null : annotation
1098 .toArray(new AlignmentAnnotation[annotation.size()]);
1102 public boolean hasAnnotation(AlignmentAnnotation ann)
1104 return annotation == null ? false : annotation.contains(ann);
1108 public void addAlignmentAnnotation(AlignmentAnnotation annotation)
1110 if (this.annotation == null)
1112 this.annotation = new Vector<AlignmentAnnotation>();
1114 if (!this.annotation.contains(annotation))
1116 this.annotation.addElement(annotation);
1118 annotation.setSequenceRef(this);
1122 public void removeAlignmentAnnotation(AlignmentAnnotation annotation)
1124 if (this.annotation != null)
1126 this.annotation.removeElement(annotation);
1127 if (this.annotation.size() == 0)
1129 this.annotation = null;
1135 * test if this is a valid candidate for another sequence's dataset sequence.
1138 private boolean isValidDatasetSequence()
1140 if (datasetSequence != null)
1144 for (int i = 0; i < sequence.length; i++)
1146 if (jalview.util.Comparison.isGap(sequence[i]))
1155 public SequenceI deriveSequence()
1157 Sequence seq = null;
1158 if (datasetSequence == null)
1160 if (isValidDatasetSequence())
1162 // Use this as dataset sequence
1163 seq = new Sequence(getName(), "", 1, -1);
1164 seq.setDatasetSequence(this);
1165 seq.initSeqFrom(this, getAnnotation());
1170 // Create a new, valid dataset sequence
1171 createDatasetSequence();
1174 return new Sequence(this);
1177 private boolean _isNa;
1179 private long _seqhash = 0;
1182 * Answers false if the sequence is more than 85% nucleotide (ACGTU), else
1186 public boolean isProtein()
1188 if (datasetSequence != null)
1190 return datasetSequence.isProtein();
1192 if (_seqhash != sequence.hashCode())
1194 _seqhash = sequence.hashCode();
1195 _isNa = Comparison.isNucleotide(this);
1203 * @see jalview.datamodel.SequenceI#createDatasetSequence()
1206 public SequenceI createDatasetSequence()
1208 if (datasetSequence == null)
1210 Sequence dsseq = new Sequence(getName(), AlignSeq.extractGaps(
1211 jalview.util.Comparison.GapChars, getSequenceAsString()),
1212 getStart(), getEnd());
1214 datasetSequence = dsseq;
1216 dsseq.setDescription(description);
1217 // move features and database references onto dataset sequence
1218 dsseq.sequenceFeatureStore = sequenceFeatureStore;
1219 sequenceFeatureStore = null;
1220 dsseq.dbrefs = dbrefs;
1222 // TODO: search and replace any references to this sequence with
1223 // references to the dataset sequence in Mappings on dbref
1224 dsseq.pdbIds = pdbIds;
1226 datasetSequence.updatePDBIds();
1227 if (annotation != null)
1229 // annotation is cloned rather than moved, to preserve what's currently
1231 for (AlignmentAnnotation aa : annotation)
1233 AlignmentAnnotation _aa = new AlignmentAnnotation(aa);
1234 _aa.sequenceRef = datasetSequence;
1235 _aa.adjustForAlignment(); // uses annotation's own record of
1236 // sequence-column mapping
1237 datasetSequence.addAlignmentAnnotation(_aa);
1241 return datasetSequence;
1248 * jalview.datamodel.SequenceI#setAlignmentAnnotation(AlignmmentAnnotation[]
1252 public void setAlignmentAnnotation(AlignmentAnnotation[] annotations)
1254 if (annotation != null)
1256 annotation.removeAllElements();
1258 if (annotations != null)
1260 for (int i = 0; i < annotations.length; i++)
1262 if (annotations[i] != null)
1264 addAlignmentAnnotation(annotations[i]);
1271 public AlignmentAnnotation[] getAnnotation(String label)
1273 if (annotation == null || annotation.size() == 0)
1278 Vector<AlignmentAnnotation> subset = new Vector<AlignmentAnnotation>();
1279 Enumeration<AlignmentAnnotation> e = annotation.elements();
1280 while (e.hasMoreElements())
1282 AlignmentAnnotation ann = e.nextElement();
1283 if (ann.label != null && ann.label.equals(label))
1285 subset.addElement(ann);
1288 if (subset.size() == 0)
1292 AlignmentAnnotation[] anns = new AlignmentAnnotation[subset.size()];
1294 e = subset.elements();
1295 while (e.hasMoreElements())
1297 anns[i++] = e.nextElement();
1299 subset.removeAllElements();
1304 public boolean updatePDBIds()
1306 if (datasetSequence != null)
1308 // TODO: could merge DBRefs
1309 return datasetSequence.updatePDBIds();
1311 if (dbrefs == null || dbrefs.length == 0)
1315 boolean added = false;
1316 for (DBRefEntry dbr : dbrefs)
1318 if (DBRefSource.PDB.equals(dbr.getSource()))
1321 * 'Add' any PDB dbrefs as a PDBEntry - add is only performed if the
1322 * PDB id is not already present in a 'matching' PDBEntry
1323 * Constructor parses out a chain code if appended to the accession id
1324 * (a fudge used to 'store' the chain code in the DBRef)
1326 PDBEntry pdbe = new PDBEntry(dbr);
1327 added |= addPDBId(pdbe);
1334 public void transferAnnotation(SequenceI entry, Mapping mp)
1336 if (datasetSequence != null)
1338 datasetSequence.transferAnnotation(entry, mp);
1341 if (entry.getDatasetSequence() != null)
1343 transferAnnotation(entry.getDatasetSequence(), mp);
1346 // transfer any new features from entry onto sequence
1347 if (entry.getSequenceFeatures() != null)
1350 List<SequenceFeature> sfs = entry.getSequenceFeatures();
1351 for (SequenceFeature feature : sfs)
1353 SequenceFeature sf[] = (mp != null) ? mp.locateFeature(feature)
1354 : new SequenceFeature[] { new SequenceFeature(feature) };
1357 for (int sfi = 0; sfi < sf.length; sfi++)
1359 addSequenceFeature(sf[sfi]);
1365 // transfer PDB entries
1366 if (entry.getAllPDBEntries() != null)
1368 Enumeration<PDBEntry> e = entry.getAllPDBEntries().elements();
1369 while (e.hasMoreElements())
1371 PDBEntry pdb = e.nextElement();
1375 // transfer database references
1376 DBRefEntry[] entryRefs = entry.getDBRefs();
1377 if (entryRefs != null)
1379 for (int r = 0; r < entryRefs.length; r++)
1381 DBRefEntry newref = new DBRefEntry(entryRefs[r]);
1382 if (newref.getMap() != null && mp != null)
1384 // remap ref using our local mapping
1386 // we also assume all version string setting is done by dbSourceProxy
1388 * if (!newref.getSource().equalsIgnoreCase(dbSource)) {
1389 * newref.setSource(dbSource); }
1397 * @return The index (zero-based) on this sequence in the MSA. It returns
1398 * {@code -1} if this information is not available.
1401 public int getIndex()
1407 * Defines the position of this sequence in the MSA. Use the value {@code -1}
1408 * if this information is undefined.
1411 * position for this sequence. This value is zero-based (zero for
1412 * this first sequence)
1415 public void setIndex(int value)
1421 public void setRNA(RNA r)
1433 public List<AlignmentAnnotation> getAlignmentAnnotations(String calcId,
1436 List<AlignmentAnnotation> result = new ArrayList<AlignmentAnnotation>();
1437 if (this.annotation != null)
1439 for (AlignmentAnnotation ann : annotation)
1441 if (ann.calcId != null && ann.calcId.equals(calcId)
1442 && ann.label != null && ann.label.equals(label))
1452 public String toString()
1454 return getDisplayId(false);
1458 public PDBEntry getPDBEntry(String pdbIdStr)
1460 if (getDatasetSequence() != null)
1462 return getDatasetSequence().getPDBEntry(pdbIdStr);
1468 List<PDBEntry> entries = getAllPDBEntries();
1469 for (PDBEntry entry : entries)
1471 if (entry.getId().equalsIgnoreCase(pdbIdStr))
1480 public List<DBRefEntry> getPrimaryDBRefs()
1482 if (datasetSequence != null)
1484 return datasetSequence.getPrimaryDBRefs();
1486 if (dbrefs == null || dbrefs.length == 0)
1488 return Collections.emptyList();
1490 synchronized (dbrefs)
1492 List<DBRefEntry> primaries = new ArrayList<DBRefEntry>();
1493 DBRefEntry[] tmp = new DBRefEntry[1];
1494 for (DBRefEntry ref : dbrefs)
1496 if (!ref.isPrimaryCandidate())
1502 MapList mp = ref.getMap().getMap();
1503 if (mp.getFromLowest() > start || mp.getFromHighest() < end)
1505 // map only involves a subsequence, so cannot be primary
1509 // whilst it looks like it is a primary ref, we also sanity check type
1510 if (DBRefUtils.getCanonicalName(DBRefSource.PDB).equals(
1511 DBRefUtils.getCanonicalName(ref.getSource())))
1513 // PDB dbrefs imply there should be a PDBEntry associated
1514 // TODO: tighten PDB dbrefs
1515 // formally imply Jalview has actually downloaded and
1516 // parsed the pdb file. That means there should be a cached file
1517 // handle on the PDBEntry, and a real mapping between sequence and
1518 // extracted sequence from PDB file
1519 PDBEntry pdbentry = getPDBEntry(ref.getAccessionId());
1520 if (pdbentry != null && pdbentry.getFile() != null)
1526 // check standard protein or dna sources
1528 DBRefEntry[] res = DBRefUtils.selectDbRefs(!isProtein(), tmp);
1529 if (res != null && res[0] == tmp[0])
1543 public List<SequenceFeature> findFeatures(int from, int to,
1546 if (datasetSequence != null)
1548 return datasetSequence.findFeatures(from, to, types);
1550 return sequenceFeatureStore.findFeatures(from, to, types);