001package com.hfg.bio.proteinproperty;
002
003
004import com.hfg.bio.AminoAcid;
005import com.hfg.bio.HfgBioXML;
006import com.hfg.util.CompareUtil;
007import com.hfg.xml.XMLTag;
008
009//------------------------------------------------------------------------------
010/**
011 Reduced (and denatured) protein analysis mode.
012 <div>
013  @author J. Alex Taylor, hairyfatguy.com
014 </div>
015 */
016//------------------------------------------------------------------------------
017// com.hfg XML/HTML Coding Library
018//
019// This library is free software; you can redistribute it and/or
020// modify it under the terms of the GNU Lesser General Public
021// License as published by the Free Software Foundation; either
022// version 2.1 of the License, or (at your option) any later version.
023//
024// This library is distributed in the hope that it will be useful,
025// but WITHOUT ANY WARRANTY; without even the implied warranty of
026// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
027// Lesser General Public License for more details.
028//
029// You should have received a copy of the GNU Lesser General Public
030// License along with this library; if not, write to the Free Software
031// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
032//
033// J. Alex Taylor, President, Founder, CEO, COO, CFO, OOPS hairyfatguy.com
034// jataylor@hairyfatguy.com
035//------------------------------------------------------------------------------
036
037public class ReducedAnalysisMode extends ProteinAnalysisMode
038{
039   private AminoAcid mAlkylatedCys;
040
041
042
043   //---------------------------------------------------------------------------
044   public ReducedAnalysisMode()
045   {
046      super("Reduced");
047   }
048
049   //---------------------------------------------------------------------------
050   public ReducedAnalysisMode(XMLTag inXMLNode)
051   {
052      this();
053
054      XMLTag alkylatedCysTag = inXMLNode.getOptionalSubtagByName(HfgBioXML.AA_TAG);
055      if (alkylatedCysTag != null)
056      {
057         setAlkylatedCysteine(new AminoAcid(alkylatedCysTag));
058      }
059   }
060
061   //--------------------------------------------------------------------------
062   @Override
063   public String toString()
064   {
065      return toXMLTag().toXML();
066   }
067
068   //--------------------------------------------------------------------------
069   @Override
070   public XMLTag toXMLTag()
071   {
072      XMLTag tag = super.toXMLTag();
073
074      if (mAlkylatedCys != null)
075      {
076         tag.addSubtag(mAlkylatedCys.toXMLNode());
077      }
078
079      return tag;
080   }
081
082   //--------------------------------------------------------------------------
083   public ReducedAnalysisMode setAlkylatedCysteine(AminoAcid inAA)
084   {
085      mAlkylatedCys = inAA;
086      return this;
087   }
088
089   //--------------------------------------------------------------------------
090   public AminoAcid getAlkylatedCysteine()
091   {
092      return mAlkylatedCys;
093   }
094
095   //--------------------------------------------------------------------------
096   @Override
097   public boolean equals(Object inObj2)
098   {
099      return (inObj2 instanceof ReducedAnalysisMode
100              && 0 == CompareUtil.compare(getAlkylatedCysteine(), ((ReducedAnalysisMode) inObj2).getAlkylatedCysteine()));
101   }
102}