2 * Jalview - A Sequence Alignment Editor and Viewer
3 * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19 package jalview.datamodel;
21 public class DBRefEntry
23 String source="", version="", accessionId="";
25 * maps from associated sequence to the database sequence's coordinate system
31 public DBRefEntry(String source, String version, String accessionId)
33 this(source, version, accessionId, null);
37 * @param source canonical source (uppercase only)
38 * @param version (source dependent version string)
39 * @param accessionId (source dependent accession number string)
40 * @param map (mapping from local sequence numbering to source accession numbering)
42 public DBRefEntry(String source, String version, String accessionId, Mapping map) {
43 this.source = source.toUpperCase();
44 this.version = version;
45 this.accessionId = accessionId;
48 public DBRefEntry(DBRefEntry entry)
50 this(new String(entry.source), new String(entry.version), new String(entry.accessionId), new Mapping(entry.map));
52 public boolean equals(DBRefEntry entry) {
59 ((map==null && entry.map==null) || (map!=null && entry.map!=null && map.equals(entry.map)))) {
65 * test for similar DBRef attributes, except for the map object.
67 * @return true if source, accession and version are equal with those of entry
69 public boolean equalRef(DBRefEntry entry)
77 if ((source!=null && entry.source!=null && source.equalsIgnoreCase(entry.source))
79 (accessionId!=null && entry.accessionId!=null && accessionId.equalsIgnoreCase(entry.accessionId))
81 (version!=null && entry.version!=null && version.equalsIgnoreCase(entry.version))
88 public String getSource()
93 public String getVersion()
98 public String getAccessionId()
103 * @param accessionId the accessionId to set
105 public void setAccessionId(String accessionId) {
106 this.accessionId = accessionId;
109 * @param source the source to set
111 public void setSource(String source) {
112 this.source = source;
115 * @param version the version to set
117 public void setVersion(String version) {
118 this.version = version;
123 public Mapping getMap() {
127 * @param map the map to set
129 public void setMap(Mapping map) {
132 public boolean hasMap()
138 * @return source+":"+accessionId
140 public String getSrcAccString()
142 return ((source!=null) ? source : "")
143 + ":" + ((accessionId!=null) ? accessionId : "");