Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
szhan committed Jun 16, 2023
1 parent e4e5225 commit 1b7393d
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/compare_vcfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,19 @@ def make_compatible_genotypes(ds1, ds2):
"""
Make `ds2` compatible with `ds1` by remapping genotypes.
Definition of compatibility:
1. `ds1` and `ds2` have the same number of samples.
2. `ds1` and `ds2` have the same ploidy.
3. `ds1` and `ds2` have the same number of variable sites.
4. `ds1` and `ds2` have the same allele list at each site.
:param xarray.Dataset ds1: sgkit-style dataset
:param xarray.Dataset ds2: sgkit-style dataset
:return: Remapped `ds2`
:rtype: xarray.Dataset
:return: Compatible `ds1` and `ds2`
:rtype: tuple(xarray.Dataset, xarray.Dataset)
"""
remapped_ds2_genotype = remap_genotypes(ds1, ds2)
remapped_ds2_genotype = xr.DataArray(remapped_ds2_genotype, dims=('variants', 'samples'))
ds1_reduced = None
ds2_reduced = None
remapped_ds2 = ds2.assign(call_genotype=remapped_ds2_genotype)
return remapped_ds2
common_site_pos = remapped_ds2_genotype.variant_position
ds1_subset = None
ds2_subset = None
return (ds1_subset, ds2_subset)

0 comments on commit 1b7393d

Please sign in to comment.