Skip to content

Commit 4a6ed6b

Browse files
committed
Go back to Group.array() following zarr-developers/zarr-python#2667
1 parent d8f72c9 commit 4a6ed6b

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

bio2zarr/plink.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def convert(
8686
# we're not using the best Blosc settings for genotypes here.
8787
default_compressor = numcodecs.Blosc(cname="zstd", clevel=7)
8888

89-
a = root.create_dataset(
89+
a = root.array(
9090
"sample_id",
9191
data=bed.iid,
9292
shape=bed.iid.shape,
@@ -99,7 +99,7 @@ def convert(
9999

100100
# TODO encode these in slices - but read them in one go to avoid
101101
# fetching repeatedly from bim file
102-
a = root.create_dataset(
102+
a = root.array(
103103
"variant_position",
104104
data=bed.bp_position,
105105
shape=bed.bp_position.shape,
@@ -111,7 +111,7 @@ def convert(
111111
logger.debug("encoded variant_position")
112112

113113
alleles = np.stack([bed.allele_1, bed.allele_2], axis=1)
114-
a = root.create_dataset(
114+
a = root.array(
115115
"variant_allele",
116116
data=alleles,
117117
shape=alleles.shape,

bio2zarr/vcf2zarr/vcz.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ def init(
572572
def encode_samples(self, root):
573573
if self.schema.samples != self.icf.metadata.samples:
574574
raise ValueError("Subsetting or reordering samples not supported currently")
575-
array = root.create_dataset(
575+
array = root.array(
576576
"sample_id",
577577
data=[sample.id for sample in self.schema.samples],
578578
shape=len(self.schema.samples),
@@ -584,7 +584,7 @@ def encode_samples(self, root):
584584
logger.debug("Samples done")
585585

586586
def encode_contig_id(self, root):
587-
array = root.create_dataset(
587+
array = root.array(
588588
"contig_id",
589589
data=[contig.id for contig in self.schema.contigs],
590590
shape=len(self.schema.contigs),
@@ -593,7 +593,7 @@ def encode_contig_id(self, root):
593593
)
594594
array.attrs["_ARRAY_DIMENSIONS"] = ["contigs"]
595595
if all(contig.length is not None for contig in self.schema.contigs):
596-
array = root.create_dataset(
596+
array = root.array(
597597
"contig_length",
598598
data=[contig.length for contig in self.schema.contigs],
599599
shape=len(self.schema.contigs),
@@ -605,7 +605,7 @@ def encode_contig_id(self, root):
605605
def encode_filter_id(self, root):
606606
# TODO need a way to store description also
607607
# https://github.com/sgkit-dev/vcf-zarr-spec/issues/19
608-
array = root.create_dataset(
608+
array = root.array(
609609
"filter_id",
610610
data=[filt.id for filt in self.schema.filters],
611611
shape=len(self.schema.filters),
@@ -955,7 +955,7 @@ def create_index(self):
955955
kwargs = {}
956956
if not zarr_v3():
957957
kwargs["dimension_separator"] = self.metadata.dimension_separator
958-
array = root.create_dataset(
958+
array = root.array(
959959
"region_index",
960960
data=index,
961961
shape=index.shape,

0 commit comments

Comments
 (0)