a4ec575636e96161d3428b17ef581737a44efde2
[jalview.git] / src / jalview / api / DBRefEntryI.java
1 package jalview.api;
2
3 import jalview.datamodel.Mapping;
4
5 //JBPComment: this is a datamodel API - so it should be in datamodel (it's a peer of SequenceI)
6
7 public interface DBRefEntryI
8 {
9   public boolean equalRef(DBRefEntryI entry);
10
11   /**
12    * 
13    * @return Source DB name for this entry
14    */
15   public String getSource();
16
17   /**
18    * 
19    * @return Accession Id for this entry
20    */
21   public String getAccessionId();
22
23   /**
24    * 
25    * @param accessionId
26    *          Accession Id for this entry
27    */
28   public void setAccessionId(String accessionId);
29
30   /**
31    * 
32    * @param source
33    *          Source DB name for this entry
34    */
35   public void setSource(String source);
36
37   /**
38    * 
39    * @return Source DB version for this entry
40    */
41   public String getVersion();
42
43   /**
44    * 
45    * @param version
46    *          Source DB version for this entry
47    */
48   public void setVersion(String version);
49
50   /**
51    * access a mapping, if present that can be used to map positions from the
52    * associated dataset sequence to the DBRef's sequence frame.
53    * 
54    * @return null or a valid mapping.
55    */
56   public Mapping getMap();
57
58   /**
59    * Answers true if this object is either equivalent to, or can be 'improved'
60    * by, the given entry. Specifically, answers true if
61    * <ul>
62    * <li>source and accession are identical</li>
63    * <li>version is identical, or this version is of the format "someSource:0",
64    * in which case the version for the other entry replaces it</li>
65    * <li>mappings are not compared but if this entry has no mapping, replace
66    * with that for the other entry</li>
67    * </ul>
68    * 
69    * @param otherEntry
70    * @return
71    */
72   public boolean updateFrom(DBRefEntryI otherEntry);
73
74   /**
75    * Method to distinguish between direct and indirect database references. <br>
76    * Primary references indicate the local sequence data directly corresponds
77    * with the database record. All other references are secondary. Direct
78    * references indicate that part or all of the local sequence data can be
79    * mapped with another sequence, enabling annotation transfer.
80    * Cross-references indicate the local sequence data can be corresponded to
81    * some other linear coordinate system via a transformation. <br>
82    * This method is also sufficient to distinguish direct DBRefEntry mappings
83    * from other relationships - e.g. coding relationships (imply a 1:3/3:1
84    * mapping), but not transcript relationships, which imply a (possibly
85    * non-contiguous) 1:1 mapping. <br>
86    * The only way a dbref's mappings can be fully verified is via the local
87    * sequence frame, so rather than use isPrimary directly, please use
88    * SequenceI.getPrimaryDbRefs().
89    *
90    * @return true if this reference provides a primary accession for the
91    *         associated sequence object
92    */
93   public boolean isPrimary();
94 }