Skip to content

Commit

Permalink
add internal attributes of QueryCollection to its init and comment …
Browse files Browse the repository at this point in the history
…in docstring.

also fix docstring typos in process method
  • Loading branch information
DaniBodor committed Nov 1, 2023
1 parent 96f8bbe commit 47b97ee
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions deeprank2/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,15 +377,29 @@ def _build_helper(self) -> Graph:


class QueryCollection:
"""Represents the collection of data queries.
"""Represents the collection of data queries that will be processed.
The class attributes are set either while adding queries to the
collection (`_queries` and `_ids_count`), or when processing the collection
(`_cpu_count`, `_prefix`, and `_grid_settings`).
Attributes:
_queries (list[:class:`Query`]): The `Query` objects in the collection.
_ids_count (dict[str, int]): The original `query_id` and the repeat number for this id.
This is used to rename the `query_id` to ensure that there are no duplicate ids.
_prefix, _cpu_count, and _grid_settings: See docstring for `QueryCollection.process`.
Note:
Queries can be saved as a dictionary to easily navigate through their data,
using `QueryCollection.export_dict()`.
"""

def __init__(self):
self._queries = []
self._ids_count = {}
self._queries: list[Query] = []
self._ids_count: dict[str, int] = {}
self._prefix: str | None = None
self._cpu_count: int | None = None
self._grid_settings: GridSettings | None = None

def add(
self,
Expand Down Expand Up @@ -475,8 +489,8 @@ def process( # pylint: disable=too-many-arguments, too-many-locals, dangerous-de
"""Render queries into graphs (and optionally grids).
Args:
prefix (str None, optional): prefix for naming the output files. Defaults to "processed-queries".
feature_modules (list[ModuleType] | list[str] | Literal ['all'], optional): feature module or list of feature modules
prefix (str | None, optional): Prefix for naming the output files. Defaults to "processed-queries".
feature_modules (list[ModuleType] | list[str] | Literal ['all'], optional): Feature module or list of feature modules
used to generate features (given as string or as an imported module).
Each module must implement the :py:func:`add_features` function, and all feature modules must exist inside `deeprank2.features` folder.
If set to 'all', all available modules in `deeprank2.features` are used to generate the features.
Expand All @@ -485,7 +499,7 @@ def process( # pylint: disable=too-many-arguments, too-many-locals, dangerous-de
the number of CPUs available to the system.
Defaults to None, which takes all available cpu cores.
combine_output (bool, optional):
if `True` (default): all processes are combined into a single HDF5 file.
If `True` (default): all processes are combined into a single HDF5 file.
If `False`: separate HDF5 files are created for each process (i.e. for each CPU used).
grid_settings (:class:`GridSettings` | None, optional): If valid together with `grid_map_method`, the grid data will be stored as well.
Defaults to None.
Expand Down

0 comments on commit 47b97ee

Please sign in to comment.