001 package org.jaga.individualRepresentation.proteinLocation;
002
003
004 /**
005 * TODO: Complete these comments.
006 *
007 * <p><u>Project:</u> JAGA - Java API for Genetic Algorithms.</p>
008 *
009 * <p><u>Company:</u> University College London and JAGA.Org
010 * (<a href="http://www.jaga.org" target="_blank">http://www.jaga.org</a>).
011 * </p>
012 *
013 * <p><u>Copyright:</u> (c) 2004 by G. Paperin.<br/>
014 * This program is free software; you can redistribute it and/or modify
015 * it under the terms of the GNU General Public License as published by
016 * the Free Software Foundation, ONLY if you include a note of the original
017 * author(s) in any redistributed/modified copy.<br/>
018 * This program is distributed in the hope that it will be useful,
019 * but WITHOUT ANY WARRANTY; without even the implied warranty of
020 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
021 * GNU General Public License for more details.<br/>
022 * You should have received a copy of the GNU General Public License
023 * along with this program; if not, write to the Free Software
024 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
025 * or see http://www.gnu.org/licenses/gpl.html</p>
026 *
027 * @author Greg Paperin (greg@jaga.org)
028 *
029 * @version JAGA public release 1.0 beta
030 */
031
032 public class AminoAcidProperty extends PolypeptidePatternItem {
033
034 public static final int Small = 1;
035 public static final int Hydrophobic = 2;
036 public static final int Polar = 4;
037 public static final int Positive = 8;
038 public static final int Negative = 16;
039 public static final int Tiny = 32;
040 public static final int Aliphatic = 64;
041 public static final int Aromatic = 128;
042
043 private int property = 0;
044 private String name = null;
045
046 private AminoAcidProperty() {
047 throw new UnsupportedOperationException("Use AminoAcidProperty(short property) instead.");
048 }
049
050 /*package*/ AminoAcidProperty(int property) {
051 super();
052 switch(property) {
053 case Small:
054 this.property = Small;
055 this.name = "Small";
056 break;
057 case Hydrophobic:
058 this.property = Hydrophobic;
059 this.name = "Hydrophobic";
060 break;
061 case Polar:
062 this.property = Polar;
063 this.name = "Polar";
064 break;
065 case Positive:
066 this.property = Positive;
067 this.name = "Positive";
068 break;
069 case Negative:
070 this.property = Negative;
071 this.name = "Negative";
072 break;
073 case Tiny:
074 this.property = Tiny;
075 this.name = "Tiny";
076 break;
077 case Aliphatic:
078 this.property = Aliphatic;
079 this.name = "Aliphatic";
080 break;
081 case Aromatic:
082 this.property = Aromatic;
083 this.name = "Aromatic";
084 break;
085 default:
086 throw new IllegalArgumentException("Illegal property: " + property);
087 }
088
089 }
090
091 public int getProperty() {
092 return this.property;
093 }
094
095 public String toString() {
096 StringBuffer s = new StringBuffer("<");
097 s.append(name);
098 s.append(">");
099 return s.toString();
100 }
101
102 public boolean doesntMatch(AminoAcid aminoAcid) {
103 int itemProperties = aminoAcid.getProperties();
104 return 0 == (itemProperties & this.property);
105 }
106
107 }