partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
valid | complex_has_member | Does the given complex contain the member? | src/pybel_tools/biogrammar/double_edges.py | def complex_has_member(graph: BELGraph, complex_node: ComplexAbundance, member_node: BaseEntity) -> bool:
"""Does the given complex contain the member?"""
return any( # TODO can't you look in the members of the complex object (if it's enumerated)
v == member_node
for _, v, data in graph.out_edg... | def complex_has_member(graph: BELGraph, complex_node: ComplexAbundance, member_node: BaseEntity) -> bool:
"""Does the given complex contain the member?"""
return any( # TODO can't you look in the members of the complex object (if it's enumerated)
v == member_node
for _, v, data in graph.out_edg... | [
"Does",
"the",
"given",
"complex",
"contain",
"the",
"member?"
] | pybel/pybel-tools | python | https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/biogrammar/double_edges.py#L42-L48 | [
"def",
"complex_has_member",
"(",
"graph",
":",
"BELGraph",
",",
"complex_node",
":",
"ComplexAbundance",
",",
"member_node",
":",
"BaseEntity",
")",
"->",
"bool",
":",
"return",
"any",
"(",
"# TODO can't you look in the members of the complex object (if it's enumerated)",
... | 3491adea0ac4ee60f57275ef72f9b73da6dbfe0c |
valid | complex_increases_activity | Return if the formation of a complex with u increases the activity of v. | src/pybel_tools/biogrammar/double_edges.py | def complex_increases_activity(graph: BELGraph, u: BaseEntity, v: BaseEntity, key: str) -> bool:
"""Return if the formation of a complex with u increases the activity of v."""
return (
isinstance(u, (ComplexAbundance, NamedComplexAbundance)) and
complex_has_member(graph, u, v) and
part_h... | def complex_increases_activity(graph: BELGraph, u: BaseEntity, v: BaseEntity, key: str) -> bool:
"""Return if the formation of a complex with u increases the activity of v."""
return (
isinstance(u, (ComplexAbundance, NamedComplexAbundance)) and
complex_has_member(graph, u, v) and
part_h... | [
"Return",
"if",
"the",
"formation",
"of",
"a",
"complex",
"with",
"u",
"increases",
"the",
"activity",
"of",
"v",
"."
] | pybel/pybel-tools | python | https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/biogrammar/double_edges.py#L51-L57 | [
"def",
"complex_increases_activity",
"(",
"graph",
":",
"BELGraph",
",",
"u",
":",
"BaseEntity",
",",
"v",
":",
"BaseEntity",
",",
"key",
":",
"str",
")",
"->",
"bool",
":",
"return",
"(",
"isinstance",
"(",
"u",
",",
"(",
"ComplexAbundance",
",",
"Named... | 3491adea0ac4ee60f57275ef72f9b73da6dbfe0c |
valid | find_activations | Find edges that are A - A, meaning that some conditions in the edge best describe the interaction. | src/pybel_tools/biogrammar/double_edges.py | def find_activations(graph: BELGraph):
"""Find edges that are A - A, meaning that some conditions in the edge best describe the interaction."""
for u, v, key, data in graph.edges(keys=True, data=True):
if u != v:
continue
bel = graph.edge_to_bel(u, v, data)
line = data.get(... | def find_activations(graph: BELGraph):
"""Find edges that are A - A, meaning that some conditions in the edge best describe the interaction."""
for u, v, key, data in graph.edges(keys=True, data=True):
if u != v:
continue
bel = graph.edge_to_bel(u, v, data)
line = data.get(... | [
"Find",
"edges",
"that",
"are",
"A",
"-",
"A",
"meaning",
"that",
"some",
"conditions",
"in",
"the",
"edge",
"best",
"describe",
"the",
"interaction",
"."
] | pybel/pybel-tools | python | https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/biogrammar/double_edges.py#L187-L220 | [
"def",
"find_activations",
"(",
"graph",
":",
"BELGraph",
")",
":",
"for",
"u",
",",
"v",
",",
"key",
",",
"data",
"in",
"graph",
".",
"edges",
"(",
"keys",
"=",
"True",
",",
"data",
"=",
"True",
")",
":",
"if",
"u",
"!=",
"v",
":",
"continue",
... | 3491adea0ac4ee60f57275ef72f9b73da6dbfe0c |
valid | pairwise | s -> (s0,s1), (s1,s2), (s2, s3), ... | src/pybel_tools/selection/paths.py | def pairwise(iterable):
"s -> (s0,s1), (s1,s2), (s2, s3), ..."
a, b = itt.tee(iterable)
next(b, None)
return zip(a, b) | def pairwise(iterable):
"s -> (s0,s1), (s1,s2), (s2, s3), ..."
a, b = itt.tee(iterable)
next(b, None)
return zip(a, b) | [
"s",
"-",
">",
"(",
"s0",
"s1",
")",
"(",
"s1",
"s2",
")",
"(",
"s2",
"s3",
")",
"..."
] | pybel/pybel-tools | python | https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/selection/paths.py#L49-L53 | [
"def",
"pairwise",
"(",
"iterable",
")",
":",
"a",
",",
"b",
"=",
"itt",
".",
"tee",
"(",
"iterable",
")",
"next",
"(",
"b",
",",
"None",
")",
"return",
"zip",
"(",
"a",
",",
"b",
")"
] | 3491adea0ac4ee60f57275ef72f9b73da6dbfe0c |
valid | rank_path | Takes in a path (a list of nodes in the graph) and calculates a score
:param pybel.BELGraph graph: A BEL graph
:param list[tuple] path: A list of nodes in the path (includes terminal nodes)
:param dict edge_ranking: A dictionary of {relationship: score}
:return: The score for the edge
:rtype: int | src/pybel_tools/selection/paths.py | def rank_path(graph, path, edge_ranking=None):
"""Takes in a path (a list of nodes in the graph) and calculates a score
:param pybel.BELGraph graph: A BEL graph
:param list[tuple] path: A list of nodes in the path (includes terminal nodes)
:param dict edge_ranking: A dictionary of {relationship: score}... | def rank_path(graph, path, edge_ranking=None):
"""Takes in a path (a list of nodes in the graph) and calculates a score
:param pybel.BELGraph graph: A BEL graph
:param list[tuple] path: A list of nodes in the path (includes terminal nodes)
:param dict edge_ranking: A dictionary of {relationship: score}... | [
"Takes",
"in",
"a",
"path",
"(",
"a",
"list",
"of",
"nodes",
"in",
"the",
"graph",
")",
"and",
"calculates",
"a",
"score"
] | pybel/pybel-tools | python | https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/selection/paths.py#L56-L67 | [
"def",
"rank_path",
"(",
"graph",
",",
"path",
",",
"edge_ranking",
"=",
"None",
")",
":",
"edge_ranking",
"=",
"default_edge_ranking",
"if",
"edge_ranking",
"is",
"None",
"else",
"edge_ranking",
"return",
"sum",
"(",
"max",
"(",
"edge_ranking",
"[",
"d",
"[... | 3491adea0ac4ee60f57275ef72f9b73da6dbfe0c |
valid | find_root_in_path | Find the 'root' of the path -> The node with the lowest out degree, if multiple:
root is the one with the highest out degree among those with lowest out degree
:param pybel.BELGraph graph: A BEL Graph
:param list[tuple] path_nodes: A list of nodes in their order in a path
:return: A pair of th... | src/pybel_tools/selection/paths.py | def find_root_in_path(graph, path_nodes):
"""Find the 'root' of the path -> The node with the lowest out degree, if multiple:
root is the one with the highest out degree among those with lowest out degree
:param pybel.BELGraph graph: A BEL Graph
:param list[tuple] path_nodes: A list of nodes i... | def find_root_in_path(graph, path_nodes):
"""Find the 'root' of the path -> The node with the lowest out degree, if multiple:
root is the one with the highest out degree among those with lowest out degree
:param pybel.BELGraph graph: A BEL Graph
:param list[tuple] path_nodes: A list of nodes i... | [
"Find",
"the",
"root",
"of",
"the",
"path",
"-",
">",
"The",
"node",
"with",
"the",
"lowest",
"out",
"degree",
"if",
"multiple",
":",
"root",
"is",
"the",
"one",
"with",
"the",
"highest",
"out",
"degree",
"among",
"those",
"with",
"lowest",
"out",
"deg... | pybel/pybel-tools | python | https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/selection/paths.py#L124-L157 | [
"def",
"find_root_in_path",
"(",
"graph",
",",
"path_nodes",
")",
":",
"path_graph",
"=",
"graph",
".",
"subgraph",
"(",
"path_nodes",
")",
"# node_in_degree_tuple: list of tuples with (node,in_degree_of_node) in ascending order",
"node_in_degree_tuple",
"=",
"sorted",
"(",
... | 3491adea0ac4ee60f57275ef72f9b73da6dbfe0c |
valid | summarize_edge_filter | Print a summary of the number of edges passing a given set of filters. | src/pybel_tools/filters/edge_filters.py | def summarize_edge_filter(graph: BELGraph, edge_predicates: EdgePredicates) -> None:
"""Print a summary of the number of edges passing a given set of filters."""
passed = count_passed_edge_filter(graph, edge_predicates)
print('{}/{} edges passed {}'.format(
passed, graph.number_of_edges(),
(... | def summarize_edge_filter(graph: BELGraph, edge_predicates: EdgePredicates) -> None:
"""Print a summary of the number of edges passing a given set of filters."""
passed = count_passed_edge_filter(graph, edge_predicates)
print('{}/{} edges passed {}'.format(
passed, graph.number_of_edges(),
(... | [
"Print",
"a",
"summary",
"of",
"the",
"number",
"of",
"edges",
"passing",
"a",
"given",
"set",
"of",
"filters",
"."
] | pybel/pybel-tools | python | https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/filters/edge_filters.py#L32-L42 | [
"def",
"summarize_edge_filter",
"(",
"graph",
":",
"BELGraph",
",",
"edge_predicates",
":",
"EdgePredicates",
")",
"->",
"None",
":",
"passed",
"=",
"count_passed_edge_filter",
"(",
"graph",
",",
"edge_predicates",
")",
"print",
"(",
"'{}/{} edges passed {}'",
".",
... | 3491adea0ac4ee60f57275ef72f9b73da6dbfe0c |
valid | build_edge_data_filter | Build a filter that keeps edges whose data dictionaries are super-dictionaries to the given dictionary.
:param annotations: The annotation query dict to match
:param partial_match: Should the query values be used as partial or exact matches? Defaults to :code:`True`. | src/pybel_tools/filters/edge_filters.py | def build_edge_data_filter(annotations: Mapping, partial_match: bool = True) -> EdgePredicate: # noqa: D202
"""Build a filter that keeps edges whose data dictionaries are super-dictionaries to the given dictionary.
:param annotations: The annotation query dict to match
:param partial_match: Should the quer... | def build_edge_data_filter(annotations: Mapping, partial_match: bool = True) -> EdgePredicate: # noqa: D202
"""Build a filter that keeps edges whose data dictionaries are super-dictionaries to the given dictionary.
:param annotations: The annotation query dict to match
:param partial_match: Should the quer... | [
"Build",
"a",
"filter",
"that",
"keeps",
"edges",
"whose",
"data",
"dictionaries",
"are",
"super",
"-",
"dictionaries",
"to",
"the",
"given",
"dictionary",
"."
] | pybel/pybel-tools | python | https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/filters/edge_filters.py#L45-L57 | [
"def",
"build_edge_data_filter",
"(",
"annotations",
":",
"Mapping",
",",
"partial_match",
":",
"bool",
"=",
"True",
")",
"->",
"EdgePredicate",
":",
"# noqa: D202",
"@",
"edge_predicate",
"def",
"annotation_dict_filter",
"(",
"data",
":",
"EdgeData",
")",
"->",
... | 3491adea0ac4ee60f57275ef72f9b73da6dbfe0c |
valid | build_pmid_exclusion_filter | Fail for edges with citations whose references are one of the given PubMed identifiers.
:param pmids: A PubMed identifier or list of PubMed identifiers to filter against | src/pybel_tools/filters/edge_filters.py | def build_pmid_exclusion_filter(pmids: Strings) -> EdgePredicate:
"""Fail for edges with citations whose references are one of the given PubMed identifiers.
:param pmids: A PubMed identifier or list of PubMed identifiers to filter against
"""
if isinstance(pmids, str):
@edge_predicate
d... | def build_pmid_exclusion_filter(pmids: Strings) -> EdgePredicate:
"""Fail for edges with citations whose references are one of the given PubMed identifiers.
:param pmids: A PubMed identifier or list of PubMed identifiers to filter against
"""
if isinstance(pmids, str):
@edge_predicate
d... | [
"Fail",
"for",
"edges",
"with",
"citations",
"whose",
"references",
"are",
"one",
"of",
"the",
"given",
"PubMed",
"identifiers",
"."
] | pybel/pybel-tools | python | https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/filters/edge_filters.py#L92-L120 | [
"def",
"build_pmid_exclusion_filter",
"(",
"pmids",
":",
"Strings",
")",
"->",
"EdgePredicate",
":",
"if",
"isinstance",
"(",
"pmids",
",",
"str",
")",
":",
"@",
"edge_predicate",
"def",
"pmid_exclusion_filter",
"(",
"data",
":",
"EdgeData",
")",
"->",
"bool",... | 3491adea0ac4ee60f57275ef72f9b73da6dbfe0c |
valid | node_has_namespace | Pass for nodes that have the given namespace. | src/pybel_tools/filters/edge_filters.py | def node_has_namespace(node: BaseEntity, namespace: str) -> bool:
"""Pass for nodes that have the given namespace."""
ns = node.get(NAMESPACE)
return ns is not None and ns == namespace | def node_has_namespace(node: BaseEntity, namespace: str) -> bool:
"""Pass for nodes that have the given namespace."""
ns = node.get(NAMESPACE)
return ns is not None and ns == namespace | [
"Pass",
"for",
"nodes",
"that",
"have",
"the",
"given",
"namespace",
"."
] | pybel/pybel-tools | python | https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/filters/edge_filters.py#L157-L160 | [
"def",
"node_has_namespace",
"(",
"node",
":",
"BaseEntity",
",",
"namespace",
":",
"str",
")",
"->",
"bool",
":",
"ns",
"=",
"node",
".",
"get",
"(",
"NAMESPACE",
")",
"return",
"ns",
"is",
"not",
"None",
"and",
"ns",
"==",
"namespace"
] | 3491adea0ac4ee60f57275ef72f9b73da6dbfe0c |
valid | node_has_namespaces | Pass for nodes that have one of the given namespaces. | src/pybel_tools/filters/edge_filters.py | def node_has_namespaces(node: BaseEntity, namespaces: Set[str]) -> bool:
"""Pass for nodes that have one of the given namespaces."""
ns = node.get(NAMESPACE)
return ns is not None and ns in namespaces | def node_has_namespaces(node: BaseEntity, namespaces: Set[str]) -> bool:
"""Pass for nodes that have one of the given namespaces."""
ns = node.get(NAMESPACE)
return ns is not None and ns in namespaces | [
"Pass",
"for",
"nodes",
"that",
"have",
"one",
"of",
"the",
"given",
"namespaces",
"."
] | pybel/pybel-tools | python | https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/filters/edge_filters.py#L163-L166 | [
"def",
"node_has_namespaces",
"(",
"node",
":",
"BaseEntity",
",",
"namespaces",
":",
"Set",
"[",
"str",
"]",
")",
"->",
"bool",
":",
"ns",
"=",
"node",
".",
"get",
"(",
"NAMESPACE",
")",
"return",
"ns",
"is",
"not",
"None",
"and",
"ns",
"in",
"names... | 3491adea0ac4ee60f57275ef72f9b73da6dbfe0c |
valid | build_source_namespace_filter | Pass for edges whose source nodes have the given namespace or one of the given namespaces.
:param namespaces: The namespace or namespaces to filter by | src/pybel_tools/filters/edge_filters.py | def build_source_namespace_filter(namespaces: Strings) -> EdgePredicate:
"""Pass for edges whose source nodes have the given namespace or one of the given namespaces.
:param namespaces: The namespace or namespaces to filter by
"""
if isinstance(namespaces, str):
def source_namespace_filter(_, u... | def build_source_namespace_filter(namespaces: Strings) -> EdgePredicate:
"""Pass for edges whose source nodes have the given namespace or one of the given namespaces.
:param namespaces: The namespace or namespaces to filter by
"""
if isinstance(namespaces, str):
def source_namespace_filter(_, u... | [
"Pass",
"for",
"edges",
"whose",
"source",
"nodes",
"have",
"the",
"given",
"namespace",
"or",
"one",
"of",
"the",
"given",
"namespaces",
"."
] | pybel/pybel-tools | python | https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/filters/edge_filters.py#L169-L187 | [
"def",
"build_source_namespace_filter",
"(",
"namespaces",
":",
"Strings",
")",
"->",
"EdgePredicate",
":",
"if",
"isinstance",
"(",
"namespaces",
",",
"str",
")",
":",
"def",
"source_namespace_filter",
"(",
"_",
",",
"u",
":",
"BaseEntity",
",",
"__",
",",
... | 3491adea0ac4ee60f57275ef72f9b73da6dbfe0c |
valid | build_target_namespace_filter | Only passes for edges whose target nodes have the given namespace or one of the given namespaces
:param namespaces: The namespace or namespaces to filter by | src/pybel_tools/filters/edge_filters.py | def build_target_namespace_filter(namespaces: Strings) -> EdgePredicate:
"""Only passes for edges whose target nodes have the given namespace or one of the given namespaces
:param namespaces: The namespace or namespaces to filter by
"""
if isinstance(namespaces, str):
def target_namespace_filte... | def build_target_namespace_filter(namespaces: Strings) -> EdgePredicate:
"""Only passes for edges whose target nodes have the given namespace or one of the given namespaces
:param namespaces: The namespace or namespaces to filter by
"""
if isinstance(namespaces, str):
def target_namespace_filte... | [
"Only",
"passes",
"for",
"edges",
"whose",
"target",
"nodes",
"have",
"the",
"given",
"namespace",
"or",
"one",
"of",
"the",
"given",
"namespaces"
] | pybel/pybel-tools | python | https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/filters/edge_filters.py#L190-L208 | [
"def",
"build_target_namespace_filter",
"(",
"namespaces",
":",
"Strings",
")",
"->",
"EdgePredicate",
":",
"if",
"isinstance",
"(",
"namespaces",
",",
"str",
")",
":",
"def",
"target_namespace_filter",
"(",
"_",
",",
"__",
",",
"v",
":",
"BaseEntity",
",",
... | 3491adea0ac4ee60f57275ef72f9b73da6dbfe0c |
valid | search_node_namespace_names | Search for nodes with the given namespace(s) and whose names containing a given string(s).
:param pybel.BELGraph graph: A BEL graph
:param query: The search query
:type query: str or iter[str]
:param namespace: The namespace(s) to filter
:type namespace: str or iter[str]
:return: An iterator ov... | src/pybel_tools/selection/search.py | def search_node_namespace_names(graph, query, namespace):
"""Search for nodes with the given namespace(s) and whose names containing a given string(s).
:param pybel.BELGraph graph: A BEL graph
:param query: The search query
:type query: str or iter[str]
:param namespace: The namespace(s) to filter
... | def search_node_namespace_names(graph, query, namespace):
"""Search for nodes with the given namespace(s) and whose names containing a given string(s).
:param pybel.BELGraph graph: A BEL graph
:param query: The search query
:type query: str or iter[str]
:param namespace: The namespace(s) to filter
... | [
"Search",
"for",
"nodes",
"with",
"the",
"given",
"namespace",
"(",
"s",
")",
"and",
"whose",
"names",
"containing",
"a",
"given",
"string",
"(",
"s",
")",
"."
] | pybel/pybel-tools | python | https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/selection/search.py#L34-L50 | [
"def",
"search_node_namespace_names",
"(",
"graph",
",",
"query",
",",
"namespace",
")",
":",
"node_predicates",
"=",
"[",
"namespace_inclusion_builder",
"(",
"namespace",
")",
",",
"build_node_name_search",
"(",
"query",
")",
"]",
"return",
"filter_nodes",
"(",
"... | 3491adea0ac4ee60f57275ef72f9b73da6dbfe0c |
valid | get_cutoff | Assign if a value is greater than or less than a cutoff. | src/pybel_tools/analysis/concordance.py | def get_cutoff(value: float, cutoff: Optional[float] = None) -> int:
"""Assign if a value is greater than or less than a cutoff."""
cutoff = cutoff if cutoff is not None else 0
if value > cutoff:
return 1
if value < (-1 * cutoff):
return - 1
return 0 | def get_cutoff(value: float, cutoff: Optional[float] = None) -> int:
"""Assign if a value is greater than or less than a cutoff."""
cutoff = cutoff if cutoff is not None else 0
if value > cutoff:
return 1
if value < (-1 * cutoff):
return - 1
return 0 | [
"Assign",
"if",
"a",
"value",
"is",
"greater",
"than",
"or",
"less",
"than",
"a",
"cutoff",
"."
] | pybel/pybel-tools | python | https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/analysis/concordance.py#L36-L46 | [
"def",
"get_cutoff",
"(",
"value",
":",
"float",
",",
"cutoff",
":",
"Optional",
"[",
"float",
"]",
"=",
"None",
")",
"->",
"int",
":",
"cutoff",
"=",
"cutoff",
"if",
"cutoff",
"is",
"not",
"None",
"else",
"0",
"if",
"value",
">",
"cutoff",
":",
"r... | 3491adea0ac4ee60f57275ef72f9b73da6dbfe0c |
valid | calculate_concordance_helper | Help calculate network-wide concordance
Assumes data already annotated with given key
:param graph: A BEL graph
:param key: The node data dictionary key storing the logFC
:param cutoff: The optional logFC cutoff for significance | src/pybel_tools/analysis/concordance.py | def calculate_concordance_helper(graph: BELGraph,
key: str,
cutoff: Optional[float] = None,
) -> Tuple[int, int, int, int]:
"""Help calculate network-wide concordance
Assumes data already annotated with given key... | def calculate_concordance_helper(graph: BELGraph,
key: str,
cutoff: Optional[float] = None,
) -> Tuple[int, int, int, int]:
"""Help calculate network-wide concordance
Assumes data already annotated with given key... | [
"Help",
"calculate",
"network",
"-",
"wide",
"concordance"
] | pybel/pybel-tools | python | https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/analysis/concordance.py#L140-L163 | [
"def",
"calculate_concordance_helper",
"(",
"graph",
":",
"BELGraph",
",",
"key",
":",
"str",
",",
"cutoff",
":",
"Optional",
"[",
"float",
"]",
"=",
"None",
",",
")",
"->",
"Tuple",
"[",
"int",
",",
"int",
",",
"int",
",",
"int",
"]",
":",
"scores",... | 3491adea0ac4ee60f57275ef72f9b73da6dbfe0c |
valid | calculate_concordance | Calculates network-wide concordance.
Assumes data already annotated with given key
:param graph: A BEL graph
:param key: The node data dictionary key storing the logFC
:param cutoff: The optional logFC cutoff for significance
:param use_ambiguous: Compare to ambiguous edges as well | src/pybel_tools/analysis/concordance.py | def calculate_concordance(graph: BELGraph, key: str, cutoff: Optional[float] = None,
use_ambiguous: bool = False) -> float:
"""Calculates network-wide concordance.
Assumes data already annotated with given key
:param graph: A BEL graph
:param key: The node data dictionary key... | def calculate_concordance(graph: BELGraph, key: str, cutoff: Optional[float] = None,
use_ambiguous: bool = False) -> float:
"""Calculates network-wide concordance.
Assumes data already annotated with given key
:param graph: A BEL graph
:param key: The node data dictionary key... | [
"Calculates",
"network",
"-",
"wide",
"concordance",
"."
] | pybel/pybel-tools | python | https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/analysis/concordance.py#L166-L182 | [
"def",
"calculate_concordance",
"(",
"graph",
":",
"BELGraph",
",",
"key",
":",
"str",
",",
"cutoff",
":",
"Optional",
"[",
"float",
"]",
"=",
"None",
",",
"use_ambiguous",
":",
"bool",
"=",
"False",
")",
"->",
"float",
":",
"correct",
",",
"incorrect",
... | 3491adea0ac4ee60f57275ef72f9b73da6dbfe0c |
valid | one_sided | Calculate the one-sided probability of getting a value more extreme than the distribution. | src/pybel_tools/analysis/concordance.py | def one_sided(value: float, distribution: List[float]) -> float:
"""Calculate the one-sided probability of getting a value more extreme than the distribution."""
assert distribution
return sum(value < element for element in distribution) / len(distribution) | def one_sided(value: float, distribution: List[float]) -> float:
"""Calculate the one-sided probability of getting a value more extreme than the distribution."""
assert distribution
return sum(value < element for element in distribution) / len(distribution) | [
"Calculate",
"the",
"one",
"-",
"sided",
"probability",
"of",
"getting",
"a",
"value",
"more",
"extreme",
"than",
"the",
"distribution",
"."
] | pybel/pybel-tools | python | https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/analysis/concordance.py#L185-L188 | [
"def",
"one_sided",
"(",
"value",
":",
"float",
",",
"distribution",
":",
"List",
"[",
"float",
"]",
")",
"->",
"float",
":",
"assert",
"distribution",
"return",
"sum",
"(",
"value",
"<",
"element",
"for",
"element",
"in",
"distribution",
")",
"/",
"len"... | 3491adea0ac4ee60f57275ef72f9b73da6dbfe0c |
valid | calculate_concordance_probability | Calculates a graph's concordance as well as its statistical probability.
:param graph: A BEL graph
:param str key: The node data dictionary key storing the logFC
:param float cutoff: The optional logFC cutoff for significance
:param int permutations: The number of random permutations to test. Default... | src/pybel_tools/analysis/concordance.py | def calculate_concordance_probability(graph: BELGraph,
key: str,
cutoff: Optional[float] = None,
permutations: Optional[int] = None,
percentage: Optional[float] = None,... | def calculate_concordance_probability(graph: BELGraph,
key: str,
cutoff: Optional[float] = None,
permutations: Optional[int] = None,
percentage: Optional[float] = None,... | [
"Calculates",
"a",
"graph",
"s",
"concordance",
"as",
"well",
"as",
"its",
"statistical",
"probability",
"."
] | pybel/pybel-tools | python | https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/analysis/concordance.py#L191-L233 | [
"def",
"calculate_concordance_probability",
"(",
"graph",
":",
"BELGraph",
",",
"key",
":",
"str",
",",
"cutoff",
":",
"Optional",
"[",
"float",
"]",
"=",
"None",
",",
"permutations",
":",
"Optional",
"[",
"int",
"]",
"=",
"None",
",",
"percentage",
":",
... | 3491adea0ac4ee60f57275ef72f9b73da6dbfe0c |
valid | calculate_concordance_by_annotation | Returns the concordance scores for each stratified graph based on the given annotation
:param pybel.BELGraph graph: A BEL graph
:param str annotation: The annotation to group by.
:param str key: The node data dictionary key storing the logFC
:param float cutoff: The optional logFC cutoff for significan... | src/pybel_tools/analysis/concordance.py | def calculate_concordance_by_annotation(graph, annotation, key, cutoff=None):
"""Returns the concordance scores for each stratified graph based on the given annotation
:param pybel.BELGraph graph: A BEL graph
:param str annotation: The annotation to group by.
:param str key: The node data dictionary ke... | def calculate_concordance_by_annotation(graph, annotation, key, cutoff=None):
"""Returns the concordance scores for each stratified graph based on the given annotation
:param pybel.BELGraph graph: A BEL graph
:param str annotation: The annotation to group by.
:param str key: The node data dictionary ke... | [
"Returns",
"the",
"concordance",
"scores",
"for",
"each",
"stratified",
"graph",
"based",
"on",
"the",
"given",
"annotation"
] | pybel/pybel-tools | python | https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/analysis/concordance.py#L236-L248 | [
"def",
"calculate_concordance_by_annotation",
"(",
"graph",
",",
"annotation",
",",
"key",
",",
"cutoff",
"=",
"None",
")",
":",
"return",
"{",
"value",
":",
"calculate_concordance",
"(",
"subgraph",
",",
"key",
",",
"cutoff",
"=",
"cutoff",
")",
"for",
"val... | 3491adea0ac4ee60f57275ef72f9b73da6dbfe0c |
valid | calculate_concordance_probability_by_annotation | Returns the results of concordance analysis on each subgraph, stratified by the given annotation.
:param pybel.BELGraph graph: A BEL graph
:param str annotation: The annotation to group by.
:param str key: The node data dictionary key storing the logFC
:param float cutoff: The optional logFC cutoff for... | src/pybel_tools/analysis/concordance.py | def calculate_concordance_probability_by_annotation(graph, annotation, key, cutoff=None, permutations=None,
percentage=None,
use_ambiguous=False):
"""Returns the results of concordance analysis on each subgraph, ... | def calculate_concordance_probability_by_annotation(graph, annotation, key, cutoff=None, permutations=None,
percentage=None,
use_ambiguous=False):
"""Returns the results of concordance analysis on each subgraph, ... | [
"Returns",
"the",
"results",
"of",
"concordance",
"analysis",
"on",
"each",
"subgraph",
"stratified",
"by",
"the",
"given",
"annotation",
"."
] | pybel/pybel-tools | python | https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/analysis/concordance.py#L252-L278 | [
"def",
"calculate_concordance_probability_by_annotation",
"(",
"graph",
",",
"annotation",
",",
"key",
",",
"cutoff",
"=",
"None",
",",
"permutations",
"=",
"None",
",",
"percentage",
"=",
"None",
",",
"use_ambiguous",
"=",
"False",
")",
":",
"result",
"=",
"[... | 3491adea0ac4ee60f57275ef72f9b73da6dbfe0c |
valid | _get_drug_target_interactions | Get a mapping from drugs to their list of gene. | src/pybel_tools/analysis/epicom/algorithm.py | def _get_drug_target_interactions(manager: Optional['bio2bel_drugbank.manager'] = None) -> Mapping[str, List[str]]:
"""Get a mapping from drugs to their list of gene."""
if manager is None:
import bio2bel_drugbank
manager = bio2bel_drugbank.Manager()
if not manager.is_populated():
m... | def _get_drug_target_interactions(manager: Optional['bio2bel_drugbank.manager'] = None) -> Mapping[str, List[str]]:
"""Get a mapping from drugs to their list of gene."""
if manager is None:
import bio2bel_drugbank
manager = bio2bel_drugbank.Manager()
if not manager.is_populated():
m... | [
"Get",
"a",
"mapping",
"from",
"drugs",
"to",
"their",
"list",
"of",
"gene",
"."
] | pybel/pybel-tools | python | https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/analysis/epicom/algorithm.py#L21-L30 | [
"def",
"_get_drug_target_interactions",
"(",
"manager",
":",
"Optional",
"[",
"'bio2bel_drugbank.manager'",
"]",
"=",
"None",
")",
"->",
"Mapping",
"[",
"str",
",",
"List",
"[",
"str",
"]",
"]",
":",
"if",
"manager",
"is",
"None",
":",
"import",
"bio2bel_dru... | 3491adea0ac4ee60f57275ef72f9b73da6dbfe0c |
valid | multi_run_epicom | Run EpiCom analysis on many graphs. | src/pybel_tools/analysis/epicom/algorithm.py | def multi_run_epicom(graphs: Iterable[BELGraph], path: Union[None, str, TextIO]) -> None:
"""Run EpiCom analysis on many graphs."""
if isinstance(path, str):
with open(path, 'w') as file:
_multi_run_helper_file_wrapper(graphs, file)
else:
_multi_run_helper_file_wrapper(graphs, p... | def multi_run_epicom(graphs: Iterable[BELGraph], path: Union[None, str, TextIO]) -> None:
"""Run EpiCom analysis on many graphs."""
if isinstance(path, str):
with open(path, 'w') as file:
_multi_run_helper_file_wrapper(graphs, file)
else:
_multi_run_helper_file_wrapper(graphs, p... | [
"Run",
"EpiCom",
"analysis",
"on",
"many",
"graphs",
"."
] | pybel/pybel-tools | python | https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/analysis/epicom/algorithm.py#L81-L88 | [
"def",
"multi_run_epicom",
"(",
"graphs",
":",
"Iterable",
"[",
"BELGraph",
"]",
",",
"path",
":",
"Union",
"[",
"None",
",",
"str",
",",
"TextIO",
"]",
")",
"->",
"None",
":",
"if",
"isinstance",
"(",
"path",
",",
"str",
")",
":",
"with",
"open",
... | 3491adea0ac4ee60f57275ef72f9b73da6dbfe0c |
valid | main | Convert the Alzheimer's and Parkinson's disease NeuroMMSig excel sheets to BEL. | src/pybel_tools/analysis/neurommsig/cli.py | def main():
"""Convert the Alzheimer's and Parkinson's disease NeuroMMSig excel sheets to BEL."""
logging.basicConfig(level=logging.INFO)
log.setLevel(logging.INFO)
bms_base = get_bms_base()
neurommsig_base = get_neurommsig_base()
neurommsig_excel_dir = os.path.join(neurommsig_base, 'resources'... | def main():
"""Convert the Alzheimer's and Parkinson's disease NeuroMMSig excel sheets to BEL."""
logging.basicConfig(level=logging.INFO)
log.setLevel(logging.INFO)
bms_base = get_bms_base()
neurommsig_base = get_neurommsig_base()
neurommsig_excel_dir = os.path.join(neurommsig_base, 'resources'... | [
"Convert",
"the",
"Alzheimer",
"s",
"and",
"Parkinson",
"s",
"disease",
"NeuroMMSig",
"excel",
"sheets",
"to",
"BEL",
"."
] | pybel/pybel-tools | python | https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/analysis/neurommsig/cli.py#L20-L43 | [
"def",
"main",
"(",
")",
":",
"logging",
".",
"basicConfig",
"(",
"level",
"=",
"logging",
".",
"INFO",
")",
"log",
".",
"setLevel",
"(",
"logging",
".",
"INFO",
")",
"bms_base",
"=",
"get_bms_base",
"(",
")",
"neurommsig_base",
"=",
"get_neurommsig_base",... | 3491adea0ac4ee60f57275ef72f9b73da6dbfe0c |
valid | remove_inconsistent_edges | Remove all edges between node pairs with inconsistent edges.
This is the all-or-nothing approach. It would be better to do more careful investigation of the evidences during
curation. | src/pybel_tools/mutation/deletion.py | def remove_inconsistent_edges(graph: BELGraph) -> None:
"""Remove all edges between node pairs with inconsistent edges.
This is the all-or-nothing approach. It would be better to do more careful investigation of the evidences during
curation.
"""
for u, v in get_inconsistent_edges(graph):
e... | def remove_inconsistent_edges(graph: BELGraph) -> None:
"""Remove all edges between node pairs with inconsistent edges.
This is the all-or-nothing approach. It would be better to do more careful investigation of the evidences during
curation.
"""
for u, v in get_inconsistent_edges(graph):
e... | [
"Remove",
"all",
"edges",
"between",
"node",
"pairs",
"with",
"inconsistent",
"edges",
"."
] | pybel/pybel-tools | python | https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/mutation/deletion.py#L18-L26 | [
"def",
"remove_inconsistent_edges",
"(",
"graph",
":",
"BELGraph",
")",
"->",
"None",
":",
"for",
"u",
",",
"v",
"in",
"get_inconsistent_edges",
"(",
"graph",
")",
":",
"edges",
"=",
"[",
"(",
"u",
",",
"v",
",",
"k",
")",
"for",
"k",
"in",
"graph",
... | 3491adea0ac4ee60f57275ef72f9b73da6dbfe0c |
valid | get_walks_exhaustive | Gets all walks under a given length starting at a given node
:param networkx.Graph graph: A graph
:param node: Starting node
:param int length: The length of walks to get
:return: A list of paths
:rtype: list[tuple] | src/pybel_tools/selection/metapaths.py | def get_walks_exhaustive(graph, node, length):
"""Gets all walks under a given length starting at a given node
:param networkx.Graph graph: A graph
:param node: Starting node
:param int length: The length of walks to get
:return: A list of paths
:rtype: list[tuple]
"""
if 0 == length:
... | def get_walks_exhaustive(graph, node, length):
"""Gets all walks under a given length starting at a given node
:param networkx.Graph graph: A graph
:param node: Starting node
:param int length: The length of walks to get
:return: A list of paths
:rtype: list[tuple]
"""
if 0 == length:
... | [
"Gets",
"all",
"walks",
"under",
"a",
"given",
"length",
"starting",
"at",
"a",
"given",
"node"
] | pybel/pybel-tools | python | https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/selection/metapaths.py#L37-L55 | [
"def",
"get_walks_exhaustive",
"(",
"graph",
",",
"node",
",",
"length",
")",
":",
"if",
"0",
"==",
"length",
":",
"return",
"(",
"node",
",",
")",
",",
"return",
"tuple",
"(",
"(",
"node",
",",
"key",
")",
"+",
"path",
"for",
"neighbor",
"in",
"gr... | 3491adea0ac4ee60f57275ef72f9b73da6dbfe0c |
valid | match_simple_metapath | Matches a simple metapath starting at the given node
:param pybel.BELGraph graph: A BEL graph
:param tuple node: A BEL node
:param list[str] simple_metapath: A list of BEL Functions
:return: An iterable over paths from the node matching the metapath
:rtype: iter[tuple] | src/pybel_tools/selection/metapaths.py | def match_simple_metapath(graph, node, simple_metapath):
"""Matches a simple metapath starting at the given node
:param pybel.BELGraph graph: A BEL graph
:param tuple node: A BEL node
:param list[str] simple_metapath: A list of BEL Functions
:return: An iterable over paths from the node matching th... | def match_simple_metapath(graph, node, simple_metapath):
"""Matches a simple metapath starting at the given node
:param pybel.BELGraph graph: A BEL graph
:param tuple node: A BEL node
:param list[str] simple_metapath: A list of BEL Functions
:return: An iterable over paths from the node matching th... | [
"Matches",
"a",
"simple",
"metapath",
"starting",
"at",
"the",
"given",
"node"
] | pybel/pybel-tools | python | https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/selection/metapaths.py#L58-L75 | [
"def",
"match_simple_metapath",
"(",
"graph",
",",
"node",
",",
"simple_metapath",
")",
":",
"if",
"0",
"==",
"len",
"(",
"simple_metapath",
")",
":",
"yield",
"node",
",",
"else",
":",
"for",
"neighbor",
"in",
"graph",
".",
"edges",
"[",
"node",
"]",
... | 3491adea0ac4ee60f57275ef72f9b73da6dbfe0c |
valid | build_database | Build a database of scores for NeuroMMSig annotated graphs.
1. Get all networks that use the Subgraph annotation
2. run on each | src/pybel_tools/analysis/epicom/build.py | def build_database(manager: pybel.Manager, annotation_url: Optional[str] = None) -> None:
"""Build a database of scores for NeuroMMSig annotated graphs.
1. Get all networks that use the Subgraph annotation
2. run on each
"""
annotation_url = annotation_url or NEUROMMSIG_DEFAULT_URL
annotation ... | def build_database(manager: pybel.Manager, annotation_url: Optional[str] = None) -> None:
"""Build a database of scores for NeuroMMSig annotated graphs.
1. Get all networks that use the Subgraph annotation
2. run on each
"""
annotation_url = annotation_url or NEUROMMSIG_DEFAULT_URL
annotation ... | [
"Build",
"a",
"database",
"of",
"scores",
"for",
"NeuroMMSig",
"annotated",
"graphs",
"."
] | pybel/pybel-tools | python | https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/analysis/epicom/build.py#L38-L76 | [
"def",
"build_database",
"(",
"manager",
":",
"pybel",
".",
"Manager",
",",
"annotation_url",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
")",
"->",
"None",
":",
"annotation_url",
"=",
"annotation_url",
"or",
"NEUROMMSIG_DEFAULT_URL",
"annotation",
"=",
"ma... | 3491adea0ac4ee60f57275ef72f9b73da6dbfe0c |
valid | calculate_average_scores_on_graph | Calculate the scores over all biological processes in the sub-graph.
As an implementation, it simply computes the sub-graphs then calls :func:`calculate_average_scores_on_subgraphs` as
described in that function's documentation.
:param graph: A BEL graph with heats already on the nodes
:param key: The... | src/pybel_tools/analysis/heat.py | def calculate_average_scores_on_graph(
graph: BELGraph,
key: Optional[str] = None,
tag: Optional[str] = None,
default_score: Optional[float] = None,
runs: Optional[int] = None,
use_tqdm: bool = False,
):
"""Calculate the scores over all biological processes in the sub... | def calculate_average_scores_on_graph(
graph: BELGraph,
key: Optional[str] = None,
tag: Optional[str] = None,
default_score: Optional[float] = None,
runs: Optional[int] = None,
use_tqdm: bool = False,
):
"""Calculate the scores over all biological processes in the sub... | [
"Calculate",
"the",
"scores",
"over",
"all",
"biological",
"processes",
"in",
"the",
"sub",
"-",
"graph",
"."
] | pybel/pybel-tools | python | https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/analysis/heat.py#L111-L152 | [
"def",
"calculate_average_scores_on_graph",
"(",
"graph",
":",
"BELGraph",
",",
"key",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
",",
"tag",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
",",
"default_score",
":",
"Optional",
"[",
"float",
"]",
"="... | 3491adea0ac4ee60f57275ef72f9b73da6dbfe0c |
valid | calculate_average_scores_on_subgraphs | Calculate the scores over precomputed candidate mechanisms.
:param subgraphs: A dictionary of keys to their corresponding subgraphs
:param key: The key in the node data dictionary representing the experimental data. Defaults to
:data:`pybel_tools.constants.WEIGHT`.
:param tag: The key for the nodes' d... | src/pybel_tools/analysis/heat.py | def calculate_average_scores_on_subgraphs(
subgraphs: Mapping[H, BELGraph],
key: Optional[str] = None,
tag: Optional[str] = None,
default_score: Optional[float] = None,
runs: Optional[int] = None,
use_tqdm: bool = False,
tqdm_kwargs: Optional[Mapping[str, Any]] = ... | def calculate_average_scores_on_subgraphs(
subgraphs: Mapping[H, BELGraph],
key: Optional[str] = None,
tag: Optional[str] = None,
default_score: Optional[float] = None,
runs: Optional[int] = None,
use_tqdm: bool = False,
tqdm_kwargs: Optional[Mapping[str, Any]] = ... | [
"Calculate",
"the",
"scores",
"over",
"precomputed",
"candidate",
"mechanisms",
"."
] | pybel/pybel-tools | python | https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/analysis/heat.py#L158-L236 | [
"def",
"calculate_average_scores_on_subgraphs",
"(",
"subgraphs",
":",
"Mapping",
"[",
"H",
",",
"BELGraph",
"]",
",",
"key",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
",",
"tag",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
",",
"default_score",
... | 3491adea0ac4ee60f57275ef72f9b73da6dbfe0c |
valid | workflow | Generate candidate mechanisms and run the heat diffusion workflow.
:param graph: A BEL graph
:param node: The BEL node that is the focus of this analysis
:param key: The key in the node data dictionary representing the experimental data. Defaults to
:data:`pybel_tools.constants.WEIGHT`.
:param tag... | src/pybel_tools/analysis/heat.py | def workflow(
graph: BELGraph,
node: BaseEntity,
key: Optional[str] = None,
tag: Optional[str] = None,
default_score: Optional[float] = None,
runs: Optional[int] = None,
minimum_nodes: int = 1,
) -> List['Runner']:
"""Generate candidate mechanisms and run the ... | def workflow(
graph: BELGraph,
node: BaseEntity,
key: Optional[str] = None,
tag: Optional[str] = None,
default_score: Optional[float] = None,
runs: Optional[int] = None,
minimum_nodes: int = 1,
) -> List['Runner']:
"""Generate candidate mechanisms and run the ... | [
"Generate",
"candidate",
"mechanisms",
"and",
"run",
"the",
"heat",
"diffusion",
"workflow",
"."
] | pybel/pybel-tools | python | https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/analysis/heat.py#L239-L266 | [
"def",
"workflow",
"(",
"graph",
":",
"BELGraph",
",",
"node",
":",
"BaseEntity",
",",
"key",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
",",
"tag",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
",",
"default_score",
":",
"Optional",
"[",
"float... | 3491adea0ac4ee60f57275ef72f9b73da6dbfe0c |
valid | multirun | Run the heat diffusion workflow multiple times, each time yielding a :class:`Runner` object upon completion.
:param graph: A BEL graph
:param node: The BEL node that is the focus of this analysis
:param key: The key in the node data dictionary representing the experimental data. Defaults to
:data:`pyb... | src/pybel_tools/analysis/heat.py | def multirun(graph: BELGraph,
node: BaseEntity,
key: Optional[str] = None,
tag: Optional[str] = None,
default_score: Optional[float] = None,
runs: Optional[int] = None,
use_tqdm: bool = False,
) -> Iterable['Runner']:
"""Run ... | def multirun(graph: BELGraph,
node: BaseEntity,
key: Optional[str] = None,
tag: Optional[str] = None,
default_score: Optional[float] = None,
runs: Optional[int] = None,
use_tqdm: bool = False,
) -> Iterable['Runner']:
"""Run ... | [
"Run",
"the",
"heat",
"diffusion",
"workflow",
"multiple",
"times",
"each",
"time",
"yielding",
"a",
":",
"class",
":",
"Runner",
"object",
"upon",
"completion",
"."
] | pybel/pybel-tools | python | https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/analysis/heat.py#L269-L303 | [
"def",
"multirun",
"(",
"graph",
":",
"BELGraph",
",",
"node",
":",
"BaseEntity",
",",
"key",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
",",
"tag",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
",",
"default_score",
":",
"Optional",
"[",
"float... | 3491adea0ac4ee60f57275ef72f9b73da6dbfe0c |
valid | workflow_aggregate | Get the average score over multiple runs.
This function is very simple, and can be copied to do more interesting statistics over the :class:`Runner`
instances. To iterate over the runners themselves, see :func:`workflow`
:param graph: A BEL graph
:param node: The BEL node that is the focus of this ana... | src/pybel_tools/analysis/heat.py | def workflow_aggregate(graph: BELGraph,
node: BaseEntity,
key: Optional[str] = None,
tag: Optional[str] = None,
default_score: Optional[float] = None,
runs: Optional[int] = None,
agg... | def workflow_aggregate(graph: BELGraph,
node: BaseEntity,
key: Optional[str] = None,
tag: Optional[str] = None,
default_score: Optional[float] = None,
runs: Optional[int] = None,
agg... | [
"Get",
"the",
"average",
"score",
"over",
"multiple",
"runs",
"."
] | pybel/pybel-tools | python | https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/analysis/heat.py#L499-L533 | [
"def",
"workflow_aggregate",
"(",
"graph",
":",
"BELGraph",
",",
"node",
":",
"BaseEntity",
",",
"key",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
",",
"tag",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
",",
"default_score",
":",
"Optional",
"["... | 3491adea0ac4ee60f57275ef72f9b73da6dbfe0c |
valid | workflow_all | Run the heat diffusion workflow and get runners for every possible candidate mechanism
1. Get all biological processes
2. Get candidate mechanism induced two level back from each biological process
3. Heat diffusion workflow for each candidate mechanism for multiple runs
4. Return all runner results
... | src/pybel_tools/analysis/heat.py | def workflow_all(graph: BELGraph,
key: Optional[str] = None,
tag: Optional[str] = None,
default_score: Optional[float] = None,
runs: Optional[int] = None,
) -> Mapping[BaseEntity, List[Runner]]:
"""Run the heat diffusion workflow a... | def workflow_all(graph: BELGraph,
key: Optional[str] = None,
tag: Optional[str] = None,
default_score: Optional[float] = None,
runs: Optional[int] = None,
) -> Mapping[BaseEntity, List[Runner]]:
"""Run the heat diffusion workflow a... | [
"Run",
"the",
"heat",
"diffusion",
"workflow",
"and",
"get",
"runners",
"for",
"every",
"possible",
"candidate",
"mechanism"
] | pybel/pybel-tools | python | https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/analysis/heat.py#L536-L562 | [
"def",
"workflow_all",
"(",
"graph",
":",
"BELGraph",
",",
"key",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
",",
"tag",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
",",
"default_score",
":",
"Optional",
"[",
"float",
"]",
"=",
"None",
",",
... | 3491adea0ac4ee60f57275ef72f9b73da6dbfe0c |
valid | workflow_all_aggregate | Run the heat diffusion workflow to get average score for every possible candidate mechanism.
1. Get all biological processes
2. Get candidate mechanism induced two level back from each biological process
3. Heat diffusion workflow on each candidate mechanism for multiple runs
4. Report average scores f... | src/pybel_tools/analysis/heat.py | def workflow_all_aggregate(graph: BELGraph,
key: Optional[str] = None,
tag: Optional[str] = None,
default_score: Optional[float] = None,
runs: Optional[int] = None,
aggregator: Optional... | def workflow_all_aggregate(graph: BELGraph,
key: Optional[str] = None,
tag: Optional[str] = None,
default_score: Optional[float] = None,
runs: Optional[int] = None,
aggregator: Optional... | [
"Run",
"the",
"heat",
"diffusion",
"workflow",
"to",
"get",
"average",
"score",
"for",
"every",
"possible",
"candidate",
"mechanism",
"."
] | pybel/pybel-tools | python | https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/analysis/heat.py#L565-L609 | [
"def",
"workflow_all_aggregate",
"(",
"graph",
":",
"BELGraph",
",",
"key",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
",",
"tag",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
",",
"default_score",
":",
"Optional",
"[",
"float",
"]",
"=",
"None",... | 3491adea0ac4ee60f57275ef72f9b73da6dbfe0c |
valid | calculate_average_score_by_annotation | For each sub-graph induced over the edges matching the annotation, calculate the average score
for all of the contained biological processes
Assumes you haven't done anything yet
1. Generates biological process upstream candidate mechanistic sub-graphs with
:func:`generate_bioprocess_mechanisms`
... | src/pybel_tools/analysis/heat.py | def calculate_average_score_by_annotation(
graph: BELGraph,
annotation: str,
key: Optional[str] = None,
runs: Optional[int] = None,
use_tqdm: bool = False,
) -> Mapping[str, float]:
"""For each sub-graph induced over the edges matching the annotation, calculate the average sc... | def calculate_average_score_by_annotation(
graph: BELGraph,
annotation: str,
key: Optional[str] = None,
runs: Optional[int] = None,
use_tqdm: bool = False,
) -> Mapping[str, float]:
"""For each sub-graph induced over the edges matching the annotation, calculate the average sc... | [
"For",
"each",
"sub",
"-",
"graph",
"induced",
"over",
"the",
"edges",
"matching",
"the",
"annotation",
"calculate",
"the",
"average",
"score",
"for",
"all",
"of",
"the",
"contained",
"biological",
"processes"
] | pybel/pybel-tools | python | https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/analysis/heat.py#L613-L666 | [
"def",
"calculate_average_score_by_annotation",
"(",
"graph",
":",
"BELGraph",
",",
"annotation",
":",
"str",
",",
"key",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
",",
"runs",
":",
"Optional",
"[",
"int",
"]",
"=",
"None",
",",
"use_tqdm",
":",
"bo... | 3491adea0ac4ee60f57275ef72f9b73da6dbfe0c |
valid | Runner.iter_leaves | Return an iterable over all nodes that are leaves.
A node is a leaf if either:
- it doesn't have any predecessors, OR
- all of its predecessors have a score in their data dictionaries | src/pybel_tools/analysis/heat.py | def iter_leaves(self) -> Iterable[BaseEntity]:
"""Return an iterable over all nodes that are leaves.
A node is a leaf if either:
- it doesn't have any predecessors, OR
- all of its predecessors have a score in their data dictionaries
"""
for node in self.graph:
... | def iter_leaves(self) -> Iterable[BaseEntity]:
"""Return an iterable over all nodes that are leaves.
A node is a leaf if either:
- it doesn't have any predecessors, OR
- all of its predecessors have a score in their data dictionaries
"""
for node in self.graph:
... | [
"Return",
"an",
"iterable",
"over",
"all",
"nodes",
"that",
"are",
"leaves",
"."
] | pybel/pybel-tools | python | https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/analysis/heat.py#L336-L349 | [
"def",
"iter_leaves",
"(",
"self",
")",
"->",
"Iterable",
"[",
"BaseEntity",
"]",
":",
"for",
"node",
"in",
"self",
".",
"graph",
":",
"if",
"self",
".",
"tag",
"in",
"self",
".",
"graph",
".",
"nodes",
"[",
"node",
"]",
":",
"continue",
"if",
"not... | 3491adea0ac4ee60f57275ef72f9b73da6dbfe0c |
valid | Runner.in_out_ratio | Calculate the ratio of in-degree / out-degree of a node. | src/pybel_tools/analysis/heat.py | def in_out_ratio(self, node: BaseEntity) -> float:
"""Calculate the ratio of in-degree / out-degree of a node."""
return self.graph.in_degree(node) / float(self.graph.out_degree(node)) | def in_out_ratio(self, node: BaseEntity) -> float:
"""Calculate the ratio of in-degree / out-degree of a node."""
return self.graph.in_degree(node) / float(self.graph.out_degree(node)) | [
"Calculate",
"the",
"ratio",
"of",
"in",
"-",
"degree",
"/",
"out",
"-",
"degree",
"of",
"a",
"node",
"."
] | pybel/pybel-tools | python | https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/analysis/heat.py#L359-L361 | [
"def",
"in_out_ratio",
"(",
"self",
",",
"node",
":",
"BaseEntity",
")",
"->",
"float",
":",
"return",
"self",
".",
"graph",
".",
"in_degree",
"(",
"node",
")",
"/",
"float",
"(",
"self",
".",
"graph",
".",
"out_degree",
"(",
"node",
")",
")"
] | 3491adea0ac4ee60f57275ef72f9b73da6dbfe0c |
valid | Runner.unscored_nodes_iter | Iterate over all nodes without a score. | src/pybel_tools/analysis/heat.py | def unscored_nodes_iter(self) -> BaseEntity:
"""Iterate over all nodes without a score."""
for node, data in self.graph.nodes(data=True):
if self.tag not in data:
yield node | def unscored_nodes_iter(self) -> BaseEntity:
"""Iterate over all nodes without a score."""
for node, data in self.graph.nodes(data=True):
if self.tag not in data:
yield node | [
"Iterate",
"over",
"all",
"nodes",
"without",
"a",
"score",
"."
] | pybel/pybel-tools | python | https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/analysis/heat.py#L363-L367 | [
"def",
"unscored_nodes_iter",
"(",
"self",
")",
"->",
"BaseEntity",
":",
"for",
"node",
",",
"data",
"in",
"self",
".",
"graph",
".",
"nodes",
"(",
"data",
"=",
"True",
")",
":",
"if",
"self",
".",
"tag",
"not",
"in",
"data",
":",
"yield",
"node"
] | 3491adea0ac4ee60f57275ef72f9b73da6dbfe0c |
valid | Runner.get_random_edge | This function should be run when there are no leaves, but there are still unscored nodes. It will introduce
a probabilistic element to the algorithm, where some edges are disregarded randomly to eventually get a score
for the network. This means that the score can be averaged over many runs for a given ... | src/pybel_tools/analysis/heat.py | def get_random_edge(self):
"""This function should be run when there are no leaves, but there are still unscored nodes. It will introduce
a probabilistic element to the algorithm, where some edges are disregarded randomly to eventually get a score
for the network. This means that the score can b... | def get_random_edge(self):
"""This function should be run when there are no leaves, but there are still unscored nodes. It will introduce
a probabilistic element to the algorithm, where some edges are disregarded randomly to eventually get a score
for the network. This means that the score can b... | [
"This",
"function",
"should",
"be",
"run",
"when",
"there",
"are",
"no",
"leaves",
"but",
"there",
"are",
"still",
"unscored",
"nodes",
".",
"It",
"will",
"introduce",
"a",
"probabilistic",
"element",
"to",
"the",
"algorithm",
"where",
"some",
"edges",
"are"... | pybel/pybel-tools | python | https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/analysis/heat.py#L369-L399 | [
"def",
"get_random_edge",
"(",
"self",
")",
":",
"nodes",
"=",
"[",
"(",
"n",
",",
"self",
".",
"in_out_ratio",
"(",
"n",
")",
")",
"for",
"n",
"in",
"self",
".",
"unscored_nodes_iter",
"(",
")",
"if",
"n",
"!=",
"self",
".",
"target_node",
"]",
"n... | 3491adea0ac4ee60f57275ef72f9b73da6dbfe0c |
valid | Runner.remove_random_edge | Remove a random in-edge from the node with the lowest in/out degree ratio. | src/pybel_tools/analysis/heat.py | def remove_random_edge(self):
"""Remove a random in-edge from the node with the lowest in/out degree ratio."""
u, v, k = self.get_random_edge()
log.log(5, 'removing %s, %s (%s)', u, v, k)
self.graph.remove_edge(u, v, k) | def remove_random_edge(self):
"""Remove a random in-edge from the node with the lowest in/out degree ratio."""
u, v, k = self.get_random_edge()
log.log(5, 'removing %s, %s (%s)', u, v, k)
self.graph.remove_edge(u, v, k) | [
"Remove",
"a",
"random",
"in",
"-",
"edge",
"from",
"the",
"node",
"with",
"the",
"lowest",
"in",
"/",
"out",
"degree",
"ratio",
"."
] | pybel/pybel-tools | python | https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/analysis/heat.py#L401-L405 | [
"def",
"remove_random_edge",
"(",
"self",
")",
":",
"u",
",",
"v",
",",
"k",
"=",
"self",
".",
"get_random_edge",
"(",
")",
"log",
".",
"log",
"(",
"5",
",",
"'removing %s, %s (%s)'",
",",
"u",
",",
"v",
",",
"k",
")",
"self",
".",
"graph",
".",
... | 3491adea0ac4ee60f57275ef72f9b73da6dbfe0c |
valid | Runner.remove_random_edge_until_has_leaves | Remove random edges until there is at least one leaf node. | src/pybel_tools/analysis/heat.py | def remove_random_edge_until_has_leaves(self) -> None:
"""Remove random edges until there is at least one leaf node."""
while True:
leaves = set(self.iter_leaves())
if leaves:
return
self.remove_random_edge() | def remove_random_edge_until_has_leaves(self) -> None:
"""Remove random edges until there is at least one leaf node."""
while True:
leaves = set(self.iter_leaves())
if leaves:
return
self.remove_random_edge() | [
"Remove",
"random",
"edges",
"until",
"there",
"is",
"at",
"least",
"one",
"leaf",
"node",
"."
] | pybel/pybel-tools | python | https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/analysis/heat.py#L407-L413 | [
"def",
"remove_random_edge_until_has_leaves",
"(",
"self",
")",
"->",
"None",
":",
"while",
"True",
":",
"leaves",
"=",
"set",
"(",
"self",
".",
"iter_leaves",
"(",
")",
")",
"if",
"leaves",
":",
"return",
"self",
".",
"remove_random_edge",
"(",
")"
] | 3491adea0ac4ee60f57275ef72f9b73da6dbfe0c |
valid | Runner.score_leaves | Calculate the score for all leaves.
:return: The set of leaf nodes that were scored | src/pybel_tools/analysis/heat.py | def score_leaves(self) -> Set[BaseEntity]:
"""Calculate the score for all leaves.
:return: The set of leaf nodes that were scored
"""
leaves = set(self.iter_leaves())
if not leaves:
log.warning('no leaves.')
return set()
for leaf in leaves:
... | def score_leaves(self) -> Set[BaseEntity]:
"""Calculate the score for all leaves.
:return: The set of leaf nodes that were scored
"""
leaves = set(self.iter_leaves())
if not leaves:
log.warning('no leaves.')
return set()
for leaf in leaves:
... | [
"Calculate",
"the",
"score",
"for",
"all",
"leaves",
"."
] | pybel/pybel-tools | python | https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/analysis/heat.py#L415-L430 | [
"def",
"score_leaves",
"(",
"self",
")",
"->",
"Set",
"[",
"BaseEntity",
"]",
":",
"leaves",
"=",
"set",
"(",
"self",
".",
"iter_leaves",
"(",
")",
")",
"if",
"not",
"leaves",
":",
"log",
".",
"warning",
"(",
"'no leaves.'",
")",
"return",
"set",
"("... | 3491adea0ac4ee60f57275ef72f9b73da6dbfe0c |
valid | Runner.run_with_graph_transformation | Calculate scores for all leaves until there are none, removes edges until there are, and repeats until
all nodes have been scored. Also, yields the current graph at every step so you can make a cool animation
of how the graph changes throughout the course of the algorithm
:return: An iterable o... | src/pybel_tools/analysis/heat.py | def run_with_graph_transformation(self) -> Iterable[BELGraph]:
"""Calculate scores for all leaves until there are none, removes edges until there are, and repeats until
all nodes have been scored. Also, yields the current graph at every step so you can make a cool animation
of how the graph chan... | def run_with_graph_transformation(self) -> Iterable[BELGraph]:
"""Calculate scores for all leaves until there are none, removes edges until there are, and repeats until
all nodes have been scored. Also, yields the current graph at every step so you can make a cool animation
of how the graph chan... | [
"Calculate",
"scores",
"for",
"all",
"leaves",
"until",
"there",
"are",
"none",
"removes",
"edges",
"until",
"there",
"are",
"and",
"repeats",
"until",
"all",
"nodes",
"have",
"been",
"scored",
".",
"Also",
"yields",
"the",
"current",
"graph",
"at",
"every",... | pybel/pybel-tools | python | https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/analysis/heat.py#L440-L453 | [
"def",
"run_with_graph_transformation",
"(",
"self",
")",
"->",
"Iterable",
"[",
"BELGraph",
"]",
":",
"yield",
"self",
".",
"get_remaining_graph",
"(",
")",
"while",
"not",
"self",
".",
"done_chomping",
"(",
")",
":",
"while",
"not",
"list",
"(",
"self",
... | 3491adea0ac4ee60f57275ef72f9b73da6dbfe0c |
valid | Runner.done_chomping | Determines if the algorithm is complete by checking if the target node of this analysis has been scored
yet. Because the algorithm removes edges when it gets stuck until it is un-stuck, it is always guaranteed to
finish.
:return: Is the algorithm done running? | src/pybel_tools/analysis/heat.py | def done_chomping(self) -> bool:
"""Determines if the algorithm is complete by checking if the target node of this analysis has been scored
yet. Because the algorithm removes edges when it gets stuck until it is un-stuck, it is always guaranteed to
finish.
:return: Is the algorithm done... | def done_chomping(self) -> bool:
"""Determines if the algorithm is complete by checking if the target node of this analysis has been scored
yet. Because the algorithm removes edges when it gets stuck until it is un-stuck, it is always guaranteed to
finish.
:return: Is the algorithm done... | [
"Determines",
"if",
"the",
"algorithm",
"is",
"complete",
"by",
"checking",
"if",
"the",
"target",
"node",
"of",
"this",
"analysis",
"has",
"been",
"scored",
"yet",
".",
"Because",
"the",
"algorithm",
"removes",
"edges",
"when",
"it",
"gets",
"stuck",
"until... | pybel/pybel-tools | python | https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/analysis/heat.py#L455-L462 | [
"def",
"done_chomping",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"self",
".",
"tag",
"in",
"self",
".",
"graph",
".",
"nodes",
"[",
"self",
".",
"target_node",
"]"
] | 3491adea0ac4ee60f57275ef72f9b73da6dbfe0c |
valid | Runner.get_final_score | Return the final score for the target node.
:return: The final score for the target node | src/pybel_tools/analysis/heat.py | def get_final_score(self) -> float:
"""Return the final score for the target node.
:return: The final score for the target node
"""
if not self.done_chomping():
raise ValueError('algorithm has not yet completed')
return self.graph.nodes[self.target_node][self.tag] | def get_final_score(self) -> float:
"""Return the final score for the target node.
:return: The final score for the target node
"""
if not self.done_chomping():
raise ValueError('algorithm has not yet completed')
return self.graph.nodes[self.target_node][self.tag] | [
"Return",
"the",
"final",
"score",
"for",
"the",
"target",
"node",
"."
] | pybel/pybel-tools | python | https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/analysis/heat.py#L464-L472 | [
"def",
"get_final_score",
"(",
"self",
")",
"->",
"float",
":",
"if",
"not",
"self",
".",
"done_chomping",
"(",
")",
":",
"raise",
"ValueError",
"(",
"'algorithm has not yet completed'",
")",
"return",
"self",
".",
"graph",
".",
"nodes",
"[",
"self",
".",
... | 3491adea0ac4ee60f57275ef72f9b73da6dbfe0c |
valid | Runner.calculate_score | Calculate the new score of the given node. | src/pybel_tools/analysis/heat.py | def calculate_score(self, node: BaseEntity) -> float:
"""Calculate the new score of the given node."""
score = (
self.graph.nodes[node][self.tag]
if self.tag in self.graph.nodes[node] else
self.default_score
)
for predecessor, _, d in self.graph.in_ed... | def calculate_score(self, node: BaseEntity) -> float:
"""Calculate the new score of the given node."""
score = (
self.graph.nodes[node][self.tag]
if self.tag in self.graph.nodes[node] else
self.default_score
)
for predecessor, _, d in self.graph.in_ed... | [
"Calculate",
"the",
"new",
"score",
"of",
"the",
"given",
"node",
"."
] | pybel/pybel-tools | python | https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/analysis/heat.py#L474-L488 | [
"def",
"calculate_score",
"(",
"self",
",",
"node",
":",
"BaseEntity",
")",
"->",
"float",
":",
"score",
"=",
"(",
"self",
".",
"graph",
".",
"nodes",
"[",
"node",
"]",
"[",
"self",
".",
"tag",
"]",
"if",
"self",
".",
"tag",
"in",
"self",
".",
"g... | 3491adea0ac4ee60f57275ef72f9b73da6dbfe0c |
valid | microcanonical_statistics_dtype | Return the numpy structured array data type for sample states
Helper function
Parameters
----------
spanning_cluster : bool, optional
Whether to detect a spanning cluster or not.
Defaults to ``True``.
Returns
-------
ret : list of pairs of str
A list of tuples of f... | percolate/hpc.py | def microcanonical_statistics_dtype(spanning_cluster=True):
"""
Return the numpy structured array data type for sample states
Helper function
Parameters
----------
spanning_cluster : bool, optional
Whether to detect a spanning cluster or not.
Defaults to ``True``.
Returns
... | def microcanonical_statistics_dtype(spanning_cluster=True):
"""
Return the numpy structured array data type for sample states
Helper function
Parameters
----------
spanning_cluster : bool, optional
Whether to detect a spanning cluster or not.
Defaults to ``True``.
Returns
... | [
"Return",
"the",
"numpy",
"structured",
"array",
"data",
"type",
"for",
"sample",
"states"
] | andsor/pypercolate | python | https://github.com/andsor/pypercolate/blob/92478c1fc4d4ff5ae157f7607fd74f6f9ec360ac/percolate/hpc.py#L34-L70 | [
"def",
"microcanonical_statistics_dtype",
"(",
"spanning_cluster",
"=",
"True",
")",
":",
"fields",
"=",
"list",
"(",
")",
"fields",
".",
"extend",
"(",
"[",
"(",
"'n'",
",",
"'uint32'",
")",
",",
"(",
"'edge'",
",",
"'uint32'",
")",
",",
"]",
")",
"if... | 92478c1fc4d4ff5ae157f7607fd74f6f9ec360ac |
valid | bond_sample_states | Generate successive sample states of the bond percolation model
This is a :ref:`generator function <python:tut-generators>` to successively
add one edge at a time from the graph to the percolation model.
At each iteration, it calculates and returns the cluster statistics.
CAUTION: it returns a referenc... | percolate/hpc.py | def bond_sample_states(
perc_graph, num_nodes, num_edges, seed, spanning_cluster=True,
auxiliary_node_attributes=None, auxiliary_edge_attributes=None,
spanning_sides=None,
**kwargs
):
'''
Generate successive sample states of the bond percolation model
This is a :ref:`generator function <pyt... | def bond_sample_states(
perc_graph, num_nodes, num_edges, seed, spanning_cluster=True,
auxiliary_node_attributes=None, auxiliary_edge_attributes=None,
spanning_sides=None,
**kwargs
):
'''
Generate successive sample states of the bond percolation model
This is a :ref:`generator function <pyt... | [
"Generate",
"successive",
"sample",
"states",
"of",
"the",
"bond",
"percolation",
"model"
] | andsor/pypercolate | python | https://github.com/andsor/pypercolate/blob/92478c1fc4d4ff5ae157f7607fd74f6f9ec360ac/percolate/hpc.py#L73-L307 | [
"def",
"bond_sample_states",
"(",
"perc_graph",
",",
"num_nodes",
",",
"num_edges",
",",
"seed",
",",
"spanning_cluster",
"=",
"True",
",",
"auxiliary_node_attributes",
"=",
"None",
",",
"auxiliary_edge_attributes",
"=",
"None",
",",
"spanning_sides",
"=",
"None",
... | 92478c1fc4d4ff5ae157f7607fd74f6f9ec360ac |
valid | bond_microcanonical_statistics | Evolve a single run over all microstates (bond occupation numbers)
Return the cluster statistics for each microstate
Parameters
----------
perc_graph : networkx.Graph
The substrate graph on which percolation is to take place
num_nodes : int
Number ``N`` of sites in the graph
... | percolate/hpc.py | def bond_microcanonical_statistics(
perc_graph, num_nodes, num_edges, seed,
spanning_cluster=True,
auxiliary_node_attributes=None, auxiliary_edge_attributes=None,
spanning_sides=None,
**kwargs
):
"""
Evolve a single run over all microstates (bond occupation numbers)
Return the cluster s... | def bond_microcanonical_statistics(
perc_graph, num_nodes, num_edges, seed,
spanning_cluster=True,
auxiliary_node_attributes=None, auxiliary_edge_attributes=None,
spanning_sides=None,
**kwargs
):
"""
Evolve a single run over all microstates (bond occupation numbers)
Return the cluster s... | [
"Evolve",
"a",
"single",
"run",
"over",
"all",
"microstates",
"(",
"bond",
"occupation",
"numbers",
")"
] | andsor/pypercolate | python | https://github.com/andsor/pypercolate/blob/92478c1fc4d4ff5ae157f7607fd74f6f9ec360ac/percolate/hpc.py#L310-L404 | [
"def",
"bond_microcanonical_statistics",
"(",
"perc_graph",
",",
"num_nodes",
",",
"num_edges",
",",
"seed",
",",
"spanning_cluster",
"=",
"True",
",",
"auxiliary_node_attributes",
"=",
"None",
",",
"auxiliary_edge_attributes",
"=",
"None",
",",
"spanning_sides",
"=",... | 92478c1fc4d4ff5ae157f7607fd74f6f9ec360ac |
valid | canonical_statistics_dtype | The NumPy Structured Array type for canonical statistics
Helper function
Parameters
----------
spanning_cluster : bool, optional
Whether to detect a spanning cluster or not.
Defaults to ``True``.
Returns
-------
ret : list of pairs of str
A list of tuples of field ... | percolate/hpc.py | def canonical_statistics_dtype(spanning_cluster=True):
"""
The NumPy Structured Array type for canonical statistics
Helper function
Parameters
----------
spanning_cluster : bool, optional
Whether to detect a spanning cluster or not.
Defaults to ``True``.
Returns
------... | def canonical_statistics_dtype(spanning_cluster=True):
"""
The NumPy Structured Array type for canonical statistics
Helper function
Parameters
----------
spanning_cluster : bool, optional
Whether to detect a spanning cluster or not.
Defaults to ``True``.
Returns
------... | [
"The",
"NumPy",
"Structured",
"Array",
"type",
"for",
"canonical",
"statistics"
] | andsor/pypercolate | python | https://github.com/andsor/pypercolate/blob/92478c1fc4d4ff5ae157f7607fd74f6f9ec360ac/percolate/hpc.py#L407-L440 | [
"def",
"canonical_statistics_dtype",
"(",
"spanning_cluster",
"=",
"True",
")",
":",
"fields",
"=",
"list",
"(",
")",
"if",
"spanning_cluster",
":",
"fields",
".",
"extend",
"(",
"[",
"(",
"'percolation_probability'",
",",
"'float64'",
")",
",",
"]",
")",
"f... | 92478c1fc4d4ff5ae157f7607fd74f6f9ec360ac |
valid | bond_canonical_statistics | canonical cluster statistics for a single run and a single probability
Parameters
----------
microcanonical_statistics : ndarray
Return value of `bond_microcanonical_statistics`
convolution_factors : 1-D array_like
The coefficients of the convolution for the given probabilty ``p``
... | percolate/hpc.py | def bond_canonical_statistics(
microcanonical_statistics,
convolution_factors,
**kwargs
):
"""
canonical cluster statistics for a single run and a single probability
Parameters
----------
microcanonical_statistics : ndarray
Return value of `bond_microcanonical_statistics`
... | def bond_canonical_statistics(
microcanonical_statistics,
convolution_factors,
**kwargs
):
"""
canonical cluster statistics for a single run and a single probability
Parameters
----------
microcanonical_statistics : ndarray
Return value of `bond_microcanonical_statistics`
... | [
"canonical",
"cluster",
"statistics",
"for",
"a",
"single",
"run",
"and",
"a",
"single",
"probability"
] | andsor/pypercolate | python | https://github.com/andsor/pypercolate/blob/92478c1fc4d4ff5ae157f7607fd74f6f9ec360ac/percolate/hpc.py#L443-L515 | [
"def",
"bond_canonical_statistics",
"(",
"microcanonical_statistics",
",",
"convolution_factors",
",",
"*",
"*",
"kwargs",
")",
":",
"# initialize return array",
"spanning_cluster",
"=",
"(",
"'has_spanning_cluster'",
"in",
"microcanonical_statistics",
".",
"dtype",
".",
... | 92478c1fc4d4ff5ae157f7607fd74f6f9ec360ac |
valid | canonical_averages_dtype | The NumPy Structured Array type for canonical averages over several
runs
Helper function
Parameters
----------
spanning_cluster : bool, optional
Whether to detect a spanning cluster or not.
Defaults to ``True``.
Returns
-------
ret : list of pairs of str
A list... | percolate/hpc.py | def canonical_averages_dtype(spanning_cluster=True):
"""
The NumPy Structured Array type for canonical averages over several
runs
Helper function
Parameters
----------
spanning_cluster : bool, optional
Whether to detect a spanning cluster or not.
Defaults to ``True``.
... | def canonical_averages_dtype(spanning_cluster=True):
"""
The NumPy Structured Array type for canonical averages over several
runs
Helper function
Parameters
----------
spanning_cluster : bool, optional
Whether to detect a spanning cluster or not.
Defaults to ``True``.
... | [
"The",
"NumPy",
"Structured",
"Array",
"type",
"for",
"canonical",
"averages",
"over",
"several",
"runs"
] | andsor/pypercolate | python | https://github.com/andsor/pypercolate/blob/92478c1fc4d4ff5ae157f7607fd74f6f9ec360ac/percolate/hpc.py#L518-L558 | [
"def",
"canonical_averages_dtype",
"(",
"spanning_cluster",
"=",
"True",
")",
":",
"fields",
"=",
"list",
"(",
")",
"fields",
".",
"extend",
"(",
"[",
"(",
"'number_of_runs'",
",",
"'uint32'",
")",
",",
"]",
")",
"if",
"spanning_cluster",
":",
"fields",
".... | 92478c1fc4d4ff5ae157f7607fd74f6f9ec360ac |
valid | bond_initialize_canonical_averages | Initialize the canonical averages from a single-run cluster statistics
Parameters
----------
canonical_statistics : 1-D structured ndarray
Typically contains the canonical statistics for a range of values
of the occupation probability ``p``.
The dtype is the result of `canonical_sta... | percolate/hpc.py | def bond_initialize_canonical_averages(
canonical_statistics, **kwargs
):
"""
Initialize the canonical averages from a single-run cluster statistics
Parameters
----------
canonical_statistics : 1-D structured ndarray
Typically contains the canonical statistics for a range of values
... | def bond_initialize_canonical_averages(
canonical_statistics, **kwargs
):
"""
Initialize the canonical averages from a single-run cluster statistics
Parameters
----------
canonical_statistics : 1-D structured ndarray
Typically contains the canonical statistics for a range of values
... | [
"Initialize",
"the",
"canonical",
"averages",
"from",
"a",
"single",
"-",
"run",
"cluster",
"statistics"
] | andsor/pypercolate | python | https://github.com/andsor/pypercolate/blob/92478c1fc4d4ff5ae157f7607fd74f6f9ec360ac/percolate/hpc.py#L561-L635 | [
"def",
"bond_initialize_canonical_averages",
"(",
"canonical_statistics",
",",
"*",
"*",
"kwargs",
")",
":",
"# initialize return array",
"spanning_cluster",
"=",
"(",
"'percolation_probability'",
"in",
"canonical_statistics",
".",
"dtype",
".",
"names",
")",
"# array sho... | 92478c1fc4d4ff5ae157f7607fd74f6f9ec360ac |
valid | bond_reduce | Reduce the canonical averages over several runs
This is a "true" reducer.
It is associative and commutative.
This is a wrapper around `simoa.stats.online_variance`.
Parameters
----------
row_a, row_b : structured ndarrays
Output of this function, or initial input from
`bond_in... | percolate/hpc.py | def bond_reduce(row_a, row_b):
"""
Reduce the canonical averages over several runs
This is a "true" reducer.
It is associative and commutative.
This is a wrapper around `simoa.stats.online_variance`.
Parameters
----------
row_a, row_b : structured ndarrays
Output of this funct... | def bond_reduce(row_a, row_b):
"""
Reduce the canonical averages over several runs
This is a "true" reducer.
It is associative and commutative.
This is a wrapper around `simoa.stats.online_variance`.
Parameters
----------
row_a, row_b : structured ndarrays
Output of this funct... | [
"Reduce",
"the",
"canonical",
"averages",
"over",
"several",
"runs"
] | andsor/pypercolate | python | https://github.com/andsor/pypercolate/blob/92478c1fc4d4ff5ae157f7607fd74f6f9ec360ac/percolate/hpc.py#L638-L702 | [
"def",
"bond_reduce",
"(",
"row_a",
",",
"row_b",
")",
":",
"spanning_cluster",
"=",
"(",
"'percolation_probability_mean'",
"in",
"row_a",
".",
"dtype",
".",
"names",
"and",
"'percolation_probability_mean'",
"in",
"row_b",
".",
"dtype",
".",
"names",
"and",
"'pe... | 92478c1fc4d4ff5ae157f7607fd74f6f9ec360ac |
valid | finalized_canonical_averages_dtype | The NumPy Structured Array type for finalized canonical averages over
several runs
Helper function
Parameters
----------
spanning_cluster : bool, optional
Whether to detect a spanning cluster or not.
Defaults to ``True``.
Returns
-------
ret : list of pairs of str
... | percolate/hpc.py | def finalized_canonical_averages_dtype(spanning_cluster=True):
"""
The NumPy Structured Array type for finalized canonical averages over
several runs
Helper function
Parameters
----------
spanning_cluster : bool, optional
Whether to detect a spanning cluster or not.
Default... | def finalized_canonical_averages_dtype(spanning_cluster=True):
"""
The NumPy Structured Array type for finalized canonical averages over
several runs
Helper function
Parameters
----------
spanning_cluster : bool, optional
Whether to detect a spanning cluster or not.
Default... | [
"The",
"NumPy",
"Structured",
"Array",
"type",
"for",
"finalized",
"canonical",
"averages",
"over",
"several",
"runs"
] | andsor/pypercolate | python | https://github.com/andsor/pypercolate/blob/92478c1fc4d4ff5ae157f7607fd74f6f9ec360ac/percolate/hpc.py#L705-L749 | [
"def",
"finalized_canonical_averages_dtype",
"(",
"spanning_cluster",
"=",
"True",
")",
":",
"fields",
"=",
"list",
"(",
")",
"fields",
".",
"extend",
"(",
"[",
"(",
"'number_of_runs'",
",",
"'uint32'",
")",
",",
"(",
"'p'",
",",
"'float64'",
")",
",",
"("... | 92478c1fc4d4ff5ae157f7607fd74f6f9ec360ac |
valid | finalize_canonical_averages | Finalize canonical averages | percolate/hpc.py | def finalize_canonical_averages(
number_of_nodes, ps, canonical_averages, alpha,
):
"""
Finalize canonical averages
"""
spanning_cluster = (
(
'percolation_probability_mean' in
canonical_averages.dtype.names
) and
'percolation_probability_m2' in canon... | def finalize_canonical_averages(
number_of_nodes, ps, canonical_averages, alpha,
):
"""
Finalize canonical averages
"""
spanning_cluster = (
(
'percolation_probability_mean' in
canonical_averages.dtype.names
) and
'percolation_probability_m2' in canon... | [
"Finalize",
"canonical",
"averages"
] | andsor/pypercolate | python | https://github.com/andsor/pypercolate/blob/92478c1fc4d4ff5ae157f7607fd74f6f9ec360ac/percolate/hpc.py#L752-L834 | [
"def",
"finalize_canonical_averages",
"(",
"number_of_nodes",
",",
"ps",
",",
"canonical_averages",
",",
"alpha",
",",
")",
":",
"spanning_cluster",
"=",
"(",
"(",
"'percolation_probability_mean'",
"in",
"canonical_averages",
".",
"dtype",
".",
"names",
")",
"and",
... | 92478c1fc4d4ff5ae157f7607fd74f6f9ec360ac |
valid | compare | Compare generated mechanisms to actual ones.
1. Generates candidate mechanisms for each biological process
2. Gets sub-graphs for all NeuroMMSig signatures
3. Make tanimoto similarity comparison for all sets
:return: A dictionary table comparing the canonical subgraphs to generated ones | src/pybel_tools/analysis/mechanisms.py | def compare(graph: BELGraph, annotation: str = 'Subgraph') -> Mapping[str, Mapping[str, float]]:
"""Compare generated mechanisms to actual ones.
1. Generates candidate mechanisms for each biological process
2. Gets sub-graphs for all NeuroMMSig signatures
3. Make tanimoto similarity comparison for all ... | def compare(graph: BELGraph, annotation: str = 'Subgraph') -> Mapping[str, Mapping[str, float]]:
"""Compare generated mechanisms to actual ones.
1. Generates candidate mechanisms for each biological process
2. Gets sub-graphs for all NeuroMMSig signatures
3. Make tanimoto similarity comparison for all ... | [
"Compare",
"generated",
"mechanisms",
"to",
"actual",
"ones",
"."
] | pybel/pybel-tools | python | https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/analysis/mechanisms.py#L19-L41 | [
"def",
"compare",
"(",
"graph",
":",
"BELGraph",
",",
"annotation",
":",
"str",
"=",
"'Subgraph'",
")",
"->",
"Mapping",
"[",
"str",
",",
"Mapping",
"[",
"str",
",",
"float",
"]",
"]",
":",
"canonical_mechanisms",
"=",
"get_subgraphs_by_annotation",
"(",
"... | 3491adea0ac4ee60f57275ef72f9b73da6dbfe0c |
valid | summarize_node_filter | Print a summary of the number of nodes passing a given set of filters.
:param graph: A BEL graph
:param node_filters: A node filter or list/tuple of node filters | src/pybel_tools/filters/node_filters.py | def summarize_node_filter(graph: BELGraph, node_filters: NodePredicates) -> None:
"""Print a summary of the number of nodes passing a given set of filters.
:param graph: A BEL graph
:param node_filters: A node filter or list/tuple of node filters
"""
passed = count_passed_node_filter(graph, node_fi... | def summarize_node_filter(graph: BELGraph, node_filters: NodePredicates) -> None:
"""Print a summary of the number of nodes passing a given set of filters.
:param graph: A BEL graph
:param node_filters: A node filter or list/tuple of node filters
"""
passed = count_passed_node_filter(graph, node_fi... | [
"Print",
"a",
"summary",
"of",
"the",
"number",
"of",
"nodes",
"passing",
"a",
"given",
"set",
"of",
"filters",
"."
] | pybel/pybel-tools | python | https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/filters/node_filters.py#L39-L46 | [
"def",
"summarize_node_filter",
"(",
"graph",
":",
"BELGraph",
",",
"node_filters",
":",
"NodePredicates",
")",
"->",
"None",
":",
"passed",
"=",
"count_passed_node_filter",
"(",
"graph",
",",
"node_filters",
")",
"print",
"(",
"'{}/{} nodes passed'",
".",
"format... | 3491adea0ac4ee60f57275ef72f9b73da6dbfe0c |
valid | node_inclusion_filter_builder | Build a filter that only passes on nodes in the given list.
:param nodes: An iterable of BEL nodes | src/pybel_tools/filters/node_filters.py | def node_inclusion_filter_builder(nodes: Iterable[BaseEntity]) -> NodePredicate:
"""Build a filter that only passes on nodes in the given list.
:param nodes: An iterable of BEL nodes
"""
node_set = set(nodes)
def inclusion_filter(_: BELGraph, node: BaseEntity) -> bool:
"""Pass only for a n... | def node_inclusion_filter_builder(nodes: Iterable[BaseEntity]) -> NodePredicate:
"""Build a filter that only passes on nodes in the given list.
:param nodes: An iterable of BEL nodes
"""
node_set = set(nodes)
def inclusion_filter(_: BELGraph, node: BaseEntity) -> bool:
"""Pass only for a n... | [
"Build",
"a",
"filter",
"that",
"only",
"passes",
"on",
"nodes",
"in",
"the",
"given",
"list",
"."
] | pybel/pybel-tools | python | https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/filters/node_filters.py#L51-L65 | [
"def",
"node_inclusion_filter_builder",
"(",
"nodes",
":",
"Iterable",
"[",
"BaseEntity",
"]",
")",
"->",
"NodePredicate",
":",
"node_set",
"=",
"set",
"(",
"nodes",
")",
"def",
"inclusion_filter",
"(",
"_",
":",
"BELGraph",
",",
"node",
":",
"BaseEntity",
"... | 3491adea0ac4ee60f57275ef72f9b73da6dbfe0c |
valid | node_exclusion_filter_builder | Build a filter that fails on nodes in the given list. | src/pybel_tools/filters/node_filters.py | def node_exclusion_filter_builder(nodes: Iterable[BaseEntity]) -> NodePredicate:
"""Build a filter that fails on nodes in the given list."""
node_set = set(nodes)
def exclusion_filter(_: BELGraph, node: BaseEntity) -> bool:
"""Pass only for a node that isn't in the enclosed node list
:retu... | def node_exclusion_filter_builder(nodes: Iterable[BaseEntity]) -> NodePredicate:
"""Build a filter that fails on nodes in the given list."""
node_set = set(nodes)
def exclusion_filter(_: BELGraph, node: BaseEntity) -> bool:
"""Pass only for a node that isn't in the enclosed node list
:retu... | [
"Build",
"a",
"filter",
"that",
"fails",
"on",
"nodes",
"in",
"the",
"given",
"list",
"."
] | pybel/pybel-tools | python | https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/filters/node_filters.py#L68-L79 | [
"def",
"node_exclusion_filter_builder",
"(",
"nodes",
":",
"Iterable",
"[",
"BaseEntity",
"]",
")",
"->",
"NodePredicate",
":",
"node_set",
"=",
"set",
"(",
"nodes",
")",
"def",
"exclusion_filter",
"(",
"_",
":",
"BELGraph",
",",
"node",
":",
"BaseEntity",
"... | 3491adea0ac4ee60f57275ef72f9b73da6dbfe0c |
valid | function_exclusion_filter_builder | Build a filter that fails on nodes of the given function(s).
:param func: A BEL Function or list/set/tuple of BEL functions | src/pybel_tools/filters/node_filters.py | def function_exclusion_filter_builder(func: Strings) -> NodePredicate:
"""Build a filter that fails on nodes of the given function(s).
:param func: A BEL Function or list/set/tuple of BEL functions
"""
if isinstance(func, str):
def function_exclusion_filter(_: BELGraph, node: BaseEntity) -> boo... | def function_exclusion_filter_builder(func: Strings) -> NodePredicate:
"""Build a filter that fails on nodes of the given function(s).
:param func: A BEL Function or list/set/tuple of BEL functions
"""
if isinstance(func, str):
def function_exclusion_filter(_: BELGraph, node: BaseEntity) -> boo... | [
"Build",
"a",
"filter",
"that",
"fails",
"on",
"nodes",
"of",
"the",
"given",
"function",
"(",
"s",
")",
"."
] | pybel/pybel-tools | python | https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/filters/node_filters.py#L120-L147 | [
"def",
"function_exclusion_filter_builder",
"(",
"func",
":",
"Strings",
")",
"->",
"NodePredicate",
":",
"if",
"isinstance",
"(",
"func",
",",
"str",
")",
":",
"def",
"function_exclusion_filter",
"(",
"_",
":",
"BELGraph",
",",
"node",
":",
"BaseEntity",
")",... | 3491adea0ac4ee60f57275ef72f9b73da6dbfe0c |
valid | function_namespace_inclusion_builder | Build a filter function for matching the given BEL function with the given namespace or namespaces.
:param func: A BEL function
:param namespace: The namespace to search by | src/pybel_tools/filters/node_filters.py | def function_namespace_inclusion_builder(func: str, namespace: Strings) -> NodePredicate:
"""Build a filter function for matching the given BEL function with the given namespace or namespaces.
:param func: A BEL function
:param namespace: The namespace to search by
"""
if isinstance(namespace, str)... | def function_namespace_inclusion_builder(func: str, namespace: Strings) -> NodePredicate:
"""Build a filter function for matching the given BEL function with the given namespace or namespaces.
:param func: A BEL function
:param namespace: The namespace to search by
"""
if isinstance(namespace, str)... | [
"Build",
"a",
"filter",
"function",
"for",
"matching",
"the",
"given",
"BEL",
"function",
"with",
"the",
"given",
"namespace",
"or",
"namespaces",
"."
] | pybel/pybel-tools | python | https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/filters/node_filters.py#L150-L175 | [
"def",
"function_namespace_inclusion_builder",
"(",
"func",
":",
"str",
",",
"namespace",
":",
"Strings",
")",
"->",
"NodePredicate",
":",
"if",
"isinstance",
"(",
"namespace",
",",
"str",
")",
":",
"def",
"function_namespaces_filter",
"(",
"_",
":",
"BELGraph",... | 3491adea0ac4ee60f57275ef72f9b73da6dbfe0c |
valid | data_contains_key_builder | Build a filter that passes only on nodes that have the given key in their data dictionary.
:param key: A key for the node's data dictionary | src/pybel_tools/filters/node_filters.py | def data_contains_key_builder(key: str) -> NodePredicate: # noqa: D202
"""Build a filter that passes only on nodes that have the given key in their data dictionary.
:param key: A key for the node's data dictionary
"""
def data_contains_key(_: BELGraph, node: BaseEntity) -> bool:
"""Pass only ... | def data_contains_key_builder(key: str) -> NodePredicate: # noqa: D202
"""Build a filter that passes only on nodes that have the given key in their data dictionary.
:param key: A key for the node's data dictionary
"""
def data_contains_key(_: BELGraph, node: BaseEntity) -> bool:
"""Pass only ... | [
"Build",
"a",
"filter",
"that",
"passes",
"only",
"on",
"nodes",
"that",
"have",
"the",
"given",
"key",
"in",
"their",
"data",
"dictionary",
"."
] | pybel/pybel-tools | python | https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/filters/node_filters.py#L178-L191 | [
"def",
"data_contains_key_builder",
"(",
"key",
":",
"str",
")",
"->",
"NodePredicate",
":",
"# noqa: D202",
"def",
"data_contains_key",
"(",
"_",
":",
"BELGraph",
",",
"node",
":",
"BaseEntity",
")",
"->",
"bool",
":",
"\"\"\"Pass only for a node that contains the ... | 3491adea0ac4ee60f57275ef72f9b73da6dbfe0c |
valid | variants_of | Returns all variants of the given node. | src/pybel_tools/filters/node_filters.py | def variants_of(
graph: BELGraph,
node: Protein,
modifications: Optional[Set[str]] = None,
) -> Set[Protein]:
"""Returns all variants of the given node."""
if modifications:
return _get_filtered_variants_of(graph, node, modifications)
return {
v
for u, v, key... | def variants_of(
graph: BELGraph,
node: Protein,
modifications: Optional[Set[str]] = None,
) -> Set[Protein]:
"""Returns all variants of the given node."""
if modifications:
return _get_filtered_variants_of(graph, node, modifications)
return {
v
for u, v, key... | [
"Returns",
"all",
"variants",
"of",
"the",
"given",
"node",
"."
] | pybel/pybel-tools | python | https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/filters/node_filters.py#L221-L238 | [
"def",
"variants_of",
"(",
"graph",
":",
"BELGraph",
",",
"node",
":",
"Protein",
",",
"modifications",
":",
"Optional",
"[",
"Set",
"[",
"str",
"]",
"]",
"=",
"None",
",",
")",
"->",
"Set",
"[",
"Protein",
"]",
":",
"if",
"modifications",
":",
"retu... | 3491adea0ac4ee60f57275ef72f9b73da6dbfe0c |
valid | get_variants_to_controllers | Get a mapping from variants of the given node to all of its upstream controllers. | src/pybel_tools/filters/node_filters.py | def get_variants_to_controllers(
graph: BELGraph,
node: Protein,
modifications: Optional[Set[str]] = None,
) -> Mapping[Protein, Set[Protein]]:
"""Get a mapping from variants of the given node to all of its upstream controllers."""
rv = defaultdict(set)
variants = variants_of(graph, ... | def get_variants_to_controllers(
graph: BELGraph,
node: Protein,
modifications: Optional[Set[str]] = None,
) -> Mapping[Protein, Set[Protein]]:
"""Get a mapping from variants of the given node to all of its upstream controllers."""
rv = defaultdict(set)
variants = variants_of(graph, ... | [
"Get",
"a",
"mapping",
"from",
"variants",
"of",
"the",
"given",
"node",
"to",
"all",
"of",
"its",
"upstream",
"controllers",
"."
] | pybel/pybel-tools | python | https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/filters/node_filters.py#L258-L269 | [
"def",
"get_variants_to_controllers",
"(",
"graph",
":",
"BELGraph",
",",
"node",
":",
"Protein",
",",
"modifications",
":",
"Optional",
"[",
"Set",
"[",
"str",
"]",
"]",
"=",
"None",
",",
")",
"->",
"Mapping",
"[",
"Protein",
",",
"Set",
"[",
"Protein",... | 3491adea0ac4ee60f57275ef72f9b73da6dbfe0c |
valid | group_dict_set | Make a dict that accumulates the values for each key in an iterator of doubles. | src/pybel_tools/summary/edge_summary.py | def group_dict_set(iterator: Iterable[Tuple[A, B]]) -> Mapping[A, Set[B]]:
"""Make a dict that accumulates the values for each key in an iterator of doubles."""
d = defaultdict(set)
for key, value in iterator:
d[key].add(value)
return dict(d) | def group_dict_set(iterator: Iterable[Tuple[A, B]]) -> Mapping[A, Set[B]]:
"""Make a dict that accumulates the values for each key in an iterator of doubles."""
d = defaultdict(set)
for key, value in iterator:
d[key].add(value)
return dict(d) | [
"Make",
"a",
"dict",
"that",
"accumulates",
"the",
"values",
"for",
"each",
"key",
"in",
"an",
"iterator",
"of",
"doubles",
"."
] | pybel/pybel-tools | python | https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/summary/edge_summary.py#L41-L46 | [
"def",
"group_dict_set",
"(",
"iterator",
":",
"Iterable",
"[",
"Tuple",
"[",
"A",
",",
"B",
"]",
"]",
")",
"->",
"Mapping",
"[",
"A",
",",
"Set",
"[",
"B",
"]",
"]",
":",
"d",
"=",
"defaultdict",
"(",
"set",
")",
"for",
"key",
",",
"value",
"i... | 3491adea0ac4ee60f57275ef72f9b73da6dbfe0c |
valid | get_edge_relations | Build a dictionary of {node pair: set of edge types}. | src/pybel_tools/summary/edge_summary.py | def get_edge_relations(graph: BELGraph) -> Mapping[Tuple[BaseEntity, BaseEntity], Set[str]]:
"""Build a dictionary of {node pair: set of edge types}."""
return group_dict_set(
((u, v), d[RELATION])
for u, v, d in graph.edges(data=True)
) | def get_edge_relations(graph: BELGraph) -> Mapping[Tuple[BaseEntity, BaseEntity], Set[str]]:
"""Build a dictionary of {node pair: set of edge types}."""
return group_dict_set(
((u, v), d[RELATION])
for u, v, d in graph.edges(data=True)
) | [
"Build",
"a",
"dictionary",
"of",
"{",
"node",
"pair",
":",
"set",
"of",
"edge",
"types",
"}",
"."
] | pybel/pybel-tools | python | https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/summary/edge_summary.py#L49-L54 | [
"def",
"get_edge_relations",
"(",
"graph",
":",
"BELGraph",
")",
"->",
"Mapping",
"[",
"Tuple",
"[",
"BaseEntity",
",",
"BaseEntity",
"]",
",",
"Set",
"[",
"str",
"]",
"]",
":",
"return",
"group_dict_set",
"(",
"(",
"(",
"u",
",",
"v",
")",
",",
"d",... | 3491adea0ac4ee60f57275ef72f9b73da6dbfe0c |
valid | count_unique_relations | Return a histogram of the different types of relations present in a graph.
Note: this operation only counts each type of edge once for each pair of nodes | src/pybel_tools/summary/edge_summary.py | def count_unique_relations(graph: BELGraph) -> Counter:
"""Return a histogram of the different types of relations present in a graph.
Note: this operation only counts each type of edge once for each pair of nodes
"""
return Counter(itt.chain.from_iterable(get_edge_relations(graph).values())) | def count_unique_relations(graph: BELGraph) -> Counter:
"""Return a histogram of the different types of relations present in a graph.
Note: this operation only counts each type of edge once for each pair of nodes
"""
return Counter(itt.chain.from_iterable(get_edge_relations(graph).values())) | [
"Return",
"a",
"histogram",
"of",
"the",
"different",
"types",
"of",
"relations",
"present",
"in",
"a",
"graph",
"."
] | pybel/pybel-tools | python | https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/summary/edge_summary.py#L57-L62 | [
"def",
"count_unique_relations",
"(",
"graph",
":",
"BELGraph",
")",
"->",
"Counter",
":",
"return",
"Counter",
"(",
"itt",
".",
"chain",
".",
"from_iterable",
"(",
"get_edge_relations",
"(",
"graph",
")",
".",
"values",
"(",
")",
")",
")"
] | 3491adea0ac4ee60f57275ef72f9b73da6dbfe0c |
valid | get_annotations_containing_keyword | Get annotation/value pairs for values for whom the search string is a substring
:param graph: A BEL graph
:param keyword: Search for annotations whose values have this as a substring | src/pybel_tools/summary/edge_summary.py | def get_annotations_containing_keyword(graph: BELGraph, keyword: str) -> List[Mapping[str, str]]:
"""Get annotation/value pairs for values for whom the search string is a substring
:param graph: A BEL graph
:param keyword: Search for annotations whose values have this as a substring
"""
return [
... | def get_annotations_containing_keyword(graph: BELGraph, keyword: str) -> List[Mapping[str, str]]:
"""Get annotation/value pairs for values for whom the search string is a substring
:param graph: A BEL graph
:param keyword: Search for annotations whose values have this as a substring
"""
return [
... | [
"Get",
"annotation",
"/",
"value",
"pairs",
"for",
"values",
"for",
"whom",
"the",
"search",
"string",
"is",
"a",
"substring"
] | pybel/pybel-tools | python | https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/summary/edge_summary.py#L65-L78 | [
"def",
"get_annotations_containing_keyword",
"(",
"graph",
":",
"BELGraph",
",",
"keyword",
":",
"str",
")",
"->",
"List",
"[",
"Mapping",
"[",
"str",
",",
"str",
"]",
"]",
":",
"return",
"[",
"{",
"'annotation'",
":",
"annotation",
",",
"'value'",
":",
... | 3491adea0ac4ee60f57275ef72f9b73da6dbfe0c |
valid | count_annotation_values | Count in how many edges each annotation appears in a graph
:param graph: A BEL graph
:param annotation: The annotation to count
:return: A Counter from {annotation value: frequency} | src/pybel_tools/summary/edge_summary.py | def count_annotation_values(graph: BELGraph, annotation: str) -> Counter:
"""Count in how many edges each annotation appears in a graph
:param graph: A BEL graph
:param annotation: The annotation to count
:return: A Counter from {annotation value: frequency}
"""
return Counter(iter_annotation_v... | def count_annotation_values(graph: BELGraph, annotation: str) -> Counter:
"""Count in how many edges each annotation appears in a graph
:param graph: A BEL graph
:param annotation: The annotation to count
:return: A Counter from {annotation value: frequency}
"""
return Counter(iter_annotation_v... | [
"Count",
"in",
"how",
"many",
"edges",
"each",
"annotation",
"appears",
"in",
"a",
"graph"
] | pybel/pybel-tools | python | https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/summary/edge_summary.py#L81-L88 | [
"def",
"count_annotation_values",
"(",
"graph",
":",
"BELGraph",
",",
"annotation",
":",
"str",
")",
"->",
"Counter",
":",
"return",
"Counter",
"(",
"iter_annotation_values",
"(",
"graph",
",",
"annotation",
")",
")"
] | 3491adea0ac4ee60f57275ef72f9b73da6dbfe0c |
valid | count_annotation_values_filtered | Count in how many edges each annotation appears in a graph, but filter out source nodes and target nodes.
See :func:`pybel_tools.utils.keep_node` for a basic filter.
:param graph: A BEL graph
:param annotation: The annotation to count
:param source_predicate: A predicate (graph, node) -> bool for keep... | src/pybel_tools/summary/edge_summary.py | def count_annotation_values_filtered(graph: BELGraph,
annotation: str,
source_predicate: Optional[NodePredicate] = None,
target_predicate: Optional[NodePredicate] = None,
)... | def count_annotation_values_filtered(graph: BELGraph,
annotation: str,
source_predicate: Optional[NodePredicate] = None,
target_predicate: Optional[NodePredicate] = None,
)... | [
"Count",
"in",
"how",
"many",
"edges",
"each",
"annotation",
"appears",
"in",
"a",
"graph",
"but",
"filter",
"out",
"source",
"nodes",
"and",
"target",
"nodes",
"."
] | pybel/pybel-tools | python | https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/summary/edge_summary.py#L91-L129 | [
"def",
"count_annotation_values_filtered",
"(",
"graph",
":",
"BELGraph",
",",
"annotation",
":",
"str",
",",
"source_predicate",
":",
"Optional",
"[",
"NodePredicate",
"]",
"=",
"None",
",",
"target_predicate",
":",
"Optional",
"[",
"NodePredicate",
"]",
"=",
"... | 3491adea0ac4ee60f57275ef72f9b73da6dbfe0c |
valid | pair_is_consistent | Return if the edges between the given nodes are consistent, meaning they all have the same relation.
:return: If the edges aren't consistent, return false, otherwise return the relation type | src/pybel_tools/summary/edge_summary.py | def pair_is_consistent(graph: BELGraph, u: BaseEntity, v: BaseEntity) -> Optional[str]:
"""Return if the edges between the given nodes are consistent, meaning they all have the same relation.
:return: If the edges aren't consistent, return false, otherwise return the relation type
"""
relations = {data... | def pair_is_consistent(graph: BELGraph, u: BaseEntity, v: BaseEntity) -> Optional[str]:
"""Return if the edges between the given nodes are consistent, meaning they all have the same relation.
:return: If the edges aren't consistent, return false, otherwise return the relation type
"""
relations = {data... | [
"Return",
"if",
"the",
"edges",
"between",
"the",
"given",
"nodes",
"are",
"consistent",
"meaning",
"they",
"all",
"have",
"the",
"same",
"relation",
"."
] | pybel/pybel-tools | python | https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/summary/edge_summary.py#L132-L142 | [
"def",
"pair_is_consistent",
"(",
"graph",
":",
"BELGraph",
",",
"u",
":",
"BaseEntity",
",",
"v",
":",
"BaseEntity",
")",
"->",
"Optional",
"[",
"str",
"]",
":",
"relations",
"=",
"{",
"data",
"[",
"RELATION",
"]",
"for",
"data",
"in",
"graph",
"[",
... | 3491adea0ac4ee60f57275ef72f9b73da6dbfe0c |
valid | get_contradictory_pairs | Iterates over contradictory node pairs in the graph based on their causal relationships
:return: An iterator over (source, target) node pairs that have contradictory causal edges | src/pybel_tools/summary/edge_summary.py | def get_contradictory_pairs(graph: BELGraph) -> Iterable[Tuple[BaseEntity, BaseEntity]]:
"""Iterates over contradictory node pairs in the graph based on their causal relationships
:return: An iterator over (source, target) node pairs that have contradictory causal edges
"""
for u, v in graph.edges(... | def get_contradictory_pairs(graph: BELGraph) -> Iterable[Tuple[BaseEntity, BaseEntity]]:
"""Iterates over contradictory node pairs in the graph based on their causal relationships
:return: An iterator over (source, target) node pairs that have contradictory causal edges
"""
for u, v in graph.edges(... | [
"Iterates",
"over",
"contradictory",
"node",
"pairs",
"in",
"the",
"graph",
"based",
"on",
"their",
"causal",
"relationships",
":",
"return",
":",
"An",
"iterator",
"over",
"(",
"source",
"target",
")",
"node",
"pairs",
"that",
"have",
"contradictory",
"causal... | pybel/pybel-tools | python | https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/summary/edge_summary.py#L145-L152 | [
"def",
"get_contradictory_pairs",
"(",
"graph",
":",
"BELGraph",
")",
"->",
"Iterable",
"[",
"Tuple",
"[",
"BaseEntity",
",",
"BaseEntity",
"]",
"]",
":",
"for",
"u",
",",
"v",
"in",
"graph",
".",
"edges",
"(",
")",
":",
"if",
"pair_has_contradiction",
"... | 3491adea0ac4ee60f57275ef72f9b73da6dbfe0c |
valid | get_consistent_edges | Yield pairs of (source node, target node) for which all of their edges have the same type of relation.
:return: An iterator over (source, target) node pairs corresponding to edges with many inconsistent relations | src/pybel_tools/summary/edge_summary.py | def get_consistent_edges(graph: BELGraph) -> Iterable[Tuple[BaseEntity, BaseEntity]]:
"""Yield pairs of (source node, target node) for which all of their edges have the same type of relation.
:return: An iterator over (source, target) node pairs corresponding to edges with many inconsistent relations
"""
... | def get_consistent_edges(graph: BELGraph) -> Iterable[Tuple[BaseEntity, BaseEntity]]:
"""Yield pairs of (source node, target node) for which all of their edges have the same type of relation.
:return: An iterator over (source, target) node pairs corresponding to edges with many inconsistent relations
"""
... | [
"Yield",
"pairs",
"of",
"(",
"source",
"node",
"target",
"node",
")",
"for",
"which",
"all",
"of",
"their",
"edges",
"have",
"the",
"same",
"type",
"of",
"relation",
"."
] | pybel/pybel-tools | python | https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/summary/edge_summary.py#L155-L162 | [
"def",
"get_consistent_edges",
"(",
"graph",
":",
"BELGraph",
")",
"->",
"Iterable",
"[",
"Tuple",
"[",
"BaseEntity",
",",
"BaseEntity",
"]",
"]",
":",
"for",
"u",
",",
"v",
"in",
"graph",
".",
"edges",
"(",
")",
":",
"if",
"pair_is_consistent",
"(",
"... | 3491adea0ac4ee60f57275ef72f9b73da6dbfe0c |
valid | infer_missing_two_way_edges | Add edges to the graph when a two way edge exists, and the opposite direction doesn't exist.
Use: two way edges from BEL definition and/or axiomatic inverses of membership relations
:param pybel.BELGraph graph: A BEL graph | src/pybel_tools/mutation/inference.py | def infer_missing_two_way_edges(graph):
"""Add edges to the graph when a two way edge exists, and the opposite direction doesn't exist.
Use: two way edges from BEL definition and/or axiomatic inverses of membership relations
:param pybel.BELGraph graph: A BEL graph
"""
for u, v, k, d in graph.edge... | def infer_missing_two_way_edges(graph):
"""Add edges to the graph when a two way edge exists, and the opposite direction doesn't exist.
Use: two way edges from BEL definition and/or axiomatic inverses of membership relations
:param pybel.BELGraph graph: A BEL graph
"""
for u, v, k, d in graph.edge... | [
"Add",
"edges",
"to",
"the",
"graph",
"when",
"a",
"two",
"way",
"edge",
"exists",
"and",
"the",
"opposite",
"direction",
"doesn",
"t",
"exist",
"."
] | pybel/pybel-tools | python | https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/mutation/inference.py#L22-L31 | [
"def",
"infer_missing_two_way_edges",
"(",
"graph",
")",
":",
"for",
"u",
",",
"v",
",",
"k",
",",
"d",
"in",
"graph",
".",
"edges",
"(",
"data",
"=",
"True",
",",
"keys",
"=",
"True",
")",
":",
"if",
"d",
"[",
"RELATION",
"]",
"in",
"TWO_WAY_RELAT... | 3491adea0ac4ee60f57275ef72f9b73da6dbfe0c |
valid | infer_missing_backwards_edge | Add the same edge, but in the opposite direction if not already present.
:type graph: pybel.BELGraph
:type u: tuple
:type v: tuple
:type k: int | src/pybel_tools/mutation/inference.py | def infer_missing_backwards_edge(graph, u, v, k):
"""Add the same edge, but in the opposite direction if not already present.
:type graph: pybel.BELGraph
:type u: tuple
:type v: tuple
:type k: int
"""
if u in graph[v]:
for attr_dict in graph[v][u].values():
if attr_dict ... | def infer_missing_backwards_edge(graph, u, v, k):
"""Add the same edge, but in the opposite direction if not already present.
:type graph: pybel.BELGraph
:type u: tuple
:type v: tuple
:type k: int
"""
if u in graph[v]:
for attr_dict in graph[v][u].values():
if attr_dict ... | [
"Add",
"the",
"same",
"edge",
"but",
"in",
"the",
"opposite",
"direction",
"if",
"not",
"already",
"present",
"."
] | pybel/pybel-tools | python | https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/mutation/inference.py#L34-L47 | [
"def",
"infer_missing_backwards_edge",
"(",
"graph",
",",
"u",
",",
"v",
",",
"k",
")",
":",
"if",
"u",
"in",
"graph",
"[",
"v",
"]",
":",
"for",
"attr_dict",
"in",
"graph",
"[",
"v",
"]",
"[",
"u",
"]",
".",
"values",
"(",
")",
":",
"if",
"att... | 3491adea0ac4ee60f57275ef72f9b73da6dbfe0c |
valid | enrich_internal_unqualified_edges | Add the missing unqualified edges between entities in the subgraph that are contained within the full graph.
:param pybel.BELGraph graph: The full BEL graph
:param pybel.BELGraph subgraph: The query BEL subgraph | src/pybel_tools/mutation/inference.py | def enrich_internal_unqualified_edges(graph, subgraph):
"""Add the missing unqualified edges between entities in the subgraph that are contained within the full graph.
:param pybel.BELGraph graph: The full BEL graph
:param pybel.BELGraph subgraph: The query BEL subgraph
"""
for u, v in itt.combinat... | def enrich_internal_unqualified_edges(graph, subgraph):
"""Add the missing unqualified edges between entities in the subgraph that are contained within the full graph.
:param pybel.BELGraph graph: The full BEL graph
:param pybel.BELGraph subgraph: The query BEL subgraph
"""
for u, v in itt.combinat... | [
"Add",
"the",
"missing",
"unqualified",
"edges",
"between",
"entities",
"in",
"the",
"subgraph",
"that",
"are",
"contained",
"within",
"the",
"full",
"graph",
"."
] | pybel/pybel-tools | python | https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/mutation/inference.py#L51-L63 | [
"def",
"enrich_internal_unqualified_edges",
"(",
"graph",
",",
"subgraph",
")",
":",
"for",
"u",
",",
"v",
"in",
"itt",
".",
"combinations",
"(",
"subgraph",
",",
"2",
")",
":",
"if",
"not",
"graph",
".",
"has_edge",
"(",
"u",
",",
"v",
")",
":",
"co... | 3491adea0ac4ee60f57275ef72f9b73da6dbfe0c |
valid | boilerplate | Build a template BEL document with the given PubMed identifiers. | src/pybel_tools/cli.py | def boilerplate(name, contact, description, pmids, version, copyright, authors, licenses, disclaimer, output):
"""Build a template BEL document with the given PubMed identifiers."""
from .document_utils import write_boilerplate
write_boilerplate(
name=name,
version=version,
descript... | def boilerplate(name, contact, description, pmids, version, copyright, authors, licenses, disclaimer, output):
"""Build a template BEL document with the given PubMed identifiers."""
from .document_utils import write_boilerplate
write_boilerplate(
name=name,
version=version,
descript... | [
"Build",
"a",
"template",
"BEL",
"document",
"with",
"the",
"given",
"PubMed",
"identifiers",
"."
] | pybel/pybel-tools | python | https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/cli.py#L137-L152 | [
"def",
"boilerplate",
"(",
"name",
",",
"contact",
",",
"description",
",",
"pmids",
",",
"version",
",",
"copyright",
",",
"authors",
",",
"licenses",
",",
"disclaimer",
",",
"output",
")",
":",
"from",
".",
"document_utils",
"import",
"write_boilerplate",
... | 3491adea0ac4ee60f57275ef72f9b73da6dbfe0c |
valid | serialize_namespaces | Parse a BEL document then serializes the given namespaces (errors and all) to the given directory. | src/pybel_tools/cli.py | def serialize_namespaces(namespaces, connection: str, path, directory):
"""Parse a BEL document then serializes the given namespaces (errors and all) to the given directory."""
from .definition_utils import export_namespaces
graph = from_lines(path, manager=connection)
export_namespaces(namespaces, gra... | def serialize_namespaces(namespaces, connection: str, path, directory):
"""Parse a BEL document then serializes the given namespaces (errors and all) to the given directory."""
from .definition_utils import export_namespaces
graph = from_lines(path, manager=connection)
export_namespaces(namespaces, gra... | [
"Parse",
"a",
"BEL",
"document",
"then",
"serializes",
"the",
"given",
"namespaces",
"(",
"errors",
"and",
"all",
")",
"to",
"the",
"given",
"directory",
"."
] | pybel/pybel-tools | python | https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/cli.py#L160-L165 | [
"def",
"serialize_namespaces",
"(",
"namespaces",
",",
"connection",
":",
"str",
",",
"path",
",",
"directory",
")",
":",
"from",
".",
"definition_utils",
"import",
"export_namespaces",
"graph",
"=",
"from_lines",
"(",
"path",
",",
"manager",
"=",
"connection",
... | 3491adea0ac4ee60f57275ef72f9b73da6dbfe0c |
valid | get_pmids | Output PubMed identifiers from a graph to a stream. | src/pybel_tools/cli.py | def get_pmids(graph: BELGraph, output: TextIO):
"""Output PubMed identifiers from a graph to a stream."""
for pmid in get_pubmed_identifiers(graph):
click.echo(pmid, file=output) | def get_pmids(graph: BELGraph, output: TextIO):
"""Output PubMed identifiers from a graph to a stream."""
for pmid in get_pubmed_identifiers(graph):
click.echo(pmid, file=output) | [
"Output",
"PubMed",
"identifiers",
"from",
"a",
"graph",
"to",
"a",
"stream",
"."
] | pybel/pybel-tools | python | https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/cli.py#L171-L174 | [
"def",
"get_pmids",
"(",
"graph",
":",
"BELGraph",
",",
"output",
":",
"TextIO",
")",
":",
"for",
"pmid",
"in",
"get_pubmed_identifiers",
"(",
"graph",
")",
":",
"click",
".",
"echo",
"(",
"pmid",
",",
"file",
"=",
"output",
")"
] | 3491adea0ac4ee60f57275ef72f9b73da6dbfe0c |
valid | Table.getrowcount | Get count of rows in table object.
@param window_name: Window name to look for, either full name,
LDTP's name convention, or a Unix glob.
@type window_name: string
@param object_name: Object name to look for, either full name,
LDTP's name convention, or a Unix glob. Or menu heir... | atomac/ldtpd/table.py | def getrowcount(self, window_name, object_name):
"""
Get count of rows in table object.
@param window_name: Window name to look for, either full name,
LDTP's name convention, or a Unix glob.
@type window_name: string
@param object_name: Object name to look for, either fu... | def getrowcount(self, window_name, object_name):
"""
Get count of rows in table object.
@param window_name: Window name to look for, either full name,
LDTP's name convention, or a Unix glob.
@type window_name: string
@param object_name: Object name to look for, either fu... | [
"Get",
"count",
"of",
"rows",
"in",
"table",
"object",
"."
] | alex-kostirin/pyatomac | python | https://github.com/alex-kostirin/pyatomac/blob/3f46f6feb4504315eec07abb18bb41be4d257aeb/atomac/ldtpd/table.py#L29-L46 | [
"def",
"getrowcount",
"(",
"self",
",",
"window_name",
",",
"object_name",
")",
":",
"object_handle",
"=",
"self",
".",
"_get_object_handle",
"(",
"window_name",
",",
"object_name",
")",
"if",
"not",
"object_handle",
".",
"AXEnabled",
":",
"raise",
"LdtpServerEx... | 3f46f6feb4504315eec07abb18bb41be4d257aeb |
valid | Table.selectrow | Select row
@param window_name: Window name to type in, either full name,
LDTP's name convention, or a Unix glob.
@type window_name: string
@param object_name: Object name to type in, either full name,
LDTP's name convention, or a Unix glob.
@type object_name: string
... | atomac/ldtpd/table.py | def selectrow(self, window_name, object_name, row_text, partial_match=False):
"""
Select row
@param window_name: Window name to type in, either full name,
LDTP's name convention, or a Unix glob.
@type window_name: string
@param object_name: Object name to type in, either... | def selectrow(self, window_name, object_name, row_text, partial_match=False):
"""
Select row
@param window_name: Window name to type in, either full name,
LDTP's name convention, or a Unix glob.
@type window_name: string
@param object_name: Object name to type in, either... | [
"Select",
"row"
] | alex-kostirin/pyatomac | python | https://github.com/alex-kostirin/pyatomac/blob/3f46f6feb4504315eec07abb18bb41be4d257aeb/atomac/ldtpd/table.py#L48-L78 | [
"def",
"selectrow",
"(",
"self",
",",
"window_name",
",",
"object_name",
",",
"row_text",
",",
"partial_match",
"=",
"False",
")",
":",
"object_handle",
"=",
"self",
".",
"_get_object_handle",
"(",
"window_name",
",",
"object_name",
")",
"if",
"not",
"object_h... | 3f46f6feb4504315eec07abb18bb41be4d257aeb |
valid | Table.multiselect | Select multiple row
@param window_name: Window name to type in, either full name,
LDTP's name convention, or a Unix glob.
@type window_name: string
@param object_name: Object name to type in, either full name,
LDTP's name convention, or a Unix glob.
@type object_name: s... | atomac/ldtpd/table.py | def multiselect(self, window_name, object_name, row_text_list, partial_match=False):
"""
Select multiple row
@param window_name: Window name to type in, either full name,
LDTP's name convention, or a Unix glob.
@type window_name: string
@param object_name: Object name to... | def multiselect(self, window_name, object_name, row_text_list, partial_match=False):
"""
Select multiple row
@param window_name: Window name to type in, either full name,
LDTP's name convention, or a Unix glob.
@type window_name: string
@param object_name: Object name to... | [
"Select",
"multiple",
"row"
] | alex-kostirin/pyatomac | python | https://github.com/alex-kostirin/pyatomac/blob/3f46f6feb4504315eec07abb18bb41be4d257aeb/atomac/ldtpd/table.py#L80-L131 | [
"def",
"multiselect",
"(",
"self",
",",
"window_name",
",",
"object_name",
",",
"row_text_list",
",",
"partial_match",
"=",
"False",
")",
":",
"object_handle",
"=",
"self",
".",
"_get_object_handle",
"(",
"window_name",
",",
"object_name",
")",
"if",
"not",
"o... | 3f46f6feb4504315eec07abb18bb41be4d257aeb |
valid | Table.selectrowpartialmatch | Select row partial match
@param window_name: Window name to type in, either full name,
LDTP's name convention, or a Unix glob.
@type window_name: string
@param object_name: Object name to type in, either full name,
LDTP's name convention, or a Unix glob.
@type object_na... | atomac/ldtpd/table.py | def selectrowpartialmatch(self, window_name, object_name, row_text):
"""
Select row partial match
@param window_name: Window name to type in, either full name,
LDTP's name convention, or a Unix glob.
@type window_name: string
@param object_name: Object name to type in, e... | def selectrowpartialmatch(self, window_name, object_name, row_text):
"""
Select row partial match
@param window_name: Window name to type in, either full name,
LDTP's name convention, or a Unix glob.
@type window_name: string
@param object_name: Object name to type in, e... | [
"Select",
"row",
"partial",
"match"
] | alex-kostirin/pyatomac | python | https://github.com/alex-kostirin/pyatomac/blob/3f46f6feb4504315eec07abb18bb41be4d257aeb/atomac/ldtpd/table.py#L186-L216 | [
"def",
"selectrowpartialmatch",
"(",
"self",
",",
"window_name",
",",
"object_name",
",",
"row_text",
")",
":",
"object_handle",
"=",
"self",
".",
"_get_object_handle",
"(",
"window_name",
",",
"object_name",
")",
"if",
"not",
"object_handle",
".",
"AXEnabled",
... | 3f46f6feb4504315eec07abb18bb41be4d257aeb |
valid | Table.selectrowindex | Select row index
@param window_name: Window name to type in, either full name,
LDTP's name convention, or a Unix glob.
@type window_name: string
@param object_name: Object name to type in, either full name,
LDTP's name convention, or a Unix glob.
@type object_name: stri... | atomac/ldtpd/table.py | def selectrowindex(self, window_name, object_name, row_index):
"""
Select row index
@param window_name: Window name to type in, either full name,
LDTP's name convention, or a Unix glob.
@type window_name: string
@param object_name: Object name to type in, either full nam... | def selectrowindex(self, window_name, object_name, row_index):
"""
Select row index
@param window_name: Window name to type in, either full name,
LDTP's name convention, or a Unix glob.
@type window_name: string
@param object_name: Object name to type in, either full nam... | [
"Select",
"row",
"index"
] | alex-kostirin/pyatomac | python | https://github.com/alex-kostirin/pyatomac/blob/3f46f6feb4504315eec07abb18bb41be4d257aeb/atomac/ldtpd/table.py#L218-L248 | [
"def",
"selectrowindex",
"(",
"self",
",",
"window_name",
",",
"object_name",
",",
"row_index",
")",
":",
"object_handle",
"=",
"self",
".",
"_get_object_handle",
"(",
"window_name",
",",
"object_name",
")",
"if",
"not",
"object_handle",
".",
"AXEnabled",
":",
... | 3f46f6feb4504315eec07abb18bb41be4d257aeb |
valid | Table.selectlastrow | Select last row
@param window_name: Window name to type in, either full name,
LDTP's name convention, or a Unix glob.
@type window_name: string
@param object_name: Object name to type in, either full name,
LDTP's name convention, or a Unix glob.
@type object_name: strin... | atomac/ldtpd/table.py | def selectlastrow(self, window_name, object_name):
"""
Select last row
@param window_name: Window name to type in, either full name,
LDTP's name convention, or a Unix glob.
@type window_name: string
@param object_name: Object name to type in, either full name,
LD... | def selectlastrow(self, window_name, object_name):
"""
Select last row
@param window_name: Window name to type in, either full name,
LDTP's name convention, or a Unix glob.
@type window_name: string
@param object_name: Object name to type in, either full name,
LD... | [
"Select",
"last",
"row"
] | alex-kostirin/pyatomac | python | https://github.com/alex-kostirin/pyatomac/blob/3f46f6feb4504315eec07abb18bb41be4d257aeb/atomac/ldtpd/table.py#L250-L275 | [
"def",
"selectlastrow",
"(",
"self",
",",
"window_name",
",",
"object_name",
")",
":",
"object_handle",
"=",
"self",
".",
"_get_object_handle",
"(",
"window_name",
",",
"object_name",
")",
"if",
"not",
"object_handle",
".",
"AXEnabled",
":",
"raise",
"LdtpServer... | 3f46f6feb4504315eec07abb18bb41be4d257aeb |
valid | Table.getcellvalue | Get cell value
@param window_name: Window name to type in, either full name,
LDTP's name convention, or a Unix glob.
@type window_name: string
@param object_name: Object name to type in, either full name,
LDTP's name convention, or a Unix glob.
@type object_name: string... | atomac/ldtpd/table.py | def getcellvalue(self, window_name, object_name, row_index, column=0):
"""
Get cell value
@param window_name: Window name to type in, either full name,
LDTP's name convention, or a Unix glob.
@type window_name: string
@param object_name: Object name to type in, either fu... | def getcellvalue(self, window_name, object_name, row_index, column=0):
"""
Get cell value
@param window_name: Window name to type in, either full name,
LDTP's name convention, or a Unix glob.
@type window_name: string
@param object_name: Object name to type in, either fu... | [
"Get",
"cell",
"value"
] | alex-kostirin/pyatomac | python | https://github.com/alex-kostirin/pyatomac/blob/3f46f6feb4504315eec07abb18bb41be4d257aeb/atomac/ldtpd/table.py#L301-L333 | [
"def",
"getcellvalue",
"(",
"self",
",",
"window_name",
",",
"object_name",
",",
"row_index",
",",
"column",
"=",
"0",
")",
":",
"object_handle",
"=",
"self",
".",
"_get_object_handle",
"(",
"window_name",
",",
"object_name",
")",
"if",
"not",
"object_handle",... | 3f46f6feb4504315eec07abb18bb41be4d257aeb |
valid | Table.gettablerowindex | Get table row index matching given text
@param window_name: Window name to type in, either full name,
LDTP's name convention, or a Unix glob.
@type window_name: string
@param object_name: Object name to type in, either full name,
LDTP's name convention, or a Unix glob.
... | atomac/ldtpd/table.py | def gettablerowindex(self, window_name, object_name, row_text):
"""
Get table row index matching given text
@param window_name: Window name to type in, either full name,
LDTP's name convention, or a Unix glob.
@type window_name: string
@param object_name: Object name to ... | def gettablerowindex(self, window_name, object_name, row_text):
"""
Get table row index matching given text
@param window_name: Window name to type in, either full name,
LDTP's name convention, or a Unix glob.
@type window_name: string
@param object_name: Object name to ... | [
"Get",
"table",
"row",
"index",
"matching",
"given",
"text"
] | alex-kostirin/pyatomac | python | https://github.com/alex-kostirin/pyatomac/blob/3f46f6feb4504315eec07abb18bb41be4d257aeb/atomac/ldtpd/table.py#L462-L488 | [
"def",
"gettablerowindex",
"(",
"self",
",",
"window_name",
",",
"object_name",
",",
"row_text",
")",
":",
"object_handle",
"=",
"self",
".",
"_get_object_handle",
"(",
"window_name",
",",
"object_name",
")",
"if",
"not",
"object_handle",
".",
"AXEnabled",
":",
... | 3f46f6feb4504315eec07abb18bb41be4d257aeb |
valid | Table.doubleclickrow | Double click row matching given text
@param window_name: Window name to type in, either full name,
LDTP's name convention, or a Unix glob.
@type window_name: string
@param object_name: Object name to type in, either full name,
LDTP's name convention, or a Unix glob.
@ty... | atomac/ldtpd/table.py | def doubleclickrow(self, window_name, object_name, row_text):
"""
Double click row matching given text
@param window_name: Window name to type in, either full name,
LDTP's name convention, or a Unix glob.
@type window_name: string
@param object_name: Object name to type ... | def doubleclickrow(self, window_name, object_name, row_text):
"""
Double click row matching given text
@param window_name: Window name to type in, either full name,
LDTP's name convention, or a Unix glob.
@type window_name: string
@param object_name: Object name to type ... | [
"Double",
"click",
"row",
"matching",
"given",
"text"
] | alex-kostirin/pyatomac | python | https://github.com/alex-kostirin/pyatomac/blob/3f46f6feb4504315eec07abb18bb41be4d257aeb/atomac/ldtpd/table.py#L523-L554 | [
"def",
"doubleclickrow",
"(",
"self",
",",
"window_name",
",",
"object_name",
",",
"row_text",
")",
":",
"object_handle",
"=",
"self",
".",
"_get_object_handle",
"(",
"window_name",
",",
"object_name",
")",
"if",
"not",
"object_handle",
".",
"AXEnabled",
":",
... | 3f46f6feb4504315eec07abb18bb41be4d257aeb |
valid | Table.doubleclickrowindex | Double click row matching given text
@param window_name: Window name to type in, either full name,
LDTP's name convention, or a Unix glob.
@type window_name: string
@param object_name: Object name to type in, either full name,
LDTP's name convention, or a Unix glob.
@typ... | atomac/ldtpd/table.py | def doubleclickrowindex(self, window_name, object_name, row_index, col_index=0):
"""
Double click row matching given text
@param window_name: Window name to type in, either full name,
LDTP's name convention, or a Unix glob.
@type window_name: string
@param object_name: O... | def doubleclickrowindex(self, window_name, object_name, row_index, col_index=0):
"""
Double click row matching given text
@param window_name: Window name to type in, either full name,
LDTP's name convention, or a Unix glob.
@type window_name: string
@param object_name: O... | [
"Double",
"click",
"row",
"matching",
"given",
"text"
] | alex-kostirin/pyatomac | python | https://github.com/alex-kostirin/pyatomac/blob/3f46f6feb4504315eec07abb18bb41be4d257aeb/atomac/ldtpd/table.py#L556-L586 | [
"def",
"doubleclickrowindex",
"(",
"self",
",",
"window_name",
",",
"object_name",
",",
"row_index",
",",
"col_index",
"=",
"0",
")",
":",
"object_handle",
"=",
"self",
".",
"_get_object_handle",
"(",
"window_name",
",",
"object_name",
")",
"if",
"not",
"objec... | 3f46f6feb4504315eec07abb18bb41be4d257aeb |
valid | Table.verifytablecell | Verify table cell value with given text
@param window_name: Window name to type in, either full name,
LDTP's name convention, or a Unix glob.
@type window_name: string
@param object_name: Object name to type in, either full name,
LDTP's name convention, or a Unix glob.
... | atomac/ldtpd/table.py | def verifytablecell(self, window_name, object_name, row_index,
column_index, row_text):
"""
Verify table cell value with given text
@param window_name: Window name to type in, either full name,
LDTP's name convention, or a Unix glob.
@type window_name: st... | def verifytablecell(self, window_name, object_name, row_index,
column_index, row_text):
"""
Verify table cell value with given text
@param window_name: Window name to type in, either full name,
LDTP's name convention, or a Unix glob.
@type window_name: st... | [
"Verify",
"table",
"cell",
"value",
"with",
"given",
"text"
] | alex-kostirin/pyatomac | python | https://github.com/alex-kostirin/pyatomac/blob/3f46f6feb4504315eec07abb18bb41be4d257aeb/atomac/ldtpd/table.py#L588-L615 | [
"def",
"verifytablecell",
"(",
"self",
",",
"window_name",
",",
"object_name",
",",
"row_index",
",",
"column_index",
",",
"row_text",
")",
":",
"try",
":",
"value",
"=",
"getcellvalue",
"(",
"window_name",
",",
"object_name",
",",
"row_index",
",",
"column_in... | 3f46f6feb4504315eec07abb18bb41be4d257aeb |
valid | Table.doesrowexist | Verify table cell value with given text
@param window_name: Window name to type in, either full name,
LDTP's name convention, or a Unix glob.
@type window_name: string
@param object_name: Object name to type in, either full name,
LDTP's name convention, or a Unix glob.
... | atomac/ldtpd/table.py | def doesrowexist(self, window_name, object_name, row_text,
partial_match=False):
"""
Verify table cell value with given text
@param window_name: Window name to type in, either full name,
LDTP's name convention, or a Unix glob.
@type window_name: string
... | def doesrowexist(self, window_name, object_name, row_text,
partial_match=False):
"""
Verify table cell value with given text
@param window_name: Window name to type in, either full name,
LDTP's name convention, or a Unix glob.
@type window_name: string
... | [
"Verify",
"table",
"cell",
"value",
"with",
"given",
"text"
] | alex-kostirin/pyatomac | python | https://github.com/alex-kostirin/pyatomac/blob/3f46f6feb4504315eec07abb18bb41be4d257aeb/atomac/ldtpd/table.py#L617-L650 | [
"def",
"doesrowexist",
"(",
"self",
",",
"window_name",
",",
"object_name",
",",
"row_text",
",",
"partial_match",
"=",
"False",
")",
":",
"try",
":",
"object_handle",
"=",
"self",
".",
"_get_object_handle",
"(",
"window_name",
",",
"object_name",
")",
"if",
... | 3f46f6feb4504315eec07abb18bb41be4d257aeb |
valid | Table.verifypartialtablecell | Verify partial table cell value
@param window_name: Window name to type in, either full name,
LDTP's name convention, or a Unix glob.
@type window_name: string
@param object_name: Object name to type in, either full name,
LDTP's name convention, or a Unix glob.
@type ob... | atomac/ldtpd/table.py | def verifypartialtablecell(self, window_name, object_name, row_index,
column_index, row_text):
"""
Verify partial table cell value
@param window_name: Window name to type in, either full name,
LDTP's name convention, or a Unix glob.
@type window_na... | def verifypartialtablecell(self, window_name, object_name, row_index,
column_index, row_text):
"""
Verify partial table cell value
@param window_name: Window name to type in, either full name,
LDTP's name convention, or a Unix glob.
@type window_na... | [
"Verify",
"partial",
"table",
"cell",
"value"
] | alex-kostirin/pyatomac | python | https://github.com/alex-kostirin/pyatomac/blob/3f46f6feb4504315eec07abb18bb41be4d257aeb/atomac/ldtpd/table.py#L652-L679 | [
"def",
"verifypartialtablecell",
"(",
"self",
",",
"window_name",
",",
"object_name",
",",
"row_index",
",",
"column_index",
",",
"row_text",
")",
":",
"try",
":",
"value",
"=",
"getcellvalue",
"(",
"window_name",
",",
"object_name",
",",
"row_index",
",",
"co... | 3f46f6feb4504315eec07abb18bb41be4d257aeb |
valid | Core.getapplist | Get all accessibility application name that are currently running
@return: list of appliction name of string type on success.
@rtype: list | atomac/ldtpd/core.py | def getapplist(self):
"""
Get all accessibility application name that are currently running
@return: list of appliction name of string type on success.
@rtype: list
"""
app_list = []
# Update apps list, before parsing the list
self._update_apps()
... | def getapplist(self):
"""
Get all accessibility application name that are currently running
@return: list of appliction name of string type on success.
@rtype: list
"""
app_list = []
# Update apps list, before parsing the list
self._update_apps()
... | [
"Get",
"all",
"accessibility",
"application",
"name",
"that",
"are",
"currently",
"running"
] | alex-kostirin/pyatomac | python | https://github.com/alex-kostirin/pyatomac/blob/3f46f6feb4504315eec07abb18bb41be4d257aeb/atomac/ldtpd/core.py#L80-L103 | [
"def",
"getapplist",
"(",
"self",
")",
":",
"app_list",
"=",
"[",
"]",
"# Update apps list, before parsing the list",
"self",
".",
"_update_apps",
"(",
")",
"for",
"gui",
"in",
"self",
".",
"_running_apps",
":",
"name",
"=",
"gui",
".",
"localizedName",
"(",
... | 3f46f6feb4504315eec07abb18bb41be4d257aeb |
valid | Core.startprocessmonitor | Start memory and CPU monitoring, with the time interval between
each process scan
@param process_name: Process name, ex: firefox-bin.
@type process_name: string
@param interval: Time interval between each process scan
@type interval: double
@return: 1 on success
... | atomac/ldtpd/core.py | def startprocessmonitor(self, process_name, interval=2):
"""
Start memory and CPU monitoring, with the time interval between
each process scan
@param process_name: Process name, ex: firefox-bin.
@type process_name: string
@param interval: Time interval between each proce... | def startprocessmonitor(self, process_name, interval=2):
"""
Start memory and CPU monitoring, with the time interval between
each process scan
@param process_name: Process name, ex: firefox-bin.
@type process_name: string
@param interval: Time interval between each proce... | [
"Start",
"memory",
"and",
"CPU",
"monitoring",
"with",
"the",
"time",
"interval",
"between",
"each",
"process",
"scan"
] | alex-kostirin/pyatomac | python | https://github.com/alex-kostirin/pyatomac/blob/3f46f6feb4504315eec07abb18bb41be4d257aeb/atomac/ldtpd/core.py#L148-L170 | [
"def",
"startprocessmonitor",
"(",
"self",
",",
"process_name",
",",
"interval",
"=",
"2",
")",
":",
"if",
"process_name",
"in",
"self",
".",
"_process_stats",
":",
"# Stop previously running instance",
"# At any point, only one process name can be tracked",
"# If an instan... | 3f46f6feb4504315eec07abb18bb41be4d257aeb |
valid | Core.stopprocessmonitor | Stop memory and CPU monitoring
@param process_name: Process name, ex: firefox-bin.
@type process_name: string
@return: 1 on success
@rtype: integer | atomac/ldtpd/core.py | def stopprocessmonitor(self, process_name):
"""
Stop memory and CPU monitoring
@param process_name: Process name, ex: firefox-bin.
@type process_name: string
@return: 1 on success
@rtype: integer
"""
if process_name in self._process_stats:
# ... | def stopprocessmonitor(self, process_name):
"""
Stop memory and CPU monitoring
@param process_name: Process name, ex: firefox-bin.
@type process_name: string
@return: 1 on success
@rtype: integer
"""
if process_name in self._process_stats:
# ... | [
"Stop",
"memory",
"and",
"CPU",
"monitoring"
] | alex-kostirin/pyatomac | python | https://github.com/alex-kostirin/pyatomac/blob/3f46f6feb4504315eec07abb18bb41be4d257aeb/atomac/ldtpd/core.py#L172-L185 | [
"def",
"stopprocessmonitor",
"(",
"self",
",",
"process_name",
")",
":",
"if",
"process_name",
"in",
"self",
".",
"_process_stats",
":",
"# Stop monitoring process",
"self",
".",
"_process_stats",
"[",
"process_name",
"]",
".",
"stop",
"(",
")",
"return",
"1"
] | 3f46f6feb4504315eec07abb18bb41be4d257aeb |
valid | Core.getcpustat | get CPU stat for the give process name
@param process_name: Process name, ex: firefox-bin.
@type process_name: string
@return: cpu stat list on success, else empty list
If same process name, running multiple instance,
get the stat of all the process CPU usage
... | atomac/ldtpd/core.py | def getcpustat(self, process_name):
"""
get CPU stat for the give process name
@param process_name: Process name, ex: firefox-bin.
@type process_name: string
@return: cpu stat list on success, else empty list
If same process name, running multiple instance,
... | def getcpustat(self, process_name):
"""
get CPU stat for the give process name
@param process_name: Process name, ex: firefox-bin.
@type process_name: string
@return: cpu stat list on success, else empty list
If same process name, running multiple instance,
... | [
"get",
"CPU",
"stat",
"for",
"the",
"give",
"process",
"name"
] | alex-kostirin/pyatomac | python | https://github.com/alex-kostirin/pyatomac/blob/3f46f6feb4504315eec07abb18bb41be4d257aeb/atomac/ldtpd/core.py#L187-L207 | [
"def",
"getcpustat",
"(",
"self",
",",
"process_name",
")",
":",
"# Create an instance of process stat",
"_stat_inst",
"=",
"ProcessStats",
"(",
"process_name",
")",
"_stat_list",
"=",
"[",
"]",
"for",
"p",
"in",
"_stat_inst",
".",
"get_cpu_memory_stat",
"(",
")",... | 3f46f6feb4504315eec07abb18bb41be4d257aeb |
valid | Core.getmemorystat | get memory stat
@param process_name: Process name, ex: firefox-bin.
@type process_name: string
@return: memory stat list on success, else empty list
If same process name, running multiple instance,
get the stat of all the process memory usage
@rtype: lis... | atomac/ldtpd/core.py | def getmemorystat(self, process_name):
"""
get memory stat
@param process_name: Process name, ex: firefox-bin.
@type process_name: string
@return: memory stat list on success, else empty list
If same process name, running multiple instance,
get t... | def getmemorystat(self, process_name):
"""
get memory stat
@param process_name: Process name, ex: firefox-bin.
@type process_name: string
@return: memory stat list on success, else empty list
If same process name, running multiple instance,
get t... | [
"get",
"memory",
"stat"
] | alex-kostirin/pyatomac | python | https://github.com/alex-kostirin/pyatomac/blob/3f46f6feb4504315eec07abb18bb41be4d257aeb/atomac/ldtpd/core.py#L209-L232 | [
"def",
"getmemorystat",
"(",
"self",
",",
"process_name",
")",
":",
"# Create an instance of process stat",
"_stat_inst",
"=",
"ProcessStats",
"(",
"process_name",
")",
"_stat_list",
"=",
"[",
"]",
"for",
"p",
"in",
"_stat_inst",
".",
"get_cpu_memory_stat",
"(",
"... | 3f46f6feb4504315eec07abb18bb41be4d257aeb |
valid | Core.getobjectlist | Get list of items in given GUI.
@param window_name: Window name to look for, either full name,
LDTP's name convention, or a Unix glob.
@type window_name: string
@return: list of items in LDTP naming convention.
@rtype: list | atomac/ldtpd/core.py | def getobjectlist(self, window_name):
"""
Get list of items in given GUI.
@param window_name: Window name to look for, either full name,
LDTP's name convention, or a Unix glob.
@type window_name: string
@return: list of items in LDTP naming convention.
@rtype: l... | def getobjectlist(self, window_name):
"""
Get list of items in given GUI.
@param window_name: Window name to look for, either full name,
LDTP's name convention, or a Unix glob.
@type window_name: string
@return: list of items in LDTP naming convention.
@rtype: l... | [
"Get",
"list",
"of",
"items",
"in",
"given",
"GUI",
"."
] | alex-kostirin/pyatomac | python | https://github.com/alex-kostirin/pyatomac/blob/3f46f6feb4504315eec07abb18bb41be4d257aeb/atomac/ldtpd/core.py#L234-L255 | [
"def",
"getobjectlist",
"(",
"self",
",",
"window_name",
")",
":",
"try",
":",
"window_handle",
",",
"name",
",",
"app",
"=",
"self",
".",
"_get_window_handle",
"(",
"window_name",
",",
"True",
")",
"object_list",
"=",
"self",
".",
"_get_appmap",
"(",
"win... | 3f46f6feb4504315eec07abb18bb41be4d257aeb |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.