Skip to content

Commit 62fe20f

Browse files
tomwhitejeromekelleher
authored andcommitted
Go back to Group.array() following zarr-developers/zarr-python#2667
1 parent 80ff9bf commit 62fe20f

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
@@ -571,7 +571,7 @@ def init(
571571
def encode_samples(self, root):
572572
if self.schema.samples != self.icf.metadata.samples:
573573
raise ValueError("Subsetting or reordering samples not supported currently")
574-
array = root.create_dataset(
574+
array = root.array(
575575
"sample_id",
576576
data=[sample.id for sample in self.schema.samples],
577577
shape=len(self.schema.samples),
@@ -583,7 +583,7 @@ def encode_samples(self, root):
583583
logger.debug("Samples done")
584584

585585
def encode_contig_id(self, root):
586-
array = root.create_dataset(
586+
array = root.array(
587587
"contig_id",
588588
data=[contig.id for contig in self.schema.contigs],
589589
shape=len(self.schema.contigs),
@@ -592,7 +592,7 @@ def encode_contig_id(self, root):
592592
)
593593
array.attrs["_ARRAY_DIMENSIONS"] = ["contigs"]
594594
if all(contig.length is not None for contig in self.schema.contigs):
595-
array = root.create_dataset(
595+
array = root.array(
596596
"contig_length",
597597
data=[contig.length for contig in self.schema.contigs],
598598
shape=len(self.schema.contigs),
@@ -604,7 +604,7 @@ def encode_contig_id(self, root):
604604
def encode_filter_id(self, root):
605605
# TODO need a way to store description also
606606
# https://github.com/sgkit-dev/vcf-zarr-spec/issues/19
607-
array = root.create_dataset(
607+
array = root.array(
608608
"filter_id",
609609
data=[filt.id for filt in self.schema.filters],
610610
shape=len(self.schema.filters),
@@ -954,7 +954,7 @@ def create_index(self):
954954
kwargs = {}
955955
if not zarr_v3():
956956
kwargs["dimension_separator"] = self.metadata.dimension_separator
957-
array = root.create_dataset(
957+
array = root.array(
958958
"region_index",
959959
data=index,
960960
shape=index.shape,

0 commit comments

Comments
 (0)