2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
3 * Copyright (C) 2014 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)
79 && ((map == null && entry.map == null) || (map != null
80 && entry.map != null && map.equals(entry.map))))
88 * test for similar DBRef attributes, except for the map object.
91 * @return true if source, accession and version are equal with those of entry
93 public boolean equalRef(DBRefEntry entry)
101 if ((source != null && entry.source != null && source
102 .equalsIgnoreCase(entry.source))
103 && (accessionId != null && entry.accessionId != null && accessionId
104 .equalsIgnoreCase(entry.accessionId))
105 && (version != null && entry.version != null && version
106 .equalsIgnoreCase(entry.version)))
113 public String getSource()
118 public String getVersion()
123 public String getAccessionId()
130 * the accessionId to set
132 public void setAccessionId(String accessionId)
134 this.accessionId = accessionId;
141 public void setSource(String source)
143 this.source = source;
150 public void setVersion(String version)
152 this.version = version;
158 public Mapping getMap()
167 public void setMap(Mapping map)
172 public boolean hasMap()
179 * @return source+":"+accessionId
181 public String getSrcAccString()
183 return ((source != null) ? source : "") + ":"
184 + ((accessionId != null) ? accessionId : "");