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.structure;
022
023/**
024 *
025 * The type of entity (polymer, non-polymer, water, macrolide)
026 * as defined in the mmCIF dictionary: <a href="http://mmcif.wwpdb.org/dictionaries/mmcif_pdbx_v40.dic/Items/_entity.type.html"></a>
027 * <p>
028 * Entities are of four types:  polymer, non-polymer, macrolide and water.
029 * <p>
030 * Note that the water category includes only water;  ordered
031 * solvent such as sulfate ion or acetone would be described as
032 * individual non-polymer entities.
033 * It is not clear what macrolides are, but they appear to be supported since mmCIF 4.0.
034 *
035 *
036 * @author Anthony Bradley
037 * @author Jose Duarte
038 *
039 */
040public enum EntityType {
041
042        /**
043         * Polymeric entities: poly-peptides and nucleotide chains
044         */
045        POLYMER("polymer"),
046
047        /**
048         * The 'branched' type use mainly to represent carbohydrates.
049         * The type was introduced in these versions of the mmcif dictionary:
050         * 5.101        2012-08-22
051         * 5.291        2017-09-10
052         * 5.304        2018-08-01
053         * The type will only be used for PDB-deposited files from July 2020, as part of
054         * the carbohydrate remediation project.
055         * @since 5.4.0
056         */
057        BRANCHED("branched"),
058
059        /**
060         * Non-polymeric entities: ligands, metal ions, buffer molecules, etc
061         */
062        NONPOLYMER("non-polymer"),
063
064        /**
065         * Water
066         */
067        WATER("water"),
068
069        /**
070         * Macrolide. Supported in mmCIF 4.0 dictionary. Not clear what it refers to.
071         */
072        MACROLIDE("macrolide");
073
074        private String entityType;
075
076        /**
077         * @param entType the type of the Entity
078         */
079        private EntityType(String entType) {
080
081                this.setEntityType(entType);
082
083        }
084
085        /**
086         * Returns the type of the Entity as a String
087         *
088         * @return String representation of the entity type.
089         */
090        public String getEntityType() {
091                return entityType;
092        }
093
094
095        private void setEntityType(String entityType) {
096                this.entityType = entityType;
097        }
098
099        /**
100         * Creates a new EntityType from a String value.
101         * Returns null if entityType is null or not one of the supported
102         * standard types.
103         *
104         * @param entityType String value , should be one of "polymer","non-polymer","water","macrolide"
105         * @return an EntityType object
106         */
107        public static EntityType entityTypeFromString(String entityType)
108        {
109
110                if ( entityType == null)
111                        return null;
112
113                for(EntityType et : EntityType.values())
114                {
115                        if(entityType.equals(et.entityType))
116                        {
117                                return et;
118                        }
119                }
120                return null;
121        }
122
123}