001package com.hfg.bio;
002
003
004
005import com.hfg.setting.SettingXML;
006import com.hfg.xml.XMLTag;
007import com.hfg.xml.XMLTaggable;
008
009import java.awt.Color;
010
011//------------------------------------------------------------------------------
012/**
013 Standard grouping of amino acids.
014 <ul>
015   <li><b>Basic</b>: lysine, arginine, histidine</li>
016   <li><b>Acidic</b>: aspartic acid, glutamic acid</li>
017   <li><b>Uncharged Polar</b>: asparagine, glutamine, serine, threonine, tyrosine</li>
018   <li><b>Nonpolar</b>: glycine, alanine, valine, leucine, isoleucine, proline, phenylalanine, methionine, tryptophan, cysteine</li>
019 </ul>
020 <div>
021 @author J. Alex Taylor, hairyfatguy.com
022 </div>
023 */
024//------------------------------------------------------------------------------
025// com.hfg XML/HTML Coding Library
026//
027// This library is free software; you can redistribute it and/or
028// modify it under the terms of the GNU Lesser General Public
029// License as published by the Free Software Foundation; either
030// version 2.1 of the License, or (at your option) any later version.
031//
032// This library is distributed in the hope that it will be useful,
033// but WITHOUT ANY WARRANTY; without even the implied warranty of
034// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
035// Lesser General Public License for more details.
036//
037// You should have received a copy of the GNU Lesser General Public
038// License along with this library; if not, write to the Free Software
039// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
040//
041// J. Alex Taylor, President, Founder, CEO, COO, CFO, OOPS hairyfatguy.com
042// jataylor@hairyfatguy.com
043//------------------------------------------------------------------------------
044
045public class StandardAAGroupingScheme extends AAGroupingSchemeImpl implements XMLTaggable
046{
047
048   private static StandardAAGroupingScheme sInstance;
049
050   //##########################################################################
051   // CONSTRUCTORS
052   //##########################################################################
053
054   //--------------------------------------------------------------------------
055   private StandardAAGroupingScheme()
056   {
057      super("Standard");
058
059      add(new AAGroup("Acidic", 'A').setColor(Color.RED)
060                .add(AminoAcid.ASPARTIC_ACID)
061                .add(AminoAcid.GLUTAMIC_ACID));
062
063      add(new AAGroup("Basic", 'B').setColor(Color.BLUE)
064                .add(AminoAcid.LYSINE)
065                .add(AminoAcid.ARGININE)
066                .add(AminoAcid.HISTIDINE));
067
068      add(new AAGroup("Uncharged Polar", 'U').setColor(Color.ORANGE)
069            .add(AminoAcid.ASPARAGINE)
070            .add(AminoAcid.GLUTAMINE)
071            .add(AminoAcid.SERINE)
072            .add(AminoAcid.THREONIE)
073            .add(AminoAcid.TYROSINE));
074
075      add(new AAGroup("Nonpolar", 'N').setColor(Color.GREEN)
076            .add(AminoAcid.GLYCINE)
077            .add(AminoAcid.ALANINE)
078            .add(AminoAcid.VALINE)
079            .add(AminoAcid.LEUCINE)
080            .add(AminoAcid.ISOLEUCINE)
081            .add(AminoAcid.PROLINE)
082            .add(AminoAcid.PHENYLALANINE)
083            .add(AminoAcid.METHIONINE)
084            .add(AminoAcid.TRYPTOPHAN)
085            .add(AminoAcid.CYSTEINE));
086
087      add(new AAGroup("Deletion", 'D').setColor(Color.BLACK)
088            .add(AminoAcid.STOP)
089            .add(AminoAcid.UNDEFINED));
090
091   }
092
093   //##########################################################################
094   // PUBLIC METHODS
095   //##########################################################################
096
097   //--------------------------------------------------------------------------
098   public static synchronized StandardAAGroupingScheme getInstance()
099   {
100      if (null == sInstance)
101      {
102         sInstance = new StandardAAGroupingScheme();
103      }
104
105      return sInstance;
106   }
107
108   //--------------------------------------------------------------------------
109   public XMLTag toXMLTag()
110   {
111      XMLTag tag = new XMLTag(HfgBioXML.AA_GROUPING_SCHEME_TAG);
112      tag.setAttribute(SettingXML.CLASS_ATT, getClass().getName());
113      tag.setAttribute(SettingXML.INSTANCE_ATT, "true");
114
115      return tag;
116   }
117
118}