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

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

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

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.Map;
import java.util.Set;

import com.hfg.chem.Charge;
import com.hfg.chem.Element;
import com.hfg.chem.IonizableGroup;
import com.hfg.chem.Molecule;
import com.hfg.exception.UnmodifyableObjectException;
import com.hfg.util.CompareUtil;
import com.hfg.util.collection.OrderedSet;
import com.hfg.xml.XMLNode;
import com.hfg.xml.XMLTag;
import com.hfg.xml.XMLAttribute;
import com.hfg.util.StringUtil;
import com.hfg.util.collection.CollectionUtil;

//------------------------------------------------------------------------------
/**
 Amino Acid. Estimated pKa values are from: Jack Kyte, "Structure in Protein Chemistry" (1995), Garland Publishing, Inc.
 See Nomenclature and Symbolism for Amino Acids and Peptides.
 
@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 AminoAcid extends Molecule { // This declaration has to come before the public constants below. private static Set sValues = new OrderedSet<>(); //########################################################################## // PUBLIC FIELDS //########################################################################## public static final AminoAcid ALANINE = new AminoAcid("Alanine", "Ala", 'A', 100); public static final AminoAcid ARGININE = new AminoAcid("Arginine", "Arg", 'R', 200); public static final AminoAcid ASPARAGINE = new AminoAcid("Asparagine", "Asn", 'N', 300); public static final AminoAcid ASPARTIC_ACID = new AminoAcid("Aspartic Acid", "Asp", 'D', 400); public static final AminoAcid CYSTEINE = new AminoAcid("Cysteine", "Cys", 'C', 500); public static final AminoAcid GLUTAMIC_ACID = new AminoAcid("Glutamic Acid", "Glu", 'E', 600); public static final AminoAcid GLUTAMINE = new AminoAcid("Glutamine", "Gln", 'Q', 700); public static final AminoAcid GLYCINE = new AminoAcid("Glycine", "Gly", 'G', 800); public static final AminoAcid HISTIDINE = new AminoAcid("Histidine", "His", 'H', 900); public static final AminoAcid ISOLEUCINE = new AminoAcid("Isoleucine", "Ile", 'I', 1000); public static final AminoAcid LEUCINE = new AminoAcid("Leucine", "Leu", 'L', 1100); public static final AminoAcid LYSINE = new AminoAcid("Lysine", "Lys", 'K', 1200); public static final AminoAcid METHIONINE = new AminoAcid("Methionine", "Met", 'M', 1300); public static final AminoAcid PHENYLALANINE = new AminoAcid("Phenylalanine", "Phe", 'F', 1400); public static final AminoAcid PROLINE = new AminoAcid("Proline", "Pro", 'P', 1500); public static final AminoAcid SERINE = new AminoAcid("Serine", "Ser", 'S', 1600); public static final AminoAcid THREONIE = new AminoAcid("Threonine", "Thr", 'T', 1700); public static final AminoAcid TRYPTOPHAN = new AminoAcid("Tryptophan", "Trp", 'W', 1800); public static final AminoAcid TYROSINE = new AminoAcid("Tyrosine", "Tyr", 'Y', 1900); public static final AminoAcid VALINE = new AminoAcid("Valine", "Val", 'V', 2000); /** http://www.albany.edu/faculty/cs812/bio366/selenocysteine_ppt.pdf */ public static final AminoAcid SELENOCYSTEINE = new AminoAcid("Selenocysteine", "SeC", 'U'); public static final AminoAcid ASP_ASN_AVG = new AminoAcid("Asp/Asn avg", "Asx", 'B'); public static final AminoAcid GLU_GLN_AVG = new AminoAcid("Glu/Gln avg", "Glx", 'Z'); /** The NCBI has starting using 'J' to represent Ile/Leu ambiguity */ public static final AminoAcid ILE_LEU_AVG = new AminoAcid("Ile/Leu avg", "Ilx", 'J'); public static final AminoAcid UNDEFINED = new AminoAcid("Undefined", "Unk", 'X', 2100); public static final AminoAcid STOP = new AminoAcid("Stop", "*", '*', 2200); // D-amino acids public static final AminoAcid D_ALANINE = new AminoAcid("D-Alanine", "DAL"); public static final AminoAcid D_ARGININE = new AminoAcid("D-Arginine", "DAR"); public static final AminoAcid D_ASPARAGINE = new AminoAcid("D-Asparagine", "DSG"); public static final AminoAcid D_ASPARTIC_ACID = new AminoAcid("D-Aspartic Acid", "DAS"); public static final AminoAcid D_CYSTEINE = new AminoAcid("D-Cysteine", "DCY"); public static final AminoAcid D_GLUTAMIC_ACID = new AminoAcid("D-Glutamic Acid", "DGL"); public static final AminoAcid D_GLUTAMINE = new AminoAcid("D-Glutamine", "DGN"); public static final AminoAcid D_HISTIDINE = new AminoAcid("D-Histidine", "DHI"); public static final AminoAcid D_ISOLEUCINE = new AminoAcid("D-Isoleucine", "DIL"); public static final AminoAcid D_LEUCINE = new AminoAcid("D-Leucine", "DLE"); public static final AminoAcid D_LYSINE = new AminoAcid("D-Lysine", "DLY"); public static final AminoAcid D_METHIONINE = new AminoAcid("D-Methionine", "MED"); public static final AminoAcid D_PHENYLALANINE = new AminoAcid("D-Phenylalanine", "DPN"); public static final AminoAcid D_PROLINE = new AminoAcid("D-Proline", "DPR"); public static final AminoAcid D_SERINE = new AminoAcid("D-Serine", "DSN"); public static final AminoAcid D_THREONIE = new AminoAcid("D-Threonine", "DTH"); public static final AminoAcid D_TRYPTOPHAN = new AminoAcid("D-Tryptophan", "DTR"); public static final AminoAcid D_TYROSINE = new AminoAcid("D-Tyrosine", "DTY"); public static final AminoAcid D_VALINE = new AminoAcid("D-Valine", "DVA"); public static final AminoAcid D_ISOVALINE = new AminoAcid("D-Isovaline", "DIV"); // Common modified amino acids public static final AminoAcid ARG_N_METHYL = new AminoAcid("Arginine, N-methyl"); public static final AminoAcid ASP_HYDROXY = new AminoAcid("Aspartic acid, Hydroxy"); public static final AminoAcid CITRULLINE = new AminoAcid("Citrulline"); public static final AminoAcid CYS_ACETAMIDOMETHYL = new AminoAcid("Cysteine, Acetamidomethyl", "", 'c'); public static final AminoAcid CYS_AMINOETHYL = new AminoAcid("Cysteine, Aminoethyl", "", 'c'); public static final AminoAcid CYS_CARBAMIDOMETHYL = new AminoAcid("Cysteine, Carbamidomethyl", "CAC", 'c'); public static final AminoAcid CYS_CARBOXYMETHYL = new AminoAcid("Cysteine, Carboxymethyl", "CMC", 'c'); public static final AminoAcid CYS_PYRIDYLETHYL = new AminoAcid("Cysteine, Pyridylethyl", "", 'c'); public static final AminoAcid CYS_S_FARNESYL = new AminoAcid("Cysteine, S-farnesyl", "", 'c'); public static final AminoAcid CYS_S_PALMITYL = new AminoAcid("Cysteine, S-palmityl", "", 'c'); public static final AminoAcid CYS_S_HYDROXY = new AminoAcid("Cysteine, S-hydroxy", "CSO", 'c'); public static final AminoAcid CYS_S_DIOXIDE = new AminoAcid("Cysteine, S-dioxide", "CSW", 'c'); public static final AminoAcid CYS_S_PHOSPHO = new AminoAcid("Cysteine, S-phospho", "CSP", 'c'); public static final AminoAcid CYS_2_HYDROXYETHYL_THIOCYSTEINE = new AminoAcid("S,S-(2-Hydroxyethyl)Thiocysteine", "CME"); public static final AminoAcid CYS_SULFONIC_ACID = new AminoAcid("Cysteinesulfonic acid", "OCS"); public static final AminoAcid DEHYDROALANINE = new AminoAcid("Dehydroalanine"); public static final AminoAcid THREE_SULFINOALANINE = new AminoAcid("3-Sulfinoalanine", "CSD"); public static final AminoAcid HOMOSERINE = new AminoAcid("Homoserine"); public static final AminoAcid LYS_ACETYLATED = new AminoAcid("Lysine, Acetylated", "ALY"); public static final AminoAcid LYS_HYDROXY = new AminoAcid("Lysine, Hydroxy"); public static final AminoAcid LYS_N_METHYL = new AminoAcid("Lysine, N-methyl"); public static final AminoAcid LYS_N_DIMETHYL = new AminoAcid("Lysine, N-dimethyl", "MLY"); public static final AminoAcid LYS_N_TRIMETHYL = new AminoAcid("Lysine, N-trimethyl", "M3L"); public static final AminoAcid LYS_NZ_CARBOXYLIC_ACID = new AminoAcid("Lysine, NZ-carboxylic acid", "KCX"); public static final AminoAcid MET_SULFONE = new AminoAcid("Methionine Sulfone"); public static final AminoAcid MET_SULFOXIDE = new AminoAcid("Methionine Sulfoxide"); public static final AminoAcid MET_S_DIXOY = new AminoAcid("Methionine S-dioxy", "OMT"); public static final AminoAcid SELENOMETHIONINE = new AminoAcid("Selenomethionine", "MSE"); public static final AminoAcid NORVALINE = new AminoAcid("Norvaline", "NVA"); public static final AminoAcid NORLEUCINE = new AminoAcid("Norleucine", "NLE"); public static final AminoAcid ORNITHINE = new AminoAcid("Ornithine", "ORN"); public static final AminoAcid PRO_HYDROXY = new AminoAcid("Proline, Hydroxy", "HYP"); public static final AminoAcid SARCOSINE = new AminoAcid("Sarcosine", "SAR"); public static final AminoAcid SER_PHOSPHO = new AminoAcid("Serine, Phospho", "SEP"); public static final AminoAcid THR_PHOSPHO = new AminoAcid("Threonine, Phospho", "TPO"); public static final AminoAcid TYR_PHOSPHO = new AminoAcid("Tyrosine, Phospho", "PTR"); public static final AminoAcid TYR_O_SULFO = new AminoAcid("Tyrosine, O-sulfo", "TYS"); public static final AminoAcid ALPHA_AMINOBUTYRIC_ACID = new AminoAcid("Alpha-aminobutyric acid", "ABA"); public static final AminoAcid AMINO_MERCAPTO_BUTYRIC_ACID = new AminoAcid("2-Amino-4-mercapto-butyric acid", "HCS"); public static final AminoAcid ALPHA_AMINOISOBUTYRIC_ACID = new AminoAcid("Alpha-aminoisobutyric acid", "AIB"); public static final AminoAcid HIS_4_METHYL = new AminoAcid("4-Methyl-histidine", "HIC"); public static final AminoAcid LLP = new AminoAcid("(2S)-2-amino-6-[[3-hydroxy-2-methyl-5-(phosphonooxymethyl)pyridin-4-yl]methylideneamino]hexanoic acid", "LLP"); public static final AminoAcid ASN_N_METHYL = new AminoAcid("Asparagine, N-methyl", "MEN"); // Differing protonation states of histidine public static final AminoAcid HISTIDINE_HID = new AminoAcid("Histidine neutral δ-protonated (HID)", "HID"); public static final AminoAcid HISTIDINE_HIE = new AminoAcid("Histidine neutral ε-protonated (HIE)", "HIE"); public static final AminoAcid HISTIDINE_HIP = new AminoAcid("Histidine protonated on both sidechain nitrogens (HIP)", "HIP"); public static final Comparator AA_ORDINAL_COMPARATOR = GLYCINE.new AAOrdinalComparator(); static { GLYCINE.addAtoms(Element.CARBON, 2) .addAtoms(Element.HYDROGEN, 3) .addAtoms(Element.NITROGEN, 1) .addAtoms(Element.OXYGEN, 1) .lock() .register(); ALANINE.addAtoms(Element.CARBON, 3) .addAtoms(Element.HYDROGEN, 5) .addAtoms(Element.NITROGEN, 1) .addAtoms(Element.OXYGEN, 1) .lock() .register(); SERINE.addAtoms(Element.CARBON, 3) .addAtoms(Element.HYDROGEN, 5) .addAtoms(Element.NITROGEN, 1) .addAtoms(Element.OXYGEN, 2) .lock() .register(); PROLINE.addAtoms(Element.CARBON, 5) .addAtoms(Element.HYDROGEN, 7) .addAtoms(Element.NITROGEN, 1) .addAtoms(Element.OXYGEN, 1) .lock() .register(); VALINE.addAtoms(Element.CARBON, 5) .addAtoms(Element.HYDROGEN, 9) .addAtoms(Element.NITROGEN, 1) .addAtoms(Element.OXYGEN, 1) .lock() .register(); THREONIE.addAtoms(Element.CARBON, 4) .addAtoms(Element.HYDROGEN, 7) .addAtoms(Element.NITROGEN, 1) .addAtoms(Element.OXYGEN, 2) .lock() .register(); CYSTEINE.addAtoms(Element.CARBON, 3) .addAtoms(Element.HYDROGEN, 5) .addAtoms(Element.NITROGEN, 1) .addAtoms(Element.OXYGEN, 1) .addAtoms(Element.SULFUR, 1) // .addSidechainKa(new IonizableGroup(5E-9, Charge.NEUTRAL)) // pKa 8.3 .addSidechainKa(new IonizableGroup(2.0E-9, Charge.NEUTRAL)) // pKa 8.7 .lock() .register(); ISOLEUCINE.addAtoms(Element.CARBON, 6) .addAtoms(Element.HYDROGEN, 11) .addAtoms(Element.NITROGEN, 1) .addAtoms(Element.OXYGEN, 1) .lock() .register(); LEUCINE.addAtoms(Element.CARBON, 6) .addAtoms(Element.HYDROGEN, 11) .addAtoms(Element.NITROGEN, 1) .addAtoms(Element.OXYGEN, 1) .lock() .register(); ASPARAGINE.addAtoms(Element.CARBON, 4) .addAtoms(Element.HYDROGEN, 6) .addAtoms(Element.NITROGEN, 2) .addAtoms(Element.OXYGEN, 2) .lock() .register(); ASPARTIC_ACID.addAtoms(Element.CARBON, 4) .addAtoms(Element.HYDROGEN, 5) .addAtoms(Element.NITROGEN, 1) .addAtoms(Element.OXYGEN, 3) // .addSidechainKa(new IonizableGroup(1.23E-4, Charge.NEUTRAL)) // pKa 3.9 .addSidechainKa(new IonizableGroup(1.0E-4, Charge.NEUTRAL)) // pKa 4.0 .lock() .register(); GLUTAMINE.addAtoms(Element.CARBON, 5) .addAtoms(Element.HYDROGEN, 8) .addAtoms(Element.NITROGEN, 2) .addAtoms(Element.OXYGEN, 2) .lock() .register(); LYSINE.addAtoms(Element.CARBON, 6) .addAtoms(Element.HYDROGEN, 12) .addAtoms(Element.NITROGEN, 2) .addAtoms(Element.OXYGEN, 1) // .addSidechainKa(new IonizableGroup(1.62E-11, Charge.POSITIVE)) // pKa 10.8 .addSidechainKa(new IonizableGroup(3.2E-11, Charge.POSITIVE)) // pKa 10.5 .lock() .register(); GLUTAMIC_ACID.addAtoms(Element.CARBON, 5) .addAtoms(Element.HYDROGEN, 7) .addAtoms(Element.NITROGEN, 1) .addAtoms(Element.OXYGEN, 3) // .addSidechainKa(new IonizableGroup(5.62E-5, Charge.NEUTRAL)) // pKa 4.25 .addSidechainKa(new IonizableGroup(5.0E-5, Charge.NEUTRAL)) // pKa 4.3 .lock() .register(); METHIONINE.addAtoms(Element.CARBON, 5) .addAtoms(Element.HYDROGEN, 9) .addAtoms(Element.NITROGEN, 1) .addAtoms(Element.OXYGEN, 1) .addAtoms(Element.SULFUR, 1) .lock() .register(); HISTIDINE.addAtoms(Element.CARBON, 6) .addAtoms(Element.HYDROGEN, 7) .addAtoms(Element.NITROGEN, 3) .addAtoms(Element.OXYGEN, 1) // .addSidechainKa(new IonizableGroup(3.16E-7, Charge.POSITIVE)) // pKa 6.5 .addSidechainKa(new IonizableGroup(4.0E-7, Charge.POSITIVE)) // pKa 6.4 .lock() .register(); PHENYLALANINE.addAtoms(Element.CARBON, 9) .addAtoms(Element.HYDROGEN, 9) .addAtoms(Element.NITROGEN, 1) .addAtoms(Element.OXYGEN, 1) .lock() .register(); ARGININE.addAtoms(Element.CARBON, 6) .addAtoms(Element.HYDROGEN, 12) .addAtoms(Element.NITROGEN, 4) .addAtoms(Element.OXYGEN, 1) // .addSidechainKa(new IonizableGroup(3.16E-13, Charge.POSITIVE)) // pKa 12.5 .addSidechainKa(new IonizableGroup(1.0E-13, Charge.POSITIVE)) // pKa 13 .lock() .register(); TYROSINE.addAtoms(Element.CARBON, 9) .addAtoms(Element.HYDROGEN, 9) .addAtoms(Element.NITROGEN, 1) .addAtoms(Element.OXYGEN, 2) // .addSidechainKa(new IonizableGroup(1.12E-11, Charge.NEUTRAL)) // pKa 10.95 .addSidechainKa(new IonizableGroup(1.6E-10, Charge.NEUTRAL)) // pKa 9.8 .lock() .register(); TRYPTOPHAN.addAtoms(Element.CARBON, 11) .addAtoms(Element.HYDROGEN, 10) .addAtoms(Element.NITROGEN, 2) .addAtoms(Element.OXYGEN, 1) .lock() .register(); SELENOCYSTEINE.addSidechainKa(new IonizableGroup(2.0E-6, Charge.NEUTRAL)) // pKa 5.7 .addAtoms(Element.CARBON, 3) .addAtoms(Element.HYDROGEN, 5) .addAtoms(Element.NITROGEN, 1) .addAtoms(Element.OXYGEN, 1) .addAtoms(Element.SELENIUM, 1) .lock() .register(); ASP_ASN_AVG.addAtoms(Element.CARBON, 4) .addAtoms(Element.HYDROGEN, 5.5f) .addAtoms(Element.NITROGEN, 1.5f) .addAtoms(Element.OXYGEN, 2.5f); ASP_ASN_AVG.mIsApproximation = true; ASP_ASN_AVG.lock() .register(); GLU_GLN_AVG.addAtoms(Element.CARBON, 5) .addAtoms(Element.HYDROGEN, 7.5f) .addAtoms(Element.NITROGEN, 1.5f) .addAtoms(Element.OXYGEN, 2.5f); GLU_GLN_AVG.mIsApproximation = true; GLU_GLN_AVG.lock() .register(); ILE_LEU_AVG.addAtoms(Element.CARBON, 6) .addAtoms(Element.HYDROGEN, 11) .addAtoms(Element.NITROGEN, 1) .addAtoms(Element.OXYGEN, 1) .lock() .register(); UNDEFINED.lock() .register(); STOP.lock() .register(); // D-amino acids D_ALANINE.addAtoms(Element.CARBON, 3) .addAtoms(Element.HYDROGEN, 5) .addAtoms(Element.NITROGEN, 1) .addAtoms(Element.OXYGEN, 1) .lock() .register(); D_SERINE.addAtoms(Element.CARBON, 3) .addAtoms(Element.HYDROGEN, 5) .addAtoms(Element.NITROGEN, 1) .addAtoms(Element.OXYGEN, 2) .lock() .register(); D_PROLINE.addAtoms(Element.CARBON, 5) .addAtoms(Element.HYDROGEN, 7) .addAtoms(Element.NITROGEN, 1) .addAtoms(Element.OXYGEN, 1) .lock() .register(); D_VALINE.addAtoms(Element.CARBON, 5) .addAtoms(Element.HYDROGEN, 9) .addAtoms(Element.NITROGEN, 1) .addAtoms(Element.OXYGEN, 1) .lock() .register(); D_ISOVALINE.addAtoms(Element.CARBON, 5) .addAtoms(Element.HYDROGEN, 9) .addAtoms(Element.NITROGEN, 1) .addAtoms(Element.OXYGEN, 1) .lock() .register(); D_THREONIE.addAtoms(Element.CARBON, 4) .addAtoms(Element.HYDROGEN, 7) .addAtoms(Element.NITROGEN, 1) .addAtoms(Element.OXYGEN, 2) .lock() .register(); D_CYSTEINE.addAtoms(Element.CARBON, 3) .addAtoms(Element.HYDROGEN, 5) .addAtoms(Element.NITROGEN, 1) .addAtoms(Element.OXYGEN, 1) .addAtoms(Element.SULFUR, 1) .addSidechainKa(new IonizableGroup(2.0E-9, Charge.NEUTRAL)) // pKa 8.7 .lock() .register(); D_ISOLEUCINE.addAtoms(Element.CARBON, 6) .addAtoms(Element.HYDROGEN, 11) .addAtoms(Element.NITROGEN, 1) .addAtoms(Element.OXYGEN, 1) .lock() .register(); D_LEUCINE.addAtoms(Element.CARBON, 6) .addAtoms(Element.HYDROGEN, 11) .addAtoms(Element.NITROGEN, 1) .addAtoms(Element.OXYGEN, 1) .lock() .register(); D_ASPARAGINE.addAtoms(Element.CARBON, 4) .addAtoms(Element.HYDROGEN, 6) .addAtoms(Element.NITROGEN, 2) .addAtoms(Element.OXYGEN, 2) .lock() .register(); D_ASPARTIC_ACID.addAtoms(Element.CARBON, 4) .addAtoms(Element.HYDROGEN, 5) .addAtoms(Element.NITROGEN, 1) .addAtoms(Element.OXYGEN, 3) .addSidechainKa(new IonizableGroup(1.0E-4, Charge.NEUTRAL)) // pKa 4.0 .lock() .register(); D_GLUTAMINE.addAtoms(Element.CARBON, 5) .addAtoms(Element.HYDROGEN, 8) .addAtoms(Element.NITROGEN, 2) .addAtoms(Element.OXYGEN, 2) .lock() .register(); D_LYSINE.addAtoms(Element.CARBON, 6) .addAtoms(Element.HYDROGEN, 12) .addAtoms(Element.NITROGEN, 2) .addAtoms(Element.OXYGEN, 1) .addSidechainKa(new IonizableGroup(3.2E-11, Charge.POSITIVE)) // pKa 10.5 .lock() .register(); D_GLUTAMIC_ACID.addAtoms(Element.CARBON, 5) .addAtoms(Element.HYDROGEN, 7) .addAtoms(Element.NITROGEN, 1) .addAtoms(Element.OXYGEN, 3) .addSidechainKa(new IonizableGroup(5.0E-5, Charge.NEUTRAL)) // pKa 4.3 .lock() .register(); D_METHIONINE.addAtoms(Element.CARBON, 5) .addAtoms(Element.HYDROGEN, 9) .addAtoms(Element.NITROGEN, 1) .addAtoms(Element.OXYGEN, 1) .addAtoms(Element.SULFUR, 1) .lock() .register(); D_HISTIDINE.addAtoms(Element.CARBON, 6) .addAtoms(Element.HYDROGEN, 7) .addAtoms(Element.NITROGEN, 3) .addAtoms(Element.OXYGEN, 1) .addSidechainKa(new IonizableGroup(4.0E-7, Charge.POSITIVE)) // pKa 6.4 .lock() .register(); D_PHENYLALANINE.addAtoms(Element.CARBON, 9) .addAtoms(Element.HYDROGEN, 9) .addAtoms(Element.NITROGEN, 1) .addAtoms(Element.OXYGEN, 1) .lock() .register(); D_ARGININE.addAtoms(Element.CARBON, 6) .addAtoms(Element.HYDROGEN, 12) .addAtoms(Element.NITROGEN, 4) .addAtoms(Element.OXYGEN, 1) .addSidechainKa(new IonizableGroup(1.0E-13, Charge.POSITIVE)) // pKa 13 .lock() .register(); D_TYROSINE.addAtoms(Element.CARBON, 9) .addAtoms(Element.HYDROGEN, 9) .addAtoms(Element.NITROGEN, 1) .addAtoms(Element.OXYGEN, 2) .addSidechainKa(new IonizableGroup(1.6E-10, Charge.NEUTRAL)) // pKa 9.8 .lock() .register(); D_TRYPTOPHAN.addAtoms(Element.CARBON, 11) .addAtoms(Element.HYDROGEN, 10) .addAtoms(Element.NITROGEN, 2) .addAtoms(Element.OXYGEN, 1) .lock() .register(); ARG_N_METHYL.addAtoms(Element.CARBON, 7) .addAtoms(Element.HYDROGEN, 14) .addAtoms(Element.NITROGEN, 4) .addAtoms(Element.OXYGEN, 1) .lock() .register(); ASP_HYDROXY.addAtoms(Element.CARBON, 4) .addAtoms(Element.HYDROGEN, 5) .addAtoms(Element.NITROGEN, 1) .addAtoms(Element.OXYGEN, 4) .lock() .register(); CITRULLINE.addAtoms(Element.CARBON, 6) .addAtoms(Element.HYDROGEN, 11) .addAtoms(Element.NITROGEN, 3) .addAtoms(Element.OXYGEN, 2) .lock() .register(); CYS_ACETAMIDOMETHYL.addAtoms(Element.CARBON, 6) .addAtoms(Element.HYDROGEN, 10) .addAtoms(Element.NITROGEN, 2) .addAtoms(Element.OXYGEN, 2) .addAtoms(Element.SULFUR, 1) .lock() .register(); CYS_AMINOETHYL.addAtoms(Element.CARBON, 5) .addAtoms(Element.HYDROGEN, 10) .addAtoms(Element.NITROGEN, 2) .addAtoms(Element.OXYGEN, 1) .addAtoms(Element.SULFUR, 1) .lock() .register(); CYS_CARBAMIDOMETHYL.addAtoms(Element.CARBON, 5) .addAtoms(Element.HYDROGEN, 8) .addAtoms(Element.NITROGEN, 2) .addAtoms(Element.OXYGEN, 2) .addAtoms(Element.SULFUR, 1) .lock() .register(); CYS_CARBOXYMETHYL.addAtoms(Element.CARBON, 5) .addAtoms(Element.HYDROGEN, 7) .addAtoms(Element.NITROGEN, 1) .addAtoms(Element.OXYGEN, 3) .addAtoms(Element.SULFUR, 1) .lock() .register(); CYS_PYRIDYLETHYL.addAtoms(Element.CARBON, 10) .addAtoms(Element.HYDROGEN, 12) .addAtoms(Element.NITROGEN, 2) .addAtoms(Element.OXYGEN, 1) .addAtoms(Element.SULFUR, 1) .lock() .register(); CYS_S_FARNESYL.addAtoms(Element.CARBON, 18) .addAtoms(Element.HYDROGEN, 29) .addAtoms(Element.NITROGEN, 1) .addAtoms(Element.OXYGEN, 1) .addAtoms(Element.SULFUR, 1) .lock() .register(); CYS_S_PALMITYL.addAtoms(Element.CARBON, 19) .addAtoms(Element.HYDROGEN, 35) .addAtoms(Element.NITROGEN, 1) .addAtoms(Element.OXYGEN, 2) .addAtoms(Element.SULFUR, 1) .lock() .register(); DEHYDROALANINE.addAtoms(Element.CARBON, 3) .addAtoms(Element.HYDROGEN, 3) .addAtoms(Element.NITROGEN, 1) .addAtoms(Element.OXYGEN, 1) .lock() .register(); HOMOSERINE.addAtoms(Element.CARBON, 4) .addAtoms(Element.HYDROGEN, 7) .addAtoms(Element.NITROGEN, 1) .addAtoms(Element.OXYGEN, 2) .lock() .register(); LYS_ACETYLATED.addAtoms(Element.CARBON, 8) .addAtoms(Element.HYDROGEN, 14) .addAtoms(Element.NITROGEN, 2) .addAtoms(Element.OXYGEN, 2) .lock() .register(); LYS_HYDROXY.addAtoms(Element.CARBON, 6) .addAtoms(Element.HYDROGEN, 12) .addAtoms(Element.NITROGEN, 2) .addAtoms(Element.OXYGEN, 2) .lock() .register(); LYS_N_METHYL.addAtoms(Element.CARBON, 7) .addAtoms(Element.HYDROGEN, 14) .addAtoms(Element.NITROGEN, 2) .addAtoms(Element.OXYGEN, 1) .lock() .register(); LYS_N_DIMETHYL.addAtoms(Element.CARBON, 8) .addAtoms(Element.HYDROGEN, 15) .addAtoms(Element.NITROGEN, 2) .addAtoms(Element.OXYGEN, 1) .lock() .register(); LYS_N_TRIMETHYL.addAtoms(Element.CARBON, 9) .addAtoms(Element.HYDROGEN, 18) .addAtoms(Element.NITROGEN, 2) .addAtoms(Element.OXYGEN, 1) .lock() .register(); MET_SULFONE.addAtoms(Element.CARBON, 5) .addAtoms(Element.HYDROGEN, 9) .addAtoms(Element.NITROGEN, 1) .addAtoms(Element.OXYGEN, 3) .addAtoms(Element.SULFUR, 1) .lock() .register(); MET_SULFOXIDE.addAtoms(Element.CARBON, 5) .addAtoms(Element.HYDROGEN, 9) .addAtoms(Element.NITROGEN, 1) .addAtoms(Element.OXYGEN, 2) .addAtoms(Element.SULFUR, 1) .lock() .register(); MET_S_DIXOY.addAtoms(Element.CARBON, 5) .addAtoms(Element.HYDROGEN, 9) .addAtoms(Element.NITROGEN, 1) .addAtoms(Element.OXYGEN, 3) .addAtoms(Element.SULFUR, 1) .lock() .register(); SELENOMETHIONINE.addAtoms(Element.CARBON, 5) .addAtoms(Element.HYDROGEN, 9) .addAtoms(Element.NITROGEN, 1) .addAtoms(Element.OXYGEN, 1) .addAtoms(Element.SELENIUM, 1) .lock() .register(); NORVALINE.addAtoms(Element.CARBON, 5) .addAtoms(Element.HYDROGEN, 9) .addAtoms(Element.NITROGEN, 1) .addAtoms(Element.OXYGEN, 1) .lock() .register(); NORLEUCINE.addAtoms(Element.CARBON, 6) .addAtoms(Element.HYDROGEN, 11) .addAtoms(Element.NITROGEN, 1) .addAtoms(Element.OXYGEN, 1) .lock() .register(); ORNITHINE.addAtoms(Element.CARBON, 5) .addAtoms(Element.HYDROGEN, 10) .addAtoms(Element.NITROGEN, 2) .addAtoms(Element.OXYGEN, 1) .lock() .register(); PRO_HYDROXY.addAtoms(Element.CARBON, 5) .addAtoms(Element.HYDROGEN, 7) .addAtoms(Element.NITROGEN, 1) .addAtoms(Element.OXYGEN, 2) .lock() .register(); SARCOSINE.addAtoms(Element.CARBON, 3) .addAtoms(Element.HYDROGEN, 7) .addAtoms(Element.NITROGEN, 1) .addAtoms(Element.OXYGEN, 1) .lock() .register(); SER_PHOSPHO.addAtoms(Element.CARBON, 3) .addAtoms(Element.HYDROGEN, 6) .addAtoms(Element.NITROGEN, 1) .addAtoms(Element.OXYGEN, 5) .addAtoms(Element.PHOSPHOROUS, 1) .lock() .register(); THR_PHOSPHO.addAtoms(Element.CARBON, 4) .addAtoms(Element.HYDROGEN, 8) .addAtoms(Element.NITROGEN, 1) .addAtoms(Element.OXYGEN, 5) .addAtoms(Element.PHOSPHOROUS, 1) .lock() .register(); TYR_PHOSPHO.addAtoms(Element.CARBON, 9) .addAtoms(Element.HYDROGEN, 10) .addAtoms(Element.NITROGEN, 1) .addAtoms(Element.OXYGEN, 5) .addAtoms(Element.PHOSPHOROUS, 1) .lock() .register(); ALPHA_AMINOBUTYRIC_ACID.addAtoms(Element.CARBON, 4) .addAtoms(Element.HYDROGEN, 7) .addAtoms(Element.NITROGEN, 1) .addAtoms(Element.OXYGEN, 1) .lock() .register(); CYS_S_HYDROXY.addAtoms(Element.CARBON, 3) .addAtoms(Element.HYDROGEN, 5) .addAtoms(Element.NITROGEN, 1) .addAtoms(Element.OXYGEN, 2) .addAtoms(Element.SULFUR, 1) .lock() .register(); CYS_S_DIOXIDE.addAtoms(Element.CARBON, 3) .addAtoms(Element.HYDROGEN, 5) .addAtoms(Element.NITROGEN, 1) .addAtoms(Element.OXYGEN, 3) .addAtoms(Element.SULFUR, 1) .lock() .register(); CYS_SULFONIC_ACID.addAtoms(Element.CARBON, 3) .addAtoms(Element.HYDROGEN, 5) .addAtoms(Element.NITROGEN, 1) .addAtoms(Element.OXYGEN, 4) .addAtoms(Element.SULFUR, 1) .lock() .register(); CYS_S_PHOSPHO.addAtoms(Element.CARBON, 3) .addAtoms(Element.HYDROGEN, 6) .addAtoms(Element.NITROGEN, 1) .addAtoms(Element.OXYGEN, 4) .addAtoms(Element.SULFUR, 1) .addAtoms(Element.PHOSPHOROUS, 1) .lock() .register(); CYS_2_HYDROXYETHYL_THIOCYSTEINE.addAtoms(Element.CARBON, 5) .addAtoms(Element.HYDROGEN, 9) .addAtoms(Element.NITROGEN, 1) .addAtoms(Element.OXYGEN, 2) .addAtoms(Element.SULFUR, 2) .lock() .register(); THREE_SULFINOALANINE.addAtoms(Element.CARBON, 3) .addAtoms(Element.HYDROGEN, 5) .addAtoms(Element.NITROGEN, 1) .addAtoms(Element.OXYGEN, 3) .addAtoms(Element.SULFUR, 1) .lock() .register(); AMINO_MERCAPTO_BUTYRIC_ACID.addAtoms(Element.CARBON, 4) .addAtoms(Element.HYDROGEN, 7) .addAtoms(Element.NITROGEN, 1) .addAtoms(Element.OXYGEN, 1) .addAtoms(Element.SULFUR, 1) .lock() .register(); ALPHA_AMINOISOBUTYRIC_ACID.addAtoms(Element.CARBON, 4) .addAtoms(Element.HYDROGEN, 7) .addAtoms(Element.NITROGEN, 1) .addAtoms(Element.OXYGEN, 1) .lock() .register(); HIS_4_METHYL.addAtoms(Element.CARBON, 7) .addAtoms(Element.HYDROGEN, 9) .addAtoms(Element.NITROGEN, 3) .addAtoms(Element.OXYGEN, 1) .lock() .register(); LYS_NZ_CARBOXYLIC_ACID.addAtoms(Element.CARBON, 7) .addAtoms(Element.HYDROGEN, 12) .addAtoms(Element.NITROGEN, 2) .addAtoms(Element.OXYGEN, 3) .lock() .register(); LLP.addAtoms(Element.CARBON, 14) .addAtoms(Element.HYDROGEN, 20) .addAtoms(Element.NITROGEN, 3) .addAtoms(Element.OXYGEN, 6) .addAtoms(Element.PHOSPHOROUS, 1) .lock() .register(); TYR_O_SULFO.addAtoms(Element.CARBON, 9) .addAtoms(Element.HYDROGEN, 9) .addAtoms(Element.NITROGEN, 1) .addAtoms(Element.OXYGEN, 5) .addAtoms(Element.SULFUR, 1) .lock() .register(); ASN_N_METHYL.addAtoms(Element.CARBON, 5) .addAtoms(Element.HYDROGEN, 8) .addAtoms(Element.NITROGEN, 2) .addAtoms(Element.OXYGEN, 2) .lock() .register(); // Differing protonation states of histidine HISTIDINE_HID.addAtoms(Element.CARBON, 6) .addAtoms(Element.HYDROGEN, 7) .addAtoms(Element.NITROGEN, 3) .addAtoms(Element.OXYGEN, 1) .lock() .register(); HISTIDINE_HIE.addAtoms(Element.CARBON, 6) .addAtoms(Element.HYDROGEN, 7) .addAtoms(Element.NITROGEN, 3) .addAtoms(Element.OXYGEN, 1) .lock() .register(); HISTIDINE_HIP.addAtoms(Element.CARBON, 6) .addAtoms(Element.HYDROGEN, 8) .addAtoms(Element.NITROGEN, 3) .addAtoms(Element.OXYGEN, 1) .lock() .register(); } //########################################################################## // PRIVATE FIELDS //########################################################################## private String m3LetterCode; private Character m1LetterCode; private Collection mSidechainKas; private boolean mIsApproximation; private int mOrdinal = sDefaultOrdinal; private static int sDefaultOrdinal = 100000; //########################################################################## // CONSTRUCTORS //########################################################################## //-------------------------------------------------------------------------- public AminoAcid(String inName) { super(inName); } //-------------------------------------------------------------------------- public AminoAcid(String inName, String in3LetterCode) { this(inName, in3LetterCode, null, sDefaultOrdinal); } //-------------------------------------------------------------------------- public AminoAcid(String inName, String in3LetterCode, char in1LetterCode) { this(inName, in3LetterCode, in1LetterCode, sDefaultOrdinal); } //-------------------------------------------------------------------------- private AminoAcid(String inName, String in3LetterCode, Character in1LetterCode, int inOrdinal) { super(inName); m3LetterCode = in3LetterCode; m1LetterCode = in1LetterCode; mOrdinal = inOrdinal; } //-------------------------------------------------------------------------- public AminoAcid(String inName, Map inElementalComposition) { super(inName, inElementalComposition); } //-------------------------------------------------------------------------- public AminoAcid(XMLNode inXML) { super(inXML.getAttributeValue(HfgBioXML.NAME_ATT)); if (! inXML.getTagName().equals(HfgBioXML.AA_TAG)) { throw new RuntimeException("Cannot construct an " + this.getClass().getSimpleName() + " from a " + inXML.getTagName() + " tag!"); } XMLNode sidechainKasTag = inXML.getOptionalSubtagByName(HfgBioXML.SIDECHAIN_KAS_TAG); if (sidechainKasTag != null) { for (XMLNode subtag : sidechainKasTag.getXMLNodeSubtags()) { addSidechainKa(new IonizableGroup(subtag)); } } if (inXML.hasAttribute(HfgBioXML.IS_APPROX_ATT)) { if (inXML.getAttributeValue(HfgBioXML.IS_APPROX_ATT).equalsIgnoreCase("true")) { mIsApproximation = true; } } m3LetterCode = inXML.getAttributeValue(HfgBioXML.THREE_LTR_CODE_ATT); if (inXML.hasAttribute(HfgBioXML.ONE_LTR_CODE_ATT)) { m1LetterCode = inXML.getAttributeValue(HfgBioXML.ONE_LTR_CODE_ATT).charAt(0); } XMLNode compTag = inXML.getOptionalSubtagByName(HfgBioXML.ELEMENTAL_COMP_TAG); if (compTag != null) { for (XMLAttribute attr : compTag.getAttributes()) { addAtoms(Element.valueOf(attr.getName()), Float.parseFloat(attr.getValue())); } } // Set the ordinal value (isn't included in the XML) for (AminoAcid aa : sValues) { if (aa.name().equals(name())) { mOrdinal = aa.mOrdinal; break; } } } //########################################################################## // PUBLIC METHODS //########################################################################## //-------------------------------------------------------------------------- /** Puts the AminoAcid into the Set of unique AminoAcids returned by AminoAcid.values(). */ public void register() { if (! isLocked()) { throw new RuntimeException("Only locked AminoAcids can be added to the values list!"); } sValues.add(this); } //-------------------------------------------------------------------------- @Override public AminoAcid addAtoms(Element inElement, int inNum) { return (AminoAcid) super.addAtoms(inElement, inNum); } //-------------------------------------------------------------------------- @Override public AminoAcid lock() { return (AminoAcid) super.lock(); } //-------------------------------------------------------------------------- @Override public String toString() { return m1LetterCode != null ? m1LetterCode + "" : name(); } //-------------------------------------------------------------------------- /** Returns an unlocked copy of the AminoAcid. @return an unlocked copy of this AminoAcid */ @Override public AminoAcid clone() { AminoAcid copy = (AminoAcid) super.clone(); if (mSidechainKas != null) { copy.mSidechainKas = new ArrayList<>(mSidechainKas); } return copy; } /* //-------------------------------------------------------------------------- @Override public int hashCode() { int hashcode = mMatter.hashCode(); if (mName != null) { hashcode = hashcode + 31 * mName.hashCode(); } return hashcode; } */ //-------------------------------------------------------------------------- @Override public boolean equals(Object inObj) { boolean result = false; if (inObj != null && inObj instanceof AminoAcid) { result = (0 == compareTo(inObj)); } return result; } //-------------------------------------------------------------------------- public int compareTo(Object inObj) { int result = -1; if (inObj != null) { if (inObj instanceof AminoAcid) { AminoAcid aa2 = (AminoAcid) inObj; result = CompareUtil.compare(mOrdinal, aa2.mOrdinal); if (0 == result) { result = super.compareTo(inObj); } } else { result = CompareUtil.compare(hashCode(), inObj.hashCode()); } } return result; } //-------------------------------------------------------------------------- /** Returns the AminoAcid whose name or 3-letter code matches the specified String. (1-letter codes aren't specific enough.) @param inString the name or 3-letter code for the AminoAcid to retrieve @return the AminoAcid whose name or 3-letter code matches the specified String */ public static AminoAcid valueOf(String inString) { AminoAcid value = null; if (StringUtil.isSet(inString)) { for (AminoAcid aa : sValues) { if (aa.name().equalsIgnoreCase(inString) || inString.equalsIgnoreCase(aa.getThreeLetterCode())) // 1-letter code isn't specific enough { value = aa; break; } } } return value; } //-------------------------------------------------------------------------- public static AminoAcid[] values() { return sValues.toArray(new AminoAcid[sValues.size()]); } //-------------------------------------------------------------------------- public AminoAcid addSidechainKa(IonizableGroup inValue) { if (isLocked()) throw new UnmodifyableObjectException(name() + " is locked and cannot be modified!"); if (null == mSidechainKas) { mSidechainKas = new ArrayList<>(); } mSidechainKas.add(inValue); return this; } //-------------------------------------------------------------------------- /** Sets the sidechain Ka's. @param inKas IonizableGroups present on the AminoAcid's sidechain */ public void setSidechainKas(Collection inKas) { if (isLocked()) throw new UnmodifyableObjectException(name() + " is locked and cannot be modified!"); mSidechainKas = inKas; } //-------------------------------------------------------------------------- /** Returns any defined sidechain Ka's. @return sidechain IonizableGroups */ public Collection getSidechainKas() { return (mSidechainKas != null ? Collections.unmodifiableCollection(mSidechainKas) : null); } //-------------------------------------------------------------------------- public AminoAcid setThreeLetterCode(String inValue) { if (isLocked()) throw new UnmodifyableObjectException(name() + " is locked and cannot be modified!"); m3LetterCode = inValue; return this; } //-------------------------------------------------------------------------- public String getThreeLetterCode() { return m3LetterCode; } //-------------------------------------------------------------------------- public AminoAcid setOneLetterCode(Character inValue) { if (isLocked()) throw new UnmodifyableObjectException(name() + " is locked and cannot be modified!"); m1LetterCode = inValue; return this; } //-------------------------------------------------------------------------- public Character getOneLetterCode() { return m1LetterCode; } //-------------------------------------------------------------------------- /** Some of the defined amino acids are an average of other amino acids. Use of these renders the calculated properties as approximations. @return whether or not the AminoAcid is an average of other amino acids */ public boolean isApproximation() { return mIsApproximation; } //-------------------------------------------------------------------------- @Override public XMLNode toXMLNode() { XMLNode node = super.toXMLNode(); node.setTagName(HfgBioXML.AA_TAG); if (CollectionUtil.hasValues(mSidechainKas)) { XMLNode kasTag = new XMLTag(HfgBioXML.SIDECHAIN_KAS_TAG); node.addSubtag(kasTag); for (IonizableGroup grp : mSidechainKas) { kasTag.addSubtag(grp.toXMLNode()); } } if (mIsApproximation) node.setAttribute(HfgBioXML.IS_APPROX_ATT, "true"); if (StringUtil.isSet(m3LetterCode)) node.setAttribute(HfgBioXML.THREE_LTR_CODE_ATT, m3LetterCode); if (m1LetterCode != null) node.setAttribute(HfgBioXML.ONE_LTR_CODE_ATT, m1LetterCode); return node; } private class AAOrdinalComparator implements Comparator { //----------------------------------------------------------------------- @Override public int compare(AminoAcid inObj1, AminoAcid inObj2) { return CompareUtil.compare(inObj1.mOrdinal, inObj2.mOrdinal); } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy