Skip to content

Preserve typed Dask arrays and genotype annotations when copying - #460

Open
antonsoo wants to merge 1 commit into
cggh:masterfrom
antonsoo:fix/377-copy-dask-genotypes
Open

antonsoo wants to merge 1 commit into
cggh:masterfrom
antonsoo:fix/377-copy-dask-genotypes

Conversation

@antonsoo

Copy link
Copy Markdown

Closes #377.

GenotypeDaskArray.copy() currently returns a bare dask.array.Array, so the copy loses methods such as count_alleles. Wrap copied values in the same array class, and copy genotype masks and phasing arrays independently, matching the eager array behavior. The operation stays lazy and retains its chunk layout.

Fourteen regressions cover all six Dask wrapper types, genotype vectors/arrays, masks, phasing and later assignments to the original. They all fail before the change. The affected Dask checks pass 178 tests, and full suites pass 895 versus 881 on unchanged master, on Python 3.12/NumPy 1.26 and Python 3.10/NumPy 2.2. Whole-project correctness Flake8 passes.

A simulated cohort is read through the native VCF reader and stored in Zarr. All 24 copy-then-analysis workflows now continue through population slicing, native allele counting and dosage calculation, with masks/phasing preserved and zero tasks executed during copying. All 24 direct-analysis controls remain identical. The replay materializes values and annotations explicitly; the separate existing masked/phased whole-wrapper compute() ordering issue is outside this fix.

The installed Python 3.12 wheel reproduces all 24 analysis records and controls exactly, with imported source and native paths checked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Copying GenotypeDaskArray returns DaskArray

1 participant