Class ConstraintAdapter
java.lang.Object
org.biopax.paxtools.pattern.constraint.ConstraintAdapter
- All Implemented Interfaces:
Constraint
- Direct Known Subclasses:
ActivityConstraint,ActivityModificationChangeConstraint,ConstraintChain,ControlsNotParticipant,ControlToControllerER,ConversionSide,Empty,Equality,Field,HasAnID,IDConstraint,InterToPartER,LinkedPE,ModificationChangeConstraint,NonUbique,NOT,OR,Participant,ParticipatesInConv,PathConstraint,PEChainsIntersect,RelatedControl,SelfOrThis,Size,Type
This is a base class for a Constraint. Most constraints should typically extend this class.
- Author:
- Ozgun Babur
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedEmpty constructor.protectedConstraintAdapter(int size) Constructor with size.protectedConstraintAdapter(int size, Blacklist blacklist) Constructor with size. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidassertIndLength(int[] ind) Asserts the size of teh parameter array is equal to the variable size.booleanSpecifies if the constraint is generative.protected ConversionDirectionTypeprotected ConversionDirectionTypeSearches the controlling catalysis for possible direction of the conversion.protected ConversionDirectionTypeSearches pathways that contains this conversion for the possible directions.This method has to be overridden by generative constraints.protected ConversionDirectionTypegetCatalysisDirection(Control cont) Gets the direction of the Control, if exists.getControlChain(Control control, Interaction inter) Gets the chain of Control, staring from the given Control, leading to the given Interaction.protected Set<PhysicalEntity> getConvParticipants(Conversion conv, RelType type) Gets input ot output participants of the Conversion.protected ConversionDirectionTypegetDirection(Conversion conv) protected ConversionDirectionTypegetDirection(Conversion conv, Control cont) Gets the direction of the Control chain the the Interaction.protected ConversionDirectionTypegetDirection(Conversion conv, Pathway pathway) Gets the direction of the Control chain the the Interaction.protected ConversionDirectionTypegetDirection(Conversion conv, Pathway pathway, Control cont) Gets the direction of the Control chain the the Interaction.intGets the variable size of the constraint.booleanUse this method only if constraint canGenerate, and satisfaction criteria is that simple.voidsetSize(int size) Sets the size of the constraint.
-
Field Details
-
size
protected int sizeSize of the constraint. This is defined by how many elements this constraint needs to be \ mapped to work. -
blacklist
Blacklist to detect ubiquitous small molecules.
-
-
Constructor Details
-
ConstraintAdapter
protected ConstraintAdapter(int size) Constructor with size.- Parameters:
size- size if the constraint.
-
ConstraintAdapter
Constructor with size.- Parameters:
size- size if the constraint.blacklist- for detecting ubiquitous small molecules
-
ConstraintAdapter
protected ConstraintAdapter()Empty constructor. Note that specifying the size is not mandatory since the child constraint can overridegetVariableSizeinstead of using the size variable.
-
-
Method Details
-
canGenerate
public boolean canGenerate()Specifies if the constraint is generative. If you override this method, then don't forget to also override getGeneratedInd, and generate methods.- Specified by:
canGeneratein interfaceConstraint- Returns:
- true if constraint is generative
-
generate
This method has to be overridden by generative constraints.- Specified by:
generatein interfaceConstraint- Parameters:
match- current pattern matchind- mapped indices- Returns:
- elements that satisfy this constraint
-
satisfies
Use this method only if constraint canGenerate, and satisfaction criteria is that simple.- Specified by:
satisfiesin interfaceConstraint- Parameters:
match- current pattern matchind- mapped indices- Returns:
- true if the match satisfies this constraint
-
assertIndLength
protected void assertIndLength(int[] ind) Asserts the size of teh parameter array is equal to the variable size.- Parameters:
ind- index array to assert its size
-
setSize
public void setSize(int size) Sets the size of the constraint.- Parameters:
size- size of the constraint
-
getVariableSize
public int getVariableSize()Gets the variable size of the constraint.- Specified by:
getVariableSizein interfaceConstraint- Returns:
- variable size
-
getDirection
Gets the direction of the Control chain the the Interaction.- Parameters:
conv- controlled conversioncont- top control- Returns:
- the direction of the conversion related to the catalysis
-
getDirection
Gets the direction of the Control chain the the Interaction.- Parameters:
conv- controlled conversionpathway- the container pathwaycont- top control- Returns:
- the direction of the conversion related to the catalysis
-
getDirection
Gets the direction of the Control chain the the Interaction.- Parameters:
conv- controlled conversionpathway- the container pathway- Returns:
- the direction of the conversion related to the catalysis
-
getCatalysisDirection
Gets the direction of the Control, if exists.- Parameters:
cont- Control to get its direction- Returns:
- the direction of the Control
-
getControlChain
Gets the chain of Control, staring from the given Control, leading to the given Interaction. Use this method only if you are sure that there is a link from the control to conversion. Otherwise a RuntimeException is thrown. This assumes that there is only one control chain towards the interaction. It not, then one of the chains will be returned.- Parameters:
control- top level Controlinter- target Interaction- Returns:
- Control chain controlling the Interaction
-
getConvParticipants
Gets input ot output participants of the Conversion.- Parameters:
conv- Conversion to get participantstype- input or output- Returns:
- related participants
-
findDirectionInPathways
Searches pathways that contains this conversion for the possible directions. If both directions exist, then the result is reversible.- Parameters:
conv- the conversion- Returns:
- direction inferred from pathway membership
-
convertStepDirection
-
findDirectionInCatalysis
Searches the controlling catalysis for possible direction of the conversion.- Parameters:
conv- the conversion- Returns:
- direction inferred from catalysis objects
-
getDirection
-