001/* 002 * BioJava development code 003 * 004 * This code may be freely distributed and modified under the 005 * terms of the GNU Lesser General Public Licence. This should 006 * be distributed with the code. If you do not have a copy, 007 * see: 008 * 009 * http://www.gnu.org/copyleft/lesser.html 010 * 011 * Copyright for this code is held jointly by the individual 012 * authors. These should be listed in @author doc comments. 013 * 014 * For more information on the BioJava project and its aims, 015 * or to join the biojava-l mailing list, visit the home page 016 * at: 017 * 018 * http://www.biojava.org/ 019 * 020 * 021 */ 022package org.biojava.nbio.structure.io.mmcif.chem; 023 024import java.io.Serializable; 025 026 027/** 028 * Enumerates the possible classifications of residues. These are generally more specific than PolymerTypes 029 * This information is derived from the mmcif dictionary. 030 * @author mulvaney 031 * @author Andreas Prlic 032 * @see <a href="http://mmcif.rcsb.org/dictionaries/mmcif_pdbx.dic/Items/_chem_comp.type.html">link into mmCIF dictionary</a> 033 * @since 1.7 034 */ 035 036public enum ResidueType implements Serializable { 037 038 atomn(null, "null"), // present in db for _chem_comp.id_ = 'CFL' but not enumerated in dictionary 039 // Peptides 040 dPeptideLinking(PolymerType.dpeptide, "D-peptide linking"), 041 lPeptideLinking(PolymerType.peptide, "L-peptide linking"), 042 glycine(PolymerType.peptide,"PEPTIDE LINKING"), 043 peptideLike(PolymerType.otherPolymer, "peptide-like"), 044 dPeptideAminoTerminus(PolymerType.dpeptide, "D-peptide NH3 amino terminus"), 045 lPeptideAminoTerminus(PolymerType.peptide, "L-peptide NH3 amino terminus"), 046 dPeptideCarboxyTerminus(PolymerType.dpeptide, "D-peptide COOH carboxy terminus"), 047 lPeptideCarboxyTerminus(PolymerType.peptide, "L-peptide COOH carboxy terminus"), 048 // Nucleotides 049 dnaLinking(PolymerType.dna, "DNA linking"), 050 rnaLinking(PolymerType.rna, "RNA linking"), 051 dna3PrimeTerminus(PolymerType.dna, "DNA OH 3 prime terminus"), 052 rna3PrimeTerminus(PolymerType.rna, "RNA OH 3 prime terminus"), 053 dna5PrimeTerminus(PolymerType.dna, "DNA OH 5 prime terminus"), 054 rna5PrimeTerminus(PolymerType.rna, "RNA OH 5 prime terminus"), 055 // Sugars 056 dSaccharide(PolymerType.polysaccharide, "D-saccharide"), 057 dSaccharide14and14linking(PolymerType.polysaccharide, "D-saccharide 1,4 and 1,4 linking"), 058 dSaccharide14and16linking(PolymerType.polysaccharide, "D-saccharide 1,4 and 1,6 linking"), 059 lSaccharide(PolymerType.lpolysaccharide, "L-saccharide"), 060 lSaccharide14and14linking(PolymerType.lpolysaccharide, "L-saccharide 1,4 and 1,4 linking"), 061 lSaccharide14and16linking(PolymerType.lpolysaccharide, "L-saccharide 1,4 and 1,6 linking"), 062 saccharide(PolymerType.polysaccharide, "saccharide"), 063 // Iso-peptides 064 dBetaPeptideCGammaLinking(PolymerType.dpeptide,"D-beta-peptide, C-gamma linking"), 065 dGammaPeptideCDeltaLinking(PolymerType.dpeptide,"D-gamma-peptide, C-delta linking"), 066 lBetaPeptideCGammaLinking(PolymerType.peptide,"L-beta-peptide, C-gamma linking"), 067 lGammaPeptideCDeltaLinking(PolymerType.peptide,"L-gamma-peptide, C-delta linking"), 068 // L nucleotides. As of 2015-04, these are only found in D-DNA hybrids, so they don't have their own PolymerType 069 lDNALinking(PolymerType.dna,"L-DNA linking"), 070 lRNALinking(PolymerType.dna,"L-RNA linking"), 071 // Other 072 nonPolymer(null, "non-polymer"), 073 otherChemComp(null, "other"); 074 075 ResidueType(PolymerType pt, String chem_comp_type) 076 { 077 this.polymerType = pt; 078 this.chem_comp_type = chem_comp_type; 079 } 080 081 /** 082 * The associated {@link PolymerType} 083 */ 084 public final PolymerType polymerType; 085 086 /** 087 * Gets the associated PolymerType, which are less specific 088 * @return 089 */ 090 public PolymerType getPolymerType() {return polymerType;} 091 092 /** 093 * String value of the type 094 */ 095 public final String chem_comp_type; 096 097 public static ResidueType getResidueTypeFromString(String chem_comp_type) 098 { 099 100 chem_comp_type = chem_comp_type.replaceAll("'", ""); 101 chem_comp_type = chem_comp_type.replaceAll("\"", ""); 102 103 for(ResidueType rt : ResidueType.values()) 104 { 105 if(rt.chem_comp_type.equalsIgnoreCase(chem_comp_type)) 106 { 107 return rt; 108 } 109 if ( rt.chem_comp_type.startsWith(chem_comp_type)) 110 return rt; 111 if ( chem_comp_type.startsWith(rt.chem_comp_type)) 112 return rt; 113 } 114 return null; 115 } 116}