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 public class DBRefEntry
25 String source = "", version = "", accessionId = "";
28 * maps from associated sequence to the database sequence's coordinate system
37 public DBRefEntry(String source, String version, String accessionId)
39 this(source, version, accessionId, null);
45 * canonical source (uppercase only)
47 * (source dependent version string)
49 * (source dependent accession number string)
51 * (mapping from local sequence numbering to source accession
54 public DBRefEntry(String source, String version, String accessionId,
57 this.source = source.toUpperCase();
58 this.version = version;
59 this.accessionId = accessionId;
63 public DBRefEntry(DBRefEntry entry)
66 (entry.source == null ? "" : new String(entry.source)),
67 (entry.version == null ? "" : new String(entry.version)),
68 (entry.accessionId == null ? "" : new String(entry.accessionId)),
69 (entry.map == null ? null : new Mapping(entry.map)));
72 public boolean equals(DBRefEntry entry)
83 && ((map == null && entry.map == null) || (map != null
84 && entry.map != null && map.equals(entry.map))))
92 * test for similar DBRef attributes, except for the map object.
95 * @return true if source, accession and version are equal with those of entry
97 public boolean equalRef(DBRefEntry entry)
107 if ((source != null && entry.source != null && source
108 .equalsIgnoreCase(entry.source))
109 && (accessionId != null && entry.accessionId != null && accessionId
110 .equalsIgnoreCase(entry.accessionId))
111 && (version != null && entry.version != null && version
112 .equalsIgnoreCase(entry.version)))
119 public String getSource()
124 public String getVersion()
129 public String getAccessionId()
136 * the accessionId to set
138 public void setAccessionId(String accessionId)
140 this.accessionId = accessionId;
147 public void setSource(String source)
149 this.source = source;
156 public void setVersion(String version)
158 this.version = version;
164 public Mapping getMap()
173 public void setMap(Mapping map)
178 public boolean hasMap()
185 * @return source+":"+accessionId
187 public String getSrcAccString()
189 return ((source != null) ? source : "") + ":"
190 + ((accessionId != null) ? accessionId : "");
193 public String toString()
195 return getSrcAccString();