idx
int64
0
41.2k
question
stringlengths
74
4.21k
target
stringlengths
5
888
6,100
public static Constraint isHuman ( ) { return new OR ( new MappedConst ( new Field ( "SequenceEntityReference/organism/displayName" , Field . Operation . INTERSECT , "Homo sapiens" ) , 0 ) , new MappedConst ( new Field ( "PhysicalEntity/entityReference/organism/displayName" , Field . Operation . INTERSECT , "Homo sapiens" ) , 0 ) ) ; }
Makes sure the EntityReference or the PhysicalEntity belongs to human . Please note that this check depends on the display name of the related BioSource object to be Homo sapiens . If that is not the case the constraint won t work .
6,101
public static Constraint modificationConstraint ( String modifTerm ) { return new FieldOfMultiple ( new MappedConst ( new LinkedPE ( LinkedPE . Type . TO_SPECIFIC ) , 0 ) , "PhysicalEntity/feature:ModificationFeature/modificationType/term" , Field . Operation . INTERSECT , modifTerm ) ; }
Makes sure that the PhysicalEntity or any linked PE contains the modification term . Size = 1 .
6,102
public static Constraint inSamePathway ( ) { String s1 = "Interaction/stepProcessOf/pathwayOrderOf" ; String s2 = "Interaction/pathwayComponentOf" ; return new OR ( new MappedConst ( new Field ( s1 , s1 , Field . Operation . INTERSECT ) , 0 , 1 ) , new MappedConst ( new Field ( s2 , s2 , Field . Operation . INTERSECT ) , 0 , 1 ) ) ; }
Makes sure that the two interactions are members of the same pathway .
6,103
public static Constraint hasDifferentCompartments ( ) { String acStr = "PhysicalEntity/cellularLocation/term" ; return new Field ( acStr , acStr , Field . Operation . NOT_EMPTY_AND_NOT_INTERSECT ) ; }
Checks if two physical entities have non - empty and different compartments .
6,104
protected void initMaps ( ) { dist = new HashMap < GraphObject , Integer > ( ) ; colors = new HashMap < GraphObject , Integer > ( ) ; queue = new LinkedList < Node > ( ) ; }
Initializes maps used during query .
6,105
protected void processNode ( Node current ) { if ( current . isUbique ( ) ) { setColor ( current , BLACK ) ; return ; } for ( Edge edge : direction == Direction . DOWNSTREAM ? current . getDownstream ( ) : current . getUpstream ( ) ) { assert edge != null ; if ( direction == Direction . DOWNSTREAM || ! current . isBreadthNode ( ) ) { setLabel ( edge , getLabel ( current ) ) ; } else { setLabel ( edge , getLabel ( current ) + 1 ) ; } Node neigh = direction == Direction . DOWNSTREAM ? edge . getTargetNode ( ) : edge . getSourceNode ( ) ; assert neigh != null ; int dist = getLabel ( edge ) ; if ( neigh . isBreadthNode ( ) && direction == Direction . DOWNSTREAM ) dist ++ ; boolean further = ( stopSet == null || ! isEquivalentInTheSet ( neigh , stopSet ) ) && ( ! neigh . isBreadthNode ( ) || dist < limit ) && ! neigh . isUbique ( ) ; if ( getColor ( neigh ) == WHITE ) { setLabel ( neigh , dist ) ; if ( further ) { setColor ( neigh , GRAY ) ; if ( neigh . isBreadthNode ( ) ) { queue . addLast ( neigh ) ; } else { queue . addFirst ( neigh ) ; } } else { setColor ( neigh , BLACK ) ; } } labelEquivRecursive ( neigh , UPWARD , getLabel ( neigh ) , further , ! neigh . isBreadthNode ( ) ) ; labelEquivRecursive ( neigh , DOWNWARD , getLabel ( neigh ) , further , ! neigh . isBreadthNode ( ) ) ; } }
Processes a node .
6,106
protected void labelEquivRecursive ( Node node , boolean up , int dist , boolean enqueue , boolean head ) { if ( node == null ) { LOG . error ( "labelEquivRecursive: null (Node)" ) ; return ; } for ( Node equiv : up ? node . getUpperEquivalent ( ) : node . getLowerEquivalent ( ) ) { if ( getColor ( equiv ) == WHITE ) { setLabel ( equiv , dist ) ; if ( enqueue ) { setColor ( equiv , GRAY ) ; if ( head ) queue . addFirst ( equiv ) ; else queue . add ( equiv ) ; } else { setColor ( equiv , BLACK ) ; } } labelEquivRecursive ( equiv , up , dist , enqueue , head ) ; } }
Labels equivalent nodes recursively .
6,107
protected int getColor ( Node node ) { if ( ! colors . containsKey ( node ) ) { return WHITE ; } else { return colors . get ( node ) ; } }
Gets color tag of the node
6,108
public int getLabel ( GraphObject go ) { if ( ! dist . containsKey ( go ) ) { return Integer . MAX_VALUE - ( limit * 2 ) ; } else { return dist . get ( go ) ; } }
Gets the distance label of the object .
6,109
public boolean satisfies ( Match match , int ... ind ) { Control ctrl = ( Control ) match . get ( ind [ 0 ] ) ; for ( Process process : ctrl . getControlled ( ) ) { if ( process instanceof Interaction ) { Interaction inter = ( Interaction ) process ; Set < Entity > participant = inter . getParticipant ( ) ; for ( Controller controller : ctrl . getController ( ) ) { if ( participant . contains ( controller ) ) return false ; } } } return true ; }
Checks if the controlled Interaction contains a controller as a participant . This constraint filters out such cases .
6,110
public void setBindsTo ( BindingFeature bindsTo ) { if ( this . bindsTo != bindsTo ) { BindingFeature old = this . bindsTo ; this . bindsTo = bindsTo ; if ( old != null && old . getBindsTo ( ) == this ) { old . setBindsTo ( null ) ; } if ( ! ( this . bindsTo == null || this . bindsTo . getBindsTo ( ) == this ) ) { this . bindsTo . setBindsTo ( this ) ; } } }
This method will set the paired binding feature that binds to this feature . This method will preserve the symmetric bidirectional semantics . If not - null old feature s bindsTo will be set to null and if not null new feature s binds to will set to this
6,111
public < T extends LocalizableResource > T create ( Class < T > cls , String locale ) { Locale l = null ; if ( locale != null ) { String [ ] parts = locale . split ( "_" , 3 ) ; l = new Locale ( parts [ 0 ] , parts . length > 1 ? parts [ 1 ] : "" , parts . length > 2 ? parts [ 2 ] : "" ) ; } return LocaleProxy . create ( cls , l ) ; }
Create the resource using the Locale provided . If the locale is null the locale is retrieved from the LocaleProvider in LocaleProxy .
6,112
public boolean atEquivalentLocation ( EntityFeature that ) { return getEntityFeatureOf ( ) != null && getEntityFeatureOf ( ) . isEquivalent ( that . getEntityFeatureOf ( ) ) && getFeatureLocation ( ) != null && getFeatureLocation ( ) . isEquivalent ( that . getFeatureLocation ( ) ) ; }
This method returns true if and only if two entity features are on the same known location on a known ER . Unknown location or ER on any one of the features results in a false .
6,113
public static List < Match > search ( Match m , Pattern pattern ) { assert pattern . getStartingClass ( ) . isAssignableFrom ( m . get ( 0 ) . getModelInterface ( ) ) ; return searchRecursive ( m , pattern . getConstraints ( ) , 0 ) ; }
Searches the pattern starting from the given match . The first element of the match should be assigned . Others are optional .
6,114
public static List < Match > search ( BioPAXElement ele , Pattern pattern ) { assert pattern . getStartingClass ( ) . isAssignableFrom ( ele . getModelInterface ( ) ) ; Match m = new Match ( pattern . size ( ) ) ; m . set ( ele , 0 ) ; return search ( m , pattern ) ; }
Searches the pattern starting from the given element .
6,115
public static List < Match > searchRecursive ( Match match , List < MappedConst > mc , int index ) { List < Match > result = new ArrayList < Match > ( ) ; Constraint con = mc . get ( index ) . getConstr ( ) ; int [ ] ind = mc . get ( index ) . getInds ( ) ; int lastInd = ind [ ind . length - 1 ] ; if ( con . canGenerate ( ) && match . get ( lastInd ) == null ) { Collection < BioPAXElement > elements = con . generate ( match , ind ) ; for ( BioPAXElement ele : elements ) { match . set ( ele , lastInd ) ; if ( mc . size ( ) == index + 1 ) { result . add ( ( Match ) match . clone ( ) ) ; } else { result . addAll ( searchRecursive ( match , mc , index + 1 ) ) ; } match . set ( null , lastInd ) ; } } else { if ( con . satisfies ( match , ind ) ) { if ( mc . size ( ) == index + 1 ) { result . add ( ( Match ) match . clone ( ) ) ; } else { result . addAll ( searchRecursive ( match , mc , index + 1 ) ) ; } } } return result ; }
Continues searching with the mapped constraint at the given index .
6,116
public static List < Match > searchPlain ( Model model , Pattern pattern ) { List < Match > list = new LinkedList < Match > ( ) ; Map < BioPAXElement , List < Match > > map = search ( model , pattern ) ; for ( List < Match > matches : map . values ( ) ) { list . addAll ( matches ) ; } return list ; }
Searches the pattern in a given model but instead of a match map returns all matches in a list .
6,117
public static List < Match > searchPlain ( Collection < ? extends BioPAXElement > eles , Pattern pattern ) { List < Match > list = new LinkedList < Match > ( ) ; Map < BioPAXElement , List < Match > > map = search ( eles , pattern ) ; for ( List < Match > matches : map . values ( ) ) { list . addAll ( matches ) ; } return list ; }
Searches the pattern starting from given elements but instead of a match map returns all matches in a list .
6,118
public static Map < BioPAXElement , List < Match > > search ( final Collection < ? extends BioPAXElement > eles , final Pattern pattern ) { final Map < BioPAXElement , List < Match > > map = new ConcurrentHashMap < BioPAXElement , List < Match > > ( ) ; final ExecutorService exec = Executors . newFixedThreadPool ( 10 ) ; for ( final BioPAXElement ele : eles ) { if ( ! pattern . getStartingClass ( ) . isAssignableFrom ( ele . getModelInterface ( ) ) ) continue ; exec . execute ( new Runnable ( ) { public void run ( ) { List < Match > matches = search ( ele , pattern ) ; if ( ! matches . isEmpty ( ) ) { map . put ( ele , matches ) ; } } } ) ; } exec . shutdown ( ) ; try { exec . awaitTermination ( 10 , TimeUnit . MINUTES ) ; } catch ( InterruptedException e ) { throw new RuntimeException ( "search, failed due to exec timed out." , e ) ; } return Collections . unmodifiableMap ( new HashMap < BioPAXElement , List < Match > > ( map ) ) ; }
Searches the given pattern starting from the given elements .
6,119
public static < T extends BioPAXElement > Set < T > searchAndCollect ( Model model , Pattern pattern , int index , Class < T > c ) { return searchAndCollect ( model . getObjects ( pattern . getStartingClass ( ) ) , pattern , index , c ) ; }
Searches a model for the given pattern then collects the specified elements of the matches and returns .
6,120
public static < T extends BioPAXElement > Set < T > searchAndCollect ( Collection < ? extends BioPAXElement > eles , Pattern pattern , int index , Class < T > c ) { Set < T > set = new HashSet < T > ( ) ; for ( Match match : searchPlain ( eles , pattern ) ) { set . add ( ( T ) match . get ( index ) ) ; } return set ; }
Searches the given pattern starting from the given elements then collects the specified elements of the matches and returns .
6,121
public static < T extends BioPAXElement > Set < T > searchAndCollect ( BioPAXElement ele , Pattern pattern , int index , Class < T > c ) { Set < T > set = new HashSet < T > ( ) ; for ( Match match : search ( ele , pattern ) ) { set . add ( ( T ) match . get ( index ) ) ; } return set ; }
Searches the given pattern starting from the given element then collects the specified elements of the matches and returns .
6,122
public boolean hasSolution ( Pattern p , BioPAXElement ... ele ) { Match m = new Match ( p . size ( ) ) ; for ( int i = 0 ; i < ele . length ; i ++ ) { m . set ( ele [ i ] , i ) ; } return ! search ( m , p ) . isEmpty ( ) ; }
Checks if there is any match for the given pattern if search starts from the given element .
6,123
public static void searchInFile ( Pattern p , String inFile , String outFile ) throws FileNotFoundException { searchInFile ( p , inFile , outFile , Integer . MAX_VALUE , Integer . MAX_VALUE ) ; }
Searches a pattern reading the model from the given file and creates another model that is excised using the matching patterns .
6,124
public static void searchInFile ( Pattern p , String inFile , String outFile , int seedLimit , int graphPerSeed ) throws FileNotFoundException { SimpleIOHandler h = new SimpleIOHandler ( ) ; Model model = h . convertFromOWL ( new FileInputStream ( inFile ) ) ; Map < BioPAXElement , List < Match > > matchMap = Searcher . search ( model , p ) ; System . out . println ( "matching groups size = " + matchMap . size ( ) ) ; List < Set < Interaction > > inters = new LinkedList < Set < Interaction > > ( ) ; Set < Integer > encountered = new HashSet < Integer > ( ) ; Set < BioPAXElement > toExise = new HashSet < BioPAXElement > ( ) ; int seedCounter = 0 ; for ( BioPAXElement ele : matchMap . keySet ( ) ) { if ( seedCounter >= seedLimit ) break ; int matchCounter = 0 ; List < Match > matches = matchMap . get ( ele ) ; if ( ! matches . isEmpty ( ) ) seedCounter ++ ; for ( Match match : matches ) { matchCounter ++ ; if ( matchCounter > graphPerSeed ) break ; Set < Interaction > ints = getInter ( match ) ; toExise . addAll ( Arrays . asList ( match . getVariables ( ) ) ) ; toExise . addAll ( ints ) ; Integer hash = hashSum ( ints ) ; if ( ! encountered . contains ( hash ) ) { encountered . add ( hash ) ; inters . add ( ints ) ; } } } System . out . println ( "created pathways = " + inters . size ( ) ) ; Model clonedModel = excise ( toExise ) ; int i = 0 ; for ( Set < Interaction > ints : inters ) { Pathway pathway = clonedModel . addNew ( Pathway . class , System . currentTimeMillis ( ) + "PaxtoolsPatternGeneratedMatch" + ( ++ i ) ) ; pathway . setDisplayName ( "Match " + getLeadingZeros ( i , inters . size ( ) ) + i ) ; for ( Interaction anInt : ints ) { pathway . addPathwayComponent ( ( Process ) clonedModel . getByID ( anInt . getUri ( ) ) ) ; } } handler . convertToOWL ( clonedModel , new FileOutputStream ( outFile ) ) ; }
Searches a pattern reading the model from the given file and creates another model that is excised using the matching patterns . Users can limit the max number of starting element and max number of matches for any starting element . These parameters is good for limiting the size of the result graph .
6,125
private static String getLeadingZeros ( int i , int size ) { assert i <= size ; int w1 = ( int ) Math . floor ( Math . log10 ( size ) ) ; int w2 = ( int ) Math . floor ( Math . log10 ( i ) ) ; String s = "" ; for ( int j = w2 ; j < w1 ; j ++ ) { s += "0" ; } return s ; }
Prepares an int for printing with leading zeros for the given size .
6,126
private static Model excise ( Set < BioPAXElement > result ) { Completer c = new Completer ( EM ) ; result = c . complete ( result ) ; Cloner cln = new Cloner ( EM , BioPAXLevel . L3 . getDefaultFactory ( ) ) ; return cln . clone ( result ) ; }
Excises a model to the given elements .
6,127
private static Set < Interaction > getInter ( Match match ) { Set < Interaction > set = new HashSet < Interaction > ( ) ; for ( BioPAXElement ele : match . getVariables ( ) ) { if ( ele instanceof Interaction ) { set . add ( ( Interaction ) ele ) ; addControlsRecursive ( ( Interaction ) ele , set ) ; } } return set ; }
Gets all interactions in a match .
6,128
private static void addControlsRecursive ( Interaction inter , Set < Interaction > set ) { for ( Control ctrl : inter . getControlledOf ( ) ) { set . add ( ctrl ) ; addControlsRecursive ( ctrl , set ) ; } }
Adds controls of the given interactions recursively to the given set .
6,129
private static Integer hashSum ( Set < Interaction > set ) { int x = 0 ; for ( Interaction inter : set ) { x += inter . hashCode ( ) ; } return x ; }
Creates a hash code for a set of interactions .
6,130
public boolean satisfies ( Match match , int ... ind ) { assertIndLength ( ind ) ; return con . generate ( match , ind ) . isEmpty ( ) ; }
Checks if the wrapped Constraint can generate any elements . This satisfies if it cannot .
6,131
protected void addToUpstream ( BioPAXElement ele , Graph graph ) { AbstractNode node = ( AbstractNode ) graph . getGraphObject ( ele ) ; if ( node == null ) return ; Edge edge = new EdgeL3 ( node , this , graph ) ; if ( isTranscription ( ) ) { if ( node instanceof ControlWrapper ) { ( ( ControlWrapper ) node ) . setTranscription ( true ) ; } } node . getDownstreamNoInit ( ) . add ( edge ) ; this . getUpstreamNoInit ( ) . add ( edge ) ; }
Bind the wrapper of the given element to the upstream .
6,132
private boolean passesFilters ( Level3Element ele ) { if ( filters == null ) return true ; for ( Filter filter : filters ) { if ( ! filter . okToTraverse ( ele ) ) return false ; } return true ; }
There must be no filter opposing to traverse this object to traverse it .
6,133
public String getKey ( Object wrapped ) { if ( wrapped instanceof BioPAXElement ) { return ( ( BioPAXElement ) wrapped ) . getUri ( ) ; } throw new IllegalArgumentException ( "Object cannot be wrapped: " + wrapped ) ; }
RDF IDs of elements is used as key in the object map .
6,134
public Set < Node > getWrapperSet ( Set < ? > objects ) { Set < Node > wrapped = new HashSet < Node > ( ) ; for ( Object object : objects ) { Node node = ( Node ) getGraphObject ( object ) ; if ( node != null ) { wrapped . add ( node ) ; } } return wrapped ; }
Gets wrappers of given elements
6,135
public Map < Object , Node > getWrapperMap ( Set < ? > objects ) { Map < Object , Node > map = new HashMap < Object , Node > ( ) ; for ( Object object : objects ) { Node node = ( Node ) getGraphObject ( object ) ; if ( node != null ) { map . put ( object , node ) ; } } return map ; }
Gets an element - to - wrapper map for the given elements .
6,136
public Collection < BioPAXElement > generate ( Match match , int ... ind ) { Collection < BioPAXElement > gen = new HashSet < BioPAXElement > ( con [ 0 ] . generate ( match , ind ) ) ; for ( int i = 1 ; i < con . length ; i ++ ) { if ( gen . isEmpty ( ) ) break ; gen . retainAll ( con [ i ] . generate ( match , ind ) ) ; } return gen ; }
Gets intersection of the generated elements by the member constraints .
6,137
public Collection < BioPAXElement > generate ( Match match , int ... ind ) { PhysicalEntity pe = ( PhysicalEntity ) match . get ( ind [ 0 ] ) ; Set < BioPAXElement > set = getLinkedElements ( pe ) ; return set ; }
Gets to the linked PhysicalEntity .
6,138
protected void enrichWithGenerics ( Set < BioPAXElement > seed , Set < BioPAXElement > all ) { Set addition ; if ( type == Type . TO_GENERAL ) addition = access ( upperGenAcc , seed , all ) ; else addition = access ( lowerGenAcc , seed , all ) ; all . addAll ( addition ) ; seed . addAll ( addition ) ; enrichWithCM ( seed , all ) ; }
Gets the linked homologies and then switches to complex - relationship mode . These two enrich methods call each other recursively .
6,139
protected void enrichWithCM ( Set < BioPAXElement > seed , Set < BioPAXElement > all ) { Set addition = access ( type == Type . TO_GENERAL ? complexAcc : memberAcc , seed , all ) ; if ( blacklist != null ) addition = blacklist . getNonUbiqueObjects ( addition ) ; if ( ! addition . isEmpty ( ) ) { all . addAll ( addition ) ; enrichWithGenerics ( addition , all ) ; } }
Gets parent complexes or complex members recursively according to the type of the linkage .
6,140
public static < D extends BioPAXElement , R > PropertyEditor < D , R > createPropertyEditor ( Class < D > domain , String property ) { PropertyEditor editor = null ; try { Method getMethod = detectGetMethod ( domain , property ) ; boolean multipleCardinality = isMultipleCardinality ( getMethod ) ; Class < R > range = detectRange ( getMethod ) ; if ( range . isPrimitive ( ) || range . equals ( Boolean . class ) ) { editor = new PrimitivePropertyEditor < D , R > ( property , getMethod , domain , range , multipleCardinality ) ; } else if ( range . isEnum ( ) ) { editor = new EnumeratedPropertyEditor ( property , getMethod , domain , range , multipleCardinality ) ; } else if ( range . equals ( String . class ) ) { editor = new StringPropertyEditor ( property , getMethod , domain , multipleCardinality ) ; } else { editor = new ObjectPropertyEditor ( property , getMethod , domain , range , multipleCardinality ) ; } } catch ( NoSuchMethodException e ) { if ( log . isWarnEnabled ( ) ) log . warn ( "Failed creating the controller for " + property + " on " + domain ) ; } return editor ; }
This method creates a property reflecting on the domain and property . Proper subclass is chosen based on the range of the property .
6,141
private static String getJavaName ( String owlName ) { String s = owlName . replaceAll ( "-" , "_" ) ; s = s . substring ( 0 , 1 ) . toUpperCase ( ) + s . substring ( 1 ) ; return s ; }
Given the name of a property s name as indicated in the OWL file this method converts the name to a Java compatible name .
6,142
public static String getDataTypeDef ( String datatypeKey ) { Datatype datatype = getDatatype ( datatypeKey ) ; return datatype . getDefinition ( ) ; }
Retrieves the definition of a data type .
6,143
public static String [ ] getDataResources ( String datatypeKey ) { Set < String > locations = new HashSet < String > ( ) ; Datatype datatype = getDatatype ( datatypeKey ) ; for ( Resource resource : getResources ( datatype ) ) { String link = resource . getDataResource ( ) ; locations . add ( link ) ; } return locations . toArray ( ARRAY_OF_STRINGS ) ; }
Retrieves home page URLs of a datatype .
6,144
public static boolean isDeprecated ( String uri ) { Datatype datatype = datatypesHash . get ( uri ) ; String urn = getOfficialDataTypeURI ( datatype ) ; return ! uri . equalsIgnoreCase ( urn ) ; }
To know if a URI of a data type is deprecated .
6,145
public static String getName ( String datatypeKey ) { Datatype datatype = getDatatype ( datatypeKey ) ; return datatype . getName ( ) ; }
Retrieves the preferred name of a data type .
6,146
public static String [ ] getDataTypesName ( ) { Set < String > dataTypeNames = new HashSet < String > ( ) ; for ( Datatype datatype : miriam . getDatatype ( ) ) { dataTypeNames . add ( datatype . getName ( ) ) ; } return dataTypeNames . toArray ( ARRAY_OF_STRINGS ) ; }
Retrieves the list of preferred names of all the data types available .
6,147
public static String convertUrn ( String urn ) { String [ ] tokens = urn . split ( ":" ) ; return "http://identifiers.org/" + tokens [ tokens . length - 2 ] + "/" + URLDecoder . decode ( tokens [ tokens . length - 1 ] ) ; }
Converts a MIRIAM URN into its equivalent Identifiers . org URL .
6,148
public boolean satisfies ( Match match , int ... ind ) { int x = - 1 ; for ( MappedConst mc : con ) { if ( mc . satisfies ( match , ind ) ) x *= - 1 ; } return x == 1 ; }
Checks if constraints satisfy in xor pattern .
6,149
public Collection < BioPAXElement > generate ( Match match , int ... ind ) { Collection < BioPAXElement > gen = new HashSet < BioPAXElement > ( con [ 0 ] . generate ( match , ind ) ) ; for ( int i = 1 ; i < con . length ; i ++ ) { if ( gen . isEmpty ( ) ) break ; Collection < BioPAXElement > subset = con [ i ] . generate ( match , ind ) ; Set < BioPAXElement > copy = new HashSet < BioPAXElement > ( subset ) ; copy . removeAll ( gen ) ; gen . removeAll ( subset ) ; gen . addAll ( copy ) ; } return gen ; }
Gets xor of the generated elements by the member constraints .
6,150
public boolean satisfies ( Match match , int ... ind ) { assert ind . length == 1 ; return clazz . isAssignableFrom ( match . get ( ind [ 0 ] ) . getModelInterface ( ) ) ; }
Checks if the element is assignable to a variable of the desired type .
6,151
public void run ( Entry entry ) { final Set < String > avail = new HashSet < String > ( ) ; if ( entry . hasAvailabilities ( ) ) { for ( Availability a : entry . getAvailabilities ( ) ) if ( a . hasValue ( ) ) avail . add ( a . getValue ( ) ) ; } final Provenance pro = createProvenance ( entry . getSource ( ) ) ; Set < Interaction > participantInteractions = new HashSet < Interaction > ( ) ; for ( Interaction interaction : entry . getInteractions ( ) ) { for ( Participant participant : interaction . getParticipants ( ) ) { if ( participant . hasInteraction ( ) ) { participantInteractions . add ( participant . getInteraction ( ) ) ; } } } for ( Interaction interaction : entry . getInteractions ( ) ) { if ( ! participantInteractions . contains ( interaction ) ) { processInteraction ( interaction , avail , pro , false ) ; } } }
Convert a PSIMI entry to BioPAX interactions participants etc . objects and add to the target BioPAX model .
6,152
public Collection < BioPAXElement > generate ( Match match , int ... ind ) { Interaction inter = ( Interaction ) match . get ( ind [ 0 ] ) ; Set < Entity > taboo = new HashSet < Entity > ( ) ; for ( int i = 1 ; i < getVariableSize ( ) - 1 ; i ++ ) { taboo . add ( ( Entity ) match . get ( ind [ i ] ) ) ; } if ( direction == null ) return generate ( inter , taboo ) ; else return generate ( ( Conversion ) inter , direction , taboo ) ; }
Iterated over non - taboo participants and collectes related ER .
6,153
protected Collection < BioPAXElement > generate ( Interaction inter , Set < Entity > taboo ) { Set < BioPAXElement > simples = new HashSet < BioPAXElement > ( ) ; for ( Entity part : inter . getParticipant ( ) ) { if ( part instanceof PhysicalEntity && ! taboo . contains ( part ) ) { simples . addAll ( linker . getLinkedElements ( ( PhysicalEntity ) part ) ) ; } } return pe2ER . getValueFromBeans ( simples ) ; }
Gets the related entity references of the given interaction .
6,154
protected Collection < BioPAXElement > generate ( Conversion conv , Direction direction , Set < Entity > taboo ) { if ( direction == null ) throw new IllegalArgumentException ( "Direction cannot be null" ) ; if ( ! ( direction == Direction . BOTHSIDERS || direction == Direction . ONESIDERS ) ) { Set < BioPAXElement > simples = new HashSet < BioPAXElement > ( ) ; for ( Entity part : direction == Direction . ANY ? conv . getParticipant ( ) : direction == Direction . LEFT ? conv . getLeft ( ) : conv . getRight ( ) ) { if ( part instanceof PhysicalEntity && ! taboo . contains ( part ) ) { simples . addAll ( linker . getLinkedElements ( ( PhysicalEntity ) part ) ) ; } } return pe2ER . getValueFromBeans ( simples ) ; } else { Set < BioPAXElement > leftSimples = new HashSet < BioPAXElement > ( ) ; Set < BioPAXElement > rightSimples = new HashSet < BioPAXElement > ( ) ; for ( PhysicalEntity pe : conv . getLeft ( ) ) { if ( ! taboo . contains ( pe ) ) leftSimples . addAll ( linker . getLinkedElements ( pe ) ) ; } for ( PhysicalEntity pe : conv . getRight ( ) ) { if ( ! taboo . contains ( pe ) ) rightSimples . addAll ( linker . getLinkedElements ( pe ) ) ; } Set leftERs = pe2ER . getValueFromBeans ( leftSimples ) ; Set rightERs = pe2ER . getValueFromBeans ( rightSimples ) ; if ( direction == Direction . ONESIDERS ) { Set temp = new HashSet ( leftERs ) ; leftERs . removeAll ( rightERs ) ; rightERs . removeAll ( temp ) ; leftERs . addAll ( rightERs ) ; } else { leftERs . retainAll ( rightERs ) ; } return leftERs ; } }
Gets the related entity references of the given interaction
6,155
public static < D extends BioPAXElement , R > PropertyAccessor < D , R > create ( PropertyAccessor < D , R > pa , Class filter ) { return new FilteredPropertyAccessor < D , R > ( pa , filter ) ; }
FactoryMethod that creates a filtered property accessor by decorating a given accessor with a class filter .
6,156
public void visit ( BioPAXElement domain , Object range , Model model , PropertyEditor < ? , ? > editor ) { visit ( range , domain , model , editor ) ; }
Calls the protected abstract method visit that is to be implemented in subclasses of this abstract class .
6,157
private void bindValue ( Triple triple , Model model ) { if ( log . isDebugEnabled ( ) ) log . debug ( String . valueOf ( triple ) ) ; BioPAXElement domain = model . getByID ( triple . domain ) ; PropertyEditor editor = this . getEditorMap ( ) . getEditorForProperty ( triple . property , domain . getModelInterface ( ) ) ; bindValue ( triple . range , editor , domain , model ) ; }
Binds property .
6,158
public boolean satisfies ( Match match , int ... ind ) { PhysicalEntity pe1 = ( PhysicalEntity ) match . get ( ind [ 0 ] ) ; PhysicalEntity pe2 = ( PhysicalEntity ) match . get ( ind [ 1 ] ) ; Set < ModificationFeature > [ ] mods = DifferentialModificationUtil . getChangedModifications ( pe1 , pe2 ) ; Set < String > terms ; if ( type == Type . GAIN ) terms = collectTerms ( mods [ 0 ] ) ; else if ( type == Type . LOSS ) terms = collectTerms ( mods [ 1 ] ) ; else terms = collectTerms ( mods ) ; return termsContainDesired ( terms ) ; }
Checks the any of the changed modifications match to any of the desired modifications .
6,159
public boolean satisfies ( Match match , int ... ind ) { for ( MappedConst mc : con ) { if ( mc . satisfies ( match , ind ) ) return true ; } return false ; }
Checks if any of the wrapped constraints satisfy .
6,160
public int getVariableSize ( ) { int size = 0 ; for ( MappedConst mc : con ) { int m = max ( mc . getInds ( ) ) ; if ( m > size ) size = m ; } return size + 1 ; }
Checks the inner mapping of the wrapped constraints and figures the size .
6,161
protected int max ( int [ ] v ) { int x = 0 ; for ( int i : v ) { if ( i > x ) x = i ; } return x ; }
Gets the max value .
6,162
public Collection < BioPAXElement > generate ( Match match , int ... ind ) { Collection < BioPAXElement > gen = new HashSet < BioPAXElement > ( ) ; for ( MappedConst mc : con ) { gen . addAll ( mc . generate ( match , ind ) ) ; } return gen ; }
Gets the intersection of the generated values of wrapped constraints .
6,163
public static Pattern controlsStateChange ( ) { Pattern p = new Pattern ( SequenceEntityReference . class , "controller ER" ) ; p . add ( linkedER ( true ) , "controller ER" , "generic controller ER" ) ; p . add ( erToPE ( ) , "generic controller ER" , "controller simple PE" ) ; p . add ( linkToComplex ( ) , "controller simple PE" , "controller PE" ) ; p . add ( peToControl ( ) , "controller PE" , "Control" ) ; p . add ( controlToConv ( ) , "Control" , "Conversion" ) ; p . add ( new NOT ( participantER ( ) ) , "Conversion" , "controller ER" ) ; p . add ( new Participant ( RelType . INPUT , true ) , "Control" , "Conversion" , "input PE" ) ; p . add ( new NOT ( new ConversionSide ( ConversionSide . Type . OTHER_SIDE ) ) , "input PE" , "Conversion" , "input PE" ) ; p . add ( linkToSpecific ( ) , "input PE" , "input simple PE" ) ; p . add ( new Type ( SequenceEntity . class ) , "input simple PE" ) ; p . add ( peToER ( ) , "input simple PE" , "changed generic ER" ) ; p . add ( new ConversionSide ( ConversionSide . Type . OTHER_SIDE ) , "input PE" , "Conversion" , "output PE" ) ; p . add ( new NOT ( new ConversionSide ( ConversionSide . Type . OTHER_SIDE ) ) , "output PE" , "Conversion" , "output PE" ) ; p . add ( equal ( false ) , "input PE" , "output PE" ) ; p . add ( linkToSpecific ( ) , "output PE" , "output simple PE" ) ; p . add ( peToER ( ) , "output simple PE" , "changed generic ER" ) ; p . add ( linkedER ( false ) , "changed generic ER" , "changed ER" ) ; return p ; }
Pattern for a EntityReference has a member PhysicalEntity that is controlling a state change reaction of another EntityReference .
6,164
public static Pattern controlsTransport ( ) { Pattern p = controlsStateChange ( ) ; p . add ( new OR ( new MappedConst ( hasDifferentCompartments ( ) , 0 , 1 ) , new MappedConst ( hasDifferentCompartments ( ) , 2 , 3 ) ) , "input simple PE" , "output simple PE" , "input PE" , "output PE" ) ; return p ; }
Pattern for a ProteinReference has a member PhysicalEntity that is controlling a transportation of another ProteinReference .
6,165
public static Pattern controlsTransportOfChemical ( Blacklist blacklist ) { Pattern p = new Pattern ( SequenceEntityReference . class , "controller ER" ) ; p . add ( linkedER ( true ) , "controller ER" , "controller generic ER" ) ; p . add ( erToPE ( ) , "controller generic ER" , "controller simple PE" ) ; p . add ( linkToComplex ( ) , "controller simple PE" , "controller PE" ) ; p . add ( peToControl ( ) , "controller PE" , "Control" ) ; p . add ( controlToConv ( ) , "Control" , "Conversion" ) ; p . add ( new Participant ( RelType . INPUT , blacklist , true ) , "Control" , "Conversion" , "input PE" ) ; p . add ( linkToSimple ( blacklist ) , "input PE" , "input simple PE" ) ; p . add ( new Type ( SmallMolecule . class ) , "input simple PE" ) ; p . add ( notGeneric ( ) , "input simple PE" ) ; p . add ( peToER ( ) , "input simple PE" , "changed generic SMR" ) ; p . add ( new ConversionSide ( ConversionSide . Type . OTHER_SIDE , blacklist , RelType . OUTPUT ) , "input PE" , "Conversion" , "output PE" ) ; p . add ( equal ( false ) , "input PE" , "output PE" ) ; p . add ( linkToSimple ( blacklist ) , "output PE" , "output simple PE" ) ; p . add ( new Type ( SmallMolecule . class ) , "output simple PE" ) ; p . add ( notGeneric ( ) , "output simple PE" ) ; p . add ( peToER ( ) , "output simple PE" , "changed generic SMR" ) ; p . add ( linkedER ( false ) , "changed generic SMR" , "changed SMR" ) ; p . add ( new OR ( new MappedConst ( hasDifferentCompartments ( ) , 0 , 1 ) , new MappedConst ( hasDifferentCompartments ( ) , 2 , 3 ) ) , "input simple PE" , "output simple PE" , "input PE" , "output PE" ) ; return p ; }
Pattern for a ProteinReference has a member PhysicalEntity that is controlling a reaction that changes cellular location of a small molecule .
6,166
public static Pattern controlsStateChangeBothControlAndPart ( ) { Pattern p = new Pattern ( SequenceEntityReference . class , "controller ER" ) ; p . add ( linkedER ( true ) , "controller ER" , "controller generic ER" ) ; p . add ( erToPE ( ) , "controller generic ER" , "controller simple PE" ) ; p . add ( linkToComplex ( ) , "controller simple PE" , "controller PE" ) ; p . add ( peToControl ( ) , "controller PE" , "Control" ) ; p . add ( controlToConv ( ) , "Control" , "Conversion" ) ; p . add ( new ParticipatesInConv ( RelType . INPUT ) , "controller PE" , "Conversion" ) ; p . add ( linkToComplex ( ) , "controller simple PE" , "special output PE" ) ; p . add ( equal ( false ) , "special output PE" , "controller PE" ) ; p . add ( new ParticipatesInConv ( RelType . OUTPUT ) , "special output PE" , "Conversion" ) ; stateChange ( p , "Control" ) ; p . add ( equal ( false ) , "input simple PE" , "output simple PE" ) ; p . add ( new NOT ( simplePEToConv ( RelType . OUTPUT ) ) , "input simple PE" , "Conversion" ) ; p . add ( new NOT ( simplePEToConv ( RelType . INPUT ) ) , "output simple PE" , "Conversion" ) ; p . add ( equal ( false ) , "controller ER" , "changed ER" ) ; p . add ( type ( SequenceEntityReference . class ) , "changed ER" ) ; return p ; }
Pattern for a EntityReference has a member PhysicalEntity that is controlling a state change reaction of another EntityReference . In this case the controller is also an input to the reaction . The affected protein is the one that is represented with different non - generic physical entities at left and right of the reaction .
6,167
public static Pattern controlsStateChangeButIsParticipant ( ) { Pattern p = new Pattern ( SequenceEntityReference . class , "controller ER" ) ; p . add ( linkedER ( true ) , "controller ER" , "controller generic ER" ) ; p . add ( erToPE ( ) , "controller generic ER" , "controller simple PE" ) ; p . add ( linkToComplex ( ) , "controller simple PE" , "controller PE" ) ; p . add ( participatesInConv ( ) , "controller PE" , "Conversion" ) ; p . add ( left ( ) , "Conversion" , "controller PE" ) ; p . add ( right ( ) , "Conversion" , "controller PE" ) ; p . add ( new NOT ( new InterToPartER ( 1 ) ) , "Conversion" , "controller PE" , "controller ER" ) ; stateChange ( p , null ) ; p . add ( equal ( false ) , "controller ER" , "changed ER" ) ; p . add ( equal ( false ) , "controller PE" , "input PE" ) ; p . add ( equal ( false ) , "controller PE" , "output PE" ) ; return p ; }
Pattern for a EntityReference has a member PhysicalEntity that is controlling a state change reaction of another EntityReference . This pattern is different from the original controls - state - change . The controller in this case is not modeled as a controller but as a participant of the conversion and it is at both sides .
6,168
public static Pattern stateChange ( Pattern p , String ctrlLabel ) { if ( p == null ) p = new Pattern ( Conversion . class , "Conversion" ) ; if ( ctrlLabel == null ) p . add ( new Participant ( RelType . INPUT ) , "Conversion" , "input PE" ) ; else p . add ( new Participant ( RelType . INPUT , true ) , ctrlLabel , "Conversion" , "input PE" ) ; p . add ( linkToSpecific ( ) , "input PE" , "input simple PE" ) ; p . add ( peToER ( ) , "input simple PE" , "changed generic ER" ) ; p . add ( new ConversionSide ( ConversionSide . Type . OTHER_SIDE ) , "input PE" , "Conversion" , "output PE" ) ; p . add ( equal ( false ) , "input PE" , "output PE" ) ; p . add ( linkToSpecific ( ) , "output PE" , "output simple PE" ) ; p . add ( peToER ( ) , "output simple PE" , "changed generic ER" ) ; p . add ( linkedER ( false ) , "changed generic ER" , "changed ER" ) ; return p ; }
Pattern for a Conversion has an input PhysicalEntity and another output PhysicalEntity that belongs to the same EntityReference .
6,169
public static Pattern controlsStateChangeThroughControllerSmallMolecule ( Blacklist blacklist ) { Pattern p = new Pattern ( SequenceEntityReference . class , "upper controller ER" ) ; p . add ( linkedER ( true ) , "upper controller ER" , "upper controller generic ER" ) ; p . add ( erToPE ( ) , "upper controller generic ER" , "upper controller simple PE" ) ; p . add ( linkToComplex ( ) , "upper controller simple PE" , "upper controller PE" ) ; p . add ( peToControl ( ) , "upper controller PE" , "upper Control" ) ; p . add ( controlToConv ( ) , "upper Control" , "upper Conversion" ) ; p . add ( new NOT ( participantER ( ) ) , "upper Conversion" , "upper controller ER" ) ; p . add ( new Participant ( RelType . OUTPUT , blacklist ) , "upper Conversion" , "controller PE" ) ; p . add ( type ( SmallMolecule . class ) , "controller PE" ) ; if ( blacklist != null ) p . add ( new NonUbique ( blacklist ) , "controller PE" ) ; p . add ( new NOT ( new ConstraintChain ( new ConversionSide ( ConversionSide . Type . OTHER_SIDE ) , linkToSpecific ( ) ) ) , "controller PE" , "upper Conversion" , "controller PE" ) ; p . add ( peToControl ( ) , "controller PE" , "Control" ) ; p . add ( controlToConv ( ) , "Control" , "Conversion" ) ; p . add ( equal ( false ) , "upper Conversion" , "Conversion" ) ; stateChange ( p , "Control" ) ; p . add ( type ( SequenceEntityReference . class ) , "changed ER" ) ; p . add ( equal ( false ) , "upper controller ER" , "changed ER" ) ; p . add ( new NOT ( participantER ( ) ) , "Conversion" , "upper controller ER" ) ; return p ; }
Pattern for an entity is producing a small molecule and the small molecule controls state change of another molecule .
6,170
public static Pattern controlsStateChangeThroughDegradation ( ) { Pattern p = new Pattern ( SequenceEntityReference . class , "upstream ER" ) ; p . add ( linkedER ( true ) , "upstream ER" , "upstream generic ER" ) ; p . add ( erToPE ( ) , "upstream generic ER" , "upstream SPE" ) ; p . add ( linkToComplex ( ) , "upstream SPE" , "upstream PE" ) ; p . add ( peToControl ( ) , "upstream PE" , "Control" ) ; p . add ( controlToConv ( ) , "Control" , "Conversion" ) ; p . add ( new NOT ( participantER ( ) ) , "Conversion" , "upstream ER" ) ; p . add ( new Empty ( new Participant ( RelType . OUTPUT ) ) , "Conversion" ) ; p . add ( new Participant ( RelType . INPUT ) , "Conversion" , "input PE" ) ; p . add ( linkToSpecific ( ) , "input PE" , "input SPE" ) ; p . add ( peToER ( ) , "input SPE" , "downstream generic ER" ) ; p . add ( type ( SequenceEntityReference . class ) , "downstream generic ER" ) ; p . add ( linkedER ( false ) , "downstream generic ER" , "downstream ER" ) ; return p ; }
Finds cases where proteins affect their degradation .
6,171
public static Pattern controlsMetabolicCatalysis ( Blacklist blacklist , boolean consumption ) { Pattern p = new Pattern ( SequenceEntityReference . class , "controller ER" ) ; p . add ( linkedER ( true ) , "controller ER" , "controller generic ER" ) ; p . add ( erToPE ( ) , "controller generic ER" , "controller simple PE" ) ; p . add ( linkToComplex ( ) , "controller simple PE" , "controller PE" ) ; p . add ( peToControl ( ) , "controller PE" , "Control" ) ; p . add ( controlToConv ( ) , "Control" , "Conversion" ) ; p . add ( new NOT ( participantER ( ) ) , "Conversion" , "controller ER" ) ; p . add ( new Participant ( consumption ? RelType . INPUT : RelType . OUTPUT , blacklist , true ) , "Control" , "Conversion" , "part PE" ) ; p . add ( linkToSimple ( blacklist ) , "part PE" , "part SM" ) ; p . add ( notGeneric ( ) , "part SM" ) ; p . add ( type ( SmallMolecule . class ) , "part SM" ) ; p . add ( peToER ( ) , "part SM" , "part SMR" ) ; p . add ( new XOR ( new MappedConst ( new InterToPartER ( InterToPartER . Direction . LEFT ) , 0 , 1 ) , new MappedConst ( new InterToPartER ( InterToPartER . Direction . RIGHT ) , 0 , 1 ) ) , "Conversion" , "part SMR" ) ; return p ; }
Pattern for a Protein controlling a reaction whose participant is a small molecule .
6,172
public static Pattern controlsExpressionWithTemplateReac ( ) { Pattern p = new Pattern ( SequenceEntityReference . class , "TF ER" ) ; p . add ( linkedER ( true ) , "TF ER" , "TF generic ER" ) ; p . add ( erToPE ( ) , "TF generic ER" , "TF SPE" ) ; p . add ( linkToComplex ( ) , "TF SPE" , "TF PE" ) ; p . add ( peToControl ( ) , "TF PE" , "Control" ) ; p . add ( controlToTempReac ( ) , "Control" , "TempReac" ) ; p . add ( product ( ) , "TempReac" , "product PE" ) ; p . add ( linkToSpecific ( ) , "product PE" , "product SPE" ) ; p . add ( new Type ( SequenceEntity . class ) , "product SPE" ) ; p . add ( peToER ( ) , "product SPE" , "product generic ER" ) ; p . add ( linkedER ( false ) , "product generic ER" , "product ER" ) ; p . add ( equal ( false ) , "TF ER" , "product ER" ) ; return p ; }
Finds transcription factors that trans - activate or trans - inhibit an entity .
6,173
public static Pattern controlsExpressionWithConversion ( ) { Pattern p = new Pattern ( SequenceEntityReference . class , "TF ER" ) ; p . add ( linkedER ( true ) , "TF ER" , "TF generic ER" ) ; p . add ( erToPE ( ) , "TF generic ER" , "TF SPE" ) ; p . add ( linkToComplex ( ) , "TF SPE" , "TF PE" ) ; p . add ( peToControl ( ) , "TF PE" , "Control" ) ; p . add ( controlToConv ( ) , "Control" , "Conversion" ) ; p . add ( new Size ( right ( ) , 1 , Size . Type . EQUAL ) , "Conversion" ) ; p . add ( new OR ( new MappedConst ( new Empty ( left ( ) ) , 0 ) , new MappedConst ( new ConstraintAdapter ( 1 ) { public boolean satisfies ( Match match , int ... ind ) { Conversion cnv = ( Conversion ) match . get ( ind [ 0 ] ) ; Set < PhysicalEntity > left = cnv . getLeft ( ) ; if ( left . size ( ) > 1 ) return false ; if ( left . isEmpty ( ) ) return true ; PhysicalEntity pe = left . iterator ( ) . next ( ) ; if ( pe instanceof NucleicAcid ) { PhysicalEntity rPE = cnv . getRight ( ) . iterator ( ) . next ( ) ; return rPE instanceof Protein ; } return false ; } } , 0 ) ) , "Conversion" ) ; p . add ( right ( ) , "Conversion" , "right PE" ) ; p . add ( linkToSpecific ( ) , "right PE" , "right SPE" ) ; p . add ( new Type ( SequenceEntity . class ) , "right SPE" ) ; p . add ( peToER ( ) , "right SPE" , "product generic ER" ) ; p . add ( linkedER ( false ) , "product generic ER" , "product ER" ) ; p . add ( equal ( false ) , "TF ER" , "product ER" ) ; return p ; }
Finds the cases where transcription relation is shown using a Conversion instead of a TemplateReaction .
6,174
public static Pattern controlsDegradationIndirectly ( ) { Pattern p = controlsStateChange ( ) ; p . add ( new Size ( new ParticipatesInConv ( RelType . INPUT ) , 1 , Size . Type . EQUAL ) , "output PE" ) ; p . add ( new Empty ( peToControl ( ) ) , "output PE" ) ; p . add ( new ParticipatesInConv ( RelType . INPUT ) , "output PE" , "degrading Conv" ) ; p . add ( new NOT ( type ( ComplexAssembly . class ) ) , "degrading Conv" ) ; p . add ( new Size ( participant ( ) , 1 , Size . Type . EQUAL ) , "degrading Conv" ) ; p . add ( new Empty ( new Participant ( RelType . OUTPUT ) ) , "degrading Conv" ) ; p . add ( new Empty ( convToControl ( ) ) , "degrading Conv" ) ; p . add ( equal ( false ) , "degrading Conv" , "Conversion" ) ; return p ; }
Finds cases where protein A changes state of B and B is then degraded .
6,175
public static Pattern inComplexWith ( ) { Pattern p = new Pattern ( SequenceEntityReference . class , "Protein 1" ) ; p . add ( linkedER ( true ) , "Protein 1" , "generic Protein 1" ) ; p . add ( erToPE ( ) , "generic Protein 1" , "SPE1" ) ; p . add ( linkToComplex ( ) , "SPE1" , "PE1" ) ; p . add ( new PathConstraint ( "PhysicalEntity/componentOf" ) , "PE1" , "Complex" ) ; p . add ( new PathConstraint ( "Complex/component" ) , "Complex" , "PE2" ) ; p . add ( equal ( false ) , "PE1" , "PE2" ) ; p . add ( linkToSpecific ( ) , "PE2" , "SPE2" ) ; p . add ( peToER ( ) , "SPE2" , "generic Protein 2" ) ; p . add ( linkedER ( false ) , "generic Protein 2" , "Protein 2" ) ; p . add ( equal ( false ) , "Protein 1" , "Protein 2" ) ; p . add ( new Type ( SequenceEntityReference . class ) , "Protein 2" ) ; return p ; }
Two proteins have states that are members of the same complex . Handles nested complexes and homologies . Also guarantees that relationship to the complex is through different direct complex members .
6,176
public static Pattern chemicalAffectsProteinThroughBinding ( Blacklist blacklist ) { Pattern p = new Pattern ( SmallMoleculeReference . class , "SMR" ) ; p . add ( erToPE ( ) , "SMR" , "SPE1" ) ; p . add ( notGeneric ( ) , "SPE1" ) ; if ( blacklist != null ) p . add ( new NonUbique ( blacklist ) , "SPE1" ) ; p . add ( linkToComplex ( ) , "SPE1" , "PE1" ) ; p . add ( new PathConstraint ( "PhysicalEntity/componentOf" ) , "PE1" , "Complex" ) ; p . add ( new PathConstraint ( "Complex/component" ) , "Complex" , "PE2" ) ; p . add ( equal ( false ) , "PE1" , "PE2" ) ; p . add ( linkToSpecific ( ) , "PE2" , "SPE2" ) ; p . add ( new Type ( SequenceEntity . class ) , "SPE2" ) ; p . add ( peToER ( ) , "SPE2" , "generic ER" ) ; p . add ( linkedER ( false ) , "generic ER" , "ER" ) ; return p ; }
A small molecule is in a complex with a protein .
6,177
public static Pattern chemicalAffectsProteinThroughControl ( ) { Pattern p = new Pattern ( SmallMoleculeReference . class , "controller SMR" ) ; p . add ( erToPE ( ) , "controller SMR" , "controller simple PE" ) ; p . add ( notGeneric ( ) , "controller simple PE" ) ; p . add ( linkToComplex ( ) , "controller simple PE" , "controller PE" ) ; p . add ( peToControl ( ) , "controller PE" , "Control" ) ; p . add ( controlToInter ( ) , "Control" , "Interaction" ) ; p . add ( new NOT ( participantER ( ) ) , "Interaction" , "controller SMR" ) ; p . add ( participant ( ) , "Interaction" , "affected PE" ) ; p . add ( linkToSpecific ( ) , "affected PE" , "affected simple PE" ) ; p . add ( new Type ( SequenceEntity . class ) , "affected simple PE" ) ; p . add ( peToER ( ) , "affected simple PE" , "affected generic ER" ) ; p . add ( linkedER ( false ) , "affected generic ER" , "affected ER" ) ; return p ; }
A small molecule controls an interaction of which the protein is a participant .
6,178
public static Pattern neighborOf ( ) { Pattern p = new Pattern ( SequenceEntityReference . class , "Protein 1" ) ; p . add ( linkedER ( true ) , "Protein 1" , "generic Protein 1" ) ; p . add ( erToPE ( ) , "generic Protein 1" , "SPE1" ) ; p . add ( linkToComplex ( ) , "SPE1" , "PE1" ) ; p . add ( peToInter ( ) , "PE1" , "Inter" ) ; p . add ( interToPE ( ) , "Inter" , "PE2" ) ; p . add ( linkToSpecific ( ) , "PE2" , "SPE2" ) ; p . add ( equal ( false ) , "SPE1" , "SPE2" ) ; p . add ( type ( SequenceEntity . class ) , "SPE2" ) ; p . add ( peToER ( ) , "SPE2" , "generic Protein 2" ) ; p . add ( linkedER ( false ) , "generic Protein 2" , "Protein 2" ) ; p . add ( equal ( false ) , "Protein 1" , "Protein 2" ) ; return p ; }
Constructs a pattern where first and last proteins are related through an interaction . They can be participants or controllers . No limitation .
6,179
public static Pattern reactsWith ( Blacklist blacklist ) { Pattern p = new Pattern ( SmallMoleculeReference . class , "SMR1" ) ; p . add ( erToPE ( ) , "SMR1" , "SPE1" ) ; p . add ( notGeneric ( ) , "SPE1" ) ; p . add ( linkToComplex ( blacklist ) , "SPE1" , "PE1" ) ; p . add ( new ParticipatesInConv ( RelType . INPUT , blacklist ) , "PE1" , "Conv" ) ; p . add ( type ( BiochemicalReaction . class ) , "Conv" ) ; p . add ( new InterToPartER ( InterToPartER . Direction . ONESIDERS ) , "Conv" , "SMR1" ) ; p . add ( new ConversionSide ( ConversionSide . Type . SAME_SIDE , blacklist , RelType . INPUT ) , "PE1" , "Conv" , "PE2" ) ; p . add ( type ( SmallMolecule . class ) , "PE2" ) ; p . add ( linkToSpecific ( ) , "PE2" , "SPE2" ) ; p . add ( notGeneric ( ) , "SPE2" ) ; p . add ( new PEChainsIntersect ( false ) , "SPE1" , "PE1" , "SPE2" , "PE2" ) ; p . add ( peToER ( ) , "SPE2" , "SMR2" ) ; p . add ( equal ( false ) , "SMR1" , "SMR2" ) ; p . add ( new InterToPartER ( InterToPartER . Direction . ONESIDERS ) , "Conv" , "SMR2" ) ; return p ; }
Constructs a pattern where first and last small molecules are substrates to the same biochemical reaction .
6,180
public static Pattern usedToProduce ( Blacklist blacklist ) { Pattern p = new Pattern ( SmallMoleculeReference . class , "SMR1" ) ; p . add ( erToPE ( ) , "SMR1" , "SPE1" ) ; p . add ( notGeneric ( ) , "SPE1" ) ; p . add ( linkToComplex ( blacklist ) , "SPE1" , "PE1" ) ; p . add ( new ParticipatesInConv ( RelType . INPUT , blacklist ) , "PE1" , "Conv" ) ; p . add ( type ( BiochemicalReaction . class ) , "Conv" ) ; p . add ( new InterToPartER ( InterToPartER . Direction . ONESIDERS ) , "Conv" , "SMR1" ) ; p . add ( new ConversionSide ( ConversionSide . Type . OTHER_SIDE , blacklist , RelType . OUTPUT ) , "PE1" , "Conv" , "PE2" ) ; p . add ( type ( SmallMolecule . class ) , "PE2" ) ; p . add ( linkToSimple ( blacklist ) , "PE2" , "SPE2" ) ; p . add ( notGeneric ( ) , "SPE2" ) ; p . add ( equal ( false ) , "SPE1" , "SPE2" ) ; p . add ( peToER ( ) , "SPE2" , "SMR2" ) ; p . add ( equal ( false ) , "SMR1" , "SMR2" ) ; p . add ( new InterToPartER ( InterToPartER . Direction . ONESIDERS ) , "Conv" , "SMR2" ) ; return p ; }
Constructs a pattern where first small molecule is an input a biochemical reaction that produces the second small molecule . biochemical reaction .
6,181
public static Pattern molecularInteraction ( ) { Pattern p = new Pattern ( SequenceEntityReference . class , "Protein 1" ) ; p . add ( linkedER ( true ) , "Protein 1" , "generic Protein 1" ) ; p . add ( erToPE ( ) , "generic Protein 1" , "SPE1" ) ; p . add ( linkToComplex ( ) , "SPE1" , "PE1" ) ; p . add ( new PathConstraint ( "PhysicalEntity/participantOf:MolecularInteraction" ) , "PE1" , "MI" ) ; p . add ( participant ( ) , "MI" , "PE2" ) ; p . add ( equal ( false ) , "PE1" , "PE2" ) ; p . add ( new NOT ( new AND ( new MappedConst ( isPrey ( ) , 0 ) , new MappedConst ( isPrey ( ) , 1 ) ) ) , "PE1" , "PE2" ) ; p . add ( new NOT ( new AND ( new MappedConst ( isBait ( ) , 0 ) , new MappedConst ( isBait ( ) , 1 ) ) ) , "PE1" , "PE2" ) ; p . add ( linkToSpecific ( ) , "PE2" , "SPE2" ) ; p . add ( type ( SequenceEntity . class ) , "SPE2" ) ; p . add ( new PEChainsIntersect ( false ) , "SPE1" , "PE1" , "SPE2" , "PE2" ) ; p . add ( peToER ( ) , "SPE2" , "generic Protein 2" ) ; p . add ( linkedER ( false ) , "generic Protein 2" , "Protein 2" ) ; p . add ( equal ( false ) , "Protein 1" , "Protein 2" ) ; return p ; }
Constructs a pattern where first and last molecules are participants of a MolecularInteraction .
6,182
public static Pattern relatedProteinRefOfInter ( Class < ? extends Interaction > ... seedType ) { Pattern p = new Pattern ( Interaction . class , "Interaction" ) ; if ( seedType . length == 1 ) { p . add ( new Type ( seedType [ 0 ] ) , "Interaction" ) ; } else if ( seedType . length > 1 ) { MappedConst [ ] mc = new MappedConst [ seedType . length ] ; for ( int i = 0 ; i < mc . length ; i ++ ) { mc [ i ] = new MappedConst ( new Type ( seedType [ i ] ) , 0 ) ; } p . add ( new OR ( mc ) , "Interaction" ) ; } p . add ( new OR ( new MappedConst ( participant ( ) , 0 , 1 ) , new MappedConst ( new PathConstraint ( "Interaction/controlledOf*/controller:PhysicalEntity" ) , 0 , 1 ) ) , "Interaction" , "PE" ) ; p . add ( linkToSpecific ( ) , "PE" , "SPE" ) ; p . add ( peToER ( ) , "SPE" , "generic PR" ) ; p . add ( new Type ( ProteinReference . class ) , "generic PR" ) ; p . add ( linkedER ( false ) , "generic PR" , "PR" ) ; return p ; }
Finds ProteinsReference related to an interaction . If specific types of interactions are desired they should be sent as parameter otherwise leave the parameter empty .
6,183
public static Pattern modifiedPESimple ( ) { Pattern p = new Pattern ( EntityReference . class , "modified ER" ) ; p . add ( erToPE ( ) , "modified ER" , "first PE" ) ; p . add ( participatesInConv ( ) , "first PE" , "Conversion" ) ; p . add ( new ConversionSide ( ConversionSide . Type . OTHER_SIDE ) , "first PE" , "Conversion" , "second PE" ) ; p . add ( equal ( false ) , "first PE" , "second PE" ) ; p . add ( peToER ( ) , "second PE" , "modified ER" ) ; return p ; }
Pattern for an EntityReference has distinct PhysicalEntities associated with both left and right of a Conversion .
6,184
public static Pattern actChange ( boolean activating , Map < EntityReference , Set < ModificationFeature > > activityFeat , Map < EntityReference , Set < ModificationFeature > > inactivityFeat ) { Pattern p = peInOut ( ) ; p . add ( new OR ( new MappedConst ( differentialActivity ( activating ) , 0 , 1 ) , new MappedConst ( new ActivityModificationChangeConstraint ( activating , activityFeat , inactivityFeat ) , 0 , 1 ) ) , "input simple PE" , "output simple PE" ) ; return p ; }
Pattern for the activity of an EntityReference is changed through a Conversion .
6,185
public static Pattern modifierConv ( ) { Pattern p = new Pattern ( EntityReference . class , "ER" ) ; p . add ( erToPE ( ) , "ER" , "SPE" ) ; p . add ( linkToComplex ( ) , "SPE" , "PE" ) ; p . add ( participatesInConv ( ) , "PE" , "Conversion" ) ; return p ; }
Pattern for finding Conversions that an EntityReference is participating .
6,186
public static Pattern hasNonSelfEffect ( ) { Pattern p = new Pattern ( PhysicalEntity . class , "SPE" ) ; p . add ( peToER ( ) , "SPE" , "ER" ) ; p . add ( linkToComplex ( ) , "SPE" , "PE" ) ; p . add ( peToControl ( ) , "PE" , "Control" ) ; p . add ( controlToInter ( ) , "Control" , "Inter" ) ; p . add ( new NOT ( participantER ( ) ) , "Inter" , "ER" ) ; return p ; }
Pattern for detecting PhysicalEntity that controls a Conversion whose participants are not associated with the EntityReference of the initial PhysicalEntity .
6,187
public static Pattern bindsTo ( ) { Pattern p = new Pattern ( ProteinReference . class , "first PR" ) ; p . add ( erToPE ( ) , "first PR" , "first simple PE" ) ; p . add ( linkToComplex ( ) , "first simple PE" , "Complex" ) ; p . add ( new Type ( Complex . class ) , "Complex" ) ; p . add ( linkToSpecific ( ) , "Complex" , "second simple PE" ) ; p . add ( peToER ( ) , "second simple PE" , "second PR" ) ; p . add ( equal ( false ) , "first PR" , "second PR" ) ; return p ; }
Finds two Protein that appear together in a Complex .
6,188
public static void listUnificationXrefsPerPathway ( Model model ) { Visitor visitor = new Visitor ( ) { public void visit ( BioPAXElement domain , Object range , Model model , PropertyEditor editor ) { if ( range instanceof physicalEntity ) { physicalEntity pe = ( physicalEntity ) range ; ClassFilterSet < xref , unificationXref > unis = new ClassFilterSet < xref , unificationXref > ( pe . getXREF ( ) , unificationXref . class ) ; for ( unificationXref uni : unis ) { System . out . println ( "pe.getNAME() = " + pe . getNAME ( ) ) ; System . out . println ( "uni = " + uni . getID ( ) ) ; } } } } ; Traverser traverser = new Traverser ( SimpleEditorMap . L2 , visitor ) ; Set < pathway > pathways = model . getObjects ( pathway . class ) ; for ( pathway pathway : pathways ) { traverser . traverse ( pathway , model ) ; } }
Here is a more elegant way of doing the previous method!
6,189
public boolean satisfies ( Match match , int ... ind ) { PhysicalEntity pe0 = ( PhysicalEntity ) match . get ( ind [ 0 ] ) ; PhysicalEntity pe1 = ( PhysicalEntity ) match . get ( ind [ 1 ] ) ; PhysicalEntity pe2 = ( PhysicalEntity ) match . get ( ind [ 2 ] ) ; PhysicalEntity pe3 = ( PhysicalEntity ) match . get ( ind [ 3 ] ) ; PhysicalEntityChain ch1 = new PhysicalEntityChain ( pe0 , pe1 ) ; PhysicalEntityChain ch2 = new PhysicalEntityChain ( pe2 , pe3 ) ; return ch1 . intersects ( ch2 , ignoreEndPoints ) == intersectionDesired ; }
Creates two PhysicalEntity chains with the given endpoints and checks if they are intersecting .
6,190
public Collection < BioPAXElement > generate ( Match match , int ... ind ) { assertIndLength ( ind ) ; PhysicalEntity pe1 = ( PhysicalEntity ) match . get ( ind [ 0 ] ) ; Conversion conv = ( Conversion ) match . get ( ind [ 1 ] ) ; Set < PhysicalEntity > parts ; if ( conv . getLeft ( ) . contains ( pe1 ) ) { parts = sideType == Type . OTHER_SIDE ? conv . getRight ( ) : conv . getLeft ( ) ; } else if ( conv . getRight ( ) . contains ( pe1 ) ) { parts = sideType == Type . SAME_SIDE ? conv . getRight ( ) : conv . getLeft ( ) ; } else throw new IllegalArgumentException ( "The PhysicalEntity has to be a participant of the Conversion." ) ; if ( blacklist == null ) return new HashSet < BioPAXElement > ( parts ) ; else { ConversionDirectionType dir = getDirection ( conv ) ; if ( ( dir == ConversionDirectionType . LEFT_TO_RIGHT && ( ( relType == RelType . INPUT && parts != conv . getLeft ( ) ) || ( relType == RelType . OUTPUT && parts != conv . getRight ( ) ) ) ) || ( dir == ConversionDirectionType . RIGHT_TO_LEFT && ( ( relType == RelType . INPUT && parts != conv . getRight ( ) ) || ( relType == RelType . OUTPUT && parts != conv . getLeft ( ) ) ) ) ) return Collections . emptySet ( ) ; return new HashSet < BioPAXElement > ( blacklist . getNonUbiques ( parts , relType ) ) ; } }
Checks which side is the first PhysicalEntity and gathers participants on either the other side or the same side .
6,191
protected void registerEditorsWithSubClasses ( PropertyEditor editor , Class < ? extends BioPAXElement > domain ) { for ( Class < ? extends BioPAXElement > c : classToEditorMap . keySet ( ) ) { if ( domain . isAssignableFrom ( c ) ) { if ( ( editor . getProperty ( ) . equals ( "PARTICIPANTS" ) && ( conversion . class . isAssignableFrom ( c ) || control . class . isAssignableFrom ( c ) ) ) || ( editor . getProperty ( ) . equals ( "participant" ) && ( Conversion . class . isAssignableFrom ( c ) || Control . class . isAssignableFrom ( c ) ) ) ) { if ( log . isDebugEnabled ( ) ) { log . debug ( "skipping restricted participant property" ) ; } } else { classToEditorMap . get ( c ) . put ( editor . getProperty ( ) , editor ) ; } } } if ( editor instanceof ObjectPropertyEditor ) { registerInverseEditors ( ( ObjectPropertyEditor ) editor ) ; } }
This method registers an editor with sub classes - i . e . inserts the editor to the proper value in editor maps .
6,192
protected void registerModelClass ( String localName ) { try { Class < ? extends BioPAXElement > domain = this . getLevel ( ) . getInterfaceForName ( localName ) ; HashMap < String , PropertyEditor > peMap = new HashMap < String , PropertyEditor > ( ) ; classToEditorMap . put ( domain , peMap ) ; classToInverseEditorMap . put ( domain , new HashSet < ObjectPropertyEditor > ( ) ) ; classToEditorSet . put ( domain , new ValueSet ( peMap . values ( ) ) ) ; } catch ( IllegalBioPAXArgumentException e ) { if ( log . isDebugEnabled ( ) ) { log . debug ( "Skipping (" + e . getMessage ( ) + ")" ) ; } } }
This method inserts the class into internal hashmaps and initializes the value collections .
6,193
private void checkNodeRecursive ( Node node ) { if ( isDangling ( node ) ) { removeNode ( node ) ; for ( Edge edge : node . getUpstream ( ) ) { checkNodeRecursive ( edge . getSourceNode ( ) ) ; } for ( Edge edge : node . getDownstream ( ) ) { checkNodeRecursive ( edge . getTargetNode ( ) ) ; } for ( Node parent : node . getUpperEquivalent ( ) ) { checkNodeRecursive ( parent ) ; } for ( Node child : node . getLowerEquivalent ( ) ) { checkNodeRecursive ( child ) ; } } }
Recursively checks if a node is dangling .
6,194
private void removeNode ( Node node ) { result . remove ( node ) ; for ( Edge edge : node . getUpstream ( ) ) { result . remove ( edge ) ; } for ( Edge edge : node . getDownstream ( ) ) { result . remove ( edge ) ; } }
Removes the dangling node and its edges .
6,195
private boolean isDangling ( Node node ) { if ( ! result . contains ( node ) ) return false ; if ( ST . contains ( node ) ) return false ; boolean hasIncoming = false ; for ( Edge edge : node . getUpstream ( ) ) { if ( result . contains ( edge ) ) { hasIncoming = true ; break ; } } boolean hasOutgoing = false ; for ( Edge edge : node . getDownstream ( ) ) { if ( result . contains ( edge ) ) { hasOutgoing = true ; break ; } } if ( hasIncoming && hasOutgoing ) return false ; boolean hasParent = false ; for ( Node parent : node . getUpperEquivalent ( ) ) { if ( result . contains ( parent ) ) { hasParent = true ; break ; } } if ( hasParent && ( hasIncoming || hasOutgoing ) ) return false ; boolean hasChild = false ; for ( Node child : node . getLowerEquivalent ( ) ) { if ( result . contains ( child ) ) { hasChild = true ; break ; } } return ! ( hasChild && ( hasIncoming || hasOutgoing || hasParent ) ) ; }
Checks if the node is dangling .
6,196
public Model filter ( Model model ) { if ( model == null || model . getLevel ( ) != BioPAXLevel . L2 ) return model ; preparePep2PEIDMap ( model ) ; final Model newModel = factory . createModel ( ) ; newModel . getNameSpacePrefixMap ( ) . putAll ( model . getNameSpacePrefixMap ( ) ) ; newModel . setXmlBase ( model . getXmlBase ( ) ) ; normalize ( model ) ; for ( BioPAXElement bpe : model . getObjects ( ) ) { Level3Element l3element = mapClass ( bpe ) ; if ( l3element != null ) { newModel . add ( l3element ) ; } else { log . debug ( "Skipping " + bpe + " " + bpe . getModelInterface ( ) . getSimpleName ( ) ) ; } } for ( BioPAXElement e : model . getObjects ( ) ) { if ( e instanceof physicalEntityParticipant || e instanceof openControlledVocabulary ) { continue ; } traverse ( ( Level2Element ) e , newModel ) ; } log . info ( "Done: new L3 model contains " + newModel . getObjects ( ) . size ( ) + " BioPAX individuals." ) ; normalize ( newModel ) ; return newModel ; }
Converts a BioPAX Model Level 1 or 2 to the Level 3 .
6,197
private Level3Element mapClass ( BioPAXElement bpe ) { Level3Element newElement = null ; if ( bpe instanceof physicalEntityParticipant ) { String id = pep2PE . get ( bpe . getUri ( ) ) ; if ( id == null ) { log . warn ( "No mapping possible for " + bpe . getUri ( ) ) ; return null ; } else if ( id . equals ( bpe . getUri ( ) ) ) { newElement = createSimplePhysicalEntity ( ( physicalEntityParticipant ) bpe ) ; } } else if ( ! ( bpe instanceof openControlledVocabulary ) ) { String type = bpe . getModelInterface ( ) . getSimpleName ( ) ; String newType = classesmap . getProperty ( type ) . trim ( ) ; if ( newType != null && factory . canInstantiate ( factory . getLevel ( ) . getInterfaceForName ( newType ) ) ) { newElement = ( Level3Element ) factory . create ( newType , bpe . getUri ( ) ) ; } else { if ( log . isDebugEnabled ( ) ) log . debug ( "No mapping found for " + type ) ; return null ; } } return newElement ; }
creates L3 classes and sets IDs
6,198
static public String getLocalId ( BioPAXElement bpe ) { String id = bpe . getUri ( ) ; return ( id != null ) ? id . replaceFirst ( "^.+[#/]" , "" ) : null ; }
Gets the local part of the BioPAX element ID .
6,199
public boolean satisfies ( Match match , int ... ind ) { PhysicalEntity pe = ( PhysicalEntity ) match . get ( ind [ 0 ] ) ; return pe . getControllerOf ( ) . isEmpty ( ) == active ; }
Checks if the PhysicalEntity controls anything .