X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fdatamodel%2FSequenceFeature.java;h=ca72942e48234b6ade1b7c31f492172c335b0909;hb=174230b4233d9ce80f94527768d2cd2f76da11ab;hp=f8444a09f8c07b4f64fdab05fce14b2c897f3d30;hpb=d9462b7299f6c5d7025369d55bba347aee04a81d;p=jalview.git diff --git a/src/jalview/datamodel/SequenceFeature.java b/src/jalview/datamodel/SequenceFeature.java index f8444a0..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,12 +28,13 @@ package jalview.datamodel; */ public class SequenceFeature { - public int position; public int begin; public int end; + public float score; public String type; public String description; - public String status; + 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 @@ -48,41 +51,41 @@ public class SequenceFeature { this.type = type; this.description = desc; - this.status = status; - this.position = begin; + setValue("status", status); this.begin = begin; this.end = end; this.featureGroup = featureGroup; } - public boolean equals(SequenceFeature sf) + public SequenceFeature(String type, + String desc, + int begin, int end, + float score, + String featureGroup) { - if(begin != sf.begin - || end != sf.end) - return false; + 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+status).equals - (sf.type+sf.description+sf.status)) + if(!(type+description+featureGroup).equals + (sf.type+sf.description+sf.featureGroup)) return false; return true; } - public int getPosition() - { - return position; - } - - public void setPosition(int pos) - { - position = pos; - begin = pos; - end = pos; - } - - /** * DOCUMENT ME! * @@ -143,30 +146,91 @@ public class SequenceFeature 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) + { + 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) { - return status; + 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) { - this.status = status; + setValue("status", status); } - public String getFeatureGroup() + public String getStatus() { - return featureGroup; + if (otherDetails != null) + return otherDetails.get("status").toString(); + else + return null; } - public void setFeatureGroup(String featureGroup) + public void setPosition(int pos) { - this.featureGroup = featureGroup; + begin = pos; + end = pos; } + public int getPosition() + { + return begin; + } }