001package org.biopax.paxtools.pattern.miner;
002
003import java.util.Arrays;
004import java.util.List;
005
006/**
007 * Enum for representing supported SIF edge types.
008 *
009 * @author Ozgun Babur
010 */
011public enum SIFEnum implements SIFType
012{
013        CONTROLS_STATE_CHANGE_OF("First protein is controlling a reaction that changes the state of " +
014                "the second protein.", true, ControlsStateChangeOfMiner.class,
015                CSCOButIsParticipantMiner.class, CSCOBothControllerAndParticipantMiner.class,
016                CSCOThroughControllingSmallMoleculeMiner.class, CSCOThroughBindingSmallMoleculeMiner.class,
017                CSCOThroughDegradationMiner.class),
018        CONTROLS_TRANSPORT_OF("First protein is controlling a reaction that changes the cellular " +
019                "location of the second protein.", true, ControlsTransportMiner.class),
020        CONTROLS_PHOSPHORYLATION_OF("First protein is controlling a reaction that changes the " +
021                "phosphorylation status of the second protein.", true, ControlsPhosphorylationMiner.class),
022        CONTROLS_EXPRESSION_OF("First protein is controlling a conversion or a template reaction that" +
023                "changes expression of the second protein.", true, ControlsExpressionMiner.class,
024                ControlsExpressionWithConvMiner.class),
025        CATALYSIS_PRECEDES("First protein is controlling a reaction whose output molecule is input" +
026                " to another reaction controlled by the second protein.", true,
027                CatalysisPrecedesMiner.class),
028        IN_COMPLEX_WITH("Proteins appear as members of the same complex.", false,
029                InComplexWithMiner.class),
030        INTERACTS_WITH("Proteins appear as participants of the same MolecularInteraction.", false,
031                InteractsWithMiner.class),
032        NEIGHBOR_OF("Proteins appear as participants or controllers of the same interaction.", false,
033                NeighborOfMiner.class),
034        CONSUMPTION_CONTROLLED_BY("The small molecule is consumed by a reaction that is controlled by" +
035                " a protein.", true, ConsumptionControlledByMiner.class),
036        CONTROLS_PRODUCTION_OF("The protein is controlling a reaction of which the small molecule is " +
037                "an output.", true, ControlsProductionOfMiner.class),
038        CONTROLS_TRANSPORT_OF_CHEMICAL("The protein is controlling a reaction that changes cellular " +
039                "location of the small molecule.", true, ControlsTransportOfChemicalMiner.class),
040        CHEMICAL_AFFECTS("A small molecule has an effect on a protein.", true,
041                ChemicalAffectsThroughControlMiner.class, ChemicalAffectsThroughBindingMiner.class),
042        REACTS_WITH("A small molecule is input to a biochemical reaction together with another small " +
043                "molecule. None of the molecules are also output.", false, ReactsWithMiner.class),
044        USED_TO_PRODUCE("A small molecule is input to a biochemical reaction that produces " +
045                "another small molecule. Both small molecules appear at only one side of the reaction.",
046                true, UsedToProduceMiner.class),
047        ;
048
049        /**
050         * Constructor with parameters.
051         * @param description description of the edge type
052         * @param directed whether the edge type is directed
053         */
054        private SIFEnum(String description, boolean directed, Class<? extends SIFMiner>... miners)
055        {
056                this.description = description;
057                this.directed = directed;
058                this.miners = Arrays.asList(miners);
059        }
060
061        /**
062         * Description of the SIF type.
063         */
064        private String description;
065
066        /**
067         * Some SIF edges are directed and others are not.
068         */
069        private boolean directed;
070
071        /**
072         * SIF Miners to use during a search.
073         */
074        private List<Class<? extends SIFMiner>> miners;
075
076        /**
077         * Tag of a SIF type is derived from the enum name.
078         * @return tag
079         */
080        public String getTag()
081        {
082                return name().toLowerCase().replaceAll("_", "-");
083        }
084
085        /**
086         * Asks if the edge is directed.
087         * @return true if directed
088         */
089        public boolean isDirected()
090        {
091                return directed;
092        }
093
094        /**
095         * Gets the description of the SIF type.
096         * @return description
097         */
098        public String getDescription()
099        {
100                return description;
101        }
102
103        @Override
104        public List<Class<? extends SIFMiner>> getMiners()
105        {
106                return miners;
107        }
108
109        public static SIFEnum typeOf(String tag)
110        {
111                tag = tag.toUpperCase().replaceAll("-", "_");
112                SIFEnum type = null;
113                try
114                {
115                        type = valueOf(tag);
116                }
117                catch (IllegalArgumentException e){}
118                return type;
119        }
120}