View Javadoc

1   package uk.ac.ebi.intenz.tools.sib.sptr_enzyme;
2   
3   import uk.ac.ebi.interfaces.sptr.SPTRCrossReference;
4   
5   import java.io.Serializable;
6   import java.util.Hashtable;
7   
8   /** 
9    * This class implements the {@link uk.ac.ebi.interfaces.sptr.SPTRCrossReference SPTRCrossReference} interface.
10   *
11   * @author Michael Darsow
12   * @version preliminary - $Revision: 1.2 $ $Date: 2008/01/28 11:43:22 $
13   */
14  public class EnzymeCrossReference implements SPTRCrossReference, Serializable {
15  
16    /** Constant for database cross reference to SwissProt. */
17    public static final String SWISSPROT = "SwissProt";
18  
19    /** Constant for database cross reference to PROSITE. */
20    public static final String PROSITE = "PROSITE";
21  
22    /** Constant for database cross reference to MIM Disease Database. */
23    public static final String MIM = "MIM";
24  
25    private String accessionNumber;
26  
27    private String databaseName;
28  
29    private Hashtable properties;
30  
31    /**
32     * Creates an <code>EnzymeCrossReference</code> instance to the given database.
33     *
34     * Possible database name constants are:
35     * <ul>
36     *   <li>{@link uk.ac.ebi.intenz.tools.sib.sptr_enzyme.EnzymeCrossReference#SWISSPROT SwissProt}</li>
37     *   <li>{@link uk.ac.ebi.intenz.tools.sib.sptr_enzyme.EnzymeCrossReference#PROSITE PROSITE}</li>
38     *   <li>{@link uk.ac.ebi.intenz.tools.sib.sptr_enzyme.EnzymeCrossReference#MIM MIM Disease Database}</li>
39     * </ul>
40     *
41     * @param databaseName The name of database of this cross reference.
42     */
43    public EnzymeCrossReference(String databaseName) {
44      this.accessionNumber = "";
45      this.databaseName = databaseName;
46      properties = new Hashtable();
47    }
48  
49    /**
50     * <em class="text">
51     * Sets the accession number of this EnzymeCrossReference.
52     * </em>
53     * <br><br>
54     * <em class="text">
55     * Cross references are found in the DR/PR/DI lines on the marked positions, where
56     * the data base name is marked red (if existing) and the accession number green.
57     * DR lines are SwissProt, PR lines are PROSITE and DI lines are MIM cross references.
58     * DR lines contain between 1 and 3 cross references.
59     *
60     * <pre class="example">
61     * DR   <em class="green">O66503</em>; RIR1_AQUAE; <em class="green">P42491</em>, RIR1_ASFB7;  <em class="green">P26685</em>, RIR1_ASFM2;
62     * PR   <em class="red">PROSITE</em>; <em class="green">PDOC00084</em>;
63     * DI   Guanidinoacetate methyltransferase deficiency; <em class="red">MIM</em>:<em class="green">601240</em>.
64     * </pre>
65     * </em>
66     *
67     * @param accessionNumber The accession number.
68     */
69    public void setAccessionNumber(String accessionNumber) {
70      this.accessionNumber = accessionNumber;
71    }
72  
73    /**
74     * <em class="text">
75     * Returns the accession number of this EnzymeCrossReference.
76     * </em>
77     * <br><br>
78     * <em class="text">
79     * Cross references are found in the DR/PR/DI lines on the marked positions, where
80     * the data base name is marked red (if existing) and the accession number green.
81     * DR lines are SwissProt, PR lines are PROSITE and DI lines are MIM cross references.
82     * DR lines contain between 1 and 3 cross references.
83     *
84     * <pre class="example">
85     * DR   <em class="green">O66503</em>; RIR1_AQUAE; <em class="green">P42491</em>, RIR1_ASFB7;  <em class="green">P26685</em>, RIR1_ASFM2;
86     * PR   <em class="red">PROSITE</em>; <em class="green">PDOC00084</em>;
87     * DI   Guanidinoacetate methyltransferase deficiency; <em class="red">MIM</em>:<em class="green">601240</em>.
88     * </pre>
89     * </em>
90     *
91     * @return The accession number of this EnzymeCrossReference.
92     */
93    public String getAccessionNumber() {
94      return accessionNumber;
95    }
96  
97    /**
98     * <em class="text">
99     * Sets a property and value of this EnzymeCrossReference.
100    * </em>
101    *
102    * Properties of Enzyme cross references are always
103    * {@link uk.ac.ebi.intenz.tools.sib.sptr_enzyme.EnzymeCrossReference#PROPERTY_DESCRIPTION description}s.
104    *
105    * @param property The property.
106    * @param value The value of the property.
107    * @throws IllegalArgumentException if the <code>property</code> is not a valid property.
108    */
109   public void setPropertyValue(int property, String value)  {
110     if(property != EnzymeCrossReference.PROPERTY_DESCRIPTION) throw new IllegalArgumentException("The given property is not supported.");
111     properties.put(new Integer(property),  value);
112   }
113 
114   /**
115    * <em class="text">
116    * Indicates if a cross reference property is set.
117    * </em>
118    *
119    * @param property The property.
120    * @return true, if the property is set, false if it is not.
121    */
122   public boolean hasProperty(int property) {
123     return properties.get(new Integer(property)) != null;
124   }
125 
126   /**
127    * <em class="text">
128    * Returns the value of the property.
129    * </em>
130    *
131    * @param property The property.
132    * @return The value of the property.
133    */
134   public String getPropertyValue(int property) {
135     return (String) properties.get(new Integer(property));
136   }
137 
138   /**
139    * <em class="text">
140    * Returns the name of the database this EnzymeCrossReference refers to.
141    * </em>
142    *
143    * @return The name of the database this EnzymeCrossReference refers to.
144    */
145   public String getDatabaseName() {
146     return databaseName;
147   }
148 }