All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.hfg.bio.DigestFragment Maven / Gradle / Ivy

There is a newer version: 20240423
Show newest version
package com.hfg.bio;

import com.hfg.bio.seq.Protein;
import com.hfg.util.collection.CollectionUtil;
import com.hfg.util.StringUtil;

//------------------------------------------------------------------------------
/**
 * Product of a proteolytic digest.
 *
 * @author J. Alex Taylor, hairyfatguy.com
 */
//------------------------------------------------------------------------------
// com.hfg XML/HTML Coding Library
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
//
// J. Alex Taylor, President, Founder, CEO, COO, CFO, OOPS hairyfatguy.com
// [email protected]
//------------------------------------------------------------------------------

public class DigestFragment extends Protein
{
   private int    mBegin;
   private int    mEnd;
   private int    mNumUncleavedSites;
   private int    mBeginFragIndex;
   private int    mEndFragIndex;

   //---------------------------------------------------------------------------
   public void setBegin(int inValue)
   {
      mBegin = inValue;
   }

   //---------------------------------------------------------------------------
   public int getBegin()
   {
      return mBegin;
   }

   //---------------------------------------------------------------------------
   public void setEnd(int inValue)
   {
      mEnd = inValue;
   }

   //---------------------------------------------------------------------------
   public int getEnd()
   {
      return mEnd;
   }

   //---------------------------------------------------------------------------
   public void setNumUncleavedSites(int inValue)
   {
      mNumUncleavedSites = inValue;
   }

   //---------------------------------------------------------------------------
   public int getNumUncleavedSites()
   {
      return mNumUncleavedSites;
   }

   //---------------------------------------------------------------------------
   public void setBeginFragIndex(int inValue)
   {
      mBeginFragIndex = inValue;
   }

   //---------------------------------------------------------------------------
   public int getBeginFragIndex()
   {
      return mBeginFragIndex;
   }

   //---------------------------------------------------------------------------
   public void setEndFragIndex(int inValue)
   {
      mEndFragIndex = inValue;
   }

   //---------------------------------------------------------------------------
   public int getEndFragIndex()
   {
      return mEndFragIndex;
   }

   //---------------------------------------------------------------------------
   public String getFragIndexString()
   {
      return mBeginFragIndex + (mEndFragIndex != mBeginFragIndex ? ".." + mEndFragIndex : "");
   }

   //---------------------------------------------------------------------------
   @Override
   public String toString()
   {
      StringBuilder buffer = new StringBuilder();

      if (CollectionUtil.hasValues(getChains()))
      {

      }
      else
      {
         if (StringUtil.isSet(getID()))
         {
            buffer.append(getID());
            buffer.append(" ");
         }
         buffer.append(getFragIndexString());
         buffer.append("\t");
         buffer.append(getBegin());
         buffer.append(" - ");
         buffer.append(getEnd());
         buffer.append("\t");
         buffer.append(getSequence());
      }

      return buffer.toString();
   }
}
































































© 2015 - 2024 Weber Informatics LLC | Privacy Policy