2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.6)
3 * Copyright (C) 2010 J Procter, AM Waterhouse, 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;
28 public class SequenceFeature
38 public String description;
40 public Hashtable otherDetails;
42 public java.util.Vector links;
44 // Feature group can be set from a features file
45 // as a group of features between STARTGROUP and ENDGROUP markers
46 public String featureGroup;
48 public SequenceFeature()
53 * Constructs a duplicate feature. Note: Uses clone on the otherDetails so
54 * only shallow copies are made of additional properties and method will
55 * silently fail if unclonable objects are found in the hash.
59 public SequenceFeature(SequenceFeature cpy)
68 type = new String(cpy.type);
70 if (cpy.description != null)
72 description = new String(cpy.description);
74 if (cpy.featureGroup != null)
76 featureGroup = new String(cpy.featureGroup);
78 if (cpy.otherDetails != null)
82 otherDetails = (Hashtable) cpy.otherDetails.clone();
85 // Uncloneable objects in the otherDetails - don't complain
88 if (cpy.links != null && cpy.links.size() > 0)
91 for (int i = 0, iSize = cpy.links.size(); i < iSize; i++)
93 links.addElement(cpy.links.elementAt(i));
99 public SequenceFeature(String type, String desc, String status,
100 int begin, int end, String featureGroup)
103 this.description = desc;
104 setValue("status", status);
107 this.featureGroup = featureGroup;
110 public SequenceFeature(String type, String desc, int begin, int end,
111 float score, String featureGroup)
114 this.description = desc;
118 this.featureGroup = featureGroup;
121 public boolean equals(SequenceFeature sf)
123 if (begin != sf.begin || end != sf.end || score != sf.score)
128 if (!(type + description + featureGroup).equals(sf.type
129 + sf.description + sf.featureGroup))
140 * @return DOCUMENT ME!
142 public int getBegin()
147 public void setBegin(int start)
155 * @return DOCUMENT ME!
162 public void setEnd(int end)
170 * @return DOCUMENT ME!
172 public String getType()
177 public void setType(String type)
185 * @return DOCUMENT ME!
187 public String getDescription()
192 public void setDescription(String desc)
197 public String getFeatureGroup()
202 public void setFeatureGroup(String featureGroup)
204 this.featureGroup = featureGroup;
207 public void addLink(String labelLink)
211 links = new java.util.Vector();
214 links.insertElementAt(labelLink, 0);
217 public float getScore()
222 public void setScore(float value)
228 * Used for getting values which are not in the basic set. eg STRAND, FRAME
234 public Object getValue(String key)
236 if (otherDetails == null)
242 return otherDetails.get(key);
247 * Used for setting values which are not in the basic set. eg STRAND, FRAME
255 public void setValue(String key, Object value)
259 if (otherDetails == null)
261 otherDetails = new Hashtable();
264 otherDetails.put(key, value);
269 * The following methods are added to maintain the castor Uniprot mapping file
272 public void setStatus(String status)
274 setValue("status", status);
277 public String getStatus()
279 if (otherDetails != null)
281 String stat = (String) otherDetails.get("status");
283 return new String(stat);
288 public void setPosition(int pos)
294 public int getPosition()