match.lib.variantframe

Attributes

logger

Classes

VariantFrame

Similar to pgscatalog.core.TargetVariants, but backed by the polars dataframe library

Module Contents

class match.lib.variantframe.VariantFrame(path, dataset, chrom=None, cleanup=True, tmpdir=None)

Similar to pgscatalog.core.TargetVariants, but backed by the polars dataframe library

Fast, supports more complicated things, but requires more resources.

The context manager returns a polars LazyFrame:

>>> from ._config import Config
>>> path = Config.ROOT_DIR.parent / "pgscatalog.core" / "tests" / "data" / "hapnest.bim"
>>> x = VariantFrame(path, dataset="hapnest")
>>> with x as df:
...     df.collect().shape
(101, 6)
>>> x
VariantFrame(path='.../hapnest.bim', dataset='hapnest', chrom=None, cleanup=True, tmpdir=None)

The VariantFrame contains a pgscatalog.core.TargetVariants object:

>>> x.variants
TargetVariants(path='.../hapnest.bim')
save_ipc(destination)

Save the dataframe prepared by the context manager to an Arrow IPC file

Useful because the context manager will clean up the IPC files while exiting.

This method allows data to be persisted.

arrowpaths = None
chrom = None
dataset
variants
match.lib.variantframe.logger