JAL-3863 passing test to verify a uniprot accession with canonical flag set is transf...
[jalview.git] / src / jalview / api / DBRefEntryI.java
index 01b1d2c..ed6358e 100644 (file)
@@ -1,3 +1,23 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
+ * 
+ * This file is part of Jalview.
+ * 
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License 
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *  
+ * Jalview is distributed in the hope that it will be useful, but 
+ * WITHOUT ANY WARRANTY; without even the implied warranty 
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
+ * PURPOSE.  See the GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
 package jalview.api;
 
 import jalview.datamodel.Mapping;
@@ -48,31 +68,11 @@ public interface DBRefEntryI
   public void setVersion(String version);
 
   /**
+   * access a mapping, if present that can be used to map positions from the
+   * associated dataset sequence to the DBRef's sequence frame.
    * 
-   * @param startRes
-   *          index of start residue in the source DB
+   * @return null or a valid mapping.
    */
-  public void setStartRes(int startRes);
-
-  /**
-   * 
-   * @return index of start residue in the source DB
-   */
-  public int getStartRes();
-
-  /**
-   * 
-   * @param endRes
-   *          index of end residue in the source DB
-   */
-  public void setEndRes(int endRes);
-
-  /**
-   * 
-   * @return index of end residue in the source DB
-   */
-  public int getEndRes();
-
   public Mapping getMap();
 
   /**
@@ -90,4 +90,28 @@ public interface DBRefEntryI
    * @return
    */
   public boolean updateFrom(DBRefEntryI otherEntry);
+
+  /**
+   * Answers true if the ref looks like a primary (direct) database reference.
+   * <br>
+   * The only way a dbref's mappings can be fully verified is via the local
+   * sequence frame, so rather than use isPrimaryCandidate directly, please use
+   * SequenceI.getPrimaryDbRefs(). <br>
+   * Primary references indicate the local sequence data directly corresponds
+   * with the database record. All other references are secondary. Direct
+   * references indicate that part or all of the local sequence data can be
+   * mapped with another sequence, enabling annotation transfer.
+   * Cross-references indicate the local sequence data can be corresponded to
+   * some other linear coordinate system via a transformation. <br>
+   * This method is also sufficient to distinguish direct DBRefEntry mappings
+   * from other relationships - e.g. coding relationships (imply a 1:3/3:1
+   * mapping), but not transcript relationships, which imply a (possibly
+   * non-contiguous) 1:1 mapping.
+   *
+   * @return true if this reference provides a primary accession for the
+   *         associated sequence object
+   */
+  public boolean isPrimaryCandidate();
+
+  public boolean isCanonical();
 }