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 * Created on Feb 5, 2013 021 * Created by Andreas Prlic 022 * 023 * @since 3.0.2 024 */ 025package org.biojava.nbio.structure.io.mmcif.model; 026 027import java.io.Serializable; 028 029import org.slf4j.Logger; 030import org.slf4j.LoggerFactory; 031 032 033/* 034 * _chem_comp_bond.comp_id 035_chem_comp_bond.atom_id_1 036_chem_comp_bond.atom_id_2 037_chem_comp_bond.value_order 038_chem_comp_bond.pdbx_aromatic_flag 039_chem_comp_bond.pdbx_stereo_config 040_chem_comp_bond.pdbx_ordinal 041 */ 042public class ChemCompBond implements Serializable { 043 044 private static final long serialVersionUID = 5905371029161975421L; 045 046 private static final Logger logger = LoggerFactory.getLogger(ChemCompBond.class); 047 048 String comp_id; 049 String atom_id_1; 050 String atom_id_2; 051 String value_order; 052 String pdbx_aromatic_flag; 053 String pdbx_stereo_config; 054 String pdbx_ordinal; 055 public String getComp_id() { 056 return comp_id; 057 } 058 public void setComp_id(String comp_id) { 059 this.comp_id = comp_id; 060 } 061 public String getAtom_id_1() { 062 return atom_id_1; 063 } 064 public void setAtom_id_1(String atom_id_1) { 065 this.atom_id_1 = atom_id_1; 066 } 067 public String getAtom_id_2() { 068 return atom_id_2; 069 } 070 public void setAtom_id_2(String atom_id_2) { 071 this.atom_id_2 = atom_id_2; 072 } 073 public String getValue_order() { 074 return value_order; 075 } 076 public void setValue_order(String value_order) { 077 this.value_order = value_order; 078 } 079 public String getPdbx_aromatic_flag() { 080 return pdbx_aromatic_flag; 081 } 082 public void setPdbx_aromatic_flag(String pdbx_aromatic_flag) { 083 this.pdbx_aromatic_flag = pdbx_aromatic_flag; 084 } 085 public String getPdbx_stereo_config() { 086 return pdbx_stereo_config; 087 } 088 public void setPdbx_stereo_config(String pdbx_stereo_config) { 089 this.pdbx_stereo_config = pdbx_stereo_config; 090 } 091 public String getPdbx_ordinal() { 092 return pdbx_ordinal; 093 } 094 public void setPdbx_ordinal(String pdbx_ordinal) { 095 this.pdbx_ordinal = pdbx_ordinal; 096 } 097 098 /** 099 * Converts this ChemCompBond's value_order attribute into an int using the 100 * conversion: 101 * 102 * <pre> 103 * SING -> 1 104 * DOUB -> 2 105 * TRIP -> 3 106 * QUAD -> 4 107 * </pre> 108 * 109 * Any other values will return -1. 110 * <p> 111 * (Source: 112 * http://mmcif.rcsb.org/dictionaries/mmcif_mdb.dic/Items/_chem_comp_bond. 113 * value_order.html) 114 * 115 * @return the numerical value of this ChemCompBond's bond order, or -1 if 116 * the value is non-numeric or unknown. 117 */ 118 public int getNumericalBondOrder() { 119 if (value_order.equals("SING")) { 120 return 1; 121 } else if (value_order.equals("DOUB")) { 122 return 2; 123 } else if (value_order.equals("TRIP")) { 124 return 3; 125 } else if (value_order.equals("QUAD")) { 126 return 4; 127 } else { 128 logger.error("Unknown or non-numeric value for value_order: " 129 + value_order); 130 return -1; 131 } 132 } 133}