id
int32 0
165k
| repo
stringlengths 7
58
| path
stringlengths 12
218
| func_name
stringlengths 3
140
| original_string
stringlengths 73
34.1k
| language
stringclasses 1
value | code
stringlengths 73
34.1k
| code_tokens
list | docstring
stringlengths 3
16k
| docstring_tokens
list | sha
stringlengths 40
40
| url
stringlengths 105
339
|
|---|---|---|---|---|---|---|---|---|---|---|---|
10,900
|
BioPAX/Paxtools
|
paxtools-query/src/main/java/org/biopax/paxtools/query/QueryExecuter.java
|
QueryExecuter.runCommonStream
|
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<Set<Node>> source = prepareNodeSets(sourceSet, graph);
if (sourceSet.size() < 2) return Collections.emptySet();
CommonStreamQuery query = new CommonStreamQuery(source, direction, limit);
Set<GraphObject> resultWrappers = query.run();
return convertQueryResult(resultWrappers, graph, false);
}
|
java
|
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<Set<Node>> source = prepareNodeSets(sourceSet, graph);
if (sourceSet.size() < 2) return Collections.emptySet();
CommonStreamQuery query = new CommonStreamQuery(source, direction, limit);
Set<GraphObject> resultWrappers = query.run();
return convertQueryResult(resultWrappers, graph, false);
}
|
[
"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",
"<",
"Set",
"<",
"Node",
">",
">",
"source",
"=",
"prepareNodeSets",
"(",
"sourceSet",
",",
"graph",
")",
";",
"if",
"(",
"sourceSet",
".",
"size",
"(",
")",
"<",
"2",
")",
"return",
"Collections",
".",
"emptySet",
"(",
")",
";",
"CommonStreamQuery",
"query",
"=",
"new",
"CommonStreamQuery",
"(",
"source",
",",
"direction",
",",
"limit",
")",
";",
"Set",
"<",
"GraphObject",
">",
"resultWrappers",
"=",
"query",
".",
"run",
"(",
")",
";",
"return",
"convertQueryResult",
"(",
"resultWrappers",
",",
"graph",
",",
"false",
")",
";",
"}"
] |
Gets the elements in the common upstream or downstream of the seed
@param sourceSet Seed to the query
@param model BioPAX model
@param direction UPSTREAM or DOWNSTREAM
@param limit Length limit for the search
@param filters for filtering graph elements
@return BioPAX elements in the result
|
[
"Gets",
"the",
"elements",
"in",
"the",
"common",
"upstream",
"or",
"downstream",
"of",
"the",
"seed"
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/paxtools-query/src/main/java/org/biopax/paxtools/query/QueryExecuter.java#L262-L285
|
10,901
|
BioPAX/Paxtools
|
paxtools-query/src/main/java/org/biopax/paxtools/query/QueryExecuter.java
|
QueryExecuter.convertQueryResult
|
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((BioPAXElement) o);
}
// remove disconnected simple physical entities
if (removeDisconnected)
{
Set<BioPAXElement> remove = new HashSet<BioPAXElement>();
for (BioPAXElement ele : set)
{
if (ele instanceof SimplePhysicalEntity &&
isDisconnected((SimplePhysicalEntity) ele, set))
{
remove.add(ele);
}
}
set.removeAll(remove);
}
return set;
}
|
java
|
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((BioPAXElement) o);
}
// remove disconnected simple physical entities
if (removeDisconnected)
{
Set<BioPAXElement> remove = new HashSet<BioPAXElement>();
for (BioPAXElement ele : set)
{
if (ele instanceof SimplePhysicalEntity &&
isDisconnected((SimplePhysicalEntity) ele, set))
{
remove.add(ele);
}
}
set.removeAll(remove);
}
return set;
}
|
[
"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",
"(",
"(",
"BioPAXElement",
")",
"o",
")",
";",
"}",
"// remove disconnected simple physical entities",
"if",
"(",
"removeDisconnected",
")",
"{",
"Set",
"<",
"BioPAXElement",
">",
"remove",
"=",
"new",
"HashSet",
"<",
"BioPAXElement",
">",
"(",
")",
";",
"for",
"(",
"BioPAXElement",
"ele",
":",
"set",
")",
"{",
"if",
"(",
"ele",
"instanceof",
"SimplePhysicalEntity",
"&&",
"isDisconnected",
"(",
"(",
"SimplePhysicalEntity",
")",
"ele",
",",
"set",
")",
")",
"{",
"remove",
".",
"add",
"(",
"ele",
")",
";",
"}",
"}",
"set",
".",
"removeAll",
"(",
"remove",
")",
";",
"}",
"return",
"set",
";",
"}"
] |
Converts the query result from wrappers to wrapped BioPAX elements.
@param resultWrappers Wrappers of the result set
@param graph Queried graph
@param removeDisconnected whether to remove disconnected non-complex type physical entities
@return Set of elements in the result
|
[
"Converts",
"the",
"query",
"result",
"from",
"wrappers",
"to",
"wrapped",
"BioPAX",
"elements",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/paxtools-query/src/main/java/org/biopax/paxtools/query/QueryExecuter.java#L438-L466
|
10,902
|
BioPAX/Paxtools
|
paxtools-query/src/main/java/org/biopax/paxtools/query/QueryExecuter.java
|
QueryExecuter.prepareSingleNodeSet
|
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())
{
pes.addAll(valueSet);
}
Set<Node> nodes = graph.getWrapperSet(pes);
// If there are interactions in the seed add them too
Set<Node> inters = getSeedInteractions(elements, graph);
nodes.addAll(inters);
return nodes;
}
|
java
|
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())
{
pes.addAll(valueSet);
}
Set<Node> nodes = graph.getWrapperSet(pes);
// If there are interactions in the seed add them too
Set<Node> inters = getSeedInteractions(elements, graph);
nodes.addAll(inters);
return nodes;
}
|
[
"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",
"(",
")",
")",
"{",
"pes",
".",
"addAll",
"(",
"valueSet",
")",
";",
"}",
"Set",
"<",
"Node",
">",
"nodes",
"=",
"graph",
".",
"getWrapperSet",
"(",
"pes",
")",
";",
"// If there are interactions in the seed add them too",
"Set",
"<",
"Node",
">",
"inters",
"=",
"getSeedInteractions",
"(",
"elements",
",",
"graph",
")",
";",
"nodes",
".",
"addAll",
"(",
"inters",
")",
";",
"return",
"nodes",
";",
"}"
] |
Gets the related wrappers of the given elements in a set.
@param elements Elements to get the related wrappers
@param graph Owner graph
@return Related wrappers in a set
|
[
"Gets",
"the",
"related",
"wrappers",
"of",
"the",
"given",
"elements",
"in",
"a",
"set",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/paxtools-query/src/main/java/org/biopax/paxtools/query/QueryExecuter.java#L499-L517
|
10,903
|
BioPAX/Paxtools
|
paxtools-query/src/main/java/org/biopax/paxtools/query/QueryExecuter.java
|
QueryExecuter.prepareSingleNodeSetFromSets
|
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);
}
|
java
|
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);
}
|
[
"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.
@param sets Sets of elements to get the related wrappers
@param graph Owner graph
@return Related wrappers in a set
|
[
"Gets",
"the",
"related",
"wrappers",
"of",
"the",
"given",
"elements",
"in",
"the",
"sets",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/paxtools-query/src/main/java/org/biopax/paxtools/query/QueryExecuter.java#L525-L533
|
10,904
|
BioPAX/Paxtools
|
paxtools-query/src/main/java/org/biopax/paxtools/query/QueryExecuter.java
|
QueryExecuter.getRelatedPhysicalEntityMap
|
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 : elements)
{
Set<PhysicalEntity> ents = getRelatedPhysicalEntities(ele, null);
if (!ents.isEmpty())
{
map.put(ele, ents);
}
}
return map;
}
|
java
|
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 : elements)
{
Set<PhysicalEntity> ents = getRelatedPhysicalEntities(ele, null);
if (!ents.isEmpty())
{
map.put(ele, ents);
}
}
return map;
}
|
[
"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",
":",
"elements",
")",
"{",
"Set",
"<",
"PhysicalEntity",
">",
"ents",
"=",
"getRelatedPhysicalEntities",
"(",
"ele",
",",
"null",
")",
";",
"if",
"(",
"!",
"ents",
".",
"isEmpty",
"(",
")",
")",
"{",
"map",
".",
"put",
"(",
"ele",
",",
"ents",
")",
";",
"}",
"}",
"return",
"map",
";",
"}"
] |
Maps each BioPAXElement to its related PhysicalEntity objects.
@param elements Elements to map
@return The mapping
|
[
"Maps",
"each",
"BioPAXElement",
"to",
"its",
"related",
"PhysicalEntity",
"objects",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/paxtools-query/src/main/java/org/biopax/paxtools/query/QueryExecuter.java#L594-L610
|
10,905
|
BioPAX/Paxtools
|
paxtools-query/src/main/java/org/biopax/paxtools/query/QueryExecuter.java
|
QueryExecuter.replaceXrefsWithRelatedER
|
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);
for (XReferrable able : ((Xref) element).getXrefOf())
{
if (able instanceof EntityReference)
{
ers.add((EntityReference) able);
}
}
}
}
elements.removeAll(xrefs);
for (EntityReference er : ers)
{
if (!elements.contains(er)) elements.add(er);
}
}
|
java
|
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);
for (XReferrable able : ((Xref) element).getXrefOf())
{
if (able instanceof EntityReference)
{
ers.add((EntityReference) able);
}
}
}
}
elements.removeAll(xrefs);
for (EntityReference er : ers)
{
if (!elements.contains(er)) elements.add(er);
}
}
|
[
"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",
")",
";",
"for",
"(",
"XReferrable",
"able",
":",
"(",
"(",
"Xref",
")",
"element",
")",
".",
"getXrefOf",
"(",
")",
")",
"{",
"if",
"(",
"able",
"instanceof",
"EntityReference",
")",
"{",
"ers",
".",
"add",
"(",
"(",
"EntityReference",
")",
"able",
")",
";",
"}",
"}",
"}",
"}",
"elements",
".",
"removeAll",
"(",
"xrefs",
")",
";",
"for",
"(",
"EntityReference",
"er",
":",
"ers",
")",
"{",
"if",
"(",
"!",
"elements",
".",
"contains",
"(",
"er",
")",
")",
"elements",
".",
"add",
"(",
"er",
")",
";",
"}",
"}"
] |
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.
@param elements elements to send to a query as source or target
|
[
"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",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/paxtools-query/src/main/java/org/biopax/paxtools/query/QueryExecuter.java#L617-L642
|
10,906
|
BioPAX/Paxtools
|
paxtools-query/src/main/java/org/biopax/paxtools/query/QueryExecuter.java
|
QueryExecuter.getRelatedPhysicalEntities
|
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(pe);
for (Complex cmp : pe.getComponentOf())
{
getRelatedPhysicalEntities(cmp, pes);
}
// This is a hack for BioPAX graph. Equivalence relations do not link members and
// complexes because members cannot be addressed. Below call makes sure that if the
// source node has a generic parents or children and they appear in a complex, we
// include the complex in the sources.
addEquivalentsComplexes(pe, pes);
}
}
else if (element instanceof Xref)
{
for (XReferrable xrable : ((Xref) element).getXrefOf())
{
getRelatedPhysicalEntities(xrable, pes);
}
}
else if (element instanceof EntityReference)
{
EntityReference er = (EntityReference) element;
for (SimplePhysicalEntity spe : er.getEntityReferenceOf())
{
getRelatedPhysicalEntities(spe, pes);
}
for (EntityReference parentER : er.getMemberEntityReferenceOf())
{
getRelatedPhysicalEntities(parentER, pes);
}
}
return pes;
}
|
java
|
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(pe);
for (Complex cmp : pe.getComponentOf())
{
getRelatedPhysicalEntities(cmp, pes);
}
// This is a hack for BioPAX graph. Equivalence relations do not link members and
// complexes because members cannot be addressed. Below call makes sure that if the
// source node has a generic parents or children and they appear in a complex, we
// include the complex in the sources.
addEquivalentsComplexes(pe, pes);
}
}
else if (element instanceof Xref)
{
for (XReferrable xrable : ((Xref) element).getXrefOf())
{
getRelatedPhysicalEntities(xrable, pes);
}
}
else if (element instanceof EntityReference)
{
EntityReference er = (EntityReference) element;
for (SimplePhysicalEntity spe : er.getEntityReferenceOf())
{
getRelatedPhysicalEntities(spe, pes);
}
for (EntityReference parentER : er.getMemberEntityReferenceOf())
{
getRelatedPhysicalEntities(parentER, pes);
}
}
return pes;
}
|
[
"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",
"(",
"pe",
")",
";",
"for",
"(",
"Complex",
"cmp",
":",
"pe",
".",
"getComponentOf",
"(",
")",
")",
"{",
"getRelatedPhysicalEntities",
"(",
"cmp",
",",
"pes",
")",
";",
"}",
"// This is a hack for BioPAX graph. Equivalence relations do not link members and",
"// complexes because members cannot be addressed. Below call makes sure that if the",
"// source node has a generic parents or children and they appear in a complex, we",
"// include the complex in the sources.",
"addEquivalentsComplexes",
"(",
"pe",
",",
"pes",
")",
";",
"}",
"}",
"else",
"if",
"(",
"element",
"instanceof",
"Xref",
")",
"{",
"for",
"(",
"XReferrable",
"xrable",
":",
"(",
"(",
"Xref",
")",
"element",
")",
".",
"getXrefOf",
"(",
")",
")",
"{",
"getRelatedPhysicalEntities",
"(",
"xrable",
",",
"pes",
")",
";",
"}",
"}",
"else",
"if",
"(",
"element",
"instanceof",
"EntityReference",
")",
"{",
"EntityReference",
"er",
"=",
"(",
"EntityReference",
")",
"element",
";",
"for",
"(",
"SimplePhysicalEntity",
"spe",
":",
"er",
".",
"getEntityReferenceOf",
"(",
")",
")",
"{",
"getRelatedPhysicalEntities",
"(",
"spe",
",",
"pes",
")",
";",
"}",
"for",
"(",
"EntityReference",
"parentER",
":",
"er",
".",
"getMemberEntityReferenceOf",
"(",
")",
")",
"{",
"getRelatedPhysicalEntities",
"(",
"parentER",
",",
"pes",
")",
";",
"}",
"}",
"return",
"pes",
";",
"}"
] |
Gets the related PhysicalEntity objects of the given BioPAXElement, in level 3 models.
@param element Element to get related PhysicalEntity objects
@param pes Result set. If not supplied, a new set will be initialized.
@return Related PhysicalEntity objects
|
[
"Gets",
"the",
"related",
"PhysicalEntity",
"objects",
"of",
"the",
"given",
"BioPAXElement",
"in",
"level",
"3",
"models",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/paxtools-query/src/main/java/org/biopax/paxtools/query/QueryExecuter.java#L651-L698
|
10,907
|
BioPAX/Paxtools
|
paxtools-query/src/main/java/org/biopax/paxtools/query/QueryExecuter.java
|
QueryExecuter.addEquivalentsComplexes
|
private static void addEquivalentsComplexes(PhysicalEntity pe, Set<PhysicalEntity> pes)
{
addEquivalentsComplexes(pe, true, pes);
// Do not traverse to more specific. This was causing a bug so I commented out. Did not delete it just in case
// later we realize that this is needed for another use case.
// addEquivalentsComplexes(pe, false, pes);
}
|
java
|
private static void addEquivalentsComplexes(PhysicalEntity pe, Set<PhysicalEntity> pes)
{
addEquivalentsComplexes(pe, true, pes);
// Do not traverse to more specific. This was causing a bug so I commented out. Did not delete it just in case
// later we realize that this is needed for another use case.
// addEquivalentsComplexes(pe, false, pes);
}
|
[
"private",
"static",
"void",
"addEquivalentsComplexes",
"(",
"PhysicalEntity",
"pe",
",",
"Set",
"<",
"PhysicalEntity",
">",
"pes",
")",
"{",
"addEquivalentsComplexes",
"(",
"pe",
",",
"true",
",",
"pes",
")",
";",
"// Do not traverse to more specific. This was causing a bug so I commented out. Did not delete it just in case",
"// later we realize that this is needed for another use case.",
"//\t\taddEquivalentsComplexes(pe, false, pes);",
"}"
] |
Adds equivalents and parent complexes of the given PhysicalEntity to the parameter set.
@param pe The PhysicalEntity to add its equivalents and complexes
@param pes Set to collect equivalents and complexes
|
[
"Adds",
"equivalents",
"and",
"parent",
"complexes",
"of",
"the",
"given",
"PhysicalEntity",
"to",
"the",
"parameter",
"set",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/paxtools-query/src/main/java/org/biopax/paxtools/query/QueryExecuter.java#L705-L712
|
10,908
|
BioPAX/Paxtools
|
paxtools-query/src/main/java/org/biopax/paxtools/query/QueryExecuter.java
|
QueryExecuter.getSeedInteractions
|
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.getGraphObject(ele);
if (go instanceof Node)
{
nodes.add((Node) go);
}
}
}
return nodes;
}
|
java
|
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.getGraphObject(ele);
if (go instanceof Node)
{
nodes.add((Node) go);
}
}
}
return nodes;
}
|
[
"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",
".",
"getGraphObject",
"(",
"ele",
")",
";",
"if",
"(",
"go",
"instanceof",
"Node",
")",
"{",
"nodes",
".",
"add",
"(",
"(",
"Node",
")",
"go",
")",
";",
"}",
"}",
"}",
"return",
"nodes",
";",
"}"
] |
Extracts the querible interactions from the elements.
@param elements BioPAX elements to search
@param graph graph model
@return Querible Interactions (nodes)
|
[
"Extracts",
"the",
"querible",
"interactions",
"from",
"the",
"elements",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/paxtools-query/src/main/java/org/biopax/paxtools/query/QueryExecuter.java#L746-L764
|
10,909
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/miner/OutputColumn.java
|
OutputColumn.getColumnValue
|
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.getPublicationIDs(true));
case PMC: return concat(inter.getPublicationIDs(false));
case RESOURCE: return concat(inter.getDataSources());
case SOURCE_LOC: return concat(inter.getCellularLocationsOfSource());
case TARGET_LOC: return concat(inter.getCellularLocationsOfTarget());
case COMMENTS: return concat(inter.getMediatorComments());
case CUSTOM:
{
Set<String> set = new HashSet<String>();
for (PathAccessor acc : accessors)
{
for (Object o : acc.getValueFromBeans(inter.mediators))
{
set.add(o.toString());
}
}
List<String> list = new ArrayList<String>(set);
Collections.sort(list);
return concat(list);
}
default: throw new RuntimeException("Unhandled type: " + type +
". This shouldn't be happening.");
}
}
|
java
|
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.getPublicationIDs(true));
case PMC: return concat(inter.getPublicationIDs(false));
case RESOURCE: return concat(inter.getDataSources());
case SOURCE_LOC: return concat(inter.getCellularLocationsOfSource());
case TARGET_LOC: return concat(inter.getCellularLocationsOfTarget());
case COMMENTS: return concat(inter.getMediatorComments());
case CUSTOM:
{
Set<String> set = new HashSet<String>();
for (PathAccessor acc : accessors)
{
for (Object o : acc.getValueFromBeans(inter.mediators))
{
set.add(o.toString());
}
}
List<String> list = new ArrayList<String>(set);
Collections.sort(list);
return concat(list);
}
default: throw new RuntimeException("Unhandled type: " + type +
". This shouldn't be happening.");
}
}
|
[
"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",
".",
"getPublicationIDs",
"(",
"true",
")",
")",
";",
"case",
"PMC",
":",
"return",
"concat",
"(",
"inter",
".",
"getPublicationIDs",
"(",
"false",
")",
")",
";",
"case",
"RESOURCE",
":",
"return",
"concat",
"(",
"inter",
".",
"getDataSources",
"(",
")",
")",
";",
"case",
"SOURCE_LOC",
":",
"return",
"concat",
"(",
"inter",
".",
"getCellularLocationsOfSource",
"(",
")",
")",
";",
"case",
"TARGET_LOC",
":",
"return",
"concat",
"(",
"inter",
".",
"getCellularLocationsOfTarget",
"(",
")",
")",
";",
"case",
"COMMENTS",
":",
"return",
"concat",
"(",
"inter",
".",
"getMediatorComments",
"(",
")",
")",
";",
"case",
"CUSTOM",
":",
"{",
"Set",
"<",
"String",
">",
"set",
"=",
"new",
"HashSet",
"<",
"String",
">",
"(",
")",
";",
"for",
"(",
"PathAccessor",
"acc",
":",
"accessors",
")",
"{",
"for",
"(",
"Object",
"o",
":",
"acc",
".",
"getValueFromBeans",
"(",
"inter",
".",
"mediators",
")",
")",
"{",
"set",
".",
"add",
"(",
"o",
".",
"toString",
"(",
")",
")",
";",
"}",
"}",
"List",
"<",
"String",
">",
"list",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
"set",
")",
";",
"Collections",
".",
"sort",
"(",
"list",
")",
";",
"return",
"concat",
"(",
"list",
")",
";",
"}",
"default",
":",
"throw",
"new",
"RuntimeException",
"(",
"\"Unhandled type: \"",
"+",
"type",
"+",
"\". This shouldn't be happening.\"",
")",
";",
"}",
"}"
] |
Get the string to write in the output file.
@param inter the binary interaction
@return column value
|
[
"Get",
"the",
"string",
"to",
"write",
"in",
"the",
"output",
"file",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/miner/OutputColumn.java#L69-L99
|
10,910
|
BioPAX/Paxtools
|
sbgn-converter/src/main/java/org/biopax/paxtools/io/sbgn/L3ToSBGNPDConverter.java
|
L3ToSBGNPDConverter.writeSBGN
|
public void writeSBGN(Model model, String file) {
// Create the model
Sbgn sbgn = createSBGN(model);
// Write in file
try {
SbgnUtil.writeToFile(sbgn, new File(file));
}
catch (JAXBException e) {
throw new RuntimeException("writeSBGN, SbgnUtil.writeToFile failed", e);
}
}
|
java
|
public void writeSBGN(Model model, String file) {
// Create the model
Sbgn sbgn = createSBGN(model);
// Write in file
try {
SbgnUtil.writeToFile(sbgn, new File(file));
}
catch (JAXBException e) {
throw new RuntimeException("writeSBGN, SbgnUtil.writeToFile failed", e);
}
}
|
[
"public",
"void",
"writeSBGN",
"(",
"Model",
"model",
",",
"String",
"file",
")",
"{",
"// Create the model",
"Sbgn",
"sbgn",
"=",
"createSBGN",
"(",
"model",
")",
";",
"// Write in file",
"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.
@param model model to convert
@param file file to write
|
[
"Converts",
"the",
"given",
"model",
"to",
"SBGN",
"and",
"writes",
"in",
"the",
"specified",
"file",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/sbgn-converter/src/main/java/org/biopax/paxtools/io/sbgn/L3ToSBGNPDConverter.java#L224-L235
|
10,911
|
BioPAX/Paxtools
|
sbgn-converter/src/main/java/org/biopax/paxtools/io/sbgn/L3ToSBGNPDConverter.java
|
L3ToSBGNPDConverter.writeSBGN
|
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);
marshaller.marshal(sbgn, stream);
} catch (JAXBException e) {
throw new RuntimeException("writeSBGN: JAXB marshalling failed", e);
}
}
|
java
|
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);
marshaller.marshal(sbgn, stream);
} catch (JAXBException e) {
throw new RuntimeException("writeSBGN: JAXB marshalling failed", e);
}
}
|
[
"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",
")",
";",
"marshaller",
".",
"marshal",
"(",
"sbgn",
",",
"stream",
")",
";",
"}",
"catch",
"(",
"JAXBException",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"writeSBGN: JAXB marshalling failed\"",
",",
"e",
")",
";",
"}",
"}"
] |
Converts the given model to SBGN, and writes in the specified output stream.
@param model model to convert
@param stream output stream to write
|
[
"Converts",
"the",
"given",
"model",
"to",
"SBGN",
"and",
"writes",
"in",
"the",
"specified",
"output",
"stream",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/sbgn-converter/src/main/java/org/biopax/paxtools/io/sbgn/L3ToSBGNPDConverter.java#L243-L253
|
10,912
|
BioPAX/Paxtools
|
sbgn-converter/src/main/java/org/biopax/paxtools/io/sbgn/L3ToSBGNPDConverter.java
|
L3ToSBGNPDConverter.processControllers
|
private void processControllers(Set<Control> controls, Glyph process) {
for (Control ctrl : controls) {
Glyph g = createControlStructure(ctrl); //if ctrl has upstream controls (modulations), they're processed as well
if (g != null) {
createArc(g, process, getControlType(ctrl), null);
processControllers(ctrl.getControlledOf(), g);
}
}
}
|
java
|
private void processControllers(Set<Control> controls, Glyph process) {
for (Control ctrl : controls) {
Glyph g = createControlStructure(ctrl); //if ctrl has upstream controls (modulations), they're processed as well
if (g != null) {
createArc(g, process, getControlType(ctrl), null);
processControllers(ctrl.getControlledOf(), g);
}
}
}
|
[
"private",
"void",
"processControllers",
"(",
"Set",
"<",
"Control",
">",
"controls",
",",
"Glyph",
"process",
")",
"{",
"for",
"(",
"Control",
"ctrl",
":",
"controls",
")",
"{",
"Glyph",
"g",
"=",
"createControlStructure",
"(",
"ctrl",
")",
";",
"//if ctrl has upstream controls (modulations), they're processed as well",
"if",
"(",
"g",
"!=",
"null",
")",
"{",
"createArc",
"(",
"g",
",",
"process",
",",
"getControlType",
"(",
"ctrl",
")",
",",
"null",
")",
";",
"processControllers",
"(",
"ctrl",
".",
"getControlledOf",
"(",
")",
",",
"g",
")",
";",
"}",
"}",
"}"
] |
Associate all the controllers of this process;
|
[
"Associate",
"all",
"the",
"controllers",
"of",
"this",
"process",
";"
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/sbgn-converter/src/main/java/org/biopax/paxtools/io/sbgn/L3ToSBGNPDConverter.java#L366-L374
|
10,913
|
BioPAX/Paxtools
|
sbgn-converter/src/main/java/org/biopax/paxtools/io/sbgn/L3ToSBGNPDConverter.java
|
L3ToSBGNPDConverter.extractGeneSymbol
|
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();
if (ref.contains(":")) ref = ref.substring(ref.indexOf(":") + 1);
if (ref.contains("_")) ref = ref.substring(ref.indexOf("_") + 1);
// if the reference is an HGNC ID, then convert it to a symbol
if (!HGNC.containsSymbol(ref) && Character.isDigit(ref.charAt(0))) {
ref = HGNC.getSymbol(ref);
}
}
return ref;
}
return null;
}
|
java
|
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();
if (ref.contains(":")) ref = ref.substring(ref.indexOf(":") + 1);
if (ref.contains("_")) ref = ref.substring(ref.indexOf("_") + 1);
// if the reference is an HGNC ID, then convert it to a symbol
if (!HGNC.containsSymbol(ref) && Character.isDigit(ref.charAt(0))) {
ref = HGNC.getSymbol(ref);
}
}
return ref;
}
return null;
}
|
[
"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",
"(",
")",
";",
"if",
"(",
"ref",
".",
"contains",
"(",
"\":\"",
")",
")",
"ref",
"=",
"ref",
".",
"substring",
"(",
"ref",
".",
"indexOf",
"(",
"\":\"",
")",
"+",
"1",
")",
";",
"if",
"(",
"ref",
".",
"contains",
"(",
"\"_\"",
")",
")",
"ref",
"=",
"ref",
".",
"substring",
"(",
"ref",
".",
"indexOf",
"(",
"\"_\"",
")",
"+",
"1",
")",
";",
"// if the reference is an HGNC ID, then convert it to a symbol",
"if",
"(",
"!",
"HGNC",
".",
"containsSymbol",
"(",
"ref",
")",
"&&",
"Character",
".",
"isDigit",
"(",
"ref",
".",
"charAt",
"(",
"0",
")",
")",
")",
"{",
"ref",
"=",
"HGNC",
".",
"getSymbol",
"(",
"ref",
")",
";",
"}",
"}",
"return",
"ref",
";",
"}",
"return",
"null",
";",
"}"
] |
Searches for gene symbol in Xref.
@param xref Xref to search
@return gene symbol
|
[
"Searches",
"for",
"gene",
"symbol",
"in",
"Xref",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/sbgn-converter/src/main/java/org/biopax/paxtools/io/sbgn/L3ToSBGNPDConverter.java#L775-L798
|
10,914
|
BioPAX/Paxtools
|
paxtools-core/src/main/java/org/biopax/paxtools/controller/ObjectPropertyEditor.java
|
ObjectPropertyEditor.setRangeRestriction
|
public void setRangeRestriction(
Map<Class<? extends BioPAXElement>, Set<Class<? extends BioPAXElement>>> restrictedRanges)
{
this.restrictedRanges = restrictedRanges;
}
|
java
|
public void setRangeRestriction(
Map<Class<? extends BioPAXElement>, Set<Class<? extends BioPAXElement>>> restrictedRanges)
{
this.restrictedRanges = restrictedRanges;
}
|
[
"public",
"void",
"setRangeRestriction",
"(",
"Map",
"<",
"Class",
"<",
"?",
"extends",
"BioPAXElement",
">",
",",
"Set",
"<",
"Class",
"<",
"?",
"extends",
"BioPAXElement",
">",
">",
">",
"restrictedRanges",
")",
"{",
"this",
".",
"restrictedRanges",
"=",
"restrictedRanges",
";",
"}"
] |
This method sets all range restrictions.
Note: All restrictions specified in the BioPAX specification is automatically created by the {@link EditorMap}
during initialization. Use this method if you need to add restrictions that are not specified in
the model.
@param restrictedRanges a set of range restrictions specified as a map.
|
[
"This",
"method",
"sets",
"all",
"range",
"restrictions",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/paxtools-core/src/main/java/org/biopax/paxtools/controller/ObjectPropertyEditor.java#L155-L159
|
10,915
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/constraint/ConstraintChain.java
|
ConstraintChain.generate
|
@Override
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);
int[] tempInd = {0, 1};
for (int i = 1; i < con.length; i++)
{
if (output.isEmpty()) break;
input.clear();
input.addAll(output);
output.clear();
for (BioPAXElement ele : input)
{
Match m = new Match(2);
m.set(ele, 0);
output.addAll(con[i].generate(m, tempInd));
}
}
return output;
}
|
java
|
@Override
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);
int[] tempInd = {0, 1};
for (int i = 1; i < con.length; i++)
{
if (output.isEmpty()) break;
input.clear();
input.addAll(output);
output.clear();
for (BioPAXElement ele : input)
{
Match m = new Match(2);
m.set(ele, 0);
output.addAll(con[i].generate(m, tempInd));
}
}
return output;
}
|
[
"@",
"Override",
"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",
")",
";",
"int",
"[",
"]",
"tempInd",
"=",
"{",
"0",
",",
"1",
"}",
";",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
"<",
"con",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"output",
".",
"isEmpty",
"(",
")",
")",
"break",
";",
"input",
".",
"clear",
"(",
")",
";",
"input",
".",
"addAll",
"(",
"output",
")",
";",
"output",
".",
"clear",
"(",
")",
";",
"for",
"(",
"BioPAXElement",
"ele",
":",
"input",
")",
"{",
"Match",
"m",
"=",
"new",
"Match",
"(",
"2",
")",
";",
"m",
".",
"set",
"(",
"ele",
",",
"0",
")",
";",
"output",
".",
"addAll",
"(",
"con",
"[",
"i",
"]",
".",
"generate",
"(",
"m",
",",
"tempInd",
")",
")",
";",
"}",
"}",
"return",
"output",
";",
"}"
] |
Chains the member constraints and returns the output of the last constraint.
@param match match to process
@param ind mapped indices
@return satisfying elements
|
[
"Chains",
"the",
"member",
"constraints",
"and",
"returns",
"the",
"output",
"of",
"the",
"last",
"constraint",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/constraint/ConstraintChain.java#L55-L82
|
10,916
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/constraint/ControlToControllerER.java
|
ControlToControllerER.generate
|
@Override
public Collection<BioPAXElement> generate(Match match, int... ind)
{
Control ctrl = (Control) match.get(ind[0]);
return new HashSet<BioPAXElement>(getRelatedERs(ctrl));
}
|
java
|
@Override
public Collection<BioPAXElement> generate(Match match, int... ind)
{
Control ctrl = (Control) match.get(ind[0]);
return new HashSet<BioPAXElement>(getRelatedERs(ctrl));
}
|
[
"@",
"Override",
"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.
@param match current pattern match
@param ind mapped indices
@return related ERs
|
[
"Navigates",
"to",
"the",
"related",
"ERs",
"of",
"the",
"controllers",
"of",
"the",
"given",
"Control",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/constraint/ControlToControllerER.java#L57-L62
|
10,917
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/constraint/RelatedControl.java
|
RelatedControl.generate
|
@Override
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)) ||
(peType == RelType.OUTPUT && getConvParticipants(conv, RelType.OUTPUT).contains(pe))))
throw new IllegalArgumentException("peType = " + peType +
", and related participant set does not contain this PE. Conv dir = " +
getDirection(conv) + " conv.id=" + conv.getUri() + " pe.id=" +pe.getUri());
boolean rightContains = conv.getRight().contains(pe);
boolean leftContains = conv.getLeft().contains(pe);
assert rightContains || leftContains : "PE is not a participant.";
Set<BioPAXElement> result = new HashSet<BioPAXElement>();
ConversionDirectionType avoidDir = (leftContains && rightContains) ? null : peType == RelType.OUTPUT ?
(leftContains ? ConversionDirectionType.LEFT_TO_RIGHT : ConversionDirectionType.RIGHT_TO_LEFT) :
(rightContains ? ConversionDirectionType.LEFT_TO_RIGHT : ConversionDirectionType.RIGHT_TO_LEFT);
for (Object o : controlledOf.getValueFromBean(conv))
{
Control ctrl = (Control) o;
ConversionDirectionType dir = getDirection(conv, ctrl);
if (avoidDir != null && dir == avoidDir) continue;
// don't collect this if the pe is ubique in the context of this control
if (blacklist != null && blacklist.isUbique(pe, conv, dir, peType)) continue;
result.add(ctrl);
}
return result;
}
|
java
|
@Override
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)) ||
(peType == RelType.OUTPUT && getConvParticipants(conv, RelType.OUTPUT).contains(pe))))
throw new IllegalArgumentException("peType = " + peType +
", and related participant set does not contain this PE. Conv dir = " +
getDirection(conv) + " conv.id=" + conv.getUri() + " pe.id=" +pe.getUri());
boolean rightContains = conv.getRight().contains(pe);
boolean leftContains = conv.getLeft().contains(pe);
assert rightContains || leftContains : "PE is not a participant.";
Set<BioPAXElement> result = new HashSet<BioPAXElement>();
ConversionDirectionType avoidDir = (leftContains && rightContains) ? null : peType == RelType.OUTPUT ?
(leftContains ? ConversionDirectionType.LEFT_TO_RIGHT : ConversionDirectionType.RIGHT_TO_LEFT) :
(rightContains ? ConversionDirectionType.LEFT_TO_RIGHT : ConversionDirectionType.RIGHT_TO_LEFT);
for (Object o : controlledOf.getValueFromBean(conv))
{
Control ctrl = (Control) o;
ConversionDirectionType dir = getDirection(conv, ctrl);
if (avoidDir != null && dir == avoidDir) continue;
// don't collect this if the pe is ubique in the context of this control
if (blacklist != null && blacklist.isUbique(pe, conv, dir, peType)) continue;
result.add(ctrl);
}
return result;
}
|
[
"@",
"Override",
"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",
")",
")",
"||",
"(",
"peType",
"==",
"RelType",
".",
"OUTPUT",
"&&",
"getConvParticipants",
"(",
"conv",
",",
"RelType",
".",
"OUTPUT",
")",
".",
"contains",
"(",
"pe",
")",
")",
")",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"peType = \"",
"+",
"peType",
"+",
"\", and related participant set does not contain this PE. Conv dir = \"",
"+",
"getDirection",
"(",
"conv",
")",
"+",
"\" conv.id=\"",
"+",
"conv",
".",
"getUri",
"(",
")",
"+",
"\" pe.id=\"",
"+",
"pe",
".",
"getUri",
"(",
")",
")",
";",
"boolean",
"rightContains",
"=",
"conv",
".",
"getRight",
"(",
")",
".",
"contains",
"(",
"pe",
")",
";",
"boolean",
"leftContains",
"=",
"conv",
".",
"getLeft",
"(",
")",
".",
"contains",
"(",
"pe",
")",
";",
"assert",
"rightContains",
"||",
"leftContains",
":",
"\"PE is not a participant.\"",
";",
"Set",
"<",
"BioPAXElement",
">",
"result",
"=",
"new",
"HashSet",
"<",
"BioPAXElement",
">",
"(",
")",
";",
"ConversionDirectionType",
"avoidDir",
"=",
"(",
"leftContains",
"&&",
"rightContains",
")",
"?",
"null",
":",
"peType",
"==",
"RelType",
".",
"OUTPUT",
"?",
"(",
"leftContains",
"?",
"ConversionDirectionType",
".",
"LEFT_TO_RIGHT",
":",
"ConversionDirectionType",
".",
"RIGHT_TO_LEFT",
")",
":",
"(",
"rightContains",
"?",
"ConversionDirectionType",
".",
"LEFT_TO_RIGHT",
":",
"ConversionDirectionType",
".",
"RIGHT_TO_LEFT",
")",
";",
"for",
"(",
"Object",
"o",
":",
"controlledOf",
".",
"getValueFromBean",
"(",
"conv",
")",
")",
"{",
"Control",
"ctrl",
"=",
"(",
"Control",
")",
"o",
";",
"ConversionDirectionType",
"dir",
"=",
"getDirection",
"(",
"conv",
",",
"ctrl",
")",
";",
"if",
"(",
"avoidDir",
"!=",
"null",
"&&",
"dir",
"==",
"avoidDir",
")",
"continue",
";",
"// don't collect this if the pe is ubique in the context of this control",
"if",
"(",
"blacklist",
"!=",
"null",
"&&",
"blacklist",
".",
"isUbique",
"(",
"pe",
",",
"conv",
",",
"dir",
",",
"peType",
")",
")",
"continue",
";",
"result",
".",
"add",
"(",
"ctrl",
")",
";",
"}",
"return",
"result",
";",
"}"
] |
According to the relation between PhysicalEntity and the Conversion, checks of the Control is
relevant. If relevant it is retrieved.
@param match current pattern match
@param ind mapped indices
@return related controls
|
[
"According",
"to",
"the",
"relation",
"between",
"PhysicalEntity",
"and",
"the",
"Conversion",
"checks",
"of",
"the",
"Control",
"is",
"relevant",
".",
"If",
"relevant",
"it",
"is",
"retrieved",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/constraint/RelatedControl.java#L74-L110
|
10,918
|
BioPAX/Paxtools
|
paxtools-query/src/main/java/org/biopax/paxtools/query/wrapperL3undirected/ControlWrapper.java
|
ControlWrapper.init
|
@Override
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;
}
|
java
|
@Override
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;
}
|
[
"@",
"Override",
"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.
|
[
"Extracts",
"the",
"sign",
"and",
"the",
"type",
"of",
"the",
"Control",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/paxtools-query/src/main/java/org/biopax/paxtools/query/wrapperL3undirected/ControlWrapper.java#L86-L102
|
10,919
|
BioPAX/Paxtools
|
paxtools-query/src/main/java/org/biopax/paxtools/query/wrapperL3undirected/ControlWrapper.java
|
ControlWrapper.bindUpstream
|
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);
}
}
|
java
|
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);
}
}
|
[
"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.
@param element to put at upstream
|
[
"Puts",
"the",
"wrapper",
"of",
"the",
"parameter",
"element",
"to",
"the",
"upstream",
"of",
"this",
"Control",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/paxtools-query/src/main/java/org/biopax/paxtools/query/wrapperL3undirected/ControlWrapper.java#L108-L118
|
10,920
|
BioPAX/Paxtools
|
paxtools-core/src/main/java/org/biopax/paxtools/controller/PathAccessor.java
|
PathAccessor.getValueFromModel
|
public Set getValueFromModel(Model model)
{
Set<? extends BioPAXElement> domains = new HashSet<BioPAXElement>(model.getObjects(this.getDomain()));
return getValueFromBeans(domains);
}
|
java
|
public Set getValueFromModel(Model model)
{
Set<? extends BioPAXElement> domains = new HashSet<BioPAXElement>(model.getObjects(this.getDomain()));
return getValueFromBeans(domains);
}
|
[
"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.
@param model to be queried
@return a merged set of all values that is reachable by the paths starting from all applicable objects in
the model. For example running ProteinReference/xref:UnificationXref on the model will get all the
unification xrefs of all ProteinReferences.
|
[
"This",
"method",
"runs",
"the",
"path",
"query",
"on",
"all",
"the",
"elements",
"within",
"the",
"model",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/paxtools-core/src/main/java/org/biopax/paxtools/controller/PathAccessor.java#L252-L256
|
10,921
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/util/Blacklist.java
|
Blacklist.load
|
private void load(String filename)
{
try
{
load(new FileInputStream(filename));
}
catch (FileNotFoundException e)
{
e.printStackTrace();
}
}
|
java
|
private void load(String filename)
{
try
{
load(new FileInputStream(filename));
}
catch (FileNotFoundException e)
{
e.printStackTrace();
}
}
|
[
"private",
"void",
"load",
"(",
"String",
"filename",
")",
"{",
"try",
"{",
"load",
"(",
"new",
"FileInputStream",
"(",
"filename",
")",
")",
";",
"}",
"catch",
"(",
"FileNotFoundException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}"
] |
Reads data from the given file.
|
[
"Reads",
"data",
"from",
"the",
"given",
"file",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/util/Blacklist.java#L68-L78
|
10,922
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/util/Blacklist.java
|
Blacklist.load
|
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.parseInt(tok[1]), convertContext(tok[2]));
}
}
reader.close();
}
catch (Exception e)
{
e.printStackTrace();
context = null;
score = null;
}
}
|
java
|
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.parseInt(tok[1]), convertContext(tok[2]));
}
}
reader.close();
}
catch (Exception e)
{
e.printStackTrace();
context = null;
score = null;
}
}
|
[
"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",
".",
"parseInt",
"(",
"tok",
"[",
"1",
"]",
")",
",",
"convertContext",
"(",
"tok",
"[",
"2",
"]",
")",
")",
";",
"}",
"}",
"reader",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"context",
"=",
"null",
";",
"score",
"=",
"null",
";",
"}",
"}"
] |
Reads data from the input stream and loads itself.
|
[
"Reads",
"data",
"from",
"the",
"input",
"stream",
"and",
"loads",
"itself",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/util/Blacklist.java#L83-L106
|
10,923
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/util/Blacklist.java
|
Blacklist.addEntry
|
public void addEntry(String id, int score, RelType context)
{
this.score.put(id, score);
this.context.put(id, context);
}
|
java
|
public void addEntry(String id, int score, RelType context)
{
this.score.put(id, score);
this.context.put(id, context);
}
|
[
"public",
"void",
"addEntry",
"(",
"String",
"id",
",",
"int",
"score",
",",
"RelType",
"context",
")",
"{",
"this",
".",
"score",
".",
"put",
"(",
"id",
",",
"score",
")",
";",
"this",
".",
"context",
".",
"put",
"(",
"id",
",",
"context",
")",
";",
"}"
] |
Adds a new blacklisted ID.
@param id ID of the blacklisted molecule
@param score the ubiquity score
@param context context of ubiquity
|
[
"Adds",
"a",
"new",
"blacklisted",
"ID",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/util/Blacklist.java#L114-L118
|
10,924
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/util/Blacklist.java
|
Blacklist.write
|
public void write(String filename)
{
try
{
write(new FileOutputStream(filename));
}
catch (FileNotFoundException e)
{
e.printStackTrace();
}
}
|
java
|
public void write(String filename)
{
try
{
write(new FileOutputStream(filename));
}
catch (FileNotFoundException e)
{
e.printStackTrace();
}
}
|
[
"public",
"void",
"write",
"(",
"String",
"filename",
")",
"{",
"try",
"{",
"write",
"(",
"new",
"FileOutputStream",
"(",
"filename",
")",
")",
";",
"}",
"catch",
"(",
"FileNotFoundException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}"
] |
Dumps data to the given file.
@param filename output file name
|
[
"Dumps",
"data",
"to",
"the",
"given",
"file",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/util/Blacklist.java#L135-L145
|
10,925
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/util/Blacklist.java
|
Blacklist.write
|
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>()
{
@Override
public int compare(String o1, String o2)
{
return score.get(o2).compareTo(score.get(o1));
}
});
try
{
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(os));
boolean notFirst = false;
for (String id : ids)
{
if (notFirst) writer.write("\n");
else notFirst = true;
writer.write(id + DELIM + score.get(id) + DELIM + convertContext(context.get(id)));
}
writer.close();
}
catch (IOException e)
{
e.printStackTrace();
}
}
|
java
|
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>()
{
@Override
public int compare(String o1, String o2)
{
return score.get(o2).compareTo(score.get(o1));
}
});
try
{
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(os));
boolean notFirst = false;
for (String id : ids)
{
if (notFirst) writer.write("\n");
else notFirst = true;
writer.write(id + DELIM + score.get(id) + DELIM + convertContext(context.get(id)));
}
writer.close();
}
catch (IOException e)
{
e.printStackTrace();
}
}
|
[
"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",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"int",
"compare",
"(",
"String",
"o1",
",",
"String",
"o2",
")",
"{",
"return",
"score",
".",
"get",
"(",
"o2",
")",
".",
"compareTo",
"(",
"score",
".",
"get",
"(",
"o1",
")",
")",
";",
"}",
"}",
")",
";",
"try",
"{",
"BufferedWriter",
"writer",
"=",
"new",
"BufferedWriter",
"(",
"new",
"OutputStreamWriter",
"(",
"os",
")",
")",
";",
"boolean",
"notFirst",
"=",
"false",
";",
"for",
"(",
"String",
"id",
":",
"ids",
")",
"{",
"if",
"(",
"notFirst",
")",
"writer",
".",
"write",
"(",
"\"\\n\"",
")",
";",
"else",
"notFirst",
"=",
"true",
";",
"writer",
".",
"write",
"(",
"id",
"+",
"DELIM",
"+",
"score",
".",
"get",
"(",
"id",
")",
"+",
"DELIM",
"+",
"convertContext",
"(",
"context",
".",
"get",
"(",
"id",
")",
")",
")",
";",
"}",
"writer",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}"
] |
Dumps data to the given output stream.
@param os output stream
|
[
"Dumps",
"data",
"to",
"the",
"given",
"output",
"stream",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/util/Blacklist.java#L152-L185
|
10,926
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/util/Blacklist.java
|
Blacklist.convertContext
|
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);
}
|
java
|
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);
}
|
[
"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.
@param type context
@return enum value
|
[
"Converts",
"text",
"context",
"to",
"enum",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/util/Blacklist.java#L209-L215
|
10,927
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/util/Blacklist.java
|
Blacklist.getLeastUbique
|
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;
}
|
java
|
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;
}
|
[
"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.
|
[
"Gets",
"the",
"subset",
"with",
"the",
"least",
"score",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/util/Blacklist.java#L222-L234
|
10,928
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/util/Blacklist.java
|
Blacklist.getLeastScore
|
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;
}
|
java
|
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;
}
|
[
"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.
|
[
"Gets",
"the",
"least",
"score",
"of",
"the",
"given",
"ids",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/util/Blacklist.java#L239-L249
|
10,929
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/util/Blacklist.java
|
Blacklist.isUbiqueInBothContexts
|
private boolean isUbiqueInBothContexts(String id)
{
return context.containsKey(id) && context.get(id) == null;
}
|
java
|
private boolean isUbiqueInBothContexts(String id)
{
return context.containsKey(id) && context.get(id) == null;
}
|
[
"private",
"boolean",
"isUbiqueInBothContexts",
"(",
"String",
"id",
")",
"{",
"return",
"context",
".",
"containsKey",
"(",
"id",
")",
"&&",
"context",
".",
"get",
"(",
"id",
")",
"==",
"null",
";",
"}"
] |
Checks if the given ID is blacklisted in both contexts together.
|
[
"Checks",
"if",
"the",
"given",
"ID",
"is",
"blacklisted",
"in",
"both",
"contexts",
"together",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/util/Blacklist.java#L274-L277
|
10,930
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/util/Blacklist.java
|
Blacklist.isUbique
|
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);
}
|
java
|
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);
}
|
[
"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.
|
[
"Checks",
"if",
"the",
"given",
"ID",
"is",
"blacklisted",
"in",
"the",
"given",
"context",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/util/Blacklist.java#L282-L290
|
10,931
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/util/Blacklist.java
|
Blacklist.isUbique
|
public boolean isUbique(PhysicalEntity pe)
{
String id = getSMRID(pe);
return id != null && isUbique(id);
}
|
java
|
public boolean isUbique(PhysicalEntity pe)
{
String id = getSMRID(pe);
return id != null && isUbique(id);
}
|
[
"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.
@param pe physical entity BioPAX object
@return true/false
|
[
"Checks",
"if",
"the",
"given",
"entity",
"is",
"blacklisted",
"in",
"at",
"least",
"one",
"context",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/util/Blacklist.java#L298-L302
|
10,932
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/util/Blacklist.java
|
Blacklist.isUbiqueInBothContexts
|
public boolean isUbiqueInBothContexts(PhysicalEntity pe)
{
String id = getSMRID(pe);
return id != null && isUbiqueInBothContexts(id);
}
|
java
|
public boolean isUbiqueInBothContexts(PhysicalEntity pe)
{
String id = getSMRID(pe);
return id != null && isUbiqueInBothContexts(id);
}
|
[
"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.
@param pe physical entity BioPAX object
@return true/false
|
[
"Checks",
"if",
"the",
"given",
"entity",
"is",
"blacklisted",
"in",
"both",
"context",
"together",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/util/Blacklist.java#L310-L314
|
10,933
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/util/Blacklist.java
|
Blacklist.isUbique
|
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 IllegalArgumentException("The context has to be only one type.");
Set<PhysicalEntity> parts;
if (dir == ConversionDirectionType.REVERSIBLE)
{
if (conv.getLeft().contains(pe)) parts = conv.getLeft();
else if (conv.getRight().contains(pe)) parts = conv.getRight();
else throw new IllegalArgumentException("The PhysicalEntity has to be at least one " +
"side of the Conversion");
}
else
{
parts = dir == ConversionDirectionType.LEFT_TO_RIGHT ?
context == RelType.INPUT ? conv.getLeft() : conv.getRight() :
context == RelType.OUTPUT ? conv.getLeft() : conv.getRight();
}
// if the Conversion direction is reversible, then don't mind the current context
if (dir == ConversionDirectionType.REVERSIBLE)
return getUbiques(parts, null).contains(pe);
else return getUbiques(parts, context).contains(pe);
}
|
java
|
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 IllegalArgumentException("The context has to be only one type.");
Set<PhysicalEntity> parts;
if (dir == ConversionDirectionType.REVERSIBLE)
{
if (conv.getLeft().contains(pe)) parts = conv.getLeft();
else if (conv.getRight().contains(pe)) parts = conv.getRight();
else throw new IllegalArgumentException("The PhysicalEntity has to be at least one " +
"side of the Conversion");
}
else
{
parts = dir == ConversionDirectionType.LEFT_TO_RIGHT ?
context == RelType.INPUT ? conv.getLeft() : conv.getRight() :
context == RelType.OUTPUT ? conv.getLeft() : conv.getRight();
}
// if the Conversion direction is reversible, then don't mind the current context
if (dir == ConversionDirectionType.REVERSIBLE)
return getUbiques(parts, null).contains(pe);
else return getUbiques(parts, context).contains(pe);
}
|
[
"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",
"IllegalArgumentException",
"(",
"\"The context has to be only one type.\"",
")",
";",
"Set",
"<",
"PhysicalEntity",
">",
"parts",
";",
"if",
"(",
"dir",
"==",
"ConversionDirectionType",
".",
"REVERSIBLE",
")",
"{",
"if",
"(",
"conv",
".",
"getLeft",
"(",
")",
".",
"contains",
"(",
"pe",
")",
")",
"parts",
"=",
"conv",
".",
"getLeft",
"(",
")",
";",
"else",
"if",
"(",
"conv",
".",
"getRight",
"(",
")",
".",
"contains",
"(",
"pe",
")",
")",
"parts",
"=",
"conv",
".",
"getRight",
"(",
")",
";",
"else",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"The PhysicalEntity has to be at least one \"",
"+",
"\"side of the Conversion\"",
")",
";",
"}",
"else",
"{",
"parts",
"=",
"dir",
"==",
"ConversionDirectionType",
".",
"LEFT_TO_RIGHT",
"?",
"context",
"==",
"RelType",
".",
"INPUT",
"?",
"conv",
".",
"getLeft",
"(",
")",
":",
"conv",
".",
"getRight",
"(",
")",
":",
"context",
"==",
"RelType",
".",
"OUTPUT",
"?",
"conv",
".",
"getLeft",
"(",
")",
":",
"conv",
".",
"getRight",
"(",
")",
";",
"}",
"// if the Conversion direction is reversible, then don't mind the current context",
"if",
"(",
"dir",
"==",
"ConversionDirectionType",
".",
"REVERSIBLE",
")",
"return",
"getUbiques",
"(",
"parts",
",",
"null",
")",
".",
"contains",
"(",
"pe",
")",
";",
"else",
"return",
"getUbiques",
"(",
"parts",
",",
"context",
")",
".",
"contains",
"(",
"pe",
")",
";",
"}"
] |
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.
@param pe physical entity BioPAX object
@param conv conversion interaction (BioPAX)
@param dir conversion direction
@param context relationship type - context
@return true/false
|
[
"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",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/util/Blacklist.java#L326-L358
|
10,934
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/util/Blacklist.java
|
Blacklist.getSMRID
|
private String getSMRID(PhysicalEntity pe)
{
if (pe instanceof SmallMolecule)
{
EntityReference er = ((SmallMolecule) pe).getEntityReference();
if (er != null) return er.getUri();
}
return null;
}
|
java
|
private String getSMRID(PhysicalEntity pe)
{
if (pe instanceof SmallMolecule)
{
EntityReference er = ((SmallMolecule) pe).getEntityReference();
if (er != null) return er.getUri();
}
return null;
}
|
[
"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.
|
[
"Gets",
"the",
"ID",
"of",
"the",
"reference",
"of",
"the",
"given",
"entity",
"if",
"it",
"is",
"a",
"small",
"molecule",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/util/Blacklist.java#L363-L371
|
10,935
|
BioPAX/Paxtools
|
paxtools-query/src/main/java/org/biopax/paxtools/query/wrapperL3undirected/InteractionWrapper.java
|
InteractionWrapper.addToDownstream
|
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().add(edge);
}
}
|
java
|
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().add(edge);
}
}
|
[
"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",
"(",
")",
".",
"add",
"(",
"edge",
")",
";",
"}",
"}"
] |
Binds the given PhysicalEntity to the downstream.
@param pe PhysicalEntity to bind
@param graph Owner graph
|
[
"Binds",
"the",
"given",
"PhysicalEntity",
"to",
"the",
"downstream",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/paxtools-query/src/main/java/org/biopax/paxtools/query/wrapperL3undirected/InteractionWrapper.java#L83-L95
|
10,936
|
BioPAX/Paxtools
|
paxtools-query/src/main/java/org/biopax/paxtools/query/wrapperL3/PhysicalEntityWrapper.java
|
PhysicalEntityWrapper.initDownstream
|
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 conW = (ConversionWrapper) node;
if (conv.getConversionDirection() == ConversionDirectionType.REVERSIBLE &&
conv.getRight().contains(pe))
{
node = conW.getReverse();
}
}
Edge edge = new EdgeL3(this, node, graph);
this.getDownstreamNoInit().add(edge);
node.getUpstreamNoInit().add(edge);
}
}
|
java
|
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 conW = (ConversionWrapper) node;
if (conv.getConversionDirection() == ConversionDirectionType.REVERSIBLE &&
conv.getRight().contains(pe))
{
node = conW.getReverse();
}
}
Edge edge = new EdgeL3(this, node, graph);
this.getDownstreamNoInit().add(edge);
node.getUpstreamNoInit().add(edge);
}
}
|
[
"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",
"conW",
"=",
"(",
"ConversionWrapper",
")",
"node",
";",
"if",
"(",
"conv",
".",
"getConversionDirection",
"(",
")",
"==",
"ConversionDirectionType",
".",
"REVERSIBLE",
"&&",
"conv",
".",
"getRight",
"(",
")",
".",
"contains",
"(",
"pe",
")",
")",
"{",
"node",
"=",
"conW",
".",
"getReverse",
"(",
")",
";",
"}",
"}",
"Edge",
"edge",
"=",
"new",
"EdgeL3",
"(",
"this",
",",
"node",
",",
"graph",
")",
";",
"this",
".",
"getDownstreamNoInit",
"(",
")",
".",
"add",
"(",
"edge",
")",
";",
"node",
".",
"getUpstreamNoInit",
"(",
")",
".",
"add",
"(",
"edge",
")",
";",
"}",
"}"
] |
Binds to downstream interactions.
|
[
"Binds",
"to",
"downstream",
"interactions",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/paxtools-query/src/main/java/org/biopax/paxtools/query/wrapperL3/PhysicalEntityWrapper.java#L112-L135
|
10,937
|
BioPAX/Paxtools
|
paxtools-query/src/main/java/org/biopax/paxtools/query/wrapperL3/PhysicalEntityWrapper.java
|
PhysicalEntityWrapper.getDownstreamInteractions
|
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.getConversionDirection();
if (dir == ConversionDirectionType.REVERSIBLE ||
(dir == ConversionDirectionType.RIGHT_TO_LEFT && conv.getRight().contains(pe)) ||
((dir == ConversionDirectionType.LEFT_TO_RIGHT || dir == null) &&
conv.getLeft().contains(pe)))
{
set.add(conv);
}
}
else if (inter instanceof Control)
{
set.add(inter);
}
}
return set;
}
|
java
|
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.getConversionDirection();
if (dir == ConversionDirectionType.REVERSIBLE ||
(dir == ConversionDirectionType.RIGHT_TO_LEFT && conv.getRight().contains(pe)) ||
((dir == ConversionDirectionType.LEFT_TO_RIGHT || dir == null) &&
conv.getLeft().contains(pe)))
{
set.add(conv);
}
}
else if (inter instanceof Control)
{
set.add(inter);
}
}
return set;
}
|
[
"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",
".",
"getConversionDirection",
"(",
")",
";",
"if",
"(",
"dir",
"==",
"ConversionDirectionType",
".",
"REVERSIBLE",
"||",
"(",
"dir",
"==",
"ConversionDirectionType",
".",
"RIGHT_TO_LEFT",
"&&",
"conv",
".",
"getRight",
"(",
")",
".",
"contains",
"(",
"pe",
")",
")",
"||",
"(",
"(",
"dir",
"==",
"ConversionDirectionType",
".",
"LEFT_TO_RIGHT",
"||",
"dir",
"==",
"null",
")",
"&&",
"conv",
".",
"getLeft",
"(",
")",
".",
"contains",
"(",
"pe",
")",
")",
")",
"{",
"set",
".",
"add",
"(",
"conv",
")",
";",
"}",
"}",
"else",
"if",
"(",
"inter",
"instanceof",
"Control",
")",
"{",
"set",
".",
"add",
"(",
"inter",
")",
";",
"}",
"}",
"return",
"set",
";",
"}"
] |
Gets the downstream interactions among the given set.
@param inters Interactions to search
@return Downstream interactions
|
[
"Gets",
"the",
"downstream",
"interactions",
"among",
"the",
"given",
"set",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/paxtools-query/src/main/java/org/biopax/paxtools/query/wrapperL3/PhysicalEntityWrapper.java#L174-L199
|
10,938
|
BioPAX/Paxtools
|
paxtools-query/src/main/java/org/biopax/paxtools/query/wrapperL3/PhysicalEntityWrapper.java
|
PhysicalEntityWrapper.getRelatedConversions
|
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((Control) inter, set);
}
}
return set;
}
|
java
|
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((Control) inter, set);
}
}
return set;
}
|
[
"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",
"(",
"(",
"Control",
")",
"inter",
",",
"set",
")",
";",
"}",
"}",
"return",
"set",
";",
"}"
] |
Get all related Conversions of the given Interaction set.
@param inters Interactions to query
@return Related Conversions
|
[
"Get",
"all",
"related",
"Conversions",
"of",
"the",
"given",
"Interaction",
"set",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/paxtools-query/src/main/java/org/biopax/paxtools/query/wrapperL3/PhysicalEntityWrapper.java#L208-L224
|
10,939
|
BioPAX/Paxtools
|
paxtools-query/src/main/java/org/biopax/paxtools/query/wrapperL3/PhysicalEntityWrapper.java
|
PhysicalEntityWrapper.getRelatedConversions
|
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);
}
}
return set;
}
|
java
|
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);
}
}
return set;
}
|
[
"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",
")",
";",
"}",
"}",
"return",
"set",
";",
"}"
] |
Recursively searches the related Conversions of a Control.
@param ctrl Control to query
@param set Set to collect the related Conversions
@return The same set
|
[
"Recursively",
"searches",
"the",
"related",
"Conversions",
"of",
"a",
"Control",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/paxtools-query/src/main/java/org/biopax/paxtools/query/wrapperL3/PhysicalEntityWrapper.java#L232-L246
|
10,940
|
BioPAX/Paxtools
|
psimi-converter/src/main/java/org/biopax/paxtools/converter/psi/PsiToBiopax3Converter.java
|
PsiToBiopax3Converter.convert
|
public void convert(InputStream inputStream, OutputStream outputStream,
boolean forceInteractionToComplex) throws IOException, PsimiXmlReaderException {
// check args
if (inputStream == null || outputStream == null) {
throw new IllegalArgumentException("convert(): " +
"one or more null arguments.");
}
// unmarshall the data, close the stream
PsimiXmlReader reader = new PsimiXmlReader();
EntrySet entrySet = reader.read(inputStream);
inputStream.close();
// convert
convert(entrySet, outputStream, forceInteractionToComplex);
}
|
java
|
public void convert(InputStream inputStream, OutputStream outputStream,
boolean forceInteractionToComplex) throws IOException, PsimiXmlReaderException {
// check args
if (inputStream == null || outputStream == null) {
throw new IllegalArgumentException("convert(): " +
"one or more null arguments.");
}
// unmarshall the data, close the stream
PsimiXmlReader reader = new PsimiXmlReader();
EntrySet entrySet = reader.read(inputStream);
inputStream.close();
// convert
convert(entrySet, outputStream, forceInteractionToComplex);
}
|
[
"public",
"void",
"convert",
"(",
"InputStream",
"inputStream",
",",
"OutputStream",
"outputStream",
",",
"boolean",
"forceInteractionToComplex",
")",
"throws",
"IOException",
",",
"PsimiXmlReaderException",
"{",
"// check args",
"if",
"(",
"inputStream",
"==",
"null",
"||",
"outputStream",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"convert(): \"",
"+",
"\"one or more null arguments.\"",
")",
";",
"}",
"// unmarshall the data, close the stream",
"PsimiXmlReader",
"reader",
"=",
"new",
"PsimiXmlReader",
"(",
")",
";",
"EntrySet",
"entrySet",
"=",
"reader",
".",
"read",
"(",
"inputStream",
")",
";",
"inputStream",
".",
"close",
"(",
")",
";",
"// convert",
"convert",
"(",
"entrySet",
",",
"outputStream",
",",
"forceInteractionToComplex",
")",
";",
"}"
] |
Converts the PSI-MI inputStream into BioPAX outputStream.
Streams will be closed by the converter.
Warning: for very large models (about 1-2Gb if serialized), and when ByteArrayOutputStream
is used, OutOfMemoryError might be thrown (increasing the "heap" RAM won't help; but using FileOutputStream will).
@param inputStream PSI-MI
@param outputStream BioPAX
@param forceInteractionToComplex - always generate Complex instead of MolecularInteraction
@throws IOException when an I/O error occur
@throws PsimiXmlReaderException when an error in the PSI-MI parser happens
|
[
"Converts",
"the",
"PSI",
"-",
"MI",
"inputStream",
"into",
"BioPAX",
"outputStream",
".",
"Streams",
"will",
"be",
"closed",
"by",
"the",
"converter",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/psimi-converter/src/main/java/org/biopax/paxtools/converter/psi/PsiToBiopax3Converter.java#L93-L109
|
10,941
|
BioPAX/Paxtools
|
psimi-converter/src/main/java/org/biopax/paxtools/converter/psi/PsiToBiopax3Converter.java
|
PsiToBiopax3Converter.convertTab
|
public void convertTab(InputStream inputStream, OutputStream outputStream,
boolean forceInteractionToComplex) throws IOException, PsimiTabException {
// check args
if (inputStream == null || outputStream == null) {
throw new IllegalArgumentException("convertTab(): " +
"one or more null arguments.");
}
// unmarshall the data, close the stream
PsimiTabReader reader = new PsimiTabReader();
Collection<BinaryInteraction> interactions = reader.read(inputStream);
Tab2Xml tab2Xml = new Tab2Xml();
EntrySet entrySet;
try {
entrySet = tab2Xml.convert(interactions);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
} catch (XmlConversionException e) {
throw new RuntimeException(e);
}
inputStream.close();
// convert
convert(entrySet, outputStream, forceInteractionToComplex);
}
|
java
|
public void convertTab(InputStream inputStream, OutputStream outputStream,
boolean forceInteractionToComplex) throws IOException, PsimiTabException {
// check args
if (inputStream == null || outputStream == null) {
throw new IllegalArgumentException("convertTab(): " +
"one or more null arguments.");
}
// unmarshall the data, close the stream
PsimiTabReader reader = new PsimiTabReader();
Collection<BinaryInteraction> interactions = reader.read(inputStream);
Tab2Xml tab2Xml = new Tab2Xml();
EntrySet entrySet;
try {
entrySet = tab2Xml.convert(interactions);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
} catch (XmlConversionException e) {
throw new RuntimeException(e);
}
inputStream.close();
// convert
convert(entrySet, outputStream, forceInteractionToComplex);
}
|
[
"public",
"void",
"convertTab",
"(",
"InputStream",
"inputStream",
",",
"OutputStream",
"outputStream",
",",
"boolean",
"forceInteractionToComplex",
")",
"throws",
"IOException",
",",
"PsimiTabException",
"{",
"// check args",
"if",
"(",
"inputStream",
"==",
"null",
"||",
"outputStream",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"convertTab(): \"",
"+",
"\"one or more null arguments.\"",
")",
";",
"}",
"// unmarshall the data, close the stream",
"PsimiTabReader",
"reader",
"=",
"new",
"PsimiTabReader",
"(",
")",
";",
"Collection",
"<",
"BinaryInteraction",
">",
"interactions",
"=",
"reader",
".",
"read",
"(",
"inputStream",
")",
";",
"Tab2Xml",
"tab2Xml",
"=",
"new",
"Tab2Xml",
"(",
")",
";",
"EntrySet",
"entrySet",
";",
"try",
"{",
"entrySet",
"=",
"tab2Xml",
".",
"convert",
"(",
"interactions",
")",
";",
"}",
"catch",
"(",
"IllegalAccessException",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"e",
")",
";",
"}",
"catch",
"(",
"XmlConversionException",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"e",
")",
";",
"}",
"inputStream",
".",
"close",
"(",
")",
";",
"// convert",
"convert",
"(",
"entrySet",
",",
"outputStream",
",",
"forceInteractionToComplex",
")",
";",
"}"
] |
Converts the PSI-MITAB inputStream into BioPAX outputStream.
Streams will be closed by the converter.
@param inputStream psi-mitab
@param outputStream biopax
@param forceInteractionToComplex - always generate Complex instead of MolecularInteraction
@throws IOException when an I/O error occur
@throws PsimiTabException when there's a problem within the PSI-MITAB parser
|
[
"Converts",
"the",
"PSI",
"-",
"MITAB",
"inputStream",
"into",
"BioPAX",
"outputStream",
".",
"Streams",
"will",
"be",
"closed",
"by",
"the",
"converter",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/psimi-converter/src/main/java/org/biopax/paxtools/converter/psi/PsiToBiopax3Converter.java#L123-L148
|
10,942
|
BioPAX/Paxtools
|
psimi-converter/src/main/java/org/biopax/paxtools/converter/psi/PsiToBiopax3Converter.java
|
PsiToBiopax3Converter.convert
|
public void convert(EntrySet entrySet, OutputStream outputStream,
boolean forceInteractionToComplex) {
// check args
if (entrySet == null || outputStream == null) {
throw new IllegalArgumentException("convert: one or more null arguments.");
}
if (entrySet.getLevel() != 2) {
throw new IllegalArgumentException("convert: only PSI-MI Level 2.5 is supported.");
}
//create a new empty BioPAX Model
final Model model = BioPAXLevel.L3.getDefaultFactory().createModel();
model.setXmlBase(xmlBase);
// convert all psimi entries
EntryMapper entryMapper = new EntryMapper(model, forceInteractionToComplex);
for (Entry entry : entrySet.getEntries()) {
entryMapper.run(entry);
}
//try to release some RAM earlier
entrySet.getEntries().clear();
entrySet = null;
// write BioPAX RDF/XML
(new SimpleIOHandler()).convertToOWL(model, outputStream);
}
|
java
|
public void convert(EntrySet entrySet, OutputStream outputStream,
boolean forceInteractionToComplex) {
// check args
if (entrySet == null || outputStream == null) {
throw new IllegalArgumentException("convert: one or more null arguments.");
}
if (entrySet.getLevel() != 2) {
throw new IllegalArgumentException("convert: only PSI-MI Level 2.5 is supported.");
}
//create a new empty BioPAX Model
final Model model = BioPAXLevel.L3.getDefaultFactory().createModel();
model.setXmlBase(xmlBase);
// convert all psimi entries
EntryMapper entryMapper = new EntryMapper(model, forceInteractionToComplex);
for (Entry entry : entrySet.getEntries()) {
entryMapper.run(entry);
}
//try to release some RAM earlier
entrySet.getEntries().clear();
entrySet = null;
// write BioPAX RDF/XML
(new SimpleIOHandler()).convertToOWL(model, outputStream);
}
|
[
"public",
"void",
"convert",
"(",
"EntrySet",
"entrySet",
",",
"OutputStream",
"outputStream",
",",
"boolean",
"forceInteractionToComplex",
")",
"{",
"// check args",
"if",
"(",
"entrySet",
"==",
"null",
"||",
"outputStream",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"convert: one or more null arguments.\"",
")",
";",
"}",
"if",
"(",
"entrySet",
".",
"getLevel",
"(",
")",
"!=",
"2",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"convert: only PSI-MI Level 2.5 is supported.\"",
")",
";",
"}",
"//create a new empty BioPAX Model",
"final",
"Model",
"model",
"=",
"BioPAXLevel",
".",
"L3",
".",
"getDefaultFactory",
"(",
")",
".",
"createModel",
"(",
")",
";",
"model",
".",
"setXmlBase",
"(",
"xmlBase",
")",
";",
"// convert all psimi entries",
"EntryMapper",
"entryMapper",
"=",
"new",
"EntryMapper",
"(",
"model",
",",
"forceInteractionToComplex",
")",
";",
"for",
"(",
"Entry",
"entry",
":",
"entrySet",
".",
"getEntries",
"(",
")",
")",
"{",
"entryMapper",
".",
"run",
"(",
"entry",
")",
";",
"}",
"//try to release some RAM earlier",
"entrySet",
".",
"getEntries",
"(",
")",
".",
"clear",
"(",
")",
";",
"entrySet",
"=",
"null",
";",
"// write BioPAX RDF/XML",
"(",
"new",
"SimpleIOHandler",
"(",
")",
")",
".",
"convertToOWL",
"(",
"model",
",",
"outputStream",
")",
";",
"}"
] |
Converts the PSI interactions from the EntrySet and places into BioPAX output stream.
Stream will be closed by the converter.
@param entrySet PSI-MI entry set
@param outputStream output stream for writing the BioPAX RDF/XML result
@param forceInteractionToComplex true/false - whether to always generate Complex instead of MolecularInteraction
|
[
"Converts",
"the",
"PSI",
"interactions",
"from",
"the",
"EntrySet",
"and",
"places",
"into",
"BioPAX",
"output",
"stream",
".",
"Stream",
"will",
"be",
"closed",
"by",
"the",
"converter",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/psimi-converter/src/main/java/org/biopax/paxtools/converter/psi/PsiToBiopax3Converter.java#L158-L185
|
10,943
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/miner/RelatedGenesOfInteractionsMiner.java
|
RelatedGenesOfInteractionsMiner.writeResult
|
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))
{
ProteinReference pr = (ProteinReference) m.get("PR", getPattern());
String sym = getGeneSymbol(pr);
if (sym != null) syms.add(sym);
}
if (syms.size() > 1)
{
writer.write("\n" + ele.getUri());
for (Object o : controlAcc.getValueFromBean(ele))
{
Control ctrl = (Control) o;
writer.write(" " + ctrl.getUri());
}
for (String sym : syms)
{
writer.write("\t" + sym);
}
}
}
writer.flush();
}
|
java
|
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))
{
ProteinReference pr = (ProteinReference) m.get("PR", getPattern());
String sym = getGeneSymbol(pr);
if (sym != null) syms.add(sym);
}
if (syms.size() > 1)
{
writer.write("\n" + ele.getUri());
for (Object o : controlAcc.getValueFromBean(ele))
{
Control ctrl = (Control) o;
writer.write(" " + ctrl.getUri());
}
for (String sym : syms)
{
writer.write("\t" + sym);
}
}
}
writer.flush();
}
|
[
"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",
")",
")",
"{",
"ProteinReference",
"pr",
"=",
"(",
"ProteinReference",
")",
"m",
".",
"get",
"(",
"\"PR\"",
",",
"getPattern",
"(",
")",
")",
";",
"String",
"sym",
"=",
"getGeneSymbol",
"(",
"pr",
")",
";",
"if",
"(",
"sym",
"!=",
"null",
")",
"syms",
".",
"add",
"(",
"sym",
")",
";",
"}",
"if",
"(",
"syms",
".",
"size",
"(",
")",
">",
"1",
")",
"{",
"writer",
".",
"write",
"(",
"\"\\n\"",
"+",
"ele",
".",
"getUri",
"(",
")",
")",
";",
"for",
"(",
"Object",
"o",
":",
"controlAcc",
".",
"getValueFromBean",
"(",
"ele",
")",
")",
"{",
"Control",
"ctrl",
"=",
"(",
"Control",
")",
"o",
";",
"writer",
".",
"write",
"(",
"\" \"",
"+",
"ctrl",
".",
"getUri",
"(",
")",
")",
";",
"}",
"for",
"(",
"String",
"sym",
":",
"syms",
")",
"{",
"writer",
".",
"write",
"(",
"\"\\t\"",
"+",
"sym",
")",
";",
"}",
"}",
"}",
"writer",
".",
"flush",
"(",
")",
";",
"}"
] |
Writes the IDs of interaction, then gene symbols of related proteins in a line.
@param matches pattern search result
@param out output stream
|
[
"Writes",
"the",
"IDs",
"of",
"interaction",
"then",
"gene",
"symbols",
"of",
"related",
"proteins",
"in",
"a",
"line",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/miner/RelatedGenesOfInteractionsMiner.java#L52-L86
|
10,944
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/constraint/SelfOrThis.java
|
SelfOrThis.generate
|
@Override
public Collection<BioPAXElement> generate(Match match, int... ind)
{
Collection<BioPAXElement> gen = con.generate(match, ind);
gen.add(match.get(ind[selfIndex]));
return gen;
}
|
java
|
@Override
public Collection<BioPAXElement> generate(Match match, int... ind)
{
Collection<BioPAXElement> gen = con.generate(match, ind);
gen.add(match.get(ind[selfIndex]));
return gen;
}
|
[
"@",
"Override",
"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.
@param match current pattern match
@param ind mapped indices
@return first mapped element along with the generated elements of wrapped constraint
|
[
"Gets",
"the",
"first",
"mapped",
"element",
"along",
"with",
"the",
"generated",
"elements",
"of",
"wrapped",
"constraint",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/constraint/SelfOrThis.java#L76-L82
|
10,945
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/constraint/SelfOrThis.java
|
SelfOrThis.satisfies
|
@Override
public boolean satisfies(Match match, int... ind)
{
return match.get(ind[selfIndex]) == match.get(ind[ind.length-1]) ||
super.satisfies(match, ind);
}
|
java
|
@Override
public boolean satisfies(Match match, int... ind)
{
return match.get(ind[selfIndex]) == match.get(ind[ind.length-1]) ||
super.satisfies(match, ind);
}
|
[
"@",
"Override",
"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.
@param match current pattern match
@param ind mapped indices
@return true if the last index is either generated or equal to the first element
|
[
"Checks",
"if",
"the",
"last",
"index",
"is",
"either",
"generated",
"or",
"equal",
"to",
"the",
"first",
"element",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/constraint/SelfOrThis.java#L90-L95
|
10,946
|
BioPAX/Paxtools
|
paxtools-query/src/main/java/org/biopax/paxtools/query/model/AbstractGraph.java
|
AbstractGraph.getGraphObject
|
public GraphObject getGraphObject(Object obj)
{
String key = getKey(obj);
GraphObject go = objectMap.get(key);
// if (obj instanceof Conversion && go == null)
// {
// go = objectMap.get(key + ConversionWrapper.LEFT_TO_RIGHT);
// if (go == null)
// go = objectMap.get(key + ConversionWrapper.RIGHT_TO_LEFT);
// }
if (go == null)
{
Node node = wrap(obj);
if (node != null)
{
objectMap.put(key, node);
node.init();
}
}
return objectMap.get(key);
}
|
java
|
public GraphObject getGraphObject(Object obj)
{
String key = getKey(obj);
GraphObject go = objectMap.get(key);
// if (obj instanceof Conversion && go == null)
// {
// go = objectMap.get(key + ConversionWrapper.LEFT_TO_RIGHT);
// if (go == null)
// go = objectMap.get(key + ConversionWrapper.RIGHT_TO_LEFT);
// }
if (go == null)
{
Node node = wrap(obj);
if (node != null)
{
objectMap.put(key, node);
node.init();
}
}
return objectMap.get(key);
}
|
[
"public",
"GraphObject",
"getGraphObject",
"(",
"Object",
"obj",
")",
"{",
"String",
"key",
"=",
"getKey",
"(",
"obj",
")",
";",
"GraphObject",
"go",
"=",
"objectMap",
".",
"get",
"(",
"key",
")",
";",
"//\t\tif (obj instanceof Conversion && go == null)\r",
"//\t\t{\r",
"//\t\t\tgo = objectMap.get(key + ConversionWrapper.LEFT_TO_RIGHT);\r",
"//\t\t\tif (go == null)\r",
"//\t\t\t\tgo = objectMap.get(key + ConversionWrapper.RIGHT_TO_LEFT);\r",
"//\t\t}\r",
"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.
@param obj Object to wrap
@return wrapper
|
[
"Gets",
"the",
"related",
"wrapper",
"for",
"the",
"given",
"object",
"creates",
"the",
"wrapper",
"if",
"not",
"created",
"before",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/paxtools-query/src/main/java/org/biopax/paxtools/query/model/AbstractGraph.java#L31-L55
|
10,947
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/miner/CustomFormat.java
|
CustomFormat.convert
|
@Override
public String convert(SIFInteraction inter)
{
String s = inter.toString();
for (OutputColumn column : columns)
{
s += "\t" + column.getColumnValue(inter);
}
return s;
}
|
java
|
@Override
public String convert(SIFInteraction inter)
{
String s = inter.toString();
for (OutputColumn column : columns)
{
s += "\t" + column.getColumnValue(inter);
}
return s;
}
|
[
"@",
"Override",
"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.
@param inter the interaction
@return output line.
|
[
"Prepares",
"the",
"line",
"in",
"the",
"output",
"file",
"for",
"the",
"given",
"interaction",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/miner/CustomFormat.java#L29-L40
|
10,948
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/miner/ExtendedSIFWriter.java
|
ExtendedSIFWriter.collectEntityRefs
|
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.sourceID, new HashSet<BioPAXElement>());
if (!map.containsKey(inter.targetID))
map.put(inter.targetID, new HashSet<BioPAXElement>());
map.get(inter.sourceID).addAll(inter.sourceERs);
map.get(inter.targetID).addAll(inter.targetERs);
}
return map;
}
|
java
|
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.sourceID, new HashSet<BioPAXElement>());
if (!map.containsKey(inter.targetID))
map.put(inter.targetID, new HashSet<BioPAXElement>());
map.get(inter.sourceID).addAll(inter.sourceERs);
map.get(inter.targetID).addAll(inter.targetERs);
}
return map;
}
|
[
"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",
".",
"sourceID",
",",
"new",
"HashSet",
"<",
"BioPAXElement",
">",
"(",
")",
")",
";",
"if",
"(",
"!",
"map",
".",
"containsKey",
"(",
"inter",
".",
"targetID",
")",
")",
"map",
".",
"put",
"(",
"inter",
".",
"targetID",
",",
"new",
"HashSet",
"<",
"BioPAXElement",
">",
"(",
")",
")",
";",
"map",
".",
"get",
"(",
"inter",
".",
"sourceID",
")",
".",
"addAll",
"(",
"inter",
".",
"sourceERs",
")",
";",
"map",
".",
"get",
"(",
"inter",
".",
"targetID",
")",
".",
"addAll",
"(",
"inter",
".",
"targetERs",
")",
";",
"}",
"return",
"map",
";",
"}"
] |
Collects the sources and targets in given interactions.
@param inters binary interactions
@return map from the primary id to the set of related source and target elements.
|
[
"Collects",
"the",
"sources",
"and",
"targets",
"in",
"given",
"interactions",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/miner/ExtendedSIFWriter.java#L159-L174
|
10,949
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/miner/ExtendedSIFWriter.java
|
ExtendedSIFWriter.concat
|
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();
}
|
java
|
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();
}
|
[
"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.
@param col string collection
@return concatenated string
|
[
"Concatenates",
"the",
"given",
"collection",
"of",
"strings",
"into",
"a",
"single",
"string",
"where",
"values",
"are",
"separated",
"with",
"a",
"semicolon",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/miner/ExtendedSIFWriter.java#L217-L231
|
10,950
|
BioPAX/Paxtools
|
paxtools-query/src/main/java/org/biopax/paxtools/query/wrapperL3/TemplateReactionWrapper.java
|
TemplateReactionWrapper.initUpstream
|
@Override
public void initUpstream()
{
NucleicAcid nuc = tempReac.getTemplate();
if (nuc != null)
addToUpstream(nuc, getGraph());
for (Control cont : tempReac.getControlledOf())
{
addToUpstream(cont, graph);
}
}
|
java
|
@Override
public void initUpstream()
{
NucleicAcid nuc = tempReac.getTemplate();
if (nuc != null)
addToUpstream(nuc, getGraph());
for (Control cont : tempReac.getControlledOf())
{
addToUpstream(cont, graph);
}
}
|
[
"@",
"Override",
"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.
|
[
"Binds",
"to",
"template",
"and",
"controllers",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/paxtools-query/src/main/java/org/biopax/paxtools/query/wrapperL3/TemplateReactionWrapper.java#L35-L46
|
10,951
|
BioPAX/Paxtools
|
paxtools-query/src/main/java/org/biopax/paxtools/query/wrapperL3/TemplateReactionWrapper.java
|
TemplateReactionWrapper.addToUpstream
|
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 ControlWrapper)
{
((ControlWrapper) node).setTranscription(true);
}
}
node.getDownstreamNoInit().add(edge);
this.getUpstreamNoInit().add(edge);
}
|
java
|
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 ControlWrapper)
{
((ControlWrapper) node).setTranscription(true);
}
}
node.getDownstreamNoInit().add(edge);
this.getUpstreamNoInit().add(edge);
}
|
[
"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",
"ControlWrapper",
")",
"{",
"(",
"(",
"ControlWrapper",
")",
"node",
")",
".",
"setTranscription",
"(",
"true",
")",
";",
"}",
"}",
"node",
".",
"getDownstreamNoInit",
"(",
")",
".",
"add",
"(",
"edge",
")",
";",
"this",
".",
"getUpstreamNoInit",
"(",
")",
".",
"add",
"(",
"edge",
")",
";",
"}"
] |
Binds the given element to the upstream.
@param ele Element to bind
@param graph Owner graph
|
[
"Binds",
"the",
"given",
"element",
"to",
"the",
"upstream",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/paxtools-query/src/main/java/org/biopax/paxtools/query/wrapperL3/TemplateReactionWrapper.java#L94-L111
|
10,952
|
BioPAX/Paxtools
|
paxtools-query/src/main/java/org/biopax/paxtools/query/algorithm/CommonStreamQuery.java
|
CommonStreamQuery.run
|
public Set<GraphObject> run()
{
/**
* Candidate contains all the graph objects that are the results of BFS.
* Eliminating nodes from candidate according to the reached counts
* will yield result.
*/
Map<GraphObject, Integer> candidate = new HashMap<GraphObject, Integer>();
Set<GraphObject> result = new HashSet<GraphObject>();
//for each set of states of entity, run BFS separately
for (Set<Node> source : sourceSet)
{
//run BFS for set of states of each entity
BFS bfs = new BFS (source, null, direction, limit);
Map<GraphObject, Integer> BFSResult = new HashMap<GraphObject, Integer>();
BFSResult.putAll(bfs.run());
/**
* Reached counts of the graph objects that are in BFSResult will
* be incremented by 1.
*/
for (GraphObject go : BFSResult.keySet())
{
setLabel(go, (getLabel(go) + 1));
}
//put BFS Result into candidate set
candidate.putAll(BFSResult);
}
/**
* Having a reached count equal to number of nodes in the source set
* indicates being in common stream.
*/
for(GraphObject go : candidate.keySet())
{
if (getLabel(go) == sourceSet.size())
{
result.add(go);
}
}
//Return the result of query
return result;
}
|
java
|
public Set<GraphObject> run()
{
/**
* Candidate contains all the graph objects that are the results of BFS.
* Eliminating nodes from candidate according to the reached counts
* will yield result.
*/
Map<GraphObject, Integer> candidate = new HashMap<GraphObject, Integer>();
Set<GraphObject> result = new HashSet<GraphObject>();
//for each set of states of entity, run BFS separately
for (Set<Node> source : sourceSet)
{
//run BFS for set of states of each entity
BFS bfs = new BFS (source, null, direction, limit);
Map<GraphObject, Integer> BFSResult = new HashMap<GraphObject, Integer>();
BFSResult.putAll(bfs.run());
/**
* Reached counts of the graph objects that are in BFSResult will
* be incremented by 1.
*/
for (GraphObject go : BFSResult.keySet())
{
setLabel(go, (getLabel(go) + 1));
}
//put BFS Result into candidate set
candidate.putAll(BFSResult);
}
/**
* Having a reached count equal to number of nodes in the source set
* indicates being in common stream.
*/
for(GraphObject go : candidate.keySet())
{
if (getLabel(go) == sourceSet.size())
{
result.add(go);
}
}
//Return the result of query
return result;
}
|
[
"public",
"Set",
"<",
"GraphObject",
">",
"run",
"(",
")",
"{",
"/**\r\n\t\t * Candidate contains all the graph objects that are the results of BFS.\r\n\t\t * Eliminating nodes from candidate according to the reached counts\r\n\t\t * will yield result.\r\n\t\t */",
"Map",
"<",
"GraphObject",
",",
"Integer",
">",
"candidate",
"=",
"new",
"HashMap",
"<",
"GraphObject",
",",
"Integer",
">",
"(",
")",
";",
"Set",
"<",
"GraphObject",
">",
"result",
"=",
"new",
"HashSet",
"<",
"GraphObject",
">",
"(",
")",
";",
"//for each set of states of entity, run BFS separately\r",
"for",
"(",
"Set",
"<",
"Node",
">",
"source",
":",
"sourceSet",
")",
"{",
"//run BFS for set of states of each entity\r",
"BFS",
"bfs",
"=",
"new",
"BFS",
"(",
"source",
",",
"null",
",",
"direction",
",",
"limit",
")",
";",
"Map",
"<",
"GraphObject",
",",
"Integer",
">",
"BFSResult",
"=",
"new",
"HashMap",
"<",
"GraphObject",
",",
"Integer",
">",
"(",
")",
";",
"BFSResult",
".",
"putAll",
"(",
"bfs",
".",
"run",
"(",
")",
")",
";",
"/**\r\n\t\t\t * Reached counts of the graph objects that are in BFSResult will\r\n\t\t\t * be incremented by 1.\r\n\t\t\t */",
"for",
"(",
"GraphObject",
"go",
":",
"BFSResult",
".",
"keySet",
"(",
")",
")",
"{",
"setLabel",
"(",
"go",
",",
"(",
"getLabel",
"(",
"go",
")",
"+",
"1",
")",
")",
";",
"}",
"//put BFS Result into candidate set\r",
"candidate",
".",
"putAll",
"(",
"BFSResult",
")",
";",
"}",
"/**\r\n\t\t * Having a reached count equal to number of nodes in the source set\r\n\t\t * indicates being in common stream. \r\n\t\t */",
"for",
"(",
"GraphObject",
"go",
":",
"candidate",
".",
"keySet",
"(",
")",
")",
"{",
"if",
"(",
"getLabel",
"(",
"go",
")",
"==",
"sourceSet",
".",
"size",
"(",
")",
")",
"{",
"result",
".",
"add",
"(",
"go",
")",
";",
"}",
"}",
"//Return the result of query\r",
"return",
"result",
";",
"}"
] |
Method to run the query.
@return Common stream
|
[
"Method",
"to",
"run",
"the",
"query",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/paxtools-query/src/main/java/org/biopax/paxtools/query/algorithm/CommonStreamQuery.java#L90-L135
|
10,953
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/Match.java
|
Match.get
|
public BioPAXElement get(String label, Pattern p)
{
return variables[p.indexOf(label)];
}
|
java
|
public BioPAXElement get(String label, Pattern p)
{
return variables[p.indexOf(label)];
}
|
[
"public",
"BioPAXElement",
"get",
"(",
"String",
"label",
",",
"Pattern",
"p",
")",
"{",
"return",
"variables",
"[",
"p",
".",
"indexOf",
"(",
"label",
")",
"]",
";",
"}"
] |
Gets element corresponding to the given label in the pattern.
@param label label of the element in the pattern
@param p related pattern
@return element of the given label
@throws IllegalArgumentException if the label not in the pattern
|
[
"Gets",
"element",
"corresponding",
"to",
"the",
"given",
"label",
"in",
"the",
"pattern",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/Match.java#L58-L61
|
10,954
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/Match.java
|
Match.get
|
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;
}
|
java
|
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;
}
|
[
"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.
@param label labels of the element in the pattern
@param p related pattern
@return elements of the given label
@throws IllegalArgumentException if one of the labels not in the pattern
|
[
"Gets",
"elements",
"corresponding",
"to",
"the",
"given",
"labels",
"in",
"the",
"pattern",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/Match.java#L70-L80
|
10,955
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/Match.java
|
Match.getAName
|
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() > 0)
name = n.getStandardName();
else if (!n.getName().isEmpty() && n.getName().iterator().next().length() > 0)
name = n.getName().iterator().next();
}
if (name == null ) name = ele.getUri();
return name + " (" + ele.getModelInterface().getName().substring(
ele.getModelInterface().getName().lastIndexOf(".") + 1) + ")";
}
|
java
|
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() > 0)
name = n.getStandardName();
else if (!n.getName().isEmpty() && n.getName().iterator().next().length() > 0)
name = n.getName().iterator().next();
}
if (name == null ) name = ele.getUri();
return name + " (" + ele.getModelInterface().getName().substring(
ele.getModelInterface().getName().lastIndexOf(".") + 1) + ")";
}
|
[
"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",
"(",
")",
">",
"0",
")",
"name",
"=",
"n",
".",
"getStandardName",
"(",
")",
";",
"else",
"if",
"(",
"!",
"n",
".",
"getName",
"(",
")",
".",
"isEmpty",
"(",
")",
"&&",
"n",
".",
"getName",
"(",
")",
".",
"iterator",
"(",
")",
".",
"next",
"(",
")",
".",
"length",
"(",
")",
">",
"0",
")",
"name",
"=",
"n",
".",
"getName",
"(",
")",
".",
"iterator",
"(",
")",
".",
"next",
"(",
")",
";",
"}",
"if",
"(",
"name",
"==",
"null",
")",
"name",
"=",
"ele",
".",
"getUri",
"(",
")",
";",
"return",
"name",
"+",
"\" (\"",
"+",
"ele",
".",
"getModelInterface",
"(",
")",
".",
"getName",
"(",
")",
".",
"substring",
"(",
"ele",
".",
"getModelInterface",
"(",
")",
".",
"getName",
"(",
")",
".",
"lastIndexOf",
"(",
"\".\"",
")",
"+",
"1",
")",
"+",
"\")\"",
";",
"}"
] |
Finds a name for the variable.
@param ele element to check
@return a name
|
[
"Finds",
"a",
"name",
"for",
"the",
"variable",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/Match.java#L177-L195
|
10,956
|
BioPAX/Paxtools
|
paxtools-query/src/main/java/org/biopax/paxtools/query/wrapperL3/ConversionWrapper.java
|
ConversionWrapper.init
|
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.getConversionDirection() == ConversionDirectionType.RIGHT_TO_LEFT)
{
this.direction = RIGHT_TO_LEFT;
}
else
{
this.direction = LEFT_TO_RIGHT;
}
}
|
java
|
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.getConversionDirection() == ConversionDirectionType.RIGHT_TO_LEFT)
{
this.direction = RIGHT_TO_LEFT;
}
else
{
this.direction = LEFT_TO_RIGHT;
}
}
|
[
"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",
".",
"getConversionDirection",
"(",
")",
"==",
"ConversionDirectionType",
".",
"RIGHT_TO_LEFT",
")",
"{",
"this",
".",
"direction",
"=",
"RIGHT_TO_LEFT",
";",
"}",
"else",
"{",
"this",
".",
"direction",
"=",
"LEFT_TO_RIGHT",
";",
"}",
"}"
] |
Extracts the direction, creates the reverse if necessary.
|
[
"Extracts",
"the",
"direction",
"creates",
"the",
"reverse",
"if",
"necessary",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/paxtools-query/src/main/java/org/biopax/paxtools/query/wrapperL3/ConversionWrapper.java#L63-L81
|
10,957
|
BioPAX/Paxtools
|
paxtools-query/src/main/java/org/biopax/paxtools/query/wrapperL3/ConversionWrapper.java
|
ConversionWrapper.initUpstream
|
@Override
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 instanceof Catalysis)
{
Catalysis cat = (Catalysis) cont;
if ((cat.getCatalysisDirection() == CatalysisDirectionType.LEFT_TO_RIGHT && direction == RIGHT_TO_LEFT) ||
(cat.getCatalysisDirection() == CatalysisDirectionType.RIGHT_TO_LEFT && direction == LEFT_TO_RIGHT))
{
continue;
}
}
addToUpstream(cont, graph);
}
}
|
java
|
@Override
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 instanceof Catalysis)
{
Catalysis cat = (Catalysis) cont;
if ((cat.getCatalysisDirection() == CatalysisDirectionType.LEFT_TO_RIGHT && direction == RIGHT_TO_LEFT) ||
(cat.getCatalysisDirection() == CatalysisDirectionType.RIGHT_TO_LEFT && direction == LEFT_TO_RIGHT))
{
continue;
}
}
addToUpstream(cont, graph);
}
}
|
[
"@",
"Override",
"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",
"instanceof",
"Catalysis",
")",
"{",
"Catalysis",
"cat",
"=",
"(",
"Catalysis",
")",
"cont",
";",
"if",
"(",
"(",
"cat",
".",
"getCatalysisDirection",
"(",
")",
"==",
"CatalysisDirectionType",
".",
"LEFT_TO_RIGHT",
"&&",
"direction",
"==",
"RIGHT_TO_LEFT",
")",
"||",
"(",
"cat",
".",
"getCatalysisDirection",
"(",
")",
"==",
"CatalysisDirectionType",
".",
"RIGHT_TO_LEFT",
"&&",
"direction",
"==",
"LEFT_TO_RIGHT",
")",
")",
"{",
"continue",
";",
"}",
"}",
"addToUpstream",
"(",
"cont",
",",
"graph",
")",
";",
"}",
"}"
] |
Binds inputs and controllers.
|
[
"Binds",
"inputs",
"and",
"controllers",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/paxtools-query/src/main/java/org/biopax/paxtools/query/wrapperL3/ConversionWrapper.java#L86-L119
|
10,958
|
BioPAX/Paxtools
|
paxtools-query/src/main/java/org/biopax/paxtools/query/wrapperL3/ConversionWrapper.java
|
ConversionWrapper.initDownstream
|
@Override
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());
}
}
}
|
java
|
@Override
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());
}
}
}
|
[
"@",
"Override",
"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.
|
[
"Binds",
"products",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/paxtools-query/src/main/java/org/biopax/paxtools/query/wrapperL3/ConversionWrapper.java#L124-L141
|
10,959
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/miner/MinerAdapter.java
|
MinerAdapter.getPattern
|
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), ((SIFMiner) this).getTargetLabel());
}
pattern.optimizeConstraintOrder();
}
return pattern;
}
|
java
|
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), ((SIFMiner) this).getTargetLabel());
}
pattern.optimizeConstraintOrder();
}
return pattern;
}
|
[
"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",
")",
",",
"(",
"(",
"SIFMiner",
")",
"this",
")",
".",
"getTargetLabel",
"(",
")",
")",
";",
"}",
"pattern",
".",
"optimizeConstraintOrder",
"(",
")",
";",
"}",
"return",
"pattern",
";",
"}"
] |
Gets the pattern, constructs if null.
@return pattern
|
[
"Gets",
"the",
"pattern",
"constructs",
"if",
"null",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/miner/MinerAdapter.java#L94-L105
|
10,960
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/miner/MinerAdapter.java
|
MinerAdapter.isInhibition
|
public boolean isInhibition(Control ctrl)
{
return ctrl.getControlType() != null && ctrl.getControlType().toString().startsWith("I");
}
|
java
|
public boolean isInhibition(Control ctrl)
{
return ctrl.getControlType() != null && ctrl.getControlType().toString().startsWith("I");
}
|
[
"public",
"boolean",
"isInhibition",
"(",
"Control",
"ctrl",
")",
"{",
"return",
"ctrl",
".",
"getControlType",
"(",
")",
"!=",
"null",
"&&",
"ctrl",
".",
"getControlType",
"(",
")",
".",
"toString",
"(",
")",
".",
"startsWith",
"(",
"\"I\"",
")",
";",
"}"
] |
Checks if the type of a Control is inhibition.
@param ctrl Control to check
@return true if type is inhibition related
|
[
"Checks",
"if",
"the",
"type",
"of",
"a",
"Control",
"is",
"inhibition",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/miner/MinerAdapter.java#L231-L234
|
10,961
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/miner/MinerAdapter.java
|
MinerAdapter.toStringSet
|
public Set<String> toStringSet(Set<ModificationFeature> set)
{
List<ModificationFeature> list = new ArrayList<ModificationFeature>(set);
Collections.sort(list, new Comparator<ModificationFeature>()
{
@Override
public int compare(ModificationFeature o1, ModificationFeature o2)
{
String t1 = getModificationTerm(o1);
String t2 = getModificationTerm(o2);
Integer l1 = getPositionStart(o1);
Integer l2 = getPositionStart(o2);
if (t1 == null && t2 == null) return l1.compareTo(l2);
if (t1 == null) return 1;
if (t2 == null) return -1;
if (t1.equals(t2)) return l1.compareTo(l2);
return t1.compareTo(t2);
}
});
return getInString(list);
}
|
java
|
public Set<String> toStringSet(Set<ModificationFeature> set)
{
List<ModificationFeature> list = new ArrayList<ModificationFeature>(set);
Collections.sort(list, new Comparator<ModificationFeature>()
{
@Override
public int compare(ModificationFeature o1, ModificationFeature o2)
{
String t1 = getModificationTerm(o1);
String t2 = getModificationTerm(o2);
Integer l1 = getPositionStart(o1);
Integer l2 = getPositionStart(o2);
if (t1 == null && t2 == null) return l1.compareTo(l2);
if (t1 == null) return 1;
if (t2 == null) return -1;
if (t1.equals(t2)) return l1.compareTo(l2);
return t1.compareTo(t2);
}
});
return getInString(list);
}
|
[
"public",
"Set",
"<",
"String",
">",
"toStringSet",
"(",
"Set",
"<",
"ModificationFeature",
">",
"set",
")",
"{",
"List",
"<",
"ModificationFeature",
">",
"list",
"=",
"new",
"ArrayList",
"<",
"ModificationFeature",
">",
"(",
"set",
")",
";",
"Collections",
".",
"sort",
"(",
"list",
",",
"new",
"Comparator",
"<",
"ModificationFeature",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"int",
"compare",
"(",
"ModificationFeature",
"o1",
",",
"ModificationFeature",
"o2",
")",
"{",
"String",
"t1",
"=",
"getModificationTerm",
"(",
"o1",
")",
";",
"String",
"t2",
"=",
"getModificationTerm",
"(",
"o2",
")",
";",
"Integer",
"l1",
"=",
"getPositionStart",
"(",
"o1",
")",
";",
"Integer",
"l2",
"=",
"getPositionStart",
"(",
"o2",
")",
";",
"if",
"(",
"t1",
"==",
"null",
"&&",
"t2",
"==",
"null",
")",
"return",
"l1",
".",
"compareTo",
"(",
"l2",
")",
";",
"if",
"(",
"t1",
"==",
"null",
")",
"return",
"1",
";",
"if",
"(",
"t2",
"==",
"null",
")",
"return",
"-",
"1",
";",
"if",
"(",
"t1",
".",
"equals",
"(",
"t2",
")",
")",
"return",
"l1",
".",
"compareTo",
"(",
"l2",
")",
";",
"return",
"t1",
".",
"compareTo",
"(",
"t2",
")",
";",
"}",
"}",
")",
";",
"return",
"getInString",
"(",
"list",
")",
";",
"}"
] |
Sorts the modifications and gets them in a String.
@param set modifications
@return a String listing the modifications
|
[
"Sorts",
"the",
"modifications",
"and",
"gets",
"them",
"in",
"a",
"String",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/miner/MinerAdapter.java#L273-L297
|
10,962
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/miner/MinerAdapter.java
|
MinerAdapter.getInString
|
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 (!text.contains(s)) text.add(s);
}
}
return text;
}
|
java
|
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 (!text.contains(s)) text.add(s);
}
}
return text;
}
|
[
"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",
"(",
"!",
"text",
".",
"contains",
"(",
"s",
")",
")",
"text",
".",
"add",
"(",
"s",
")",
";",
"}",
"}",
"return",
"text",
";",
"}"
] |
Gets the modifications is a string that is separated with comma.
@param list modification list
@return String representing the modifications
|
[
"Gets",
"the",
"modifications",
"is",
"a",
"string",
"that",
"is",
"separated",
"with",
"comma",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/miner/MinerAdapter.java#L304-L320
|
10,963
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/miner/MinerAdapter.java
|
MinerAdapter.getModificationTerm
|
public String getModificationTerm(ModificationFeature mf)
{
Set vals = TERM_ACC.getValueFromBean(mf);
if (vals.isEmpty()) return null;
return vals.iterator().next().toString();
}
|
java
|
public String getModificationTerm(ModificationFeature mf)
{
Set vals = TERM_ACC.getValueFromBean(mf);
if (vals.isEmpty()) return null;
return vals.iterator().next().toString();
}
|
[
"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.
@param mf modification feature
@return modification term
|
[
"Gets",
"the",
"String",
"term",
"of",
"the",
"modification",
"feature",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/miner/MinerAdapter.java#L327-L332
|
10,964
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/miner/MinerAdapter.java
|
MinerAdapter.getPositionStart
|
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().next());
}
return -1;
}
|
java
|
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().next());
}
return -1;
}
|
[
"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",
"(",
")",
".",
"next",
"(",
")",
")",
";",
"}",
"return",
"-",
"1",
";",
"}"
] |
Gets the first position of the modification feature.
@param mf modification feature
@return first location
|
[
"Gets",
"the",
"first",
"position",
"of",
"the",
"modification",
"feature",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/miner/MinerAdapter.java#L339-L356
|
10,965
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/miner/MinerAdapter.java
|
MinerAdapter.getPositionInString
|
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 begin = ((Integer) vals.iterator().next());
vals = INTERVAL_END_ACC.getValueFromBean(mf);
if (!vals.isEmpty())
{
int end = ((Integer) vals.iterator().next());
if (begin > 0 && end > 0 && begin <= end)
{
if (begin == end) return "@" + begin;
else return "@" + "[" + begin + "-" + end + "]";
}
}
}
return "";
}
|
java
|
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 begin = ((Integer) vals.iterator().next());
vals = INTERVAL_END_ACC.getValueFromBean(mf);
if (!vals.isEmpty())
{
int end = ((Integer) vals.iterator().next());
if (begin > 0 && end > 0 && begin <= end)
{
if (begin == end) return "@" + begin;
else return "@" + "[" + begin + "-" + end + "]";
}
}
}
return "";
}
|
[
"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",
"begin",
"=",
"(",
"(",
"Integer",
")",
"vals",
".",
"iterator",
"(",
")",
".",
"next",
"(",
")",
")",
";",
"vals",
"=",
"INTERVAL_END_ACC",
".",
"getValueFromBean",
"(",
"mf",
")",
";",
"if",
"(",
"!",
"vals",
".",
"isEmpty",
"(",
")",
")",
"{",
"int",
"end",
"=",
"(",
"(",
"Integer",
")",
"vals",
".",
"iterator",
"(",
")",
".",
"next",
"(",
")",
")",
";",
"if",
"(",
"begin",
">",
"0",
"&&",
"end",
">",
"0",
"&&",
"begin",
"<=",
"end",
")",
"{",
"if",
"(",
"begin",
"==",
"end",
")",
"return",
"\"@\"",
"+",
"begin",
";",
"else",
"return",
"\"@\"",
"+",
"\"[\"",
"+",
"begin",
"+",
"\"-\"",
"+",
"end",
"+",
"\"]\"",
";",
"}",
"}",
"}",
"return",
"\"\"",
";",
"}"
] |
Gets the position of the modification feature as a String.
@param mf modification feature
@return location
|
[
"Gets",
"the",
"position",
"of",
"the",
"modification",
"feature",
"as",
"a",
"String",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/miner/MinerAdapter.java#L363-L394
|
10,966
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/miner/MinerAdapter.java
|
MinerAdapter.getModifications
|
protected Set<String> getModifications(Match m, String label)
{
PhysicalEntity pe = (PhysicalEntity) m.get(label, getPattern());
return toStringSet(new HashSet<ModificationFeature>(FEAT_ACC.getValueFromBean(pe)));
}
|
java
|
protected Set<String> getModifications(Match m, String label)
{
PhysicalEntity pe = (PhysicalEntity) m.get(label, getPattern());
return toStringSet(new HashSet<ModificationFeature>(FEAT_ACC.getValueFromBean(pe)));
}
|
[
"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.
@param m match
@param label label of the PhysicalEntity
@return modifications
|
[
"Gets",
"modifications",
"of",
"the",
"given",
"element",
"in",
"a",
"string",
".",
"The",
"element",
"has",
"to",
"be",
"a",
"PhysicalEntity",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/miner/MinerAdapter.java#L402-L406
|
10,967
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/miner/MinerAdapter.java
|
MinerAdapter.concat
|
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;
}
|
java
|
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;
}
|
[
"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.
@param set the set
@param sep separator string
@return concatenated string
|
[
"Converts",
"the",
"set",
"of",
"string",
"to",
"a",
"single",
"string",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/miner/MinerAdapter.java#L509-L520
|
10,968
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/miner/MinerAdapter.java
|
MinerAdapter.sign
|
protected int sign(Control ctrl)
{
ControlType type = ctrl.getControlType();
if (type != null && type.name().startsWith("I")) return -1;
return 1;
}
|
java
|
protected int sign(Control ctrl)
{
ControlType type = ctrl.getControlType();
if (type != null && type.name().startsWith("I")) return -1;
return 1;
}
|
[
"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.
@param ctrl control to check
@return sign
|
[
"Identifies",
"negative",
"and",
"positive",
"controls",
".",
"Assumes",
"positive",
"by",
"default",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/miner/MinerAdapter.java#L527-L532
|
10,969
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/miner/MinerAdapter.java
|
MinerAdapter.sign
|
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;
}
|
java
|
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;
}
|
[
"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.
@param m result match
@param ctrlLabel labels for controls
@return sign
|
[
"Checks",
"the",
"cumulative",
"sign",
"of",
"the",
"chained",
"controls",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/miner/MinerAdapter.java#L540-L550
|
10,970
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/miner/MinerAdapter.java
|
MinerAdapter.labeledInactive
|
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;
}
|
java
|
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;
}
|
[
"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.
@param m the result match
@param simpleLabel simple end of the chain
@param complexLabel complex end of the chain
@return true if labeled inactive
|
[
"Checks",
"if",
"a",
"PE",
"chain",
"is",
"labeled",
"as",
"inactive",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/miner/MinerAdapter.java#L559-L564
|
10,971
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/miner/MinerAdapter.java
|
MinerAdapter.writeResultDetailed
|
protected void writeResultDetailed(Map<BioPAXElement, List<Match>> matches, OutputStream out,
int columns) throws IOException
{
OutputStreamWriter writer = new OutputStreamWriter(out);
// write the header
String header = getHeader();
if (header != null)
{
writer.write(header);
}
else
{
for (int i = 0; i < columns; i++)
{
writer.write("col-" + (i+1));
if (i < columns - 1) writer.write("\t");
}
}
// memory for already written lines
Set<String> mem = new HashSet<String>();
// write values
for (BioPAXElement ele : matches.keySet())
{
for (Match m : matches.get(ele))
{
String line = "";
boolean aborted = false;
for (int i = 0; i < columns; i++)
{
String s = getValue(m, i);
if (s == null)
{
aborted = true;
break;
}
else
{
line += s + "\t";
}
}
if (aborted) continue;
line = line.trim();
if (!mem.contains(line))
{
writer.write("\n" + line);
mem.add(line);
}
}
}
writer.flush();
}
|
java
|
protected void writeResultDetailed(Map<BioPAXElement, List<Match>> matches, OutputStream out,
int columns) throws IOException
{
OutputStreamWriter writer = new OutputStreamWriter(out);
// write the header
String header = getHeader();
if (header != null)
{
writer.write(header);
}
else
{
for (int i = 0; i < columns; i++)
{
writer.write("col-" + (i+1));
if (i < columns - 1) writer.write("\t");
}
}
// memory for already written lines
Set<String> mem = new HashSet<String>();
// write values
for (BioPAXElement ele : matches.keySet())
{
for (Match m : matches.get(ele))
{
String line = "";
boolean aborted = false;
for (int i = 0; i < columns; i++)
{
String s = getValue(m, i);
if (s == null)
{
aborted = true;
break;
}
else
{
line += s + "\t";
}
}
if (aborted) continue;
line = line.trim();
if (!mem.contains(line))
{
writer.write("\n" + line);
mem.add(line);
}
}
}
writer.flush();
}
|
[
"protected",
"void",
"writeResultDetailed",
"(",
"Map",
"<",
"BioPAXElement",
",",
"List",
"<",
"Match",
">",
">",
"matches",
",",
"OutputStream",
"out",
",",
"int",
"columns",
")",
"throws",
"IOException",
"{",
"OutputStreamWriter",
"writer",
"=",
"new",
"OutputStreamWriter",
"(",
"out",
")",
";",
"// write the header",
"String",
"header",
"=",
"getHeader",
"(",
")",
";",
"if",
"(",
"header",
"!=",
"null",
")",
"{",
"writer",
".",
"write",
"(",
"header",
")",
";",
"}",
"else",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"columns",
";",
"i",
"++",
")",
"{",
"writer",
".",
"write",
"(",
"\"col-\"",
"+",
"(",
"i",
"+",
"1",
")",
")",
";",
"if",
"(",
"i",
"<",
"columns",
"-",
"1",
")",
"writer",
".",
"write",
"(",
"\"\\t\"",
")",
";",
"}",
"}",
"// memory for already written lines",
"Set",
"<",
"String",
">",
"mem",
"=",
"new",
"HashSet",
"<",
"String",
">",
"(",
")",
";",
"// write values",
"for",
"(",
"BioPAXElement",
"ele",
":",
"matches",
".",
"keySet",
"(",
")",
")",
"{",
"for",
"(",
"Match",
"m",
":",
"matches",
".",
"get",
"(",
"ele",
")",
")",
"{",
"String",
"line",
"=",
"\"\"",
";",
"boolean",
"aborted",
"=",
"false",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"columns",
";",
"i",
"++",
")",
"{",
"String",
"s",
"=",
"getValue",
"(",
"m",
",",
"i",
")",
";",
"if",
"(",
"s",
"==",
"null",
")",
"{",
"aborted",
"=",
"true",
";",
"break",
";",
"}",
"else",
"{",
"line",
"+=",
"s",
"+",
"\"\\t\"",
";",
"}",
"}",
"if",
"(",
"aborted",
")",
"continue",
";",
"line",
"=",
"line",
".",
"trim",
"(",
")",
";",
"if",
"(",
"!",
"mem",
".",
"contains",
"(",
"line",
")",
")",
"{",
"writer",
".",
"write",
"(",
"\"\\n\"",
"+",
"line",
")",
";",
"mem",
".",
"add",
"(",
"line",
")",
";",
"}",
"}",
"}",
"writer",
".",
"flush",
"(",
")",
";",
"}"
] |
Writes the result as a tab delimited format, where the column values are customized.
@param matches result matches
@param out output stream
@param columns number of columns in the result
@throws IOException if cannot write to the stream
|
[
"Writes",
"the",
"result",
"as",
"a",
"tab",
"delimited",
"format",
"where",
"the",
"column",
"values",
"are",
"customized",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/miner/MinerAdapter.java#L703-L763
|
10,972
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/miner/MinerAdapter.java
|
MinerAdapter.createSIFInteraction
|
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(sourceBpe, fetcher);
Set<String> targets = fetchIDs(targetBpe, fetcher);
SIFType sifType = ((SIFMiner) this).getSIFType();
Set<SIFInteraction> set = new HashSet<SIFInteraction>();
for (String source : sources)
{
for (String target : targets)
{
if (source.equals(target)) continue;
else if (sifType.isDirected() || source.compareTo(target) < 0)
{
set.add(new SIFInteraction(source, target, sourceBpe, targetBpe, sifType,
new HashSet<BioPAXElement>(m.get(getMediatorLabels(), getPattern())),
new HashSet<BioPAXElement>(m.get(getSourcePELabels(), getPattern())),
new HashSet<BioPAXElement>(m.get(getTargetPELabels(), getPattern()))));
}
else
{
set.add(new SIFInteraction(target, source, targetBpe, sourceBpe, sifType,
new HashSet<BioPAXElement>(m.get(getMediatorLabels(), getPattern())),
new HashSet<BioPAXElement>(m.get(getTargetPELabels(), getPattern())),
new HashSet<BioPAXElement>(m.get(getSourcePELabels(), getPattern()))));
}
}
}
return set;
}
|
java
|
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(sourceBpe, fetcher);
Set<String> targets = fetchIDs(targetBpe, fetcher);
SIFType sifType = ((SIFMiner) this).getSIFType();
Set<SIFInteraction> set = new HashSet<SIFInteraction>();
for (String source : sources)
{
for (String target : targets)
{
if (source.equals(target)) continue;
else if (sifType.isDirected() || source.compareTo(target) < 0)
{
set.add(new SIFInteraction(source, target, sourceBpe, targetBpe, sifType,
new HashSet<BioPAXElement>(m.get(getMediatorLabels(), getPattern())),
new HashSet<BioPAXElement>(m.get(getSourcePELabels(), getPattern())),
new HashSet<BioPAXElement>(m.get(getTargetPELabels(), getPattern()))));
}
else
{
set.add(new SIFInteraction(target, source, targetBpe, sourceBpe, sifType,
new HashSet<BioPAXElement>(m.get(getMediatorLabels(), getPattern())),
new HashSet<BioPAXElement>(m.get(getTargetPELabels(), getPattern())),
new HashSet<BioPAXElement>(m.get(getSourcePELabels(), getPattern()))));
}
}
}
return set;
}
|
[
"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",
"(",
"sourceBpe",
",",
"fetcher",
")",
";",
"Set",
"<",
"String",
">",
"targets",
"=",
"fetchIDs",
"(",
"targetBpe",
",",
"fetcher",
")",
";",
"SIFType",
"sifType",
"=",
"(",
"(",
"SIFMiner",
")",
"this",
")",
".",
"getSIFType",
"(",
")",
";",
"Set",
"<",
"SIFInteraction",
">",
"set",
"=",
"new",
"HashSet",
"<",
"SIFInteraction",
">",
"(",
")",
";",
"for",
"(",
"String",
"source",
":",
"sources",
")",
"{",
"for",
"(",
"String",
"target",
":",
"targets",
")",
"{",
"if",
"(",
"source",
".",
"equals",
"(",
"target",
")",
")",
"continue",
";",
"else",
"if",
"(",
"sifType",
".",
"isDirected",
"(",
")",
"||",
"source",
".",
"compareTo",
"(",
"target",
")",
"<",
"0",
")",
"{",
"set",
".",
"add",
"(",
"new",
"SIFInteraction",
"(",
"source",
",",
"target",
",",
"sourceBpe",
",",
"targetBpe",
",",
"sifType",
",",
"new",
"HashSet",
"<",
"BioPAXElement",
">",
"(",
"m",
".",
"get",
"(",
"getMediatorLabels",
"(",
")",
",",
"getPattern",
"(",
")",
")",
")",
",",
"new",
"HashSet",
"<",
"BioPAXElement",
">",
"(",
"m",
".",
"get",
"(",
"getSourcePELabels",
"(",
")",
",",
"getPattern",
"(",
")",
")",
")",
",",
"new",
"HashSet",
"<",
"BioPAXElement",
">",
"(",
"m",
".",
"get",
"(",
"getTargetPELabels",
"(",
")",
",",
"getPattern",
"(",
")",
")",
")",
")",
")",
";",
"}",
"else",
"{",
"set",
".",
"add",
"(",
"new",
"SIFInteraction",
"(",
"target",
",",
"source",
",",
"targetBpe",
",",
"sourceBpe",
",",
"sifType",
",",
"new",
"HashSet",
"<",
"BioPAXElement",
">",
"(",
"m",
".",
"get",
"(",
"getMediatorLabels",
"(",
")",
",",
"getPattern",
"(",
")",
")",
")",
",",
"new",
"HashSet",
"<",
"BioPAXElement",
">",
"(",
"m",
".",
"get",
"(",
"getTargetPELabels",
"(",
")",
",",
"getPattern",
"(",
")",
")",
")",
",",
"new",
"HashSet",
"<",
"BioPAXElement",
">",
"(",
"m",
".",
"get",
"(",
"getSourcePELabels",
"(",
")",
",",
"getPattern",
"(",
")",
")",
")",
")",
")",
";",
"}",
"}",
"}",
"return",
"set",
";",
"}"
] |
Creates a SIF interaction for the given match.
@param m match to use for SIF creation
@param fetcher ID generator from BioPAX object
@return SIF interaction
|
[
"Creates",
"a",
"SIF",
"interaction",
"for",
"the",
"given",
"match",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/miner/MinerAdapter.java#L784-L818
|
10,973
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/miner/MinerAdapter.java
|
MinerAdapter.getIdentifiers
|
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((ProteinReference) el));
}
else if (el instanceof SmallMoleculeReference)
{
set.add(getCompoundName((SmallMoleculeReference) el));
}
return set;
}
|
java
|
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((ProteinReference) el));
}
else if (el instanceof SmallMoleculeReference)
{
set.add(getCompoundName((SmallMoleculeReference) el));
}
return set;
}
|
[
"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",
"(",
"(",
"ProteinReference",
")",
"el",
")",
")",
";",
"}",
"else",
"if",
"(",
"el",
"instanceof",
"SmallMoleculeReference",
")",
"{",
"set",
".",
"add",
"(",
"getCompoundName",
"(",
"(",
"SmallMoleculeReference",
")",
"el",
")",
")",
";",
"}",
"return",
"set",
";",
"}"
] |
Uses uniprot name or gene symbol as identifier.
@param m current match
@param label label of the related EntityReference in the pattern
@return identifier
|
[
"Uses",
"uniprot",
"name",
"or",
"gene",
"symbol",
"as",
"identifier",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/miner/MinerAdapter.java#L866-L883
|
10,974
|
BioPAX/Paxtools
|
sbgn-converter/src/main/java/org/biopax/paxtools/io/sbgn/VNode.java
|
VNode.update
|
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();
}
|
java
|
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();
}
|
[
"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
@param lGraphObj LGraphObject for whom the update will take place.
|
[
"Function",
"that",
"will",
"take",
"place",
"when",
"VNode",
"objects",
"will",
"update",
"in",
"layout",
"process",
"of",
"ChiLay"
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/sbgn-converter/src/main/java/org/biopax/paxtools/io/sbgn/VNode.java#L123-L135
|
10,975
|
BioPAX/Paxtools
|
sbgn-converter/src/main/java/org/biopax/paxtools/io/sbgn/VNode.java
|
VNode.setBounds
|
public void setBounds(float w, float h)
{
this.glyph.getBbox().setW(w);
this.glyph.getBbox().setH(h);
}
|
java
|
public void setBounds(float w, float h)
{
this.glyph.getBbox().setW(w);
this.glyph.getBbox().setH(h);
}
|
[
"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
@param w new width
@param h new height
|
[
"Sets",
"the",
"bound",
"of",
"this",
"VNode",
"by",
"given",
"width",
"and",
"height"
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/sbgn-converter/src/main/java/org/biopax/paxtools/io/sbgn/VNode.java#L142-L146
|
10,976
|
BioPAX/Paxtools
|
sbgn-converter/src/main/java/org/biopax/paxtools/io/sbgn/VNode.java
|
VNode.setSizeAccordingToClass
|
public void setSizeAccordingToClass()
{
String glyphClass = this.glyph.getClazz();
//If glyph class is not specified return here
if (glyphClass.equalsIgnoreCase(NONE))
return;
if (glyphClass.equalsIgnoreCase(SOURCE_AND_SINK))
{
setBounds(SOURCE_AND_SINK_BOUND.getWidth(), SOURCE_AND_SINK_BOUND.getHeight());
}
else if (glyphClass.equalsIgnoreCase(AND) || glyphClass.equalsIgnoreCase(OR) || glyphClass.equalsIgnoreCase(NOT))
{
setBounds(LOGICAL_OPERATOR_BOUND.getWidth(), LOGICAL_OPERATOR_BOUND.getHeight());
}
else if (glyphClass.equalsIgnoreCase(ASSOCIATION) || glyphClass.equalsIgnoreCase(DISSOCIATION) || glyphClass.equalsIgnoreCase(OMITTED_PROCESS) ||
glyphClass.equalsIgnoreCase(UNCERTAIN_PROCESS) || glyphClass.equalsIgnoreCase(PROCESS))
{
setBounds(PROCESS_NODES_BOUND.getWidth(), PROCESS_NODES_BOUND.getHeight());
}
else if (glyphClass.equalsIgnoreCase(SIMPLE_CHEMICAL))
{
setBounds(SIMPLE_CHEMICAL_BOUND.getWidth(), SIMPLE_CHEMICAL_BOUND.getHeight());
}
else if (glyphClass.equalsIgnoreCase(UNSPECIFIED_ENTITY))
{
setBounds(UNSPECIFIED_ENTITY_BOUND.getWidth(), UNSPECIFIED_ENTITY_BOUND.getHeight());
}
else if (glyphClass.equalsIgnoreCase(MACROMOLECULE))
{
setBounds(MACROMOLECULE_BOUND.getWidth(), MACROMOLECULE_BOUND.getHeight());
}
else if (glyphClass.equalsIgnoreCase(NUCLEIC_ACID_FEATURE))
{
setBounds(NUCLEIC_ACID_FEATURE_BOUND.getWidth(), NUCLEIC_ACID_FEATURE_BOUND.getHeight());
}
else if (glyphClass.equalsIgnoreCase(STATE_VARIABLE))
{
setBounds(STATE_BOUND.getWidth(), STATE_BOUND.getHeight());
}
else if (glyphClass.equalsIgnoreCase(UNIT_OF_INFORMATION))
{
setBounds(INFO_BOUND.getWidth(), INFO_BOUND.getHeight());
}
else if (glyphClass.equalsIgnoreCase(PHENOTYPE))
{
setBounds(PHENOTYPE_BOUND.getWidth(), PHENOTYPE_BOUND.getHeight());
}
else if (glyphClass.equalsIgnoreCase(PERTURBING_AGENT))
{
setBounds(PERTURBING_AGENT_BOUND.getWidth(), PERTURBING_AGENT_BOUND.getHeight());
}
else if (glyphClass.equalsIgnoreCase(TAG))
{
setBounds(TAG_BOUND.getWidth(), TAG_BOUND.getHeight());
}
else if (glyphClass.equalsIgnoreCase(COMPLEX))
{
setBounds(COMPLEX_BOUND.getWidth(), COMPLEX_BOUND.getHeight());
}
if( this.glyph.getClone() != null )
{
Bbox glyphBbox = this.glyph.getBbox();
setBounds(3*glyphBbox.getW()/4, 3*glyphBbox.getH()/4);
}
if (glyphClass.equalsIgnoreCase(MACROMOLECULE) || glyphClass.equalsIgnoreCase(NUCLEIC_ACID_FEATURE) || glyphClass.equalsIgnoreCase(SIMPLE_CHEMICAL) || glyphClass.equalsIgnoreCase(COMPLEX))
{
updateSizeForStateAndInfo();
}
}
|
java
|
public void setSizeAccordingToClass()
{
String glyphClass = this.glyph.getClazz();
//If glyph class is not specified return here
if (glyphClass.equalsIgnoreCase(NONE))
return;
if (glyphClass.equalsIgnoreCase(SOURCE_AND_SINK))
{
setBounds(SOURCE_AND_SINK_BOUND.getWidth(), SOURCE_AND_SINK_BOUND.getHeight());
}
else if (glyphClass.equalsIgnoreCase(AND) || glyphClass.equalsIgnoreCase(OR) || glyphClass.equalsIgnoreCase(NOT))
{
setBounds(LOGICAL_OPERATOR_BOUND.getWidth(), LOGICAL_OPERATOR_BOUND.getHeight());
}
else if (glyphClass.equalsIgnoreCase(ASSOCIATION) || glyphClass.equalsIgnoreCase(DISSOCIATION) || glyphClass.equalsIgnoreCase(OMITTED_PROCESS) ||
glyphClass.equalsIgnoreCase(UNCERTAIN_PROCESS) || glyphClass.equalsIgnoreCase(PROCESS))
{
setBounds(PROCESS_NODES_BOUND.getWidth(), PROCESS_NODES_BOUND.getHeight());
}
else if (glyphClass.equalsIgnoreCase(SIMPLE_CHEMICAL))
{
setBounds(SIMPLE_CHEMICAL_BOUND.getWidth(), SIMPLE_CHEMICAL_BOUND.getHeight());
}
else if (glyphClass.equalsIgnoreCase(UNSPECIFIED_ENTITY))
{
setBounds(UNSPECIFIED_ENTITY_BOUND.getWidth(), UNSPECIFIED_ENTITY_BOUND.getHeight());
}
else if (glyphClass.equalsIgnoreCase(MACROMOLECULE))
{
setBounds(MACROMOLECULE_BOUND.getWidth(), MACROMOLECULE_BOUND.getHeight());
}
else if (glyphClass.equalsIgnoreCase(NUCLEIC_ACID_FEATURE))
{
setBounds(NUCLEIC_ACID_FEATURE_BOUND.getWidth(), NUCLEIC_ACID_FEATURE_BOUND.getHeight());
}
else if (glyphClass.equalsIgnoreCase(STATE_VARIABLE))
{
setBounds(STATE_BOUND.getWidth(), STATE_BOUND.getHeight());
}
else if (glyphClass.equalsIgnoreCase(UNIT_OF_INFORMATION))
{
setBounds(INFO_BOUND.getWidth(), INFO_BOUND.getHeight());
}
else if (glyphClass.equalsIgnoreCase(PHENOTYPE))
{
setBounds(PHENOTYPE_BOUND.getWidth(), PHENOTYPE_BOUND.getHeight());
}
else if (glyphClass.equalsIgnoreCase(PERTURBING_AGENT))
{
setBounds(PERTURBING_AGENT_BOUND.getWidth(), PERTURBING_AGENT_BOUND.getHeight());
}
else if (glyphClass.equalsIgnoreCase(TAG))
{
setBounds(TAG_BOUND.getWidth(), TAG_BOUND.getHeight());
}
else if (glyphClass.equalsIgnoreCase(COMPLEX))
{
setBounds(COMPLEX_BOUND.getWidth(), COMPLEX_BOUND.getHeight());
}
if( this.glyph.getClone() != null )
{
Bbox glyphBbox = this.glyph.getBbox();
setBounds(3*glyphBbox.getW()/4, 3*glyphBbox.getH()/4);
}
if (glyphClass.equalsIgnoreCase(MACROMOLECULE) || glyphClass.equalsIgnoreCase(NUCLEIC_ACID_FEATURE) || glyphClass.equalsIgnoreCase(SIMPLE_CHEMICAL) || glyphClass.equalsIgnoreCase(COMPLEX))
{
updateSizeForStateAndInfo();
}
}
|
[
"public",
"void",
"setSizeAccordingToClass",
"(",
")",
"{",
"String",
"glyphClass",
"=",
"this",
".",
"glyph",
".",
"getClazz",
"(",
")",
";",
"//If glyph class is not specified return here",
"if",
"(",
"glyphClass",
".",
"equalsIgnoreCase",
"(",
"NONE",
")",
")",
"return",
";",
"if",
"(",
"glyphClass",
".",
"equalsIgnoreCase",
"(",
"SOURCE_AND_SINK",
")",
")",
"{",
"setBounds",
"(",
"SOURCE_AND_SINK_BOUND",
".",
"getWidth",
"(",
")",
",",
"SOURCE_AND_SINK_BOUND",
".",
"getHeight",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"glyphClass",
".",
"equalsIgnoreCase",
"(",
"AND",
")",
"||",
"glyphClass",
".",
"equalsIgnoreCase",
"(",
"OR",
")",
"||",
"glyphClass",
".",
"equalsIgnoreCase",
"(",
"NOT",
")",
")",
"{",
"setBounds",
"(",
"LOGICAL_OPERATOR_BOUND",
".",
"getWidth",
"(",
")",
",",
"LOGICAL_OPERATOR_BOUND",
".",
"getHeight",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"glyphClass",
".",
"equalsIgnoreCase",
"(",
"ASSOCIATION",
")",
"||",
"glyphClass",
".",
"equalsIgnoreCase",
"(",
"DISSOCIATION",
")",
"||",
"glyphClass",
".",
"equalsIgnoreCase",
"(",
"OMITTED_PROCESS",
")",
"||",
"glyphClass",
".",
"equalsIgnoreCase",
"(",
"UNCERTAIN_PROCESS",
")",
"||",
"glyphClass",
".",
"equalsIgnoreCase",
"(",
"PROCESS",
")",
")",
"{",
"setBounds",
"(",
"PROCESS_NODES_BOUND",
".",
"getWidth",
"(",
")",
",",
"PROCESS_NODES_BOUND",
".",
"getHeight",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"glyphClass",
".",
"equalsIgnoreCase",
"(",
"SIMPLE_CHEMICAL",
")",
")",
"{",
"setBounds",
"(",
"SIMPLE_CHEMICAL_BOUND",
".",
"getWidth",
"(",
")",
",",
"SIMPLE_CHEMICAL_BOUND",
".",
"getHeight",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"glyphClass",
".",
"equalsIgnoreCase",
"(",
"UNSPECIFIED_ENTITY",
")",
")",
"{",
"setBounds",
"(",
"UNSPECIFIED_ENTITY_BOUND",
".",
"getWidth",
"(",
")",
",",
"UNSPECIFIED_ENTITY_BOUND",
".",
"getHeight",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"glyphClass",
".",
"equalsIgnoreCase",
"(",
"MACROMOLECULE",
")",
")",
"{",
"setBounds",
"(",
"MACROMOLECULE_BOUND",
".",
"getWidth",
"(",
")",
",",
"MACROMOLECULE_BOUND",
".",
"getHeight",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"glyphClass",
".",
"equalsIgnoreCase",
"(",
"NUCLEIC_ACID_FEATURE",
")",
")",
"{",
"setBounds",
"(",
"NUCLEIC_ACID_FEATURE_BOUND",
".",
"getWidth",
"(",
")",
",",
"NUCLEIC_ACID_FEATURE_BOUND",
".",
"getHeight",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"glyphClass",
".",
"equalsIgnoreCase",
"(",
"STATE_VARIABLE",
")",
")",
"{",
"setBounds",
"(",
"STATE_BOUND",
".",
"getWidth",
"(",
")",
",",
"STATE_BOUND",
".",
"getHeight",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"glyphClass",
".",
"equalsIgnoreCase",
"(",
"UNIT_OF_INFORMATION",
")",
")",
"{",
"setBounds",
"(",
"INFO_BOUND",
".",
"getWidth",
"(",
")",
",",
"INFO_BOUND",
".",
"getHeight",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"glyphClass",
".",
"equalsIgnoreCase",
"(",
"PHENOTYPE",
")",
")",
"{",
"setBounds",
"(",
"PHENOTYPE_BOUND",
".",
"getWidth",
"(",
")",
",",
"PHENOTYPE_BOUND",
".",
"getHeight",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"glyphClass",
".",
"equalsIgnoreCase",
"(",
"PERTURBING_AGENT",
")",
")",
"{",
"setBounds",
"(",
"PERTURBING_AGENT_BOUND",
".",
"getWidth",
"(",
")",
",",
"PERTURBING_AGENT_BOUND",
".",
"getHeight",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"glyphClass",
".",
"equalsIgnoreCase",
"(",
"TAG",
")",
")",
"{",
"setBounds",
"(",
"TAG_BOUND",
".",
"getWidth",
"(",
")",
",",
"TAG_BOUND",
".",
"getHeight",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"glyphClass",
".",
"equalsIgnoreCase",
"(",
"COMPLEX",
")",
")",
"{",
"setBounds",
"(",
"COMPLEX_BOUND",
".",
"getWidth",
"(",
")",
",",
"COMPLEX_BOUND",
".",
"getHeight",
"(",
")",
")",
";",
"}",
"if",
"(",
"this",
".",
"glyph",
".",
"getClone",
"(",
")",
"!=",
"null",
")",
"{",
"Bbox",
"glyphBbox",
"=",
"this",
".",
"glyph",
".",
"getBbox",
"(",
")",
";",
"setBounds",
"(",
"3",
"*",
"glyphBbox",
".",
"getW",
"(",
")",
"/",
"4",
",",
"3",
"*",
"glyphBbox",
".",
"getH",
"(",
")",
"/",
"4",
")",
";",
"}",
"if",
"(",
"glyphClass",
".",
"equalsIgnoreCase",
"(",
"MACROMOLECULE",
")",
"||",
"glyphClass",
".",
"equalsIgnoreCase",
"(",
"NUCLEIC_ACID_FEATURE",
")",
"||",
"glyphClass",
".",
"equalsIgnoreCase",
"(",
"SIMPLE_CHEMICAL",
")",
"||",
"glyphClass",
".",
"equalsIgnoreCase",
"(",
"COMPLEX",
")",
")",
"{",
"updateSizeForStateAndInfo",
"(",
")",
";",
"}",
"}"
] |
Chooses a proper bound for this VNode according to its class.
|
[
"Chooses",
"a",
"proper",
"bound",
"for",
"this",
"VNode",
"according",
"to",
"its",
"class",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/sbgn-converter/src/main/java/org/biopax/paxtools/io/sbgn/VNode.java#L151-L236
|
10,977
|
BioPAX/Paxtools
|
sbgn-converter/src/main/java/org/biopax/paxtools/io/sbgn/VNode.java
|
VNode.calcReqWidthByStateAndInfos
|
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 &&
tmpGlyph.getState().getVariable().length() > 0)
{
if(tmpGlyph.getState().getVariable() != null)
text += "@" + tmpGlyph.getState().getVariable();
}
}
else if (tmpGlyph.getLabel() != null)
{
text = tmpGlyph.getLabel().getText();
}
else
{
throw new RuntimeException("Encountered an information glyph with no state " +
"variable (as modification boxes should have) and no label (as molecule type " +
"boxed should have). glyph = " + tmpGlyph);
}
int numOfUpper = 0;
int numOfLower = 0;
for (int i = 0; i < text.length(); i++)
{
if (Character.isLowerCase(text.charAt(i)))
{
numOfLower++;
} else
numOfUpper++;
}
Bbox b = new Bbox();
tmpGlyph.setBbox(b);
//Set width
float requiredSize = numOfLower * LOWERCASE_LETTER_PIXEL_WIDTH + numOfUpper * UPPERCASE_LETTER_PIXEL_WIDTH;
if (requiredSize < MAX_STATE_AND_INFO_WIDTH)
tmpGlyph.getBbox().setW(requiredSize);
else
tmpGlyph.getBbox().setW(STATE_BOUND.width);
//Set height
tmpGlyph.getBbox().setH(MAX_STATE_AND_INFO_HEIGHT);
if (count < MAX_INFO_BOX_NUMBER / 2)
wholeSize += tmpGlyph.getBbox().getW();
count++;
}
return wholeSize;
}
|
java
|
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 &&
tmpGlyph.getState().getVariable().length() > 0)
{
if(tmpGlyph.getState().getVariable() != null)
text += "@" + tmpGlyph.getState().getVariable();
}
}
else if (tmpGlyph.getLabel() != null)
{
text = tmpGlyph.getLabel().getText();
}
else
{
throw new RuntimeException("Encountered an information glyph with no state " +
"variable (as modification boxes should have) and no label (as molecule type " +
"boxed should have). glyph = " + tmpGlyph);
}
int numOfUpper = 0;
int numOfLower = 0;
for (int i = 0; i < text.length(); i++)
{
if (Character.isLowerCase(text.charAt(i)))
{
numOfLower++;
} else
numOfUpper++;
}
Bbox b = new Bbox();
tmpGlyph.setBbox(b);
//Set width
float requiredSize = numOfLower * LOWERCASE_LETTER_PIXEL_WIDTH + numOfUpper * UPPERCASE_LETTER_PIXEL_WIDTH;
if (requiredSize < MAX_STATE_AND_INFO_WIDTH)
tmpGlyph.getBbox().setW(requiredSize);
else
tmpGlyph.getBbox().setW(STATE_BOUND.width);
//Set height
tmpGlyph.getBbox().setH(MAX_STATE_AND_INFO_HEIGHT);
if (count < MAX_INFO_BOX_NUMBER / 2)
wholeSize += tmpGlyph.getBbox().getW();
count++;
}
return wholeSize;
}
|
[
"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",
"&&",
"tmpGlyph",
".",
"getState",
"(",
")",
".",
"getVariable",
"(",
")",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"if",
"(",
"tmpGlyph",
".",
"getState",
"(",
")",
".",
"getVariable",
"(",
")",
"!=",
"null",
")",
"text",
"+=",
"\"@\"",
"+",
"tmpGlyph",
".",
"getState",
"(",
")",
".",
"getVariable",
"(",
")",
";",
"}",
"}",
"else",
"if",
"(",
"tmpGlyph",
".",
"getLabel",
"(",
")",
"!=",
"null",
")",
"{",
"text",
"=",
"tmpGlyph",
".",
"getLabel",
"(",
")",
".",
"getText",
"(",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"Encountered an information glyph with no state \"",
"+",
"\"variable (as modification boxes should have) and no label (as molecule type \"",
"+",
"\"boxed should have). glyph = \"",
"+",
"tmpGlyph",
")",
";",
"}",
"int",
"numOfUpper",
"=",
"0",
";",
"int",
"numOfLower",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"text",
".",
"length",
"(",
")",
";",
"i",
"++",
")",
"{",
"if",
"(",
"Character",
".",
"isLowerCase",
"(",
"text",
".",
"charAt",
"(",
"i",
")",
")",
")",
"{",
"numOfLower",
"++",
";",
"}",
"else",
"numOfUpper",
"++",
";",
"}",
"Bbox",
"b",
"=",
"new",
"Bbox",
"(",
")",
";",
"tmpGlyph",
".",
"setBbox",
"(",
"b",
")",
";",
"//Set width",
"float",
"requiredSize",
"=",
"numOfLower",
"*",
"LOWERCASE_LETTER_PIXEL_WIDTH",
"+",
"numOfUpper",
"*",
"UPPERCASE_LETTER_PIXEL_WIDTH",
";",
"if",
"(",
"requiredSize",
"<",
"MAX_STATE_AND_INFO_WIDTH",
")",
"tmpGlyph",
".",
"getBbox",
"(",
")",
".",
"setW",
"(",
"requiredSize",
")",
";",
"else",
"tmpGlyph",
".",
"getBbox",
"(",
")",
".",
"setW",
"(",
"STATE_BOUND",
".",
"width",
")",
";",
"//Set height",
"tmpGlyph",
".",
"getBbox",
"(",
")",
".",
"setH",
"(",
"MAX_STATE_AND_INFO_HEIGHT",
")",
";",
"if",
"(",
"count",
"<",
"MAX_INFO_BOX_NUMBER",
"/",
"2",
")",
"wholeSize",
"+=",
"tmpGlyph",
".",
"getBbox",
"(",
")",
".",
"getW",
"(",
")",
";",
"count",
"++",
";",
"}",
"return",
"wholeSize",
";",
"}"
] |
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.
@param stateORinfoList list that keeps state or info glyphs of this VNode
@return new width that is adjusted so that all glyphs in stateORinfoList are included.
|
[
"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",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/sbgn-converter/src/main/java/org/biopax/paxtools/io/sbgn/VNode.java#L246-L311
|
10,978
|
BioPAX/Paxtools
|
sbgn-converter/src/main/java/org/biopax/paxtools/io/sbgn/VNode.java
|
VNode.updateSizeForStateAndInfo
|
public void updateSizeForStateAndInfo()
{
// Find all state and info glyphs
for (Glyph glyph : this.glyph.getGlyph())
{
if (glyph.getClazz() == STATE_VARIABLE)
{
stateGlyphs.add(glyph);
}
else if (glyph.getClazz() == UNIT_OF_INFORMATION)
{
infoGlyphs.add(glyph);
}
}
//Calculate "state of information" glyphs' sizes
int wholeWidthOfStates = calcReqWidthByStateAndInfos(stateGlyphs);
int wholeWidthOfInfos = calcReqWidthByStateAndInfos(infoGlyphs);
// Calculate positions
int numOfStates = stateGlyphs.size();
int numOfInfos = infoGlyphs.size();
//set a maximum width to glyph according to state and info boxes
int totNumStateInfo = numOfInfos + numOfStates;
int multiplier = totNumStateInfo <= 2 ? 2 : 3;
float requiredWidth = multiplier * OFFSET_BTW_INFO_GLYPHS + (multiplier-1) * MAX_STATE_AND_INFO_WIDTH;
//Adjust heights so that info box offsets are taken into account in layout.
if(totNumStateInfo > 0 )
this.glyph.getBbox().setH(this.glyph.getBbox().getH()+MAX_STATE_AND_INFO_HEIGHT/2);
if (this.glyph.getBbox().getW() < requiredWidth )
{
this.glyph.getBbox().setW(requiredWidth);
}
}
|
java
|
public void updateSizeForStateAndInfo()
{
// Find all state and info glyphs
for (Glyph glyph : this.glyph.getGlyph())
{
if (glyph.getClazz() == STATE_VARIABLE)
{
stateGlyphs.add(glyph);
}
else if (glyph.getClazz() == UNIT_OF_INFORMATION)
{
infoGlyphs.add(glyph);
}
}
//Calculate "state of information" glyphs' sizes
int wholeWidthOfStates = calcReqWidthByStateAndInfos(stateGlyphs);
int wholeWidthOfInfos = calcReqWidthByStateAndInfos(infoGlyphs);
// Calculate positions
int numOfStates = stateGlyphs.size();
int numOfInfos = infoGlyphs.size();
//set a maximum width to glyph according to state and info boxes
int totNumStateInfo = numOfInfos + numOfStates;
int multiplier = totNumStateInfo <= 2 ? 2 : 3;
float requiredWidth = multiplier * OFFSET_BTW_INFO_GLYPHS + (multiplier-1) * MAX_STATE_AND_INFO_WIDTH;
//Adjust heights so that info box offsets are taken into account in layout.
if(totNumStateInfo > 0 )
this.glyph.getBbox().setH(this.glyph.getBbox().getH()+MAX_STATE_AND_INFO_HEIGHT/2);
if (this.glyph.getBbox().getW() < requiredWidth )
{
this.glyph.getBbox().setW(requiredWidth);
}
}
|
[
"public",
"void",
"updateSizeForStateAndInfo",
"(",
")",
"{",
"// Find all state and info glyphs",
"for",
"(",
"Glyph",
"glyph",
":",
"this",
".",
"glyph",
".",
"getGlyph",
"(",
")",
")",
"{",
"if",
"(",
"glyph",
".",
"getClazz",
"(",
")",
"==",
"STATE_VARIABLE",
")",
"{",
"stateGlyphs",
".",
"add",
"(",
"glyph",
")",
";",
"}",
"else",
"if",
"(",
"glyph",
".",
"getClazz",
"(",
")",
"==",
"UNIT_OF_INFORMATION",
")",
"{",
"infoGlyphs",
".",
"add",
"(",
"glyph",
")",
";",
"}",
"}",
"//Calculate \"state of information\" glyphs' sizes",
"int",
"wholeWidthOfStates",
"=",
"calcReqWidthByStateAndInfos",
"(",
"stateGlyphs",
")",
";",
"int",
"wholeWidthOfInfos",
"=",
"calcReqWidthByStateAndInfos",
"(",
"infoGlyphs",
")",
";",
"// Calculate positions",
"int",
"numOfStates",
"=",
"stateGlyphs",
".",
"size",
"(",
")",
";",
"int",
"numOfInfos",
"=",
"infoGlyphs",
".",
"size",
"(",
")",
";",
"//set a maximum width to glyph according to state and info boxes",
"int",
"totNumStateInfo",
"=",
"numOfInfos",
"+",
"numOfStates",
";",
"int",
"multiplier",
"=",
"totNumStateInfo",
"<=",
"2",
"?",
"2",
":",
"3",
";",
"float",
"requiredWidth",
"=",
"multiplier",
"*",
"OFFSET_BTW_INFO_GLYPHS",
"+",
"(",
"multiplier",
"-",
"1",
")",
"*",
"MAX_STATE_AND_INFO_WIDTH",
";",
"//Adjust heights so that info box offsets are taken into account in layout.",
"if",
"(",
"totNumStateInfo",
">",
"0",
")",
"this",
".",
"glyph",
".",
"getBbox",
"(",
")",
".",
"setH",
"(",
"this",
".",
"glyph",
".",
"getBbox",
"(",
")",
".",
"getH",
"(",
")",
"+",
"MAX_STATE_AND_INFO_HEIGHT",
"/",
"2",
")",
";",
"if",
"(",
"this",
".",
"glyph",
".",
"getBbox",
"(",
")",
".",
"getW",
"(",
")",
"<",
"requiredWidth",
")",
"{",
"this",
".",
"glyph",
".",
"getBbox",
"(",
")",
".",
"setW",
"(",
"requiredWidth",
")",
";",
"}",
"}"
] |
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.
|
[
"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",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/sbgn-converter/src/main/java/org/biopax/paxtools/io/sbgn/VNode.java#L317-L355
|
10,979
|
BioPAX/Paxtools
|
paxtools-query/src/main/java/org/biopax/paxtools/query/algorithm/NeighborhoodQuery.java
|
NeighborhoodQuery.run
|
public Set<GraphObject> run()
{
// result set of neighborhood query
Set<GraphObject> queryResult = new HashSet<GraphObject>();
// if upstream is selected
if (direction == Direction.UPSTREAM || direction == Direction.BOTHSTREAM)
{
// run BFS in upstream direction
BFS bfsBackward = new BFS(sourceNodes, null, Direction.UPSTREAM, this.limit);
/*
Maps to hold forward and backward BFS results
*/
Map<GraphObject, Integer> mapBackward = bfsBackward.run();
// add result of BFS to result Set
queryResult.addAll(mapBackward.keySet());
}
// if downstream is selected
if (direction == Direction.DOWNSTREAM || direction == Direction.BOTHSTREAM)
{
// run BFS in downstream direction
BFS bfsForward = new BFS(sourceNodes, null, Direction.DOWNSTREAM, this.limit);
Map<GraphObject, Integer> mapForward = bfsForward.run();
// add result of BFS to result Set
queryResult.addAll(mapForward.keySet());
}
// return the result of query
return queryResult;
}
|
java
|
public Set<GraphObject> run()
{
// result set of neighborhood query
Set<GraphObject> queryResult = new HashSet<GraphObject>();
// if upstream is selected
if (direction == Direction.UPSTREAM || direction == Direction.BOTHSTREAM)
{
// run BFS in upstream direction
BFS bfsBackward = new BFS(sourceNodes, null, Direction.UPSTREAM, this.limit);
/*
Maps to hold forward and backward BFS results
*/
Map<GraphObject, Integer> mapBackward = bfsBackward.run();
// add result of BFS to result Set
queryResult.addAll(mapBackward.keySet());
}
// if downstream is selected
if (direction == Direction.DOWNSTREAM || direction == Direction.BOTHSTREAM)
{
// run BFS in downstream direction
BFS bfsForward = new BFS(sourceNodes, null, Direction.DOWNSTREAM, this.limit);
Map<GraphObject, Integer> mapForward = bfsForward.run();
// add result of BFS to result Set
queryResult.addAll(mapForward.keySet());
}
// return the result of query
return queryResult;
}
|
[
"public",
"Set",
"<",
"GraphObject",
">",
"run",
"(",
")",
"{",
"// result set of neighborhood query\r",
"Set",
"<",
"GraphObject",
">",
"queryResult",
"=",
"new",
"HashSet",
"<",
"GraphObject",
">",
"(",
")",
";",
"// if upstream is selected\r",
"if",
"(",
"direction",
"==",
"Direction",
".",
"UPSTREAM",
"||",
"direction",
"==",
"Direction",
".",
"BOTHSTREAM",
")",
"{",
"// run BFS in upstream direction\r",
"BFS",
"bfsBackward",
"=",
"new",
"BFS",
"(",
"sourceNodes",
",",
"null",
",",
"Direction",
".",
"UPSTREAM",
",",
"this",
".",
"limit",
")",
";",
"/*\r\n\t Maps to hold forward and backward BFS results\r\n\t */",
"Map",
"<",
"GraphObject",
",",
"Integer",
">",
"mapBackward",
"=",
"bfsBackward",
".",
"run",
"(",
")",
";",
"// add result of BFS to result Set\r",
"queryResult",
".",
"addAll",
"(",
"mapBackward",
".",
"keySet",
"(",
")",
")",
";",
"}",
"// if downstream is selected\r",
"if",
"(",
"direction",
"==",
"Direction",
".",
"DOWNSTREAM",
"||",
"direction",
"==",
"Direction",
".",
"BOTHSTREAM",
")",
"{",
"// run BFS in downstream direction\r",
"BFS",
"bfsForward",
"=",
"new",
"BFS",
"(",
"sourceNodes",
",",
"null",
",",
"Direction",
".",
"DOWNSTREAM",
",",
"this",
".",
"limit",
")",
";",
"Map",
"<",
"GraphObject",
",",
"Integer",
">",
"mapForward",
"=",
"bfsForward",
".",
"run",
"(",
")",
";",
"// add result of BFS to result Set\r",
"queryResult",
".",
"addAll",
"(",
"mapForward",
".",
"keySet",
"(",
")",
")",
";",
"}",
"// return the result of query\r",
"return",
"queryResult",
";",
"}"
] |
Executes the query.
@return Neighborhood
|
[
"Executes",
"the",
"query",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/paxtools-query/src/main/java/org/biopax/paxtools/query/algorithm/NeighborhoodQuery.java#L53-L87
|
10,980
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/Pattern.java
|
Pattern.add
|
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));
if (constr.canGenerate() && ind[ind.length - 1] > lastIndex)
{
if (ind[ind.length - 1] - lastIndex > 1) throw new IllegalArgumentException(
"Generated index too large. Attempting to generate index " + ind[ind.length - 1] +
" while last index is " + lastIndex);
else lastIndex++;
}
}
|
java
|
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));
if (constr.canGenerate() && ind[ind.length - 1] > lastIndex)
{
if (ind[ind.length - 1] - lastIndex > 1) throw new IllegalArgumentException(
"Generated index too large. Attempting to generate index " + ind[ind.length - 1] +
" while last index is " + lastIndex);
else lastIndex++;
}
}
|
[
"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",
")",
")",
";",
"if",
"(",
"constr",
".",
"canGenerate",
"(",
")",
"&&",
"ind",
"[",
"ind",
".",
"length",
"-",
"1",
"]",
">",
"lastIndex",
")",
"{",
"if",
"(",
"ind",
"[",
"ind",
".",
"length",
"-",
"1",
"]",
"-",
"lastIndex",
">",
"1",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Generated index too large. Attempting to generate index \"",
"+",
"ind",
"[",
"ind",
".",
"length",
"-",
"1",
"]",
"+",
"\" while last index is \"",
"+",
"lastIndex",
")",
";",
"else",
"lastIndex",
"++",
";",
"}",
"}"
] |
Creates a mapped constraint with the given constraint and the indexes it applies.
@param constr constraint to add
@param ind indices to map the constraint to the element in the pattern
|
[
"Creates",
"a",
"mapped",
"constraint",
"with",
"the",
"given",
"constraint",
"and",
"the",
"indexes",
"it",
"applies",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/Pattern.java#L76-L96
|
10,981
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/Pattern.java
|
Pattern.removeLastConstraint
|
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();
}
}
|
java
|
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();
}
}
|
[
"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.
|
[
"Removes",
"the",
"last",
"constraint",
"added",
"to",
"the",
"pattern",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/Pattern.java#L101-L111
|
10,982
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/Pattern.java
|
Pattern.setLastIndexToMaxFound
|
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;
}
|
java
|
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;
}
|
[
"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.
|
[
"This",
"method",
"is",
"used",
"after",
"removal",
"of",
"an",
"generative",
"constraint",
".",
"Searching",
"the",
"remaining",
"constraints",
"we",
"decide",
"the",
"value",
"of",
"lastIndex",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/Pattern.java#L117-L127
|
10,983
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/Pattern.java
|
Pattern.add
|
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.");
}
// This will also increment lastIndex if necessary
add(constr, ind);
if (!hasLabel(label[label.length - 1]) && constr.canGenerate())
{
label(label[label.length - 1], lastIndex);
}
}
|
java
|
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.");
}
// This will also increment lastIndex if necessary
add(constr, ind);
if (!hasLabel(label[label.length - 1]) && constr.canGenerate())
{
label(label[label.length - 1], lastIndex);
}
}
|
[
"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.\"",
")",
";",
"}",
"// This will also increment lastIndex if necessary",
"add",
"(",
"constr",
",",
"ind",
")",
";",
"if",
"(",
"!",
"hasLabel",
"(",
"label",
"[",
"label",
".",
"length",
"-",
"1",
"]",
")",
"&&",
"constr",
".",
"canGenerate",
"(",
")",
")",
"{",
"label",
"(",
"label",
"[",
"label",
".",
"length",
"-",
"1",
"]",
",",
"lastIndex",
")",
";",
"}",
"}"
] |
Creates a mapped constraint with the given generative constraint and the indexes it applies.
Also labels the last given index.
@param constr constraint to add
@param label a label for the last of the given indices
|
[
"Creates",
"a",
"mapped",
"constraint",
"with",
"the",
"given",
"generative",
"constraint",
"and",
"the",
"indexes",
"it",
"applies",
".",
"Also",
"labels",
"the",
"last",
"given",
"index",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/Pattern.java#L200-L218
|
10,984
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/Pattern.java
|
Pattern.convertLabelsToInds
|
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;
}
|
java
|
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;
}
|
[
"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.
@param label labels
@return indexes for labels
|
[
"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",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/Pattern.java#L226-L238
|
10,985
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/Pattern.java
|
Pattern.convertIndsToLabels
|
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]);
}
return label;
}
|
java
|
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]);
}
return label;
}
|
[
"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",
"]",
")",
";",
"}",
"return",
"label",
";",
"}"
] |
Converts the indices to the labels. All indices must have an existing label.
@param ind indices
@return labels for indices
|
[
"Converts",
"the",
"indices",
"to",
"the",
"labels",
".",
"All",
"indices",
"must",
"have",
"an",
"existing",
"label",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/Pattern.java#L245-L256
|
10,986
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/Pattern.java
|
Pattern.add
|
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.convertIndsToLabels(mc.getInds()));
}
}
|
java
|
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.convertIndsToLabels(mc.getInds()));
}
}
|
[
"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",
".",
"convertIndsToLabels",
"(",
"mc",
".",
"getInds",
"(",
")",
")",
")",
";",
"}",
"}"
] |
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 new variables. Labels in the parameter pattern is
transferred to this pattern. If there are equivalent labels, then these slots are mapped.
@param p the parameter pattern
|
[
"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",
"new",
"variables",
".",
"Labels",
"in",
"the",
"parameter",
"pattern",
"is",
"transferred",
"to",
"this",
"pattern",
".",
"If",
"there",
"are",
"equivalent",
"labels",
"then",
"these",
"slots",
"are",
"mapped",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/Pattern.java#L282-L291
|
10,987
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/Pattern.java
|
Pattern.getLabel
|
private String getLabel(int i)
{
for (String label : labelMap.keySet())
{
if (labelMap.get(label) == i) return label;
}
return null;
}
|
java
|
private String getLabel(int i)
{
for (String label : labelMap.keySet())
{
if (labelMap.get(label) == i) return label;
}
return null;
}
|
[
"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.
@param i index
@return label for the element at the specified index
|
[
"Gets",
"the",
"label",
"for",
"the",
"element",
"at",
"the",
"specified",
"index",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/Pattern.java#L298-L305
|
10,988
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/Pattern.java
|
Pattern.insertPointConstraint
|
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 MappedConst(con, i));
break;
}
}
}
}
|
java
|
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 MappedConst(con, i));
break;
}
}
}
}
|
[
"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",
"MappedConst",
"(",
"con",
",",
"i",
")",
")",
";",
"break",
";",
"}",
"}",
"}",
"}"
] |
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.
@param con constraint to add
@param ind indices to add this point constraint
|
[
"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",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/Pattern.java#L315-L331
|
10,989
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/Pattern.java
|
Pattern.label
|
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.");
labelMap.put(labelText, index);
}
|
java
|
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.");
labelMap.put(labelText, index);
}
|
[
"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.\"",
")",
";",
"labelMap",
".",
"put",
"(",
"labelText",
",",
"index",
")",
";",
"}"
] |
Puts the given label for the given index.
@param labelText the label
@param index index to label
|
[
"Puts",
"the",
"given",
"label",
"for",
"the",
"given",
"index",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/Pattern.java#L365-L374
|
10,990
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/Pattern.java
|
Pattern.indexOf
|
public int indexOf(String labelText)
{
if (!labelMap.containsKey(labelText))
throw new IllegalArgumentException("The label \"" + labelText +
"\" is absent in pattern.");
return labelMap.get(labelText);
}
|
java
|
public int indexOf(String labelText)
{
if (!labelMap.containsKey(labelText))
throw new IllegalArgumentException("The label \"" + labelText +
"\" is absent in pattern.");
return labelMap.get(labelText);
}
|
[
"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.
@param labelText label to check
@return index of the label
|
[
"Gets",
"the",
"index",
"of",
"the",
"given",
"label",
".",
"The",
"label",
"must",
"exist",
"otherwise",
"a",
"runtime",
"exception",
"is",
"thrown",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/Pattern.java#L402-L409
|
10,991
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/Pattern.java
|
Pattern.updateLabel
|
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);
}
|
java
|
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);
}
|
[
"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.
@param oldLabel label to update
@param newLabel updated label
|
[
"Changes",
"a",
"label",
".",
"The",
"oldLabel",
"has",
"to",
"be",
"an",
"existing",
"label",
"and",
"new",
"label",
"has",
"to",
"be",
"a",
"new",
"label",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/Pattern.java#L417-L425
|
10,992
|
BioPAX/Paxtools
|
paxtools-console/src/main/java/org/biopax/paxtools/examples/GOUnificationXREFtoRelationshipXREFConverter.java
|
GOUnificationXREFtoRelationshipXREFConverter.main
|
public static void main(String[] args)
throws IllegalAccessException, InvocationTargetException
{
// Process all the args
for (String arg : args)
{
log.info(arg);
if (arg.toLowerCase().endsWith("owl"))
{
try
{
processXrefs(arg);
}
catch (FileNotFoundException e)
{
e.printStackTrace();
}
}
}
}
|
java
|
public static void main(String[] args)
throws IllegalAccessException, InvocationTargetException
{
// Process all the args
for (String arg : args)
{
log.info(arg);
if (arg.toLowerCase().endsWith("owl"))
{
try
{
processXrefs(arg);
}
catch (FileNotFoundException e)
{
e.printStackTrace();
}
}
}
}
|
[
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"throws",
"IllegalAccessException",
",",
"InvocationTargetException",
"{",
"// Process all the args",
"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
|
[
"args",
"-",
"a",
"space",
"seperated",
"list",
"of",
"owl",
"files",
"to",
"be",
"processed"
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/paxtools-console/src/main/java/org/biopax/paxtools/examples/GOUnificationXREFtoRelationshipXREFConverter.java#L35-L55
|
10,993
|
BioPAX/Paxtools
|
paxtools-console/src/main/java/org/biopax/paxtools/examples/GOUnificationXREFtoRelationshipXREFConverter.java
|
GOUnificationXREFtoRelationshipXREFConverter.processXrefs
|
private static void processXrefs(String arg) throws
FileNotFoundException,
IllegalAccessException,
InvocationTargetException
{
//Read in the model
FileInputStream in =
new FileInputStream(new File(arg));
Model level2 =
reader.convertFromOWL(in);
//Get all unification xrefs.
Set<unificationXref> unis =
level2.getObjects(unificationXref.class);
//Create another set for avoiding concurrent modifications
Set<unificationXref> gos = new HashSet<unificationXref>();
//Process all uni. refs
for (unificationXref uni : unis)
{
log.trace(uni.getDB());
//Assuming DB is represented as "GO"
if (uni.getDB().equalsIgnoreCase("GO"))
{
//this it to avoid concurrent modification.
log.info("scheduling " + uni.getUri());
gos.add(uni);
}
}
//Now we have a list of xrefs to be converted. Let's do it.
for (unificationXref go : gos)
{
convert(go, level2);
}
//And finally write out the file. We are done !
reader.convertToOWL(level2, new FileOutputStream(
arg.substring(0, arg.lastIndexOf('.')) +
"-converted.owl"));
}
|
java
|
private static void processXrefs(String arg) throws
FileNotFoundException,
IllegalAccessException,
InvocationTargetException
{
//Read in the model
FileInputStream in =
new FileInputStream(new File(arg));
Model level2 =
reader.convertFromOWL(in);
//Get all unification xrefs.
Set<unificationXref> unis =
level2.getObjects(unificationXref.class);
//Create another set for avoiding concurrent modifications
Set<unificationXref> gos = new HashSet<unificationXref>();
//Process all uni. refs
for (unificationXref uni : unis)
{
log.trace(uni.getDB());
//Assuming DB is represented as "GO"
if (uni.getDB().equalsIgnoreCase("GO"))
{
//this it to avoid concurrent modification.
log.info("scheduling " + uni.getUri());
gos.add(uni);
}
}
//Now we have a list of xrefs to be converted. Let's do it.
for (unificationXref go : gos)
{
convert(go, level2);
}
//And finally write out the file. We are done !
reader.convertToOWL(level2, new FileOutputStream(
arg.substring(0, arg.lastIndexOf('.')) +
"-converted.owl"));
}
|
[
"private",
"static",
"void",
"processXrefs",
"(",
"String",
"arg",
")",
"throws",
"FileNotFoundException",
",",
"IllegalAccessException",
",",
"InvocationTargetException",
"{",
"//Read in the model",
"FileInputStream",
"in",
"=",
"new",
"FileInputStream",
"(",
"new",
"File",
"(",
"arg",
")",
")",
";",
"Model",
"level2",
"=",
"reader",
".",
"convertFromOWL",
"(",
"in",
")",
";",
"//Get all unification xrefs.",
"Set",
"<",
"unificationXref",
">",
"unis",
"=",
"level2",
".",
"getObjects",
"(",
"unificationXref",
".",
"class",
")",
";",
"//Create another set for avoiding concurrent modifications",
"Set",
"<",
"unificationXref",
">",
"gos",
"=",
"new",
"HashSet",
"<",
"unificationXref",
">",
"(",
")",
";",
"//Process all uni. refs",
"for",
"(",
"unificationXref",
"uni",
":",
"unis",
")",
"{",
"log",
".",
"trace",
"(",
"uni",
".",
"getDB",
"(",
")",
")",
";",
"//Assuming DB is represented as \"GO\"",
"if",
"(",
"uni",
".",
"getDB",
"(",
")",
".",
"equalsIgnoreCase",
"(",
"\"GO\"",
")",
")",
"{",
"//this it to avoid concurrent modification.",
"log",
".",
"info",
"(",
"\"scheduling \"",
"+",
"uni",
".",
"getUri",
"(",
")",
")",
";",
"gos",
".",
"add",
"(",
"uni",
")",
";",
"}",
"}",
"//Now we have a list of xrefs to be converted. Let's do it.",
"for",
"(",
"unificationXref",
"go",
":",
"gos",
")",
"{",
"convert",
"(",
"go",
",",
"level2",
")",
";",
"}",
"//And finally write out the file. We are done !",
"reader",
".",
"convertToOWL",
"(",
"level2",
",",
"new",
"FileOutputStream",
"(",
"arg",
".",
"substring",
"(",
"0",
",",
"arg",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
")",
"+",
"\"-converted.owl\"",
")",
")",
";",
"}"
] |
Main conversion method. Demonstrates how to read and write a BioPAX
model and accessing its objects.
@param arg file name to be processed
|
[
"Main",
"conversion",
"method",
".",
"Demonstrates",
"how",
"to",
"read",
"and",
"write",
"a",
"BioPAX",
"model",
"and",
"accessing",
"its",
"objects",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/paxtools-console/src/main/java/org/biopax/paxtools/examples/GOUnificationXREFtoRelationshipXREFConverter.java#L62-L101
|
10,994
|
BioPAX/Paxtools
|
paxtools-console/src/main/java/org/biopax/paxtools/examples/GOUnificationXREFtoRelationshipXREFConverter.java
|
GOUnificationXREFtoRelationshipXREFConverter.convert
|
private static void convert(unificationXref uni, Model level2)
{
//We can not simply convert a class, so we need to remove the
//uni and insert a new relationship xref
//First get all the objects that refers to this uni
Set<XReferrable> referrables =
new HashSet<XReferrable>(uni.isXREFof());
//Create the new relationship xref in the model.
relationshipXref relationshipXref =
level2.addNew(relationshipXref.class, uni.getUri());
//Copy the fields from uni
relationshipXref.setCOMMENT(uni.getCOMMENT());
relationshipXref.setDB(uni.getDB());
relationshipXref.setDB_VERSION(uni.getDB_VERSION());
relationshipXref.setID(uni.getID());
relationshipXref.setID_VERSION(uni.getID_VERSION());
relationshipXref.setRELATIONSHIP_TYPE(
"http://www.biopax.org/paxtools/convertedGOUnificationXREF");
//Create a link to the new xref from all the owners.
for (XReferrable referrable : referrables)
{
referrable.addXREF(relationshipXref);
}
//Remove the references to the old uni
for (XReferrable referrable : referrables)
{
referrable.removeXREF(uni);
}
//Now remove it from the model.
level2.remove(uni);
//We are done!
}
|
java
|
private static void convert(unificationXref uni, Model level2)
{
//We can not simply convert a class, so we need to remove the
//uni and insert a new relationship xref
//First get all the objects that refers to this uni
Set<XReferrable> referrables =
new HashSet<XReferrable>(uni.isXREFof());
//Create the new relationship xref in the model.
relationshipXref relationshipXref =
level2.addNew(relationshipXref.class, uni.getUri());
//Copy the fields from uni
relationshipXref.setCOMMENT(uni.getCOMMENT());
relationshipXref.setDB(uni.getDB());
relationshipXref.setDB_VERSION(uni.getDB_VERSION());
relationshipXref.setID(uni.getID());
relationshipXref.setID_VERSION(uni.getID_VERSION());
relationshipXref.setRELATIONSHIP_TYPE(
"http://www.biopax.org/paxtools/convertedGOUnificationXREF");
//Create a link to the new xref from all the owners.
for (XReferrable referrable : referrables)
{
referrable.addXREF(relationshipXref);
}
//Remove the references to the old uni
for (XReferrable referrable : referrables)
{
referrable.removeXREF(uni);
}
//Now remove it from the model.
level2.remove(uni);
//We are done!
}
|
[
"private",
"static",
"void",
"convert",
"(",
"unificationXref",
"uni",
",",
"Model",
"level2",
")",
"{",
"//We can not simply convert a class, so we need to remove the",
"//uni and insert a new relationship xref",
"//First get all the objects that refers to this uni",
"Set",
"<",
"XReferrable",
">",
"referrables",
"=",
"new",
"HashSet",
"<",
"XReferrable",
">",
"(",
"uni",
".",
"isXREFof",
"(",
")",
")",
";",
"//Create the new relationship xref in the model.",
"relationshipXref",
"relationshipXref",
"=",
"level2",
".",
"addNew",
"(",
"relationshipXref",
".",
"class",
",",
"uni",
".",
"getUri",
"(",
")",
")",
";",
"//Copy the fields from uni",
"relationshipXref",
".",
"setCOMMENT",
"(",
"uni",
".",
"getCOMMENT",
"(",
")",
")",
";",
"relationshipXref",
".",
"setDB",
"(",
"uni",
".",
"getDB",
"(",
")",
")",
";",
"relationshipXref",
".",
"setDB_VERSION",
"(",
"uni",
".",
"getDB_VERSION",
"(",
")",
")",
";",
"relationshipXref",
".",
"setID",
"(",
"uni",
".",
"getID",
"(",
")",
")",
";",
"relationshipXref",
".",
"setID_VERSION",
"(",
"uni",
".",
"getID_VERSION",
"(",
")",
")",
";",
"relationshipXref",
".",
"setRELATIONSHIP_TYPE",
"(",
"\"http://www.biopax.org/paxtools/convertedGOUnificationXREF\"",
")",
";",
"//Create a link to the new xref from all the owners.",
"for",
"(",
"XReferrable",
"referrable",
":",
"referrables",
")",
"{",
"referrable",
".",
"addXREF",
"(",
"relationshipXref",
")",
";",
"}",
"//Remove the references to the old uni",
"for",
"(",
"XReferrable",
"referrable",
":",
"referrables",
")",
"{",
"referrable",
".",
"removeXREF",
"(",
"uni",
")",
";",
"}",
"//Now remove it from the model.",
"level2",
".",
"remove",
"(",
"uni",
")",
";",
"//We are done!",
"}"
] |
This method converts the given unification xref to a relationship xref
@param uni xref to be converted
@param level2 model containing the xref
|
[
"This",
"method",
"converts",
"the",
"given",
"unification",
"xref",
"to",
"a",
"relationship",
"xref"
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/paxtools-console/src/main/java/org/biopax/paxtools/examples/GOUnificationXREFtoRelationshipXREFConverter.java#L108-L145
|
10,995
|
BioPAX/Paxtools
|
sbgn-converter/src/main/java/org/biopax/paxtools/io/sbgn/SBGNLayoutManager.java
|
SBGNLayoutManager.connectArcToPort
|
private void connectArcToPort(SbgnPDNode lPort, Port vPort)
{
//Iterate over the edges of l level port
for (Object e: (lPort.getEdges()))
{
//Ignore rigid edges
if(((LEdge)e).type.equals("rigid edge"))
continue;
//Determine the if vPort is source or target
Arc arc = idToArcs.get(((LEdge)e).label);
if( lPort.label.equals(((LEdge)e).getSource().label ))
{
arc.setSource(vPort);
}
else if ( lPort.label.equals(((LEdge)e).getTarget().label ) )
{
arc.setTarget(vPort);
}
}
}
|
java
|
private void connectArcToPort(SbgnPDNode lPort, Port vPort)
{
//Iterate over the edges of l level port
for (Object e: (lPort.getEdges()))
{
//Ignore rigid edges
if(((LEdge)e).type.equals("rigid edge"))
continue;
//Determine the if vPort is source or target
Arc arc = idToArcs.get(((LEdge)e).label);
if( lPort.label.equals(((LEdge)e).getSource().label ))
{
arc.setSource(vPort);
}
else if ( lPort.label.equals(((LEdge)e).getTarget().label ) )
{
arc.setTarget(vPort);
}
}
}
|
[
"private",
"void",
"connectArcToPort",
"(",
"SbgnPDNode",
"lPort",
",",
"Port",
"vPort",
")",
"{",
"//Iterate over the edges of l level port",
"for",
"(",
"Object",
"e",
":",
"(",
"lPort",
".",
"getEdges",
"(",
")",
")",
")",
"{",
"//Ignore rigid edges",
"if",
"(",
"(",
"(",
"LEdge",
")",
"e",
")",
".",
"type",
".",
"equals",
"(",
"\"rigid edge\"",
")",
")",
"continue",
";",
"//Determine the if vPort is source or target",
"Arc",
"arc",
"=",
"idToArcs",
".",
"get",
"(",
"(",
"(",
"LEdge",
")",
"e",
")",
".",
"label",
")",
";",
"if",
"(",
"lPort",
".",
"label",
".",
"equals",
"(",
"(",
"(",
"LEdge",
")",
"e",
")",
".",
"getSource",
"(",
")",
".",
"label",
")",
")",
"{",
"arc",
".",
"setSource",
"(",
"vPort",
")",
";",
"}",
"else",
"if",
"(",
"lPort",
".",
"label",
".",
"equals",
"(",
"(",
"(",
"LEdge",
")",
"e",
")",
".",
"getTarget",
"(",
")",
".",
"label",
")",
")",
"{",
"arc",
".",
"setTarget",
"(",
"vPort",
")",
";",
"}",
"}",
"}"
] |
This method connects the existing arcs to the newly created
ports which are created by ChiLay and SBGNPD Layout.
@param lPort l level port object.
@param vPort v level port object.
|
[
"This",
"method",
"connects",
"the",
"existing",
"arcs",
"to",
"the",
"newly",
"created",
"ports",
"which",
"are",
"created",
"by",
"ChiLay",
"and",
"SBGNPD",
"Layout",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/sbgn-converter/src/main/java/org/biopax/paxtools/io/sbgn/SBGNLayoutManager.java#L185-L205
|
10,996
|
BioPAX/Paxtools
|
sbgn-converter/src/main/java/org/biopax/paxtools/io/sbgn/SBGNLayoutManager.java
|
SBGNLayoutManager.populateCompartmentOccurencesMap
|
private void populateCompartmentOccurencesMap(Glyph targetGlyph, HashMap<String, Integer> compartmentIDandOccurenceMap)
{
String rootID = "root";
// if compartment ref of targetGlyph node is not null, increment its occurence by 1
if(targetGlyph.getCompartmentRef() != null)
{
Glyph containerCompartment = (Glyph)targetGlyph.getCompartmentRef();
String compartmentID = containerCompartment.getId();
Integer compartmentOccurrenceValue = compartmentIDandOccurenceMap.get(compartmentID);
if( compartmentOccurrenceValue != null)
{
compartmentIDandOccurenceMap.put(compartmentID, compartmentOccurrenceValue + 1);
}
else
compartmentIDandOccurenceMap.put(compartmentID, 1);
}
// else targetGlyph is in root graph so increment root graphs counter value by 1
else
{
Integer compartmentOccurrenceValue = compartmentIDandOccurenceMap.get(rootID);
if( compartmentOccurrenceValue != null)
{
compartmentIDandOccurenceMap.put(rootID, compartmentOccurrenceValue + 1);
}
else
compartmentIDandOccurenceMap.put(rootID, 1);
}
}
|
java
|
private void populateCompartmentOccurencesMap(Glyph targetGlyph, HashMap<String, Integer> compartmentIDandOccurenceMap)
{
String rootID = "root";
// if compartment ref of targetGlyph node is not null, increment its occurence by 1
if(targetGlyph.getCompartmentRef() != null)
{
Glyph containerCompartment = (Glyph)targetGlyph.getCompartmentRef();
String compartmentID = containerCompartment.getId();
Integer compartmentOccurrenceValue = compartmentIDandOccurenceMap.get(compartmentID);
if( compartmentOccurrenceValue != null)
{
compartmentIDandOccurenceMap.put(compartmentID, compartmentOccurrenceValue + 1);
}
else
compartmentIDandOccurenceMap.put(compartmentID, 1);
}
// else targetGlyph is in root graph so increment root graphs counter value by 1
else
{
Integer compartmentOccurrenceValue = compartmentIDandOccurenceMap.get(rootID);
if( compartmentOccurrenceValue != null)
{
compartmentIDandOccurenceMap.put(rootID, compartmentOccurrenceValue + 1);
}
else
compartmentIDandOccurenceMap.put(rootID, 1);
}
}
|
[
"private",
"void",
"populateCompartmentOccurencesMap",
"(",
"Glyph",
"targetGlyph",
",",
"HashMap",
"<",
"String",
",",
"Integer",
">",
"compartmentIDandOccurenceMap",
")",
"{",
"String",
"rootID",
"=",
"\"root\"",
";",
"// if compartment ref of targetGlyph node is not null, increment its occurence by 1",
"if",
"(",
"targetGlyph",
".",
"getCompartmentRef",
"(",
")",
"!=",
"null",
")",
"{",
"Glyph",
"containerCompartment",
"=",
"(",
"Glyph",
")",
"targetGlyph",
".",
"getCompartmentRef",
"(",
")",
";",
"String",
"compartmentID",
"=",
"containerCompartment",
".",
"getId",
"(",
")",
";",
"Integer",
"compartmentOccurrenceValue",
"=",
"compartmentIDandOccurenceMap",
".",
"get",
"(",
"compartmentID",
")",
";",
"if",
"(",
"compartmentOccurrenceValue",
"!=",
"null",
")",
"{",
"compartmentIDandOccurenceMap",
".",
"put",
"(",
"compartmentID",
",",
"compartmentOccurrenceValue",
"+",
"1",
")",
";",
"}",
"else",
"compartmentIDandOccurenceMap",
".",
"put",
"(",
"compartmentID",
",",
"1",
")",
";",
"}",
"// else targetGlyph is in root graph so increment root graphs counter value by 1",
"else",
"{",
"Integer",
"compartmentOccurrenceValue",
"=",
"compartmentIDandOccurenceMap",
".",
"get",
"(",
"rootID",
")",
";",
"if",
"(",
"compartmentOccurrenceValue",
"!=",
"null",
")",
"{",
"compartmentIDandOccurenceMap",
".",
"put",
"(",
"rootID",
",",
"compartmentOccurrenceValue",
"+",
"1",
")",
";",
"}",
"else",
"compartmentIDandOccurenceMap",
".",
"put",
"(",
"rootID",
",",
"1",
")",
";",
"}",
"}"
] |
Updates a hashmap by incrementing the number of nodes in the compartment glyph that includes targetGlyph.
It is assumed that given hashmap includes compartment ids' as keys and number of nodes as values.This method
is an utility method that will be used to populate a hashmap while determining the compartment node of a process
node by majority rule.
@param targetGlyph glyph whose occurence will be updated in the given hashmap.
@param compartmentIDandOccurenceMap Map that references number of nodes in a compartment by compartment ids .
|
[
"Updates",
"a",
"hashmap",
"by",
"incrementing",
"the",
"number",
"of",
"nodes",
"in",
"the",
"compartment",
"glyph",
"that",
"includes",
"targetGlyph",
".",
"It",
"is",
"assumed",
"that",
"given",
"hashmap",
"includes",
"compartment",
"ids",
"as",
"keys",
"and",
"number",
"of",
"nodes",
"as",
"values",
".",
"This",
"method",
"is",
"an",
"utility",
"method",
"that",
"will",
"be",
"used",
"to",
"populate",
"a",
"hashmap",
"while",
"determining",
"the",
"compartment",
"node",
"of",
"a",
"process",
"node",
"by",
"majority",
"rule",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/sbgn-converter/src/main/java/org/biopax/paxtools/io/sbgn/SBGNLayoutManager.java#L311-L341
|
10,997
|
BioPAX/Paxtools
|
sbgn-converter/src/main/java/org/biopax/paxtools/io/sbgn/SBGNLayoutManager.java
|
SBGNLayoutManager.createVNodes
|
private void createVNodes(VCompound parent,List<Glyph> glyphs)
{
for(Glyph glyph: glyphs )
{
if (!glyphClazzOneOf(glyph, GlyphClazz.UNIT_OF_INFORMATION, GlyphClazz.STATE_VARIABLE))
{
// if(glyph.getClazz().equals(GlyphClazz.PROCESS.getClazz()))
// {
// VCompound v = new VCompound(glyph); //TODO: v is never used; wat's the idea?
// }
if(!isChildless(glyph))
{
VCompound v = new VCompound(glyph);
idToGLyph.put(glyph.getId(), glyph);
glyphToVNode.put(glyph, v);
parent.children.add(v);
createVNodes(v, glyph.getGlyph());
}
else
{
VNode v = new VNode(glyph);
idToGLyph.put(glyph.getId(), glyph);
glyphToVNode.put(glyph, v);
parent.children.add(v);
}
}
}
}
|
java
|
private void createVNodes(VCompound parent,List<Glyph> glyphs)
{
for(Glyph glyph: glyphs )
{
if (!glyphClazzOneOf(glyph, GlyphClazz.UNIT_OF_INFORMATION, GlyphClazz.STATE_VARIABLE))
{
// if(glyph.getClazz().equals(GlyphClazz.PROCESS.getClazz()))
// {
// VCompound v = new VCompound(glyph); //TODO: v is never used; wat's the idea?
// }
if(!isChildless(glyph))
{
VCompound v = new VCompound(glyph);
idToGLyph.put(glyph.getId(), glyph);
glyphToVNode.put(glyph, v);
parent.children.add(v);
createVNodes(v, glyph.getGlyph());
}
else
{
VNode v = new VNode(glyph);
idToGLyph.put(glyph.getId(), glyph);
glyphToVNode.put(glyph, v);
parent.children.add(v);
}
}
}
}
|
[
"private",
"void",
"createVNodes",
"(",
"VCompound",
"parent",
",",
"List",
"<",
"Glyph",
">",
"glyphs",
")",
"{",
"for",
"(",
"Glyph",
"glyph",
":",
"glyphs",
")",
"{",
"if",
"(",
"!",
"glyphClazzOneOf",
"(",
"glyph",
",",
"GlyphClazz",
".",
"UNIT_OF_INFORMATION",
",",
"GlyphClazz",
".",
"STATE_VARIABLE",
")",
")",
"{",
"// if(glyph.getClazz().equals(GlyphClazz.PROCESS.getClazz()))",
"// {",
"// VCompound v = new VCompound(glyph); //TODO: v is never used; wat's the idea?",
"// }",
"if",
"(",
"!",
"isChildless",
"(",
"glyph",
")",
")",
"{",
"VCompound",
"v",
"=",
"new",
"VCompound",
"(",
"glyph",
")",
";",
"idToGLyph",
".",
"put",
"(",
"glyph",
".",
"getId",
"(",
")",
",",
"glyph",
")",
";",
"glyphToVNode",
".",
"put",
"(",
"glyph",
",",
"v",
")",
";",
"parent",
".",
"children",
".",
"add",
"(",
"v",
")",
";",
"createVNodes",
"(",
"v",
",",
"glyph",
".",
"getGlyph",
"(",
")",
")",
";",
"}",
"else",
"{",
"VNode",
"v",
"=",
"new",
"VNode",
"(",
"glyph",
")",
";",
"idToGLyph",
".",
"put",
"(",
"glyph",
".",
"getId",
"(",
")",
",",
"glyph",
")",
";",
"glyphToVNode",
".",
"put",
"(",
"glyph",
",",
"v",
")",
";",
"parent",
".",
"children",
".",
"add",
"(",
"v",
")",
";",
"}",
"}",
"}",
"}"
] |
Recursively creates VNodes from Glyphs of Sbgn.
@param parent Parent of the glyphs that are passed as second arguement.
@param glyphs Glyphs that are child of parent which is passed as first arguement.
|
[
"Recursively",
"creates",
"VNodes",
"from",
"Glyphs",
"of",
"Sbgn",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/sbgn-converter/src/main/java/org/biopax/paxtools/io/sbgn/SBGNLayoutManager.java#L390-L418
|
10,998
|
BioPAX/Paxtools
|
sbgn-converter/src/main/java/org/biopax/paxtools/io/sbgn/SBGNLayoutManager.java
|
SBGNLayoutManager.createLEdges
|
private void createLEdges(List<Arc> arcs)
{
for(Arc arc: arcs )
{
LEdge lEdge = layout.newEdge(null);
lEdge.type = arc.getClazz();
lEdge.label = arc.getId();
LNode sourceLNode = viewToLayout.get(glyphToVNode.get(arc.getSource()));
LNode targetLNode = viewToLayout.get(glyphToVNode.get(arc.getTarget()));
idToArcs.put(arc.getId(), arc);
// Add edge to the layout
layout.getGraphManager().add(lEdge, sourceLNode, targetLNode);
}
}
|
java
|
private void createLEdges(List<Arc> arcs)
{
for(Arc arc: arcs )
{
LEdge lEdge = layout.newEdge(null);
lEdge.type = arc.getClazz();
lEdge.label = arc.getId();
LNode sourceLNode = viewToLayout.get(glyphToVNode.get(arc.getSource()));
LNode targetLNode = viewToLayout.get(glyphToVNode.get(arc.getTarget()));
idToArcs.put(arc.getId(), arc);
// Add edge to the layout
layout.getGraphManager().add(lEdge, sourceLNode, targetLNode);
}
}
|
[
"private",
"void",
"createLEdges",
"(",
"List",
"<",
"Arc",
">",
"arcs",
")",
"{",
"for",
"(",
"Arc",
"arc",
":",
"arcs",
")",
"{",
"LEdge",
"lEdge",
"=",
"layout",
".",
"newEdge",
"(",
"null",
")",
";",
"lEdge",
".",
"type",
"=",
"arc",
".",
"getClazz",
"(",
")",
";",
"lEdge",
".",
"label",
"=",
"arc",
".",
"getId",
"(",
")",
";",
"LNode",
"sourceLNode",
"=",
"viewToLayout",
".",
"get",
"(",
"glyphToVNode",
".",
"get",
"(",
"arc",
".",
"getSource",
"(",
")",
")",
")",
";",
"LNode",
"targetLNode",
"=",
"viewToLayout",
".",
"get",
"(",
"glyphToVNode",
".",
"get",
"(",
"arc",
".",
"getTarget",
"(",
")",
")",
")",
";",
"idToArcs",
".",
"put",
"(",
"arc",
".",
"getId",
"(",
")",
",",
"arc",
")",
";",
"// Add edge to the layout",
"layout",
".",
"getGraphManager",
"(",
")",
".",
"add",
"(",
"lEdge",
",",
"sourceLNode",
",",
"targetLNode",
")",
";",
"}",
"}"
] |
Creates LNodes from Arcs of Sbgn and adds it to the passed layout object.
@param arcs List of arc objects from which the LEdges will be constructed for ChiLay Layout component.
|
[
"Creates",
"LNodes",
"from",
"Arcs",
"of",
"Sbgn",
"and",
"adds",
"it",
"to",
"the",
"passed",
"layout",
"object",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/sbgn-converter/src/main/java/org/biopax/paxtools/io/sbgn/SBGNLayoutManager.java#L426-L440
|
10,999
|
BioPAX/Paxtools
|
sbgn-converter/src/main/java/org/biopax/paxtools/io/sbgn/SBGNLayoutManager.java
|
SBGNLayoutManager.createLNode
|
private void createLNode(VNode vNode, VNode parent)
{
LNode lNode = layout.newNode(vNode);
lNode.type = vNode.glyph.getClazz();
lNode.label = vNode.glyph.getId();
LGraph rootLGraph = layout.getGraphManager().getRoot();
//Add corresponding nodes to corresponding maps
viewToLayout.put(vNode, lNode);
layoutToView.put(lNode.label,vNode);
// if the vNode has a parent, add the lNode as a child of the parent l-node.
// otherwise, add the node to the root graph.
if (parent != null)
{
LNode parentLNode = viewToLayout.get(parent);
parentLNode.getChild().add(lNode);
}
else
{
rootLGraph.add(lNode);
}
lNode.setLocation(vNode.glyph.getBbox().getX(), vNode.glyph.getBbox().getY());
if (vNode instanceof VCompound)
{
VCompound vCompound = (VCompound) vNode;
// add new LGraph to the graph manager for the compound node
layout.getGraphManager().add(layout.newGraph(null), lNode);
// for each VNode in the node set create an LNode
for (VNode vChildNode: vCompound.getChildren())
{
createLNode(vChildNode, vCompound);
}
}
else
{
lNode.setWidth(vNode.glyph.getBbox().getW());
lNode.setHeight(vNode.glyph.getBbox().getH());
}
}
|
java
|
private void createLNode(VNode vNode, VNode parent)
{
LNode lNode = layout.newNode(vNode);
lNode.type = vNode.glyph.getClazz();
lNode.label = vNode.glyph.getId();
LGraph rootLGraph = layout.getGraphManager().getRoot();
//Add corresponding nodes to corresponding maps
viewToLayout.put(vNode, lNode);
layoutToView.put(lNode.label,vNode);
// if the vNode has a parent, add the lNode as a child of the parent l-node.
// otherwise, add the node to the root graph.
if (parent != null)
{
LNode parentLNode = viewToLayout.get(parent);
parentLNode.getChild().add(lNode);
}
else
{
rootLGraph.add(lNode);
}
lNode.setLocation(vNode.glyph.getBbox().getX(), vNode.glyph.getBbox().getY());
if (vNode instanceof VCompound)
{
VCompound vCompound = (VCompound) vNode;
// add new LGraph to the graph manager for the compound node
layout.getGraphManager().add(layout.newGraph(null), lNode);
// for each VNode in the node set create an LNode
for (VNode vChildNode: vCompound.getChildren())
{
createLNode(vChildNode, vCompound);
}
}
else
{
lNode.setWidth(vNode.glyph.getBbox().getW());
lNode.setHeight(vNode.glyph.getBbox().getH());
}
}
|
[
"private",
"void",
"createLNode",
"(",
"VNode",
"vNode",
",",
"VNode",
"parent",
")",
"{",
"LNode",
"lNode",
"=",
"layout",
".",
"newNode",
"(",
"vNode",
")",
";",
"lNode",
".",
"type",
"=",
"vNode",
".",
"glyph",
".",
"getClazz",
"(",
")",
";",
"lNode",
".",
"label",
"=",
"vNode",
".",
"glyph",
".",
"getId",
"(",
")",
";",
"LGraph",
"rootLGraph",
"=",
"layout",
".",
"getGraphManager",
"(",
")",
".",
"getRoot",
"(",
")",
";",
"//Add corresponding nodes to corresponding maps",
"viewToLayout",
".",
"put",
"(",
"vNode",
",",
"lNode",
")",
";",
"layoutToView",
".",
"put",
"(",
"lNode",
".",
"label",
",",
"vNode",
")",
";",
"// if the vNode has a parent, add the lNode as a child of the parent l-node.",
"// otherwise, add the node to the root graph.",
"if",
"(",
"parent",
"!=",
"null",
")",
"{",
"LNode",
"parentLNode",
"=",
"viewToLayout",
".",
"get",
"(",
"parent",
")",
";",
"parentLNode",
".",
"getChild",
"(",
")",
".",
"add",
"(",
"lNode",
")",
";",
"}",
"else",
"{",
"rootLGraph",
".",
"add",
"(",
"lNode",
")",
";",
"}",
"lNode",
".",
"setLocation",
"(",
"vNode",
".",
"glyph",
".",
"getBbox",
"(",
")",
".",
"getX",
"(",
")",
",",
"vNode",
".",
"glyph",
".",
"getBbox",
"(",
")",
".",
"getY",
"(",
")",
")",
";",
"if",
"(",
"vNode",
"instanceof",
"VCompound",
")",
"{",
"VCompound",
"vCompound",
"=",
"(",
"VCompound",
")",
"vNode",
";",
"// add new LGraph to the graph manager for the compound node",
"layout",
".",
"getGraphManager",
"(",
")",
".",
"add",
"(",
"layout",
".",
"newGraph",
"(",
"null",
")",
",",
"lNode",
")",
";",
"// for each VNode in the node set create an LNode",
"for",
"(",
"VNode",
"vChildNode",
":",
"vCompound",
".",
"getChildren",
"(",
")",
")",
"{",
"createLNode",
"(",
"vChildNode",
",",
"vCompound",
")",
";",
"}",
"}",
"else",
"{",
"lNode",
".",
"setWidth",
"(",
"vNode",
".",
"glyph",
".",
"getBbox",
"(",
")",
".",
"getW",
"(",
")",
")",
";",
"lNode",
".",
"setHeight",
"(",
"vNode",
".",
"glyph",
".",
"getBbox",
"(",
")",
".",
"getH",
"(",
")",
")",
";",
"}",
"}"
] |
Helper function for creating LNode objects from VNode objects and adds them to the given layout.
@param vNode VNode object from which a corresponding LNode object will be created.
@param parent parent of vNode, if not null vNode will be added to layout as child node.
|
[
"Helper",
"function",
"for",
"creating",
"LNode",
"objects",
"from",
"VNode",
"objects",
"and",
"adds",
"them",
"to",
"the",
"given",
"layout",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/sbgn-converter/src/main/java/org/biopax/paxtools/io/sbgn/SBGNLayoutManager.java#L449-L492
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.