2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
3 * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
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 of the License, or (at your option) any later version.
11 * Jalview is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty
13 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 * PURPOSE. See the GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
18 package jalview.datamodel;
20 public class DBRefEntry
22 String source = "", version = "", accessionId = "";
25 * maps from associated sequence to the database sequence's coordinate system
34 public DBRefEntry(String source, String version, String accessionId)
36 this(source, version, accessionId, null);
42 * canonical source (uppercase only)
44 * (source dependent version string)
46 * (source dependent accession number string)
48 * (mapping from local sequence numbering to source accession
51 public DBRefEntry(String source, String version, String accessionId,
54 this.source = source.toUpperCase();
55 this.version = version;
56 this.accessionId = accessionId;
60 public DBRefEntry(DBRefEntry entry)
63 (entry.source == null ? "" : new String(entry.source)),
64 (entry.version == null ? "" : new String(entry.version)),
65 (entry.accessionId == null ? "" : new String(entry.accessionId)),
66 (entry.map == null ? null : new Mapping(entry.map)));
69 public boolean equals(DBRefEntry entry)
76 && ((map == null && entry.map == null) || (map != null
77 && entry.map != null && map.equals(entry.map))))
85 * test for similar DBRef attributes, except for the map object.
88 * @return true if source, accession and version are equal with those of entry
90 public boolean equalRef(DBRefEntry entry)
98 if ((source != null && entry.source != null && source
99 .equalsIgnoreCase(entry.source))
100 && (accessionId != null && entry.accessionId != null && accessionId
101 .equalsIgnoreCase(entry.accessionId))
102 && (version != null && entry.version != null && version
103 .equalsIgnoreCase(entry.version)))
110 public String getSource()
115 public String getVersion()
120 public String getAccessionId()
127 * the accessionId to set
129 public void setAccessionId(String accessionId)
131 this.accessionId = accessionId;
138 public void setSource(String source)
140 this.source = source;
147 public void setVersion(String version)
149 this.version = version;
155 public Mapping getMap()
164 public void setMap(Mapping map)
169 public boolean hasMap()
176 * @return source+":"+accessionId
178 public String getSrcAccString()
180 return ((source != null) ? source : "") + ":"
181 + ((accessionId != null) ? accessionId : "");