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;
31 public class SequenceFeature
41 public String description;
43 public Hashtable otherDetails;
45 public java.util.Vector links;
47 // Feature group can be set from a features file
48 // as a group of features between STARTGROUP and ENDGROUP markers
49 public String featureGroup;
51 public SequenceFeature()
56 * Constructs a duplicate feature. Note: Uses clone on the otherDetails so
57 * only shallow copies are made of additional properties and method will
58 * silently fail if unclonable objects are found in the hash.
62 public SequenceFeature(SequenceFeature cpy)
71 type = new String(cpy.type);
73 if (cpy.description != null)
75 description = new String(cpy.description);
77 if (cpy.featureGroup != null)
79 featureGroup = new String(cpy.featureGroup);
81 if (cpy.otherDetails != null)
85 otherDetails = (Hashtable) cpy.otherDetails.clone();
88 // Uncloneable objects in the otherDetails - don't complain
91 if (cpy.links != null && cpy.links.size() > 0)
94 for (int i = 0, iSize = cpy.links.size(); i < iSize; i++)
96 links.addElement(cpy.links.elementAt(i));
102 public SequenceFeature(String type, String desc, String status,
103 int begin, int end, String featureGroup)
106 this.description = desc;
107 setValue("status", status);
110 this.featureGroup = featureGroup;
113 public SequenceFeature(String type, String desc, int begin, int end,
114 float score, String featureGroup)
117 this.description = desc;
121 this.featureGroup = featureGroup;
124 public boolean equals(SequenceFeature sf)
126 if (begin != sf.begin || end != sf.end || score != sf.score)
131 if (!(type + description + featureGroup).equals(sf.type
132 + sf.description + sf.featureGroup))
143 * @return DOCUMENT ME!
145 public int getBegin()
150 public void setBegin(int start)
158 * @return DOCUMENT ME!
165 public void setEnd(int end)
173 * @return DOCUMENT ME!
175 public String getType()
180 public void setType(String type)
188 * @return DOCUMENT ME!
190 public String getDescription()
195 public void setDescription(String desc)
200 public String getFeatureGroup()
205 public void setFeatureGroup(String featureGroup)
207 this.featureGroup = featureGroup;
210 public void addLink(String labelLink)
214 links = new java.util.Vector();
217 links.insertElementAt(labelLink, 0);
220 public float getScore()
225 public void setScore(float value)
231 * Used for getting values which are not in the basic set. eg STRAND, FRAME
237 public Object getValue(String key)
239 if (otherDetails == null)
245 return otherDetails.get(key);
250 * Used for setting values which are not in the basic set. eg STRAND, FRAME
258 public void setValue(String key, Object value)
262 if (otherDetails == null)
264 otherDetails = new Hashtable();
267 otherDetails.put(key, value);
272 * The following methods are added to maintain the castor Uniprot mapping file
275 public void setStatus(String status)
277 setValue("status", status);
280 public String getStatus()
282 if (otherDetails != null)
284 String stat = (String) otherDetails.get("status");
286 return new String(stat);
291 public void setPosition(int pos)
297 public int getPosition()