001package org.biopax.paxtools.io.sif.level3; 002 003import org.biopax.paxtools.io.sif.BinaryInteractionType; 004import org.biopax.paxtools.io.sif.InteractionSet; 005import org.biopax.paxtools.io.sif.SimpleInteraction; 006import org.biopax.paxtools.model.Model; 007import org.biopax.paxtools.model.level3.EntityReference; 008 009/** 010 * Set of inferred interactions. This set handles grouping operations. 011 */ 012public class InteractionSetL3 extends InteractionSet 013{ 014 /** 015 * A map for the groups in the model. 016 */ 017 private GroupMap groupMap; 018 019 /** 020 * Constructor with the model. 021 * @param model model to mine binary interactions 022 */ 023 public InteractionSetL3(Model model) 024 { 025 this.groupMap = Grouper.inferGroups(model); 026 } 027 028 /** 029 * Getter for the groupMap 030 * @return groupMap 031 */ 032 public GroupMap getGroupMap() 033 { 034 return groupMap; 035 } 036 037 /** 038 * Creates membership links between group nodes and members in the generated SIF graph. 039 */ 040 public void convertGroupsToInteractions() 041 { 042 for (Group group : this.groupMap.getMap().values()) 043 { 044 for (EntityReference member : group.members) 045 { 046 this.add(new SimpleInteraction(groupMap.getEntityReferenceOrGroup(member),group,group.isComplex? 047 BinaryInteractionType.COMPONENT_OF:BinaryInteractionType.GENERIC_OF, 048 group.sources)); 049 } 050 for (Group subgroup : group.subgroups) 051 { 052 this.add(new SimpleInteraction(subgroup,group,group.isComplex?BinaryInteractionType 053 .COMPONENT_OF:BinaryInteractionType.GENERIC_OF, 054 group.sources)); 055 } 056 } 057 } 058 059 /** 060 * This method iteratively replaces groups with BioPAX elements 061 */ 062 public void expandGroups() 063 { 064 for (SimpleInteraction simpleInteraction : this) 065 { 066 067 } 068 } 069 070 071} 072