wobbegong.client package

Submodules

wobbegong.client.client module

wobbegong.client.client.load(path_or_url)[source]

Load a Wobbegong dataset from a local path or URL.

Parameters:

path_or_url (str) – Local filesystem path or a remote URL (http/https).

Returns:

A Wobbegong object (DataFrame, Matrix, SummarizedExperiment, or SingleCellExperiment).

wobbegong.client.readers module

class wobbegong.client.readers.WobbegongBase(accessor, summary=None)[source]

Bases: object

Base class for Wobbegong objects.

__init__(accessor, summary=None)[source]

Initialize the base object.

Parameters:
  • accessor (Accessor) – Helper to access data.

  • summary (dict) – Summary dictionary. If None, it is read from ‘summary.json’.

class wobbegong.client.readers.WobbegongDataFrame(accessor, summary=None)[source]

Bases: WobbegongBase

WobbegongDataFrame class.

__annotations__ = {}
__init__(accessor, summary=None)[source]

Initialize WobbegongDataFrame.

Parameters:
  • accessor (Accessor) – Helper to access data.

  • summary (dict) – Summary dictionary.

get_column(index_or_name)[source]

Get a column by index or name.

Parameters:

index_or_name (int | str) – Column index (int) or name (str).

Return type:

ndarray | list

Returns:

The column data.

get_row_names()[source]

Get row names if available.

Return type:

ndarray | list | None

Returns:

Row names or None.

class wobbegong.client.readers.WobbegongMatrix(accessor, summary=None)[source]

Bases: WobbegongBase

WobbegongMatrix class.

__annotations__ = {}
__init__(accessor, summary=None)[source]

Initialize WobbegongMatrix.

Parameters:
  • accessor (Accessor) – Helper to access data.

  • summary (dict) – Summary dictionary.

get_row(row_idx)[source]

Get a row by index.

Parameters:

row_idx (int) – Row index.

Return type:

ndarray

Returns:

Row data.

get_rows(row_indices, num_threads=None)[source]

Retrieves multiple rows efficiently using mmap and parallel decompression.

Note: Currently only supports local files.

Parameters:

row_indices (slice | list | ndarray) – Row indices to retrieve. Can be a slice, list, or numpy array.

Return type:

ndarray | csr_matrix

Returns:

A dense numpy array or sparse CSR matrix containing the requested rows.

get_statistic(name)[source]

Get a statistic by name.

Parameters:

name (str) – Name of the statistic.

Return type:

ndarray | int | float

Returns:

The statistic value.

class wobbegong.client.readers.WobbegongSingleCellExperiment(accessor, summary=None)[source]

Bases: WobbegongSummarizedExperiment

WobbegongSingleCellExperiment class.

__annotations__ = {}
get_reduced_dim(name)[source]

Get reduced dimension by name.

Parameters:

name (str) – Name of the reduced dimension.

Return type:

WobbegongBase

Returns:

Reduced dimension object.

class wobbegong.client.readers.WobbegongSummarizedExperiment(accessor, summary=None)[source]

Bases: WobbegongBase

WobbegongSummarizedExperiment class.

__annotations__ = {}
__init__(accessor, summary=None)[source]

Initialize WobbegongSummarizedExperiment.

Parameters:
  • accessor (Accessor) – Helper to access data.

  • summary (dict) – Summary dictionary.

get_assay(index_or_name)[source]

Get assay by index or name.

Parameters:

index_or_name (int | str) – Assay index (int) or name (str).

Return type:

WobbegongBase

Returns:

Assay object.

get_col_data()[source]

Get column data.

Return type:

WobbegongDataFrame | None

Returns:

Column data object or None.

get_row_data()[source]

Get row data.

Return type:

WobbegongDataFrame | None

Returns:

Row data object or None.

wobbegong.client.utils module

wobbegong.client.utils.read_boolean(path, start, length, compression='zlib')[source]

Read boolean data from a file.

Parameters:
  • path (str) – Path to the file.

  • start (int) – Start offset in bytes.

  • length (int) – Number of bytes to read.

  • compression (Literal['lz4', 'zlib']) – Compression method to use, either ‘lz4’ or ‘zlib’ (default).

Return type:

ndarray

Returns:

Numpy array of booleans (or None/object).

wobbegong.client.utils.read_chunk(path, start, length)[source]

Read a chunk of bytes from a file.

Parameters:
  • path (str) – Path to the file.

  • start (int) – Start offset in bytes.

  • length (int) – Number of bytes to read.

Return type:

bytes

Returns:

The bytes read.

wobbegong.client.utils.read_double(path, start, length, compression='zlib')[source]

Read double (float) data from a file.

Parameters:
  • path (str) – Path to the file.

  • start (int) – Start offset in bytes.

  • length (int) – Number of bytes to read.

  • compression (Literal['lz4', 'zlib']) – Compression method to use, either ‘lz4’ or ‘zlib’ (default).

Return type:

ndarray

Returns:

Numpy array of floats.

wobbegong.client.utils.read_integer(path, start, length, compression='zlib')[source]

Read integer data from a file.

Parameters:
  • path (str) – Path to the file.

  • start (int) – Start offset in bytes.

  • length (int) – Number of bytes to read.

  • compression (Literal['lz4', 'zlib']) – Compression method to use, either ‘lz4’ or ‘zlib’ (default).

Return type:

ndarray

Returns:

Numpy array of integers.

wobbegong.client.utils.read_sparse_row_values(path, start, vlen, ilen, reader_func, compression='zlib')[source]

Read sparse row values.

Parameters:
  • path (str) – Path to the file.

  • start (int) – Start offset.

  • vlen (int) – Length of values in bytes.

  • ilen (int) – Length of indices in bytes.

  • reader_func (callable) – Function to read the values (integer, double, etc.).

  • compression (Literal['lz4', 'zlib']) – Compression method to use, either ‘lz4’ or ‘zlib’ (default).

Returns:

Tuple of (values, indices).

wobbegong.client.utils.read_string(path, start, length, compression='zlib')[source]

Read string data from a file.

Parameters:
  • path (str) – Path to the file.

  • start (int) – Start offset in bytes.

  • length (int) – Number of bytes to read.

  • compression (Literal['lz4', 'zlib']) – Compression method to use, either ‘lz4’ or ‘zlib’ (default).

Return type:

list[str]

Returns:

List of strings.

wobbegong.client.utils.reconstruct_sparse_row(vals, indices, ncols, dtype)[source]

Reconstruct a sparse row into a dense array.

Parameters:
  • vals (ndarray) – Values.

  • indices (ndarray) – Column indices.

  • ncols (int) – Total number of columns.

  • dtype (dtype) – Data type of the array.

Returns:

Dense numpy array.

Module contents