2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
3 * Copyright (C) 2008 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((entry.source==null ? "" : new String(entry.source)),
51 (entry.version==null ? "" : new String(entry.version)),
52 (entry.accessionId==null ? "" : new String(entry.accessionId)),
53 (entry.map==null ? null : new Mapping(entry.map)));
55 public boolean equals(DBRefEntry entry) {
62 ((map==null && entry.map==null) || (map!=null && entry.map!=null && map.equals(entry.map)))) {
68 * test for similar DBRef attributes, except for the map object.
70 * @return true if source, accession and version are equal with those of entry
72 public boolean equalRef(DBRefEntry entry)
80 if ((source!=null && entry.source!=null && source.equalsIgnoreCase(entry.source))
82 (accessionId!=null && entry.accessionId!=null && accessionId.equalsIgnoreCase(entry.accessionId))
84 (version!=null && entry.version!=null && version.equalsIgnoreCase(entry.version))
91 public String getSource()
96 public String getVersion()
101 public String getAccessionId()
106 * @param accessionId the accessionId to set
108 public void setAccessionId(String accessionId) {
109 this.accessionId = accessionId;
112 * @param source the source to set
114 public void setSource(String source) {
115 this.source = source;
118 * @param version the version to set
120 public void setVersion(String version) {
121 this.version = version;
126 public Mapping getMap() {
130 * @param map the map to set
132 public void setMap(Mapping map) {
135 public boolean hasMap()
141 * @return source+":"+accessionId
143 public String getSrcAccString()
145 return ((source!=null) ? source : "")
146 + ":" + ((accessionId!=null) ? accessionId : "");