pdbsearch.models
- class pdbsearch.models.QueryNode[source]
A base class for all query nodes.
- query(return_type, **request_options)[source]
Queries the RCSB search API with this node.
- Parameters:
return_type (str) – the type of data to return.
return_all (bool) – whether to return all results, unpaginated.
start (int) – the start index of the results.
rows (int) – the number of results to return.
sort (str or list[str]) – the attribute or attributes to sort by.
counts_only (bool) – whether to return only the count of results.
content_types (list[str]) – the PDB types (experimental/computational).
facets (list[str]) – RCSB aggregation terms.
- Return type:
dict
- class pdbsearch.models.TerminalNode(service: str, parameters: dict)[source]
A terminal node in a query graph, which represents a single search term.
- Parameters:
service (str) – the service to use for the terminal node.
parameters (dict) – the parameters to use for the terminal node.
- serialize()[source]
Creates the JSON-serializable representation of the node.
- Parameters:
node (QueryNode) – the node to combine with.
- Return type:
dict
- and_(node)[source]
Combines this terminal node with another node using the AND logical operator, to create a new group node.
- Parameters:
node (QueryNode) – the node to combine with.
- Return type:
GroupNode
- or_(node)[source]
Combines this terminal node with another node using the OR logical operator, to create a new group node.
- Parameters:
node (QueryNode) – the node to combine with.
- Return type:
GroupNode
- query(return_type, **request_options)
Queries the RCSB search API with this node.
- Parameters:
return_type (str) – the type of data to return.
return_all (bool) – whether to return all results, unpaginated.
start (int) – the start index of the results.
rows (int) – the number of results to return.
sort (str or list[str]) – the attribute or attributes to sort by.
counts_only (bool) – whether to return only the count of results.
content_types (list[str]) – the PDB types (experimental/computational).
facets (list[str]) – RCSB aggregation terms.
- Return type:
dict
- class pdbsearch.models.GroupNode(logical_operator: str, nodes: list[TerminalNode])[source]
A group node in a query graph, which combines other nodes with boolean logic.
- Parameters:
logical_operator (str) – the logical operator to use for the group node.
nodes (list[TerminalNode]) – the nodes to combine.
- and_(node)[source]
Combines this group node with another node using the AND logical operator, to create a new group node.
- Parameters:
node (QueryNode) – the node to combine with.
- Return type:
GroupNode
- or_(node)[source]
Combines this group node with another node using the OR logical operator, to create a new group node.
- Parameters:
node (QueryNode) – the node to combine with.
- Return type:
GroupNode
- query(return_type, **request_options)
Queries the RCSB search API with this node.
- Parameters:
return_type (str) – the type of data to return.
return_all (bool) – whether to return all results, unpaginated.
start (int) – the start index of the results.
rows (int) – the number of results to return.
sort (str or list[str]) – the attribute or attributes to sort by.
counts_only (bool) – whether to return only the count of results.
content_types (list[str]) – the PDB types (experimental/computational).
facets (list[str]) – RCSB aggregation terms.
- Return type:
dict