X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fdatamodel%2FSequenceFeature.java;h=ca72942e48234b6ade1b7c31f492172c335b0909;hb=fbb18baad3919cbf94fcb5159bbd5269d6af18b4;hp=5bf4e885880b0285278dbb6a95bffaeef9ca0019;hpb=efc31b4a8d5cee63555586804a2b79c06bdb5a14;p=jalview.git
diff --git a/src/jalview/datamodel/SequenceFeature.java b/src/jalview/datamodel/SequenceFeature.java
index 5bf4e88..ca72942 100755
--- a/src/jalview/datamodel/SequenceFeature.java
+++ b/src/jalview/datamodel/SequenceFeature.java
@@ -1,6 +1,6 @@
/*
* Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
+ * Copyright (C) 2006 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -18,6 +18,8 @@
*/
package jalview.datamodel;
+import java.util.Hashtable;
+
/**
* DOCUMENT ME!
*
@@ -26,48 +28,79 @@ package jalview.datamodel;
*/
public class SequenceFeature
{
- int begin;
- int end;
- String type;
- String description;
- String status;
+ public int begin;
+ public int end;
+ public float score;
+ public String type;
+ public String description;
+ public Hashtable otherDetails;
+ public java.util.Vector links;
+
+ // Feature group can be set from a features file
+ // as a group of features between STARTGROUP and ENDGROUP markers
+ public String featureGroup;
- /**
- * Creates a new SequenceFeature object.
- */
public SequenceFeature()
+ {}
+
+ public SequenceFeature(String type,
+ String desc,
+ String status,
+ int begin, int end,
+ String featureGroup)
{
+ this.type = type;
+ this.description = desc;
+ setValue("status", status);
+ this.begin = begin;
+ this.end = end;
+ this.featureGroup = featureGroup;
}
- /**
- * Creates a new SequenceFeature object.
- *
- * @param type DOCUMENT ME!
- * @param start DOCUMENT ME!
- * @param end DOCUMENT ME!
- * @param description DOCUMENT ME!
- * @param status DOCUMENT ME!
- */
- public SequenceFeature(String type, int start, int end, String description,
- String status)
+ public SequenceFeature(String type,
+ String desc,
+ int begin, int end,
+ float score,
+ String featureGroup)
{
- this.type = type;
- this.begin = start;
- this.end = end;
- this.description = description;
- this.status = status;
+ this.type = type;
+ this.description = desc;
+ this.begin = begin;
+ this.end = end;
+ this.score = score;
+ this.featureGroup = featureGroup;
}
+ public boolean equals(SequenceFeature sf)
+ {
+ if (begin != sf.begin
+ || end != sf.end
+ || score != sf.score)
+ return false;
+
+ if(!(type+description+featureGroup).equals
+ (sf.type+sf.description+sf.featureGroup))
+ return false;
+
+ return true;
+ }
+
+
/**
* DOCUMENT ME!
*
* @return DOCUMENT ME!
*/
- public int getStart()
+ public int getBegin()
{
return begin;
}
+ public void setBegin(int start)
+ {
+ this.begin = start;
+ }
+
/**
* DOCUMENT ME!
*
@@ -78,6 +111,11 @@ public class SequenceFeature
return end;
}
+ public void setEnd(int end)
+ {
+ this.end = end;
+ }
+
/**
* DOCUMENT ME!
*
@@ -88,6 +126,11 @@ public class SequenceFeature
return type;
}
+ public void setType(String type)
+ {
+ this.type = type;
+ }
+
/**
* DOCUMENT ME!
*
@@ -98,52 +141,96 @@ public class SequenceFeature
return description;
}
+ public void setDescription(String desc)
+ {
+ description = desc;
+ }
+
+ public String getFeatureGroup()
+ {
+ return featureGroup;
+ }
+
+ public void setFeatureGroup(String featureGroup)
+ {
+ this.featureGroup = featureGroup;
+ }
+
+ public void addLink(String labelLink)
+ {
+ if(links==null)
+ links = new java.util.Vector();
+
+ links.insertElementAt(labelLink,0);
+ }
+
+ public float getScore()
+ {
+ return score;
+ }
+
+ public void setScore(float value)
+ {
+ score = value;
+ }
+
/**
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
+ * Used for getting values which are not in the
+ * basic set. eg STRAND, FRAME for GFF file
+ * @param key String
*/
- public String getStatus()
+ public Object getValue(String key)
{
- return status;
+ if(otherDetails==null)
+ return null;
+ else
+ return otherDetails.get(key);
}
+ /**
+ * Used for setting values which are not in the
+ * basic set. eg STRAND, FRAME for GFF file
+ * @param key eg STRAND
+ * @param value eg +
+ */
+ public void setValue(String key, Object value)
+ {
+ if(value!=null)
+ {
+ if (otherDetails == null)
+ otherDetails = new Hashtable();
+
+ otherDetails.put(key, value);
+ }
+ }
+
+
/*
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ * The following methods are added to maintain
+ * the castor Uniprot mapping file for the moment.
*/
+ public void setStatus(String status)
+ {
+ setValue("status", status);
+ }
+
+ public String getStatus()
+ {
+ if (otherDetails != null)
+ return otherDetails.get("status").toString();
+ else
+ return null;
+ }
+
+ public void setPosition(int pos)
+ {
+ begin = pos;
+ end = pos;
+ }
+
+ public int getPosition()
+ {
+ return begin;
+ }
+
}