match.lib.variantframe ====================== .. py:module:: match.lib.variantframe Attributes ---------- .. autoapisummary:: match.lib.variantframe.logger Classes ------- .. autoapisummary:: match.lib.variantframe.VariantFrame Module Contents --------------- .. py:class:: VariantFrame(path, dataset, chrom=None, cleanup=True, tmpdir=None) Similar to :class:`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 # doctest: +ELLIPSIS VariantFrame(path='.../hapnest.bim', dataset='hapnest', chrom=None, cleanup=True, tmpdir=None) The :class:`VariantFrame` contains a :class:`pgscatalog.core.TargetVariants` object: >>> x.variants # doctest: +ELLIPSIS TargetVariants(path='.../hapnest.bim') .. py:method:: 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. .. py:attribute:: arrowpaths :value: None .. py:attribute:: chrom :value: None .. py:attribute:: dataset .. py:attribute:: variants .. py:data:: logger