calc.lib.cache.zarrmodels ========================= .. py:module:: calc.lib.cache.zarrmodels .. autoapi-nested-parse:: Pydantic models for loading and saving data from zarr attributes (metadata) These models help to read and write structured data about variants and samples This data is helpful when working with the genotype array (variants = row names, samples = column names). Attributes ---------- .. autoapisummary:: calc.lib.cache.zarrmodels.logger Classes ------- .. autoapisummary:: calc.lib.cache.zarrmodels.ZarrSampleMetadata calc.lib.cache.zarrmodels.ZarrVariantMetadata Functions --------- .. autoapisummary:: calc.lib.cache.zarrmodels.is_valid_allele Module Contents --------------- .. py:class:: ZarrSampleMetadata .. py:attribute:: root :type: list[str] .. py:class:: ZarrVariantMetadata A dataframe-y model, suitable for ingesting with pandas / polars / databases Useful for saving / loading data about variants into a group-level zarr attribute. Each target genome file will have its own variant metadata. .. py:method:: check_even_length() -> ZarrVariantMetadata .. py:method:: merge(other: ZarrVariantMetadata) -> ZarrVariantMetadata .. py:method:: to_df() -> polars.DataFrame .. py:method:: to_numpy() -> collections.abc.Mapping[str, numpy.typing.NDArray[Any]] Convert the dataframe into 1D arrays Handles converting strings to a consistent fixed width dtype .. py:attribute:: alts :type: Annotated[list[list[str] | None], AfterValidator(is_valid_allele)] .. py:attribute:: chr_name :type: list[str] .. py:attribute:: chr_pos :type: list[pydantic.PositiveInt] .. py:attribute:: ref :type: Annotated[list[str | None], AfterValidator(is_valid_allele)] .. py:attribute:: variant_id :type: list[str] .. py:function:: is_valid_allele(alleles: list[list[str] | None] | list[str | None]) -> list[list[str] | None] | list[str | None] .. py:data:: logger