/*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
-*\r
-* This program is free software; you can redistribute it and/or\r
-* modify it under the terms of the GNU General Public License\r
-* as published by the Free Software Foundation; either version 2\r
-* of the License, or (at your option) any later version.\r
-*\r
-* This program is distributed in the hope that it will be useful,\r
-* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-* GNU General Public License for more details.\r
-*\r
-* You should have received a copy of the GNU General Public License\r
-* along with this program; if not, write to the Free Software\r
-* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
-*/\r
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
+ */\r
package jalview.datamodel;\r
\r
-public class SequenceFeature {\r
- int begin;\r
- int end;\r
- String type;\r
- String description;\r
- String status;\r
+import java.util.Hashtable;\r
\r
- public SequenceFeature() {\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class SequenceFeature\r
+{\r
+ public int begin;\r
+ public int end;\r
+ public float score;\r
+ public String type;\r
+ public String description;\r
+ Hashtable otherDetails;\r
+ public java.util.Vector links;\r
+\r
+ // Feature group can be set from a features file\r
+ // as a group of features between STARTGROUP and ENDGROUP markers\r
+ public String featureGroup;\r
+\r
+ public SequenceFeature()\r
+ {}\r
+\r
+ public SequenceFeature(String type,\r
+ String desc,\r
+ String status,\r
+ int begin, int end,\r
+ String featureGroup)\r
+ {\r
+ this.type = type;\r
+ this.description = desc;\r
+ setValue("status", status);\r
+ this.begin = begin;\r
+ this.end = end;\r
+ this.featureGroup = featureGroup;\r
+ }\r
+\r
+ public SequenceFeature(String type,\r
+ String desc,\r
+ int begin, int end,\r
+ float score,\r
+ String featureGroup)\r
+ {\r
+ this.type = type;\r
+ this.description = desc;\r
+ this.begin = begin;\r
+ this.end = end;\r
+ this.score = score;\r
+ this.featureGroup = featureGroup;\r
}\r
\r
- public SequenceFeature(String type, int start, int end, String description,\r
- String status) {\r
- this.type = type;\r
- this.begin = start;\r
- this.end = end;\r
- this.description = description;\r
- this.status = status;\r
+ public boolean equals(SequenceFeature sf)\r
+ {\r
+ if (begin != sf.begin\r
+ || end != sf.end\r
+ || score != sf.score)\r
+ return false;\r
+\r
+ if(!(type+description+featureGroup).equals\r
+ (sf.type+sf.description+sf.featureGroup))\r
+ return false;\r
+\r
+ return true;\r
}\r
\r
- public int getStart() {\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public int getBegin()\r
+ {\r
return begin;\r
}\r
\r
- public int getEnd() {\r
+ public void setBegin(int start)\r
+ {\r
+ this.begin = start;\r
+ }\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public int getEnd()\r
+ {\r
return end;\r
}\r
\r
- public String getType() {\r
+ public void setEnd(int end)\r
+ {\r
+ this.end = end;\r
+ }\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public String getType()\r
+ {\r
return type;\r
}\r
\r
- public String getDescription() {\r
+ public void setType(String type)\r
+ {\r
+ this.type = type;\r
+ }\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public String getDescription()\r
+ {\r
return description;\r
}\r
\r
- public String getStatus() {\r
- return status;\r
+ public void setDescription(String desc)\r
+ {\r
+ description = desc;\r
+ }\r
+\r
+ public String getFeatureGroup()\r
+ {\r
+ return featureGroup;\r
+ }\r
+\r
+ public void setFeatureGroup(String featureGroup)\r
+ {\r
+ this.featureGroup = featureGroup;\r
}\r
\r
+ public void addLink(String labelLink)\r
+ {\r
+ if(links==null)\r
+ links = new java.util.Vector();\r
+\r
+ links.insertElementAt(labelLink,0);\r
+ }\r
+\r
+ public float getScore()\r
+ {\r
+ return score;\r
+ }\r
+\r
+ public void setScore(float value)\r
+ {\r
+ score = value;\r
+ }\r
+\r
+ /**\r
+ * Used for getting values which are not in the\r
+ * basic set. eg STRAND, FRAME for GFF file\r
+ * @param key String\r
+ */\r
+ public Object getValue(String key)\r
+ {\r
+ if(otherDetails==null)\r
+ return null;\r
+ else\r
+ return otherDetails.get(key);\r
+ }\r
+\r
+ /**\r
+ * Used for setting values which are not in the\r
+ * basic set. eg STRAND, FRAME for GFF file\r
+ * @param key eg STRAND\r
+ * @param value eg +\r
+ */\r
+ public void setValue(String key, Object value)\r
+ {\r
+ if(value!=null)\r
+ {\r
+ if (otherDetails == null)\r
+ otherDetails = new Hashtable();\r
+\r
+ otherDetails.put(key, value);\r
+ }\r
+ }\r
+\r
+\r
/*\r
- <xs:enumeration value="active site" />\r
- <xs:enumeration value="binding site" />\r
- <xs:enumeration value="calcium-binding region" />\r
- <xs:enumeration value="chain" />\r
- <xs:enumeration value="cross-link" />\r
- <xs:enumeration value="disulfide bond" />\r
- <xs:enumeration value="DNA-binding region" />\r
- <xs:enumeration value="domain" />\r
- <xs:enumeration value="glycosylation site" />\r
- <xs:enumeration value="helix" />\r
- <xs:enumeration value="initiator methionine" />\r
- <xs:enumeration value="lipid moiety-binding region" />\r
- <xs:enumeration value="metal ion-binding site" />\r
- <xs:enumeration value="modified residue" />\r
- <xs:enumeration value="mutagenesis site" />\r
- <xs:enumeration value="non-consecutive residues" />\r
- <xs:enumeration value="non-terminal residue" />\r
- <xs:enumeration value="nucleotide phosphate-binding region" />\r
- <xs:enumeration value="peptide" />\r
- <xs:enumeration value="propeptide" />\r
- <xs:enumeration value="repeat" />\r
- <xs:enumeration value="selenocysteine" />\r
- <xs:enumeration value="sequence conflict" />\r
- <xs:enumeration value="sequence variant" />\r
- <xs:enumeration value="signal peptide" />\r
- <xs:enumeration value="similar" />\r
- <xs:enumeration value="site" />\r
- <xs:enumeration value="splice variant" />\r
- <xs:enumeration value="strand" />\r
- <xs:enumeration value="thioether bond" />\r
- <xs:enumeration value="thiolester bond" />\r
- <xs:enumeration value="transit peptide" />\r
- <xs:enumeration value="transmembrane region" />\r
- <xs:enumeration value="turn" />\r
- <xs:enumeration value="unsure residue" />\r
- <xs:enumeration value="zinc finger region" />\r
- */\r
+ * The following methods are added to maintain\r
+ * the castor Uniprot mapping file for the moment.\r
+ */\r
+ public void setStatus(String status)\r
+ {\r
+ setValue("status", status);\r
+ }\r
+\r
+ public String getStatus()\r
+ {\r
+ if (otherDetails != null)\r
+ return otherDetails.get("status").toString();\r
+ else\r
+ return null;\r
+ }\r
+\r
+ public void setPosition(int pos)\r
+ {\r
+ begin = pos;\r
+ end = pos;\r
+ }\r
+\r
+ public int getPosition()\r
+ {\r
+ return begin;\r
+ }\r
+\r
}\r