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

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

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

import java.util.*;

import com.hfg.bio.seq.Protein;
import com.hfg.bio.seq.ProteinDigest;
import com.hfg.exception.UnmodifyableObjectException;
import com.hfg.util.CompareUtil;
import com.hfg.util.StringUtil;
import com.hfg.util.collection.OrderedSet;

//------------------------------------------------------------------------------
/**
 * Chemical or biological proteolytic agent which can be used to theoretically
 * digest a Protein.
 *
 * @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]
//------------------------------------------------------------------------------

/*

   What to do if...

      - X-links are defined?

          - Should the DigestSettings include an optional cys-alkylation form? This would
            allow the user to specify whether the digest should be a 'native digest' or
            whether the cysteines (including those specified as x-linked) should be considered
            reduced and alkylated.

      - Multiple identical chains exist?

          - If the fragments aren't x-linked, concatenate the chain ids in the DigestFragment: 'H1/H2'

*/

public class Protease implements Comparable
{
   //##########################################################################
   // PRIVATE FIELDS
   //##########################################################################

   private static final Set sValues = new OrderedSet<>(12);

   private final String mName;

   private String mP6Specificity = "";
   private String mExcludedP6Residues = "";

   private String mP5Specificity = "";
   private String mExcludedP5Residues = "";

   private String mP4Specificity = "";
   private String mExcludedP4Residues = "";

   private String mP3Specificity = "";
   private String mExcludedP3Residues = "";

   private String mP2Specificity = "";
   private String mExcludedP2Residues = "";
   
   private String mP1Specificity = "";
   private String mExcludedP1Residues = "";
   
   
   private String mP1PrimeSpecificity   = "";
   private String mExcludedP1PrimeResidues = "";
   
   private String mP2PrimeSpecificity   = "";
   private String mExcludedP2PrimeResidues = "";
   
   private String mP3PrimeSpecificity   = "";
   private String mExcludedP3PrimeResidues = "";

   private boolean mLocked;

   private static final int NUM_N_TERMINAL_POSITIONS = 6;
   private static final int NUM_C_TERMINAL_POSITIONS = 3;
   
   //##########################################################################
   // PUBLIC FIELDS
   //##########################################################################

   public static final Protease TRYPSIN      = new Protease("Trypsin");
   public static final Protease LYS_C        = new Protease("Lys-C");
   public static final Protease CHYMOTRYPSIN = new Protease("Chymotrypsin");
   public static final Protease GLU_C        = new Protease("Glu-C");
   public static final Protease ASP_N        = new Protease("Asp-N");
   public static final Protease ASP_N_DE     = new Protease("Asp-N (DE)");

   /**
    Human thrombin protease.
    
Uses data from Gallwitz, M. et. al. (2012). "The extended cleavage specificity of human thrombin." PLoS ONE, 7 (2).
Note: Experiments suggest a preference for P in P2 and R in P3'. */ public static final Protease THROMBIN = new Protease("Thrombin"); /** Tobacco Etch virus protease.
Uses data from Kostallas, G. et. al. (2011). "Substrate profiling of tobacco Etch virus protease using a novel Fluorescence-Assisted whole-cell assay." PLoS ONE, 6 (1).
*/ public static final Protease TEV = new Protease("TEV"); /** Human rhinovirus 3C protease.
Uses data from Cordingley, M.G. et. al. (1990). "Substrate requirements of human rhinovirus 3C protease for peptide cleavage in vitro." Journal of Biological Chemistry, 265 (16), 9062-9065.
*/ public static final Protease HRV_3C = new Protease("HRV 3C"); /** Factor Xa protease.
Uses data from Harris, J. et. al. (2000). "Rapid and general profiling of protease specificity by using combinatorial fluorogenic substrate libraries." PNAS, 97 (14), 7754-7759.
*/ public static final Protease FACTOR_Xa = new Protease("Factor Xa"); public static final Protease ENTEROKINASE = new Protease("Enterokinase"); static { TRYPSIN.setP1Specificity("KR") .setExcludedP1PrimeResidues("P") .lock(); LYS_C.setP1Specificity("K") .lock(); CHYMOTRYPSIN.setP1Specificity("YFWL") .lock(); GLU_C.setP1Specificity("E") .lock(); ASP_N.setP1PrimeSpecificity("D") .lock(); ASP_N_DE.setP1PrimeSpecificity("DE") .lock(); THROMBIN.setP1Specificity("R") .setP1PrimeSpecificity("SAGT") .setExcludedP2PrimeResidues("DE") .lock(); TEV.setP6Specificity("E") .setP5Specificity("RSGLVWCEAPQKN") .setP4Specificity("VLGARESWDTIKMNY") .setP3Specificity("Y") .setP2Specificity("FGASVCREQTHLPWDIN") .setP1Specificity("Q") .setP1PrimeSpecificity("GAVSRDECKMLQIT") .lock(); HRV_3C.setP5Specificity("EQRIDHF") .setP4Specificity("TAVDF") .setP3Specificity("L") .setP2Specificity("F") .setP1Specificity("Q") .setP1PrimeSpecificity("G") .setP2PrimeSpecificity("P") .lock(); FACTOR_Xa.setP4Specificity("ILPV") .setExcludedP3Residues("P") .setP2Specificity("GAFPSWY") .setP1Specificity("R") .lock(); ENTEROKINASE .setP5Specificity("D") .setP4Specificity("D") .setP3Specificity("D") .setP2Specificity("D") .setP1Specificity("K") .lock(); } //########################################################################## // CONSTRUCTORS //########################################################################## //-------------------------------------------------------------------------- public Protease(String inName) { mName = inName; sValues.add(this); } //########################################################################## // PUBLIC METHODS //########################################################################## //-------------------------------------------------------------------------- public static Protease[] values() { return sValues.toArray(new Protease[0]); } //-------------------------------------------------------------------------- public static Protease valueOf(String inName) { Protease requestedProtease = null; if (StringUtil.isSet(inName)) { for (Protease protease : sValues) { if (protease.name().equalsIgnoreCase(inName.trim())) { requestedProtease = protease; break; } } } return requestedProtease; } //-------------------------------------------------------------------------- @Override public int hashCode() { return name().hashCode(); } //-------------------------------------------------------------------------- @Override public boolean equals(Object inObj2) { return 0 == compareTo(inObj2); } //-------------------------------------------------------------------------- @Override public int compareTo(Object inObj2) { return inObj2 instanceof Protease ? CompareUtil.compare(name(), ((Protease)inObj2).name()) : -1; } //-------------------------------------------------------------------------- public String name() { return mName; } //-------------------------------------------------------------------------- @Override public String toString() { return name(); } //-------------------------------------------------------------------------- public Protease setP6Specificity(String inValue) { checkLock(); mP6Specificity = inValue; return this; } //-------------------------------------------------------------------------- public String getP6Specificity() { return mP6Specificity; } //-------------------------------------------------------------------------- public Protease setExcludedP6Residues(String inValue) { checkLock(); mExcludedP6Residues = inValue; return this; } //-------------------------------------------------------------------------- public String getExcludedP6Residues() { return mExcludedP6Residues; } //-------------------------------------------------------------------------- public Protease setP5Specificity(String inValue) { checkLock(); mP5Specificity = inValue; return this; } //-------------------------------------------------------------------------- public String getP5Specificity() { return mP5Specificity; } //-------------------------------------------------------------------------- public Protease setExcludedP5Residues(String inValue) { checkLock(); mExcludedP5Residues = inValue; return this; } //-------------------------------------------------------------------------- public String getExcludedP5Residues() { return mExcludedP5Residues; } //-------------------------------------------------------------------------- public Protease setP4Specificity(String inValue) { checkLock(); mP4Specificity = inValue; return this; } //-------------------------------------------------------------------------- public String getP4Specificity() { return mP4Specificity; } //-------------------------------------------------------------------------- public Protease setExcludedP4Residues(String inValue) { checkLock(); mExcludedP4Residues = inValue; return this; } //-------------------------------------------------------------------------- public String getExcludedP4Residues() { return mExcludedP4Residues; } //-------------------------------------------------------------------------- public Protease setP3Specificity(String inValue) { checkLock(); mP3Specificity = inValue; return this; } //-------------------------------------------------------------------------- public String getP3Specificity() { return mP3Specificity; } //-------------------------------------------------------------------------- public Protease setExcludedP3Residues(String inValue) { checkLock(); mExcludedP3Residues = inValue; return this; } //-------------------------------------------------------------------------- public String getExcludedP3Residues() { return mExcludedP3Residues; } //-------------------------------------------------------------------------- public Protease setP2Specificity(String inValue) { checkLock(); mP2Specificity = inValue; return this; } //-------------------------------------------------------------------------- public String getP2Specificity() { return mP2Specificity; } //-------------------------------------------------------------------------- public Protease setExcludedP2Residues(String inValue) { checkLock(); mExcludedP2Residues = inValue; return this; } //-------------------------------------------------------------------------- public String getExcludedP2Residues() { return mExcludedP2Residues; } //-------------------------------------------------------------------------- public Protease setP1Specificity(String inValue) { checkLock(); mP1Specificity = inValue; return this; } //-------------------------------------------------------------------------- public String getP1Specificity() { return mP1Specificity; } //-------------------------------------------------------------------------- public Protease setExcludedP1PrimeResidues(String inValue) { checkLock(); mExcludedP1PrimeResidues = inValue; return this; } //-------------------------------------------------------------------------- public String getExcludedP1PrimeResidues() { return mExcludedP1PrimeResidues; } //-------------------------------------------------------------------------- public Protease setP1PrimeSpecificity(String inValue) { checkLock(); mP1PrimeSpecificity = inValue; return this; } //-------------------------------------------------------------------------- public String getP1PrimeSpecificity() { return mP1PrimeSpecificity; } //-------------------------------------------------------------------------- public Protease setExcludedP1Residues(String inValue) { checkLock(); mExcludedP1Residues = inValue; return this; } //-------------------------------------------------------------------------- public String getExcludedP1Residues() { return mExcludedP1Residues; } //-------------------------------------------------------------------------- public Protease setExcludedP2PrimeResidues(String inValue) { checkLock(); mExcludedP2PrimeResidues = inValue; return this; } //-------------------------------------------------------------------------- public String getExcludedP2PrimeResidues() { return mExcludedP2PrimeResidues; } //-------------------------------------------------------------------------- public Protease setP2PrimeSpecificity(String inValue) { checkLock(); mP2PrimeSpecificity = inValue; return this; } //-------------------------------------------------------------------------- public String getP2PrimeSpecificity() { return mP2PrimeSpecificity; } //-------------------------------------------------------------------------- public Protease setP3PrimeSpecificity(String inValue) { checkLock(); mP3PrimeSpecificity = inValue; return this; } //-------------------------------------------------------------------------- public String getP3PrimeSpecificity() { return mP3PrimeSpecificity; } //-------------------------------------------------------------------------- public Protease lock() { mLocked = true; return this; } //-------------------------------------------------------------------------- public List digest(Protein inProtein, DigestSettings inSettings) { inSettings.setProtease(this); ProteinDigest digest = new ProteinDigest(inProtein, inSettings); return digest.getFragments(); } //-------------------------------------------------------------------------- public boolean isCleavageSite(CharSequence inNTerminalResidues, CharSequence inCTerminalResidues) { String nTerminalResidues = inNTerminalResidues.toString().toUpperCase(); String cTerminalResidues = inCTerminalResidues.toString().toUpperCase(); return ( ((mP6Specificity.length() == 0 && mExcludedP6Residues.length() == 0 ) || nTerminalResidues.length() < 6 || mP6Specificity.indexOf(nTerminalResidues.charAt(nTerminalResidues.length() - 6)) >= 0 || (mExcludedP6Residues.length() > 0 && mExcludedP6Residues.indexOf(nTerminalResidues.charAt(nTerminalResidues.length() - 6)) == -1)) && ((mP5Specificity.length() == 0 && mExcludedP5Residues.length() == 0 ) || nTerminalResidues.length() < 5 || mP5Specificity.indexOf(nTerminalResidues.charAt(nTerminalResidues.length() - 5)) >= 0 || (mExcludedP5Residues.length() > 0 && mExcludedP5Residues.indexOf(nTerminalResidues.charAt(nTerminalResidues.length() - 5)) == -1)) && ((mP4Specificity.length() == 0 && mExcludedP4Residues.length() == 0 ) || nTerminalResidues.length() < 4 || mP4Specificity.indexOf(nTerminalResidues.charAt(nTerminalResidues.length() - 4)) >= 0 || (mExcludedP4Residues.length() > 0 && mExcludedP4Residues.indexOf(nTerminalResidues.charAt(nTerminalResidues.length() - 4)) == -1)) && ((mP3Specificity.length() == 0 && mExcludedP3Residues.length() == 0 ) || nTerminalResidues.length() < 3 || mP3Specificity.indexOf(nTerminalResidues.charAt(nTerminalResidues.length() - 3)) >= 0 || (mExcludedP3Residues.length() > 0 && mExcludedP3Residues.indexOf(nTerminalResidues.charAt(nTerminalResidues.length() - 3)) == -1)) && ((mP2Specificity.length() == 0 && mExcludedP2Residues.length() == 0 ) || nTerminalResidues.length() < 2 || mP2Specificity.indexOf(nTerminalResidues.charAt(nTerminalResidues.length() - 2)) >= 0 || (mExcludedP2Residues.length() > 0 && mExcludedP2Residues.indexOf(nTerminalResidues.charAt(nTerminalResidues.length() - 2)) == -1)) && ((mP1Specificity.length() == 0 && mExcludedP1Residues.length() == 0 ) || nTerminalResidues.length() < 1 || (mP1Specificity.length() > 0 && mP1Specificity.indexOf(nTerminalResidues.charAt(nTerminalResidues.length() - 1)) >= 0) || (mExcludedP1Residues.length() > 0 && mExcludedP1Residues.indexOf(nTerminalResidues.charAt(nTerminalResidues.length() - 1)) == -1)) && ((mP1PrimeSpecificity.length() == 0 && mExcludedP1PrimeResidues.length() == 0 ) || cTerminalResidues.length() < 1 || (mP1PrimeSpecificity.length() > 0 && mP1PrimeSpecificity.indexOf(cTerminalResidues.charAt(0)) >= 0) || (mExcludedP1PrimeResidues.length() > 0 && mExcludedP1PrimeResidues.indexOf(cTerminalResidues.charAt(0)) == -1)) && ((mP2PrimeSpecificity.length() == 0 && mExcludedP2PrimeResidues.length() == 0) || cTerminalResidues.length() < 2 || (mP2PrimeSpecificity.length() > 0 && mP2PrimeSpecificity.indexOf(cTerminalResidues.charAt(1)) >= 0) || (mExcludedP2PrimeResidues.length() > 0 && mExcludedP2PrimeResidues.indexOf(cTerminalResidues.charAt(1)) == -1)) && ((mP3PrimeSpecificity.length() == 0 && mExcludedP3PrimeResidues.length() == 0) || cTerminalResidues.length() < 3 || (mP3PrimeSpecificity.length() > 0 && mP3PrimeSpecificity.indexOf(cTerminalResidues.charAt(2)) >= 0) || (mExcludedP3PrimeResidues.length() > 0 && mExcludedP3PrimeResidues.indexOf(cTerminalResidues.charAt(2)) == -1))); } //########################################################################## // PRIVATE METHODS //########################################################################## //-------------------------------------------------------------------------- private void checkLock() { if (mLocked) throw new UnmodifyableObjectException("This object is locked and cannot be modified."); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy