Query Builder¶
A wrapper around the PyBEL query builder.
-
exception
pybel_tools.query.
QueryMissingNetworksError
[source]¶ Raised if a query is created from json but doesn’t have a listing of network identifiers.
-
class
pybel_tools.query.
Query
(network_ids=None, seeding=None, pipeline=None)[source]¶ Represents a query over a network store.
Build a query.
Parameters: network_ids (None or int or iter[int]) – Database network identifiers identifiers -
append_network
(network_id)[source]¶ Add a network to this query.
Parameters: network_id (int) – The database identifier of the network Returns: self for fluid API Return type: Query
-
append_seeding_induction
(nodes)[source]¶ Add a seed induction method.
Parameters: or Node or BaseEntity] nodes (list[tuple) – A list of PyBEL node tuples Returns: seeding container for fluid API Return type: Seeding
-
append_seeding_neighbors
(nodes)[source]¶ Add a seed by neighbors.
Parameters: nodes (BaseEntity or iter[BaseEntity]) – A list of PyBEL node tuples
-
append_seeding_annotation
(annotation, values)[source]¶ Add a seed induction method for single annotation’s values.
Parameters:
-
append_seeding_sample
(**kwargs)[source]¶ Add seed induction methods.
Kwargs can have
number_edges
ornumber_seed_nodes
.
-
append_pipeline
(name, *args, **kwargs)[source]¶ Add an entry to the pipeline. Defers to
pybel_tools.pipeline.Pipeline.append()
.Parameters: name (str or types.FunctionType) – The name of the function Returns: This pipeline for fluid query building Return type: Pipeline
-
run
(manager)[source]¶ Run this query and returns the resulting BEL graph.
Parameters: manager – A cache manager Return type: Optional[pybel.BELGraph]
-
static
from_json
(data)[source]¶ Load a query from a JSON dictionary.
Parameters: data (dict) – A JSON dictionary Return type: Query Raises: QueryMissingNetworksError
-