com.hfg.bio.DigestSettings Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of com_hfg Show documentation
Show all versions of com_hfg Show documentation
com.hfg xml, html, svg, and bioinformatics utility library
package com.hfg.bio;
//------------------------------------------------------------------------------
/**
Settings for protease cleavage.
@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 DigestSettings implements Cloneable
{
private Integer mMaxMissedCleavages = 0;
private Integer mMinFragmentLength = 1;
private Integer mMaxFragmentLength;
private Float mMinFragmentMass;
private Float mMaxFragmentMass;
private AminoAcid mAlkylatedCys;
//---------------------------------------------------------------------------
public DigestSettings setMaxMissedCleavages(Integer inValue)
{
mMaxMissedCleavages = inValue;
return this;
}
//---------------------------------------------------------------------------
public Integer getMaxMissedCleavages()
{
return mMaxMissedCleavages;
}
//---------------------------------------------------------------------------
public DigestSettings setMinFragmentLength(Integer inValue)
{
mMinFragmentLength = inValue;
return this;
}
//---------------------------------------------------------------------------
public Integer getMinFragmentLength()
{
return mMinFragmentLength;
}
//---------------------------------------------------------------------------
public DigestSettings setMaxFragmentLength(Integer inValue)
{
mMaxFragmentLength = inValue;
return this;
}
//---------------------------------------------------------------------------
public Integer getMaxFragmentLength()
{
return mMaxFragmentLength;
}
//---------------------------------------------------------------------------
public DigestSettings setMinFragmentMass(Float inValue)
{
mMinFragmentMass = inValue;
return this;
}
//---------------------------------------------------------------------------
public Float getMinFragmentMass()
{
return mMinFragmentMass;
}
//---------------------------------------------------------------------------
public DigestSettings setMaxFragmentMass(Float inValue)
{
mMaxFragmentMass = inValue;
return this;
}
//---------------------------------------------------------------------------
public Float getMaxFragmentMass()
{
return mMaxFragmentMass;
}
//---------------------------------------------------------------------------
/**
By specifying a modified cysteine a "virtual reduction" will be performed on
the protein before digestion.
@param inValue AminoAcid to substitute for x-linked or free cysteines
@return this DigestSettings object to enable method chaining
*/
public DigestSettings setAlkyatedCys(AminoAcid inValue)
{
mAlkylatedCys = inValue;
return this;
}
//---------------------------------------------------------------------------
public AminoAcid getAlkyatedCys()
{
return mAlkylatedCys;
}
//---------------------------------------------------------------------------
/**
Returns whether the specified DigestFragment meets criteria for inclusion.
@param inFrag the DigestFragment to test for inclusion
@return whether the specified DigestFragment meets criteria for inclusion
*/
public boolean meetsCriteria(DigestFragment inFrag)
{
boolean result = true;
if ( (mMinFragmentLength != null && inFrag.length() < mMinFragmentLength)
|| (mMinFragmentMass != null && inFrag.getMonoisotopicMass() < mMinFragmentMass)
|| (mMaxFragmentLength != null && inFrag.length() > mMaxFragmentLength)
|| (mMaxFragmentMass != null && inFrag.getMonoisotopicMass() > mMaxFragmentMass))
{
result = false;
}
return result;
}
//---------------------------------------------------------------------------
@Override
public DigestSettings clone()
{
DigestSettings copy;
try
{
copy = (DigestSettings) super.clone();
}
catch (CloneNotSupportedException e)
{
throw new RuntimeException(e);
}
return copy;
}
}