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 */
021package org.biojava.nbio.aaproperties.xml;
022
023import javax.xml.bind.annotation.*;
024import java.util.List;
025
026@XmlRootElement(name = "compoundcomposition", namespace ="http://biojava.org")
027@XmlAccessorType(XmlAccessType.NONE)
028public class AminoAcidComposition {
029        /**
030         * Amino acid symbol - single character
031         */
032        @XmlAttribute(name = "symbol", required = true)
033        private String symbol;
034        /**
035         * Amino acid short name - three characters
036         */
037        @XmlAttribute(name = "shortname")
038        private String shortName;
039        /**
040         * Amino acid full name
041         */
042        @XmlAttribute(name = "name")
043        private String name;
044        /**
045         * Amino acid mass based on MOD ID
046         */
047        @XmlAttribute(name = "id")
048        String id;
049        /**
050         * Stores the name of the element and the amount this amino acid contains
051         */
052        @XmlElement(name = "element")
053        private List<Name2Count> elementList;
054        /**
055         * Stores the name of the isotope and the amount this amino acid contains
056         */
057        @XmlElement(name = "isotope", required = false)
058        private List<Name2Count> isotopeList;
059
060        public AminoAcidComposition(){}
061
062        public AminoAcidComposition(String symbol, String shortName, String name, List<Name2Count> elementList,
063                        List<Name2Count> isotopeList){
064                if(symbol.length() != 1){
065                        throw new Error("Symbol attribute must be of length 1.");
066                }
067                this.symbol = symbol.toUpperCase();
068                this.shortName = shortName;
069                this.name = name;
070                this.elementList = elementList;
071                this.isotopeList = isotopeList;
072        }
073
074        @Override
075        public String toString(){
076                return symbol + ", " + shortName + ", " + name;
077        }
078
079        public String getSymbol() {
080                return symbol;
081        }
082
083        public void setSymbol(String symbol) {
084                this.symbol = symbol;
085        }
086
087        public void setShortName(String shortName) {
088                this.shortName = shortName;
089        }
090
091        public String getShorName(){
092                return this.shortName;
093        }
094
095        public void setName(String name) {
096                this.name = name;
097        }
098
099        public String getName(){
100                return this.name;
101        }
102
103        public List<Name2Count> getElementList(){
104                return this.elementList;
105        }
106
107        public List<Name2Count> getIsotopeList(){
108                return this.isotopeList;
109        }
110}