idx
int64
0
41.2k
question
stringlengths
74
4.21k
target
stringlengths
5
888
6,200
private BioPAXElement getIdentical ( BioPAXElement bpe ) { int key = bpe . hashCode ( ) ; List < BioPAXElement > list = equivalenceMap . get ( key ) ; if ( list != null ) { for ( BioPAXElement other : list ) { if ( other . equals ( bpe ) ) { return other ; } } } return null ; }
Searches the target model for an identical of given BioPAX element and returns this element if it finds it .
6,201
private void addIntoEquivalanceMap ( BioPAXElement bpe ) { int key = bpe . hashCode ( ) ; List < BioPAXElement > list = equivalenceMap . get ( key ) ; if ( list == null ) { list = new ArrayList < BioPAXElement > ( ) ; equivalenceMap . put ( key , list ) ; } list . add ( bpe ) ; }
Adds a BioPAX element into the equivalence map .
6,202
public static Set < BioPAXElement > runNeighborhood ( Set < BioPAXElement > sourceSet , Model model , int limit , Direction direction , Filter ... filters ) { Graph graph ; if ( model . getLevel ( ) == BioPAXLevel . L3 ) { if ( direction == Direction . UNDIRECTED ) { graph = new GraphL3Undirected ( model , filters ) ; ...
Gets neighborhood of the source set .
6,203
public static Set < BioPAXElement > runPathsBetween ( Set < BioPAXElement > sourceSet , Model model , int limit , Filter ... filters ) { Graph graph ; if ( model . getLevel ( ) == BioPAXLevel . L3 ) { graph = new GraphL3 ( model , filters ) ; } else return Collections . emptySet ( ) ; Collection < Set < Node > > source...
Gets the graph constructed by the paths between the given seed nodes . Does not get paths between physical entities that belong the same entity reference .
6,204
public static Set < BioPAXElement > runGOI ( Set < BioPAXElement > sourceSet , Model model , int limit , Filter ... filters ) { return runPathsFromTo ( sourceSet , sourceSet , model , LimitType . NORMAL , limit , filters ) ; }
Gets paths between the seed nodes .
6,205
public static Set < BioPAXElement > runCommonStream ( Set < BioPAXElement > sourceSet , Model model , Direction direction , int limit , Filter ... filters ) { Graph graph ; if ( model . getLevel ( ) == BioPAXLevel . L3 ) { graph = new GraphL3 ( model , filters ) ; } else return Collections . emptySet ( ) ; Collection <...
Gets the elements in the common upstream or downstream of the seed
6,206
private static Set < BioPAXElement > convertQueryResult ( Set < GraphObject > resultWrappers , Graph graph , boolean removeDisconnected ) { Set < Object > result = graph . getWrappedSet ( resultWrappers ) ; Set < BioPAXElement > set = new HashSet < BioPAXElement > ( ) ; for ( Object o : result ) { set . add ( ( BioPAXE...
Converts the query result from wrappers to wrapped BioPAX elements .
6,207
public static Set < Node > prepareSingleNodeSet ( Set < BioPAXElement > elements , Graph graph ) { Map < BioPAXElement , Set < PhysicalEntity > > map = getRelatedPhysicalEntityMap ( elements ) ; Set < PhysicalEntity > pes = new HashSet < PhysicalEntity > ( ) ; for ( Set < PhysicalEntity > valueSet : map . values ( ) ) ...
Gets the related wrappers of the given elements in a set .
6,208
public static Set < Node > prepareSingleNodeSetFromSets ( Set < Set < BioPAXElement > > sets , Graph graph ) { Set < BioPAXElement > elements = new HashSet < BioPAXElement > ( ) ; for ( Set < BioPAXElement > set : sets ) { elements . addAll ( set ) ; } return prepareSingleNodeSet ( elements , graph ) ; }
Gets the related wrappers of the given elements in the sets .
6,209
public static Map < BioPAXElement , Set < PhysicalEntity > > getRelatedPhysicalEntityMap ( Collection < BioPAXElement > elements ) { replaceXrefsWithRelatedER ( elements ) ; Map < BioPAXElement , Set < PhysicalEntity > > map = new HashMap < BioPAXElement , Set < PhysicalEntity > > ( ) ; for ( BioPAXElement ele : elemen...
Maps each BioPAXElement to its related PhysicalEntity objects .
6,210
protected static void replaceXrefsWithRelatedER ( Collection < BioPAXElement > elements ) { Set < EntityReference > ers = new HashSet < EntityReference > ( ) ; Set < Xref > xrefs = new HashSet < Xref > ( ) ; for ( BioPAXElement element : elements ) { if ( element instanceof Xref ) { xrefs . add ( ( Xref ) element ) ; f...
Replaces Xref objects with the related EntityReference objects . This is required for the use case when user provides multiple xrefs that point to the same ER .
6,211
public static Set < PhysicalEntity > getRelatedPhysicalEntities ( BioPAXElement element , Set < PhysicalEntity > pes ) { if ( pes == null ) pes = new HashSet < PhysicalEntity > ( ) ; if ( element instanceof PhysicalEntity ) { PhysicalEntity pe = ( PhysicalEntity ) element ; if ( ! pes . contains ( pe ) ) { pes . add ( ...
Gets the related PhysicalEntity objects of the given BioPAXElement in level 3 models .
6,212
private static void addEquivalentsComplexes ( PhysicalEntity pe , Set < PhysicalEntity > pes ) { addEquivalentsComplexes ( pe , true , pes ) ; }
Adds equivalents and parent complexes of the given PhysicalEntity to the parameter set .
6,213
public static Set < Node > getSeedInteractions ( Collection < BioPAXElement > elements , Graph graph ) { Set < Node > nodes = new HashSet < Node > ( ) ; for ( BioPAXElement ele : elements ) { if ( ele instanceof Conversion || ele instanceof TemplateReaction || ele instanceof Control ) { GraphObject go = graph . getGrap...
Extracts the querible interactions from the elements .
6,214
public String getColumnValue ( SIFInteraction inter ) { switch ( type ) { case MEDIATOR : return concat ( inter . getMediatorIDs ( ) ) ; case PATHWAY : return concat ( inter . getPathwayNames ( ) ) ; case PATHWAY_URI : return concat ( inter . getPathwayUris ( ) ) ; case PUBMED : return concat ( inter . getPublicationID...
Get the string to write in the output file .
6,215
public void writeSBGN ( Model model , String file ) { Sbgn sbgn = createSBGN ( model ) ; try { SbgnUtil . writeToFile ( sbgn , new File ( file ) ) ; } catch ( JAXBException e ) { throw new RuntimeException ( "writeSBGN, SbgnUtil.writeToFile failed" , e ) ; } }
Converts the given model to SBGN and writes in the specified file .
6,216
public void writeSBGN ( Model model , OutputStream stream ) { Sbgn sbgn = createSBGN ( model ) ; try { JAXBContext context = JAXBContext . newInstance ( "org.sbgn.bindings" ) ; Marshaller marshaller = context . createMarshaller ( ) ; marshaller . setProperty ( Marshaller . JAXB_FORMATTED_OUTPUT , Boolean . TRUE ) ; mar...
Converts the given model to SBGN and writes in the specified output stream .
6,217
private void processControllers ( Set < Control > controls , Glyph process ) { for ( Control ctrl : controls ) { Glyph g = createControlStructure ( ctrl ) ; if ( g != null ) { createArc ( g , process , getControlType ( ctrl ) , null ) ; processControllers ( ctrl . getControlledOf ( ) , g ) ; } } }
Associate all the controllers of this process ;
6,218
private String extractGeneSymbol ( Xref xref ) { if ( xref . getDb ( ) != null && ( xref . getDb ( ) . equalsIgnoreCase ( "HGNC Symbol" ) || xref . getDb ( ) . equalsIgnoreCase ( "Gene Symbol" ) || xref . getDb ( ) . equalsIgnoreCase ( "HGNC" ) ) ) { String ref = xref . getId ( ) ; if ( ref != null ) { ref = ref . trim...
Searches for gene symbol in Xref .
6,219
public void setRangeRestriction ( Map < Class < ? extends BioPAXElement > , Set < Class < ? extends BioPAXElement > > > restrictedRanges ) { this . restrictedRanges = restrictedRanges ; }
This method sets all range restrictions .
6,220
public Collection < BioPAXElement > generate ( Match match , int ... ind ) { Collection < BioPAXElement > gen = new HashSet < BioPAXElement > ( con [ 0 ] . generate ( match , ind ) ) ; Set < BioPAXElement > input = new HashSet < BioPAXElement > ( ) ; Set < BioPAXElement > output = new HashSet < BioPAXElement > ( gen ) ...
Chains the member constraints and returns the output of the last constraint .
6,221
public Collection < BioPAXElement > generate ( Match match , int ... ind ) { Control ctrl = ( Control ) match . get ( ind [ 0 ] ) ; return new HashSet < BioPAXElement > ( getRelatedERs ( ctrl ) ) ; }
Navigates to the related ERs of the controllers of the given Control .
6,222
public Collection < BioPAXElement > generate ( Match match , int ... ind ) { PhysicalEntity pe = ( PhysicalEntity ) match . get ( ind [ 0 ] ) ; Conversion conv = ( Conversion ) match . get ( ind [ 1 ] ) ; if ( ! ( ( peType == RelType . INPUT && getConvParticipants ( conv , RelType . INPUT ) . contains ( pe ) ) || ( peT...
According to the relation between PhysicalEntity and the Conversion checks of the Control is relevant . If relevant it is retrieved .
6,223
public void init ( ) { ControlType type = ctrl . getControlType ( ) ; if ( type != null && type . toString ( ) . startsWith ( "I" ) ) { sign = NEGATIVE ; } else { sign = POSITIVE ; } if ( ctrl instanceof TemplateReactionRegulation ) transcription = true ; }
Extracts the sign and the type of the Control .
6,224
private void bindUpstream ( BioPAXElement element ) { AbstractNode node = ( AbstractNode ) graph . getGraphObject ( element ) ; if ( node != null ) { Edge edge = new EdgeL3 ( node , this , graph ) ; node . getDownstreamNoInit ( ) . add ( edge ) ; this . getUpstreamNoInit ( ) . add ( edge ) ; } }
Puts the wrapper of the parameter element to the upstream of this Control .
6,225
public Set getValueFromModel ( Model model ) { Set < ? extends BioPAXElement > domains = new HashSet < BioPAXElement > ( model . getObjects ( this . getDomain ( ) ) ) ; return getValueFromBeans ( domains ) ; }
This method runs the path query on all the elements within the model .
6,226
private void load ( String filename ) { try { load ( new FileInputStream ( filename ) ) ; } catch ( FileNotFoundException e ) { e . printStackTrace ( ) ; } }
Reads data from the given file .
6,227
private void load ( InputStream is ) { try { BufferedReader reader = new BufferedReader ( new InputStreamReader ( is ) ) ; for ( String line = reader . readLine ( ) ; line != null ; line = reader . readLine ( ) ) { String [ ] tok = line . split ( DELIM ) ; if ( tok . length >= 3 ) { addEntry ( tok [ 0 ] , Integer . par...
Reads data from the input stream and loads itself .
6,228
public void addEntry ( String id , int score , RelType context ) { this . score . put ( id , score ) ; this . context . put ( id , context ) ; }
Adds a new blacklisted ID .
6,229
public void write ( String filename ) { try { write ( new FileOutputStream ( filename ) ) ; } catch ( FileNotFoundException e ) { e . printStackTrace ( ) ; } }
Dumps data to the given file .
6,230
public void write ( OutputStream os ) { List < String > ids = new ArrayList < String > ( score . keySet ( ) ) ; final Map < String , Integer > score = this . score ; Collections . sort ( ids , new Comparator < String > ( ) { public int compare ( String o1 , String o2 ) { return score . get ( o2 ) . compareTo ( score . ...
Dumps data to the given output stream .
6,231
private RelType convertContext ( String type ) { if ( type . equals ( "I" ) ) return RelType . INPUT ; if ( type . equals ( "O" ) ) return RelType . OUTPUT ; if ( type . equals ( "B" ) ) return null ; throw new IllegalArgumentException ( "Unknown context: " + type ) ; }
Converts text context to enum .
6,232
private Set < String > getLeastUbique ( Collection < String > ids ) { Set < String > select = new HashSet < String > ( ) ; int s = getLeastScore ( ids ) ; for ( String id : ids ) { if ( score . get ( id ) == s ) select . add ( id ) ; } return select ; }
Gets the subset with the least score .
6,233
private int getLeastScore ( Collection < String > ids ) { int s = Integer . MAX_VALUE ; for ( String id : ids ) { if ( score . get ( id ) < s ) s = score . get ( id ) ; } return s ; }
Gets the least score of the given ids .
6,234
private boolean isUbiqueInBothContexts ( String id ) { return context . containsKey ( id ) && context . get ( id ) == null ; }
Checks if the given ID is blacklisted in both contexts together .
6,235
private boolean isUbique ( String id , RelType context ) { if ( context == null ) return this . context . containsKey ( id ) ; if ( ! isUbique ( id ) ) return false ; RelType ctx = this . context . get ( id ) ; return ctx == null || ctx . equals ( context ) ; }
Checks if the given ID is blacklisted in the given context .
6,236
public boolean isUbique ( PhysicalEntity pe ) { String id = getSMRID ( pe ) ; return id != null && isUbique ( id ) ; }
Checks if the given entity is blacklisted in at least one context .
6,237
public boolean isUbiqueInBothContexts ( PhysicalEntity pe ) { String id = getSMRID ( pe ) ; return id != null && isUbiqueInBothContexts ( id ) ; }
Checks if the given entity is blacklisted in both context together .
6,238
public boolean isUbique ( PhysicalEntity pe , Conversion conv , ConversionDirectionType dir , RelType context ) { String id = getSMRID ( pe ) ; if ( id == null ) return false ; if ( dir == null ) throw new IllegalArgumentException ( "The conversion direction has to be specified." ) ; if ( context == null ) throw new Il...
Checks if the given entity is blacklisted for the given Conversion assuming the Conversion flows towards the given direction and the entity is in given context .
6,239
private String getSMRID ( PhysicalEntity pe ) { if ( pe instanceof SmallMolecule ) { EntityReference er = ( ( SmallMolecule ) pe ) . getEntityReference ( ) ; if ( er != null ) return er . getUri ( ) ; } return null ; }
Gets the ID of the reference of the given entity if it is a small molecule .
6,240
protected void addToDownstream ( BioPAXElement pe , Graph graph ) { AbstractNode node = ( AbstractNode ) graph . getGraphObject ( pe ) ; if ( node != null ) { EdgeL3 edge = new EdgeL3 ( this , node , graph ) ; edge . setTranscription ( true ) ; node . getUpstreamNoInit ( ) . add ( edge ) ; this . getDownstreamNoInit ( ...
Binds the given PhysicalEntity to the downstream .
6,241
public void initDownstream ( ) { for ( Interaction inter : getDownstreamInteractions ( pe . getParticipantOf ( ) ) ) { AbstractNode node = ( AbstractNode ) graph . getGraphObject ( inter ) ; if ( node == null ) continue ; if ( inter instanceof Conversion ) { Conversion conv = ( Conversion ) inter ; ConversionWrapper co...
Binds to downstream interactions .
6,242
protected Set < Interaction > getDownstreamInteractions ( Collection < Interaction > inters ) { Set < Interaction > set = new HashSet < Interaction > ( ) ; for ( Interaction inter : inters ) { if ( inter instanceof Conversion ) { Conversion conv = ( Conversion ) inter ; ConversionDirectionType dir = conv . getConversio...
Gets the downstream interactions among the given set .
6,243
private Set < Conversion > getRelatedConversions ( Collection < Interaction > inters ) { Set < Conversion > set = new HashSet < Conversion > ( ) ; for ( Interaction inter : inters ) { if ( inter instanceof Conversion ) { set . add ( ( Conversion ) inter ) ; } else if ( inter instanceof Control ) { getRelatedConversions...
Get all related Conversions of the given Interaction set .
6,244
private Set < Conversion > getRelatedConversions ( Control ctrl , Set < Conversion > set ) { for ( Process process : ctrl . getControlled ( ) ) { if ( process instanceof Conversion ) { set . add ( ( Conversion ) process ) ; } else if ( process instanceof Control ) { getRelatedConversions ( ( Control ) process , set ) ;...
Recursively searches the related Conversions of a Control .
6,245
public void convert ( InputStream inputStream , OutputStream outputStream , boolean forceInteractionToComplex ) throws IOException , PsimiXmlReaderException { if ( inputStream == null || outputStream == null ) { throw new IllegalArgumentException ( "convert(): " + "one or more null arguments." ) ; } PsimiXmlReader read...
Converts the PSI - MI inputStream into BioPAX outputStream . Streams will be closed by the converter .
6,246
public void convertTab ( InputStream inputStream , OutputStream outputStream , boolean forceInteractionToComplex ) throws IOException , PsimiTabException { if ( inputStream == null || outputStream == null ) { throw new IllegalArgumentException ( "convertTab(): " + "one or more null arguments." ) ; } PsimiTabReader read...
Converts the PSI - MITAB inputStream into BioPAX outputStream . Streams will be closed by the converter .
6,247
public void convert ( EntrySet entrySet , OutputStream outputStream , boolean forceInteractionToComplex ) { if ( entrySet == null || outputStream == null ) { throw new IllegalArgumentException ( "convert: one or more null arguments." ) ; } if ( entrySet . getLevel ( ) != 2 ) { throw new IllegalArgumentException ( "conv...
Converts the PSI interactions from the EntrySet and places into BioPAX output stream . Stream will be closed by the converter .
6,248
public void writeResult ( Map < BioPAXElement , List < Match > > matches , OutputStream out ) throws IOException { OutputStreamWriter writer = new OutputStreamWriter ( out ) ; for ( BioPAXElement ele : matches . keySet ( ) ) { Set < String > syms = new HashSet < String > ( ) ; for ( Match m : matches . get ( ele ) ) { ...
Writes the IDs of interaction then gene symbols of related proteins in a line .
6,249
public Collection < BioPAXElement > generate ( Match match , int ... ind ) { Collection < BioPAXElement > gen = con . generate ( match , ind ) ; gen . add ( match . get ( ind [ selfIndex ] ) ) ; return gen ; }
Gets the first mapped element along with the generated elements of wrapped constraint .
6,250
public boolean satisfies ( Match match , int ... ind ) { return match . get ( ind [ selfIndex ] ) == match . get ( ind [ ind . length - 1 ] ) || super . satisfies ( match , ind ) ; }
Checks if the last index is either generated or equal to the first element .
6,251
public GraphObject getGraphObject ( Object obj ) { String key = getKey ( obj ) ; GraphObject go = objectMap . get ( key ) ; if ( go == null ) { Node node = wrap ( obj ) ; if ( node != null ) { objectMap . put ( key , node ) ; node . init ( ) ; } } return objectMap . get ( key ) ; }
Gets the related wrapper for the given object creates the wrapper if not created before .
6,252
public String convert ( SIFInteraction inter ) { String s = inter . toString ( ) ; for ( OutputColumn column : columns ) { s += "\t" + column . getColumnValue ( inter ) ; } return s ; }
Prepares the line in the output file for the given interaction .
6,253
private static Map < String , Set < BioPAXElement > > collectEntityRefs ( Collection < SIFInteraction > inters ) { Map < String , Set < BioPAXElement > > map = new HashMap < String , Set < BioPAXElement > > ( ) ; for ( SIFInteraction inter : inters ) { if ( ! map . containsKey ( inter . sourceID ) ) map . put ( inter ....
Collects the sources and targets in given interactions .
6,254
private static String concat ( Collection < String > col ) { StringBuilder b = new StringBuilder ( ) ; boolean first = true ; for ( String s : col ) { if ( first ) first = false ; else b . append ( ";" ) ; b . append ( s ) ; } return b . toString ( ) ; }
Concatenates the given collection of strings into a single string where values are separated with a semicolon .
6,255
public void initUpstream ( ) { NucleicAcid nuc = tempReac . getTemplate ( ) ; if ( nuc != null ) addToUpstream ( nuc , getGraph ( ) ) ; for ( Control cont : tempReac . getControlledOf ( ) ) { addToUpstream ( cont , graph ) ; } }
Binds to template and controllers .
6,256
protected void addToUpstream ( BioPAXElement ele , org . biopax . paxtools . query . model . Graph graph ) { AbstractNode node = ( AbstractNode ) graph . getGraphObject ( ele ) ; if ( node == null ) return ; Edge edge = new EdgeL3 ( node , this , graph ) ; if ( isTranscription ( ) ) { if ( node instanceof ControlWrappe...
Binds the given element to the upstream .
6,257
public Set < GraphObject > run ( ) { Map < GraphObject , Integer > candidate = new HashMap < GraphObject , Integer > ( ) ; Set < GraphObject > result = new HashSet < GraphObject > ( ) ; for ( Set < Node > source : sourceSet ) { BFS bfs = new BFS ( source , null , direction , limit ) ; Map < GraphObject , Integer > BFSR...
Method to run the query .
6,258
public BioPAXElement get ( String label , Pattern p ) { return variables [ p . indexOf ( label ) ] ; }
Gets element corresponding to the given label in the pattern .
6,259
public List < BioPAXElement > get ( String [ ] label , Pattern p ) { if ( label == null ) return Collections . emptyList ( ) ; List < BioPAXElement > list = new ArrayList < BioPAXElement > ( label . length ) ; for ( String lab : label ) { list . add ( variables [ p . indexOf ( lab ) ] ) ; } return list ; }
Gets elements corresponding to the given labels in the pattern .
6,260
public String getAName ( BioPAXElement ele ) { String name = null ; if ( ele instanceof Named ) { Named n = ( Named ) ele ; if ( n . getDisplayName ( ) != null && n . getDisplayName ( ) . length ( ) > 0 ) name = n . getDisplayName ( ) ; else if ( n . getStandardName ( ) != null && n . getStandardName ( ) . length ( ) >...
Finds a name for the variable .
6,261
public void init ( ) { if ( conv . getConversionDirection ( ) == ConversionDirectionType . REVERSIBLE && this . reverse == null ) { reverse = new ConversionWrapper ( conv , ( GraphL3 ) graph ) ; this . direction = LEFT_TO_RIGHT ; reverse . direction = RIGHT_TO_LEFT ; reverse . reverse = this ; } else if ( conv . getCon...
Extracts the direction creates the reverse if necessary .
6,262
public void initUpstream ( ) { if ( direction == LEFT_TO_RIGHT ) { for ( PhysicalEntity pe : conv . getLeft ( ) ) { addToUpstream ( pe , getGraph ( ) ) ; } } else { for ( PhysicalEntity pe : conv . getRight ( ) ) { addToUpstream ( pe , getGraph ( ) ) ; } } for ( Control cont : conv . getControlledOf ( ) ) { if ( cont i...
Binds inputs and controllers .
6,263
public void initDownstream ( ) { if ( direction == RIGHT_TO_LEFT ) { for ( PhysicalEntity pe : conv . getLeft ( ) ) { addToDownstream ( pe , getGraph ( ) ) ; } } else { for ( PhysicalEntity pe : conv . getRight ( ) ) { addToDownstream ( pe , getGraph ( ) ) ; } } }
Binds products .
6,264
public Pattern getPattern ( ) { if ( pattern == null ) { pattern = constructPattern ( ) ; if ( this instanceof SIFMiner && idFetcher != null && idMap != null ) { pattern . add ( new HasAnID ( idFetcher , idMap ) , ( ( SIFMiner ) this ) . getSourceLabel ( ) ) ; pattern . add ( new HasAnID ( idFetcher , idMap ) , ( ( SIF...
Gets the pattern constructs if null .
6,265
public boolean isInhibition ( Control ctrl ) { return ctrl . getControlType ( ) != null && ctrl . getControlType ( ) . toString ( ) . startsWith ( "I" ) ; }
Checks if the type of a Control is inhibition .
6,266
public Set < String > toStringSet ( Set < ModificationFeature > set ) { List < ModificationFeature > list = new ArrayList < ModificationFeature > ( set ) ; Collections . sort ( list , new Comparator < ModificationFeature > ( ) { public int compare ( ModificationFeature o1 , ModificationFeature o2 ) { String t1 = getMod...
Sorts the modifications and gets them in a String .
6,267
private Set < String > getInString ( List < ModificationFeature > list ) { Set < String > text = new HashSet < String > ( list . size ( ) ) ; for ( ModificationFeature mf : list ) { String term = getModificationTerm ( mf ) ; String loc = getPositionInString ( mf ) ; if ( term != null ) { String s = term + loc ; if ( ! ...
Gets the modifications is a string that is separated with comma .
6,268
public String getModificationTerm ( ModificationFeature mf ) { Set vals = TERM_ACC . getValueFromBean ( mf ) ; if ( vals . isEmpty ( ) ) return null ; return vals . iterator ( ) . next ( ) . toString ( ) ; }
Gets the String term of the modification feature .
6,269
public int getPositionStart ( ModificationFeature mf ) { Set vals = SITE_ACC . getValueFromBean ( mf ) ; if ( ! vals . isEmpty ( ) ) { return ( ( Integer ) vals . iterator ( ) . next ( ) ) ; } vals = INTERVAL_BEGIN_ACC . getValueFromBean ( mf ) ; if ( ! vals . isEmpty ( ) ) { return ( ( Integer ) vals . iterator ( ) . ...
Gets the first position of the modification feature .
6,270
public String getPositionInString ( ModificationFeature mf ) { Set vals = SITE_ACC . getValueFromBean ( mf ) ; if ( ! vals . isEmpty ( ) ) { int x = ( ( Integer ) vals . iterator ( ) . next ( ) ) ; if ( x > 0 ) return "@" + x ; } vals = INTERVAL_BEGIN_ACC . getValueFromBean ( mf ) ; if ( ! vals . isEmpty ( ) ) { int be...
Gets the position of the modification feature as a String .
6,271
protected Set < String > getModifications ( Match m , String label ) { PhysicalEntity pe = ( PhysicalEntity ) m . get ( label , getPattern ( ) ) ; return toStringSet ( new HashSet < ModificationFeature > ( FEAT_ACC . getValueFromBean ( pe ) ) ) ; }
Gets modifications of the given element in a string . The element has to be a PhysicalEntity .
6,272
protected String concat ( Set < String > set , String sep ) { String s = "" ; int i = set . size ( ) ; for ( String ss : set ) { s += ss ; if ( -- i > 0 ) s += sep ; } return s ; }
Converts the set of string to a single string .
6,273
protected int sign ( Control ctrl ) { ControlType type = ctrl . getControlType ( ) ; if ( type != null && type . name ( ) . startsWith ( "I" ) ) return - 1 ; return 1 ; }
Identifies negative and positive controls . Assumes positive by default .
6,274
protected int sign ( Match m , String ... ctrlLabel ) { int sign = 1 ; for ( String lab : ctrlLabel ) { Control ctrl = ( Control ) m . get ( lab , getPattern ( ) ) ; sign *= sign ( ctrl ) ; } return sign ; }
Checks the cumulative sign of the chained controls .
6,275
protected boolean labeledInactive ( Match m , String simpleLabel , String complexLabel ) { PhysicalEntityChain chain = getChain ( m , simpleLabel , complexLabel ) ; PhysicalEntityChain . Activity activity = chain . checkActivityLabel ( ) ; return activity == PhysicalEntityChain . Activity . INACTIVE ; }
Checks if a PE chain is labeled as inactive .
6,276
protected void writeResultDetailed ( Map < BioPAXElement , List < Match > > matches , OutputStream out , int columns ) throws IOException { OutputStreamWriter writer = new OutputStreamWriter ( out ) ; String header = getHeader ( ) ; if ( header != null ) { writer . write ( header ) ; } else { for ( int i = 0 ; i < colu...
Writes the result as a tab delimited format where the column values are customized .
6,277
public Set < SIFInteraction > createSIFInteraction ( Match m , IDFetcher fetcher ) { BioPAXElement sourceBpe = m . get ( ( ( SIFMiner ) this ) . getSourceLabel ( ) , getPattern ( ) ) ; BioPAXElement targetBpe = m . get ( ( ( SIFMiner ) this ) . getTargetLabel ( ) , getPattern ( ) ) ; Set < String > sources = fetchIDs (...
Creates a SIF interaction for the given match .
6,278
protected Set < String > getIdentifiers ( Match m , String label ) { BioPAXElement el = m . get ( label , getPattern ( ) ) ; if ( idFetcher != null ) return idFetcher . fetchID ( el ) ; Set < String > set = new HashSet < String > ( ) ; if ( el instanceof ProteinReference ) { set . add ( getGeneSymbol ( ( ProteinReferen...
Uses uniprot name or gene symbol as identifier .
6,279
public void update ( LGraphObject lGraphObj ) { if ( lGraphObj instanceof CoSEGraph ) { return ; } LNode lNode = ( LNode ) lGraphObj ; this . glyph . getBbox ( ) . setX ( ( float ) lNode . getLeft ( ) ) ; this . glyph . getBbox ( ) . setY ( ( float ) lNode . getTop ( ) ) ; this . placeStateAndInfoGlyphs ( ) ; }
Function that will take place when VNode objects will update in layout process of ChiLay
6,280
public void setBounds ( float w , float h ) { this . glyph . getBbox ( ) . setW ( w ) ; this . glyph . getBbox ( ) . setH ( h ) ; }
Sets the bound of this VNode by given width and height
6,281
public void setSizeAccordingToClass ( ) { String glyphClass = this . glyph . getClazz ( ) ; if ( glyphClass . equalsIgnoreCase ( NONE ) ) return ; if ( glyphClass . equalsIgnoreCase ( SOURCE_AND_SINK ) ) { setBounds ( SOURCE_AND_SINK_BOUND . getWidth ( ) , SOURCE_AND_SINK_BOUND . getHeight ( ) ) ; } else if ( glyphClas...
Chooses a proper bound for this VNode according to its class .
6,282
public int calcReqWidthByStateAndInfos ( List < Glyph > stateORinfoList ) { int wholeSize = 0 ; int count = 0 ; for ( Glyph tmpGlyph : stateORinfoList ) { String text ; if ( tmpGlyph . getState ( ) != null ) { text = tmpGlyph . getState ( ) . getValue ( ) ; if ( tmpGlyph . getState ( ) . getVariable ( ) != null && tmpG...
Calculates required width according to the given list state and info glyphs of this VNode . This method also previously computes the width and height of state and info glyphs according to their label .
6,283
public void updateSizeForStateAndInfo ( ) { for ( Glyph glyph : this . glyph . getGlyph ( ) ) { if ( glyph . getClazz ( ) == STATE_VARIABLE ) { stateGlyphs . add ( glyph ) ; } else if ( glyph . getClazz ( ) == UNIT_OF_INFORMATION ) { infoGlyphs . add ( glyph ) ; } } int wholeWidthOfStates = calcReqWidthByStateAndInfos ...
If glyph attribute of this VNode object includes any state of information or unit of information glyphs this method updates the size of VNode accordingly .
6,284
public Set < GraphObject > run ( ) { Set < GraphObject > queryResult = new HashSet < GraphObject > ( ) ; if ( direction == Direction . UPSTREAM || direction == Direction . BOTHSTREAM ) { BFS bfsBackward = new BFS ( sourceNodes , null , Direction . UPSTREAM , this . limit ) ; Map < GraphObject , Integer > mapBackward = ...
Executes the query .
6,285
private void add ( Constraint constr , int ... ind ) { assert ind . length > 0 ; assert constr . getVariableSize ( ) == ind . length ; for ( int i = 0 ; i < ( constr . canGenerate ( ) ? ind . length - 1 : ind . length ) ; i ++ ) { assert ind [ i ] <= lastIndex ; } constraints . add ( new MappedConst ( constr , ind ) ) ...
Creates a mapped constraint with the given constraint and the indexes it applies .
6,286
public void removeLastConstraint ( ) { if ( constraints . isEmpty ( ) ) return ; MappedConst mc = constraints . get ( constraints . size ( ) - 1 ) ; constraints . remove ( mc ) ; if ( mc . canGenerate ( ) && mc . getInds ( ) [ mc . getInds ( ) . length - 1 ] == lastIndex ) { setLastIndexToMaxFound ( ) ; } }
Removes the last constraint added to the pattern .
6,287
private void setLastIndexToMaxFound ( ) { int max = - 1 ; for ( MappedConst mc : constraints ) { int [ ] ind = mc . getInds ( ) ; int last = ind [ ind . length - 1 ] ; if ( last > max ) max = last ; } lastIndex = max ; }
This method is used after removal of an generative constraint . Searching the remaining constraints we decide the value of lastIndex .
6,288
public void add ( Constraint constr , String ... label ) { checkLabels ( constr . canGenerate ( ) , label ) ; int [ ] ind = convertLabelsToInds ( label ) ; if ( ind . length != constr . getVariableSize ( ) ) { throw new IllegalArgumentException ( "Mapped elements do not match the constraint size." ) ; } add ( constr , ...
Creates a mapped constraint with the given generative constraint and the indexes it applies . Also labels the last given index .
6,289
private int [ ] convertLabelsToInds ( String ... label ) { int [ ] ind = new int [ label . length ] ; for ( int i = 0 ; i < label . length ; i ++ ) { if ( hasLabel ( label [ i ] ) ) { ind [ i ] = indexOf ( label [ i ] ) ; } else ind [ i ] = lastIndex + 1 ; } return ind ; }
Converts the labels to the indexes . Assumes the sanity of the labels already checked and if any new label exists it is only one and it is the last one .
6,290
private String [ ] convertIndsToLabels ( int ... ind ) { String [ ] label = new String [ ind . length ] ; for ( int i = 0 ; i < ind . length ; i ++ ) { if ( ! hasLabel ( ind [ i ] ) ) throw new IllegalArgumentException ( "The index " + ind [ i ] + " does not have a label." ) ; label [ i ] = getLabel ( ind [ i ] ) ; } r...
Converts the indices to the labels . All indices must have an existing label .
6,291
public void add ( Pattern p ) { if ( ! hasLabel ( p . getLabel ( 0 ) ) ) throw new IllegalArgumentException ( "The label of first " + "element of parameter index \"" + p . getLabel ( 0 ) + "\" not found in this pattern." ) ; for ( MappedConst mc : p . getConstraints ( ) ) { add ( mc . getConstr ( ) , p . convertIndsToL...
Appends the constraints in the parameter pattern to the desired location . Indexes in the constraint mappings are translated so that 0 is translated to ind0 and others are translated to orig + indAppend - 1 . All slots of this pattern should already be full before calling this method . This method makes room for the ne...
6,292
private String getLabel ( int i ) { for ( String label : labelMap . keySet ( ) ) { if ( labelMap . get ( label ) == i ) return label ; } return null ; }
Gets the label for the element at the specified index .
6,293
public void insertPointConstraint ( Constraint con , int ... ind ) { assert con . getVariableSize ( ) == 1 ; for ( int i : ind ) { for ( int j = 0 ; j < constraints . size ( ) ; j ++ ) { int [ ] index = constraints . get ( j ) . getInds ( ) ; if ( index [ index . length - 1 ] == i ) { constraints . add ( j + 1 , new Ma...
A point constraint deals with only one element in a match checks its validity . This method injects the parameter constraint multiple times among the list of mapped constraints to the specified indexes .
6,294
public void label ( String labelText , int index ) { if ( labelMap . containsKey ( labelText ) ) throw new IllegalArgumentException ( "Label \"" + labelText + "\" already exists." ) ; if ( labelMap . containsValue ( index ) ) throw new IllegalArgumentException ( "Index \"" + index + "\" already has a label." ) ; labelM...
Puts the given label for the given index .
6,295
public int indexOf ( String labelText ) { if ( ! labelMap . containsKey ( labelText ) ) throw new IllegalArgumentException ( "The label \"" + labelText + "\" is absent in pattern." ) ; return labelMap . get ( labelText ) ; }
Gets the index of the given label . The label must exist otherwise a runtime exception is thrown .
6,296
public void updateLabel ( String oldLabel , String newLabel ) { if ( hasLabel ( newLabel ) ) throw new IllegalArgumentException ( "The label \"" + newLabel + "\" already exists." ) ; int i = indexOf ( oldLabel ) ; labelMap . remove ( oldLabel ) ; labelMap . put ( newLabel , i ) ; }
Changes a label . The oldLabel has to be an existing label and new label has to be a new label .
6,297
public static void main ( String [ ] args ) throws IllegalAccessException , InvocationTargetException { for ( String arg : args ) { log . info ( arg ) ; if ( arg . toLowerCase ( ) . endsWith ( "owl" ) ) { try { processXrefs ( arg ) ; } catch ( FileNotFoundException e ) { e . printStackTrace ( ) ; } } } }
args - a space seperated list of owl files to be processed
6,298
private static void processXrefs ( String arg ) throws FileNotFoundException , IllegalAccessException , InvocationTargetException { FileInputStream in = new FileInputStream ( new File ( arg ) ) ; Model level2 = reader . convertFromOWL ( in ) ; Set < unificationXref > unis = level2 . getObjects ( unificationXref . class...
Main conversion method . Demonstrates how to read and write a BioPAX model and accessing its objects .
6,299
private static void convert ( unificationXref uni , Model level2 ) { Set < XReferrable > referrables = new HashSet < XReferrable > ( uni . isXREFof ( ) ) ; relationshipXref relationshipXref = level2 . addNew ( relationshipXref . class , uni . getUri ( ) ) ; relationshipXref . setCOMMENT ( uni . getCOMMENT ( ) ) ; relat...
This method converts the given unification xref to a relationship xref