001package org.biopax.paxtools.io.sif.level3; 002 003import org.apache.commons.logging.Log; 004import org.apache.commons.logging.LogFactory; 005import org.biopax.paxtools.io.sif.BinaryInteractionType; 006import org.biopax.paxtools.model.Model; 007import org.biopax.paxtools.model.level3.*; 008import org.biopax.paxtools.model.level3.Process; 009 010import java.util.Arrays; 011import java.util.List; 012 013/** 014 * This rule mines the transctivation and transinhibition relations between entities. 015 * 016 * @author Ozgun Babur 017 */ 018public class ExpressionRule extends InteractionRuleL3Adaptor 019{ 020 /** 021 * Log for logging. 022 */ 023 private final Log log = LogFactory.getLog(ParticipatesRule.class); 024 025 /** 026 * Types of binary interactions that this class can generate. 027 */ 028 private static final List<BinaryInteractionType> binaryInteractionTypes = 029 Arrays.asList(BinaryInteractionType.UPREGULATE_EXPRESSION, 030 BinaryInteractionType.DOWNREGULATE_EXPRESSION); 031 032 /** 033 * Searches the transcriptional relations using the pattern, then decides the interaction type 034 * according to the type of the Control. 035 * @param interactionSet to be populated 036 * @param pe PhysicalEntity that will be the seed of the inference 037 * @param model BioPAX model 038 */ 039 @Override 040 public void inferInteractionsFromPE(InteractionSetL3 interactionSet, PhysicalEntity pe, 041 Model model) 042 { 043 for (Control ctrl : pe.getControllerOf()) 044 { 045 BinaryInteractionType type = ctrl.getControlType() != null && 046 ctrl.getControlType().toString().startsWith("I") ? 047 BinaryInteractionType.DOWNREGULATE_EXPRESSION : 048 BinaryInteractionType.UPREGULATE_EXPRESSION; 049 050 if (ctrl instanceof TemplateReactionRegulation) 051 { 052 for (Process process : ctrl.getControlled()) 053 { 054 if (process instanceof TemplateReaction) 055 { 056 TemplateReaction tr = (TemplateReaction) process; 057 for (PhysicalEntity prod : tr.getProduct()) 058 { 059 createAndAdd(interactionSet.getGroupMap().getEntityReferenceOrGroup(pe), 060 interactionSet.getGroupMap().getEntityReferenceOrGroup(prod), 061 interactionSet, type, ctrl, tr); 062 } 063 } 064 } 065 } 066 } 067 } 068 069 /** 070 * Gets a list of the rule types that this class implements. 071 * @return supported rules 072 */ 073 @Override 074 public List<BinaryInteractionType> getRuleTypes() 075 { 076 return binaryInteractionTypes; 077 } 078 079}