Skip to content

Commit 7c5adbe

Browse files
Document sample_id
1 parent 2570fac commit 7c5adbe

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

sc2ts/dataset.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,11 +259,11 @@ def __init__(self, path, chunk_cache_size=1, date_field=None):
259259
else:
260260
self.store = zarr.DirectoryStore(path)
261261
self.root = zarr.open(self.store, mode="r")
262-
self.sample_id = self.root["sample_id"][:].astype(str)
262+
self._sample_id = self.root["sample_id"][:].astype(str)
263263

264264
# TODO we should be storing this mapping in the Zarr somehow.
265265
self.sample_id_map = {
266-
sample_id: k for k, sample_id in enumerate(self.sample_id)
266+
sample_id: k for k, sample_id in enumerate(self._sample_id)
267267
}
268268
self.haplotypes = CachedHaplotypeMapping(
269269
self.root, self.sample_id_map, chunk_cache_size
@@ -284,6 +284,13 @@ def __iter__(self):
284284
def __len__(self):
285285
return len(self.root)
286286

287+
@property
288+
def sample_id(self):
289+
"""
290+
The sample IDs as a numpy string array.
291+
"""
292+
return self._sample_id
293+
287294
@property
288295
def samples_chunk_size(self):
289296
return self.root["call_genotype"].chunks[1]

0 commit comments

Comments
 (0)