Skip to content

Commit 69caca6

Browse files
Undocument a few methods in the dataset
1 parent 7827ce2 commit 69caca6

File tree

1 file changed

+1
-49
lines changed

1 file changed

+1
-49
lines changed

sc2ts/dataset.py

Lines changed: 1 addition & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ class Variant:
233233

234234

235235
class Dataset(collections.abc.Mapping):
236+
236237
def __init__(self, path, chunk_cache_size=1, date_field=None):
237238
"""
238239
Open a sc2ts VCF Zarr dataset for convenient access to alignments and metadata.
@@ -385,11 +386,6 @@ def copy(
385386
sample_id=None,
386387
show_progress=False,
387388
):
388-
"""
389-
Copy this dataset to the specified path.
390-
391-
If sample_id is specified, only include these samples in the specified order.
392-
"""
393389
if samples_chunk_size is None:
394390
samples_chunk_size = self.samples_chunk_size
395391
if variants_chunk_size is None:
@@ -414,20 +410,6 @@ def copy(
414410
Dataset.add_metadata(path, df)
415411

416412
def reorder(self, path, additional_fields=list(), show_progress=False):
417-
"""
418-
Write a copy of this dataset reordered by date and optional metadata fields.
419-
420-
Samples are sorted primarily by the dataset's ``date_field`` and then
421-
by any ``additional_fields`` provided, and written to a new dataset at
422-
``path``.
423-
424-
:param str path: Output path for the reordered dataset.
425-
:param list additional_fields: Metadata field names to use as
426-
secondary sort keys after ``date_field``. Defaults to an
427-
empty list.
428-
:param bool show_progress: If True, show a progress bar while
429-
copying samples. Defaults to False.
430-
"""
431413
sample_id = self.metadata.sample_id_array[:]
432414
sort_key = [self.date_field] + list(additional_fields)
433415
logger.info(f"Reorder sort key = {sort_key})")
@@ -436,19 +418,6 @@ def reorder(self, path, additional_fields=list(), show_progress=False):
436418

437419
@staticmethod
438420
def new(path, samples_chunk_size=None, variants_chunk_size=None):
439-
"""
440-
Create an empty sc2ts dataset at the specified path.
441-
442-
The resulting Zarr store is initialised with variant coordinates and
443-
empty sample/genotype arrays, ready for use with
444-
:meth:`Dataset.append_alignments` and :meth:`Dataset.add_metadata`.
445-
446-
:param str path: Path at which to create the new dataset.
447-
:param int samples_chunk_size: Chunk size for the samples dimension;
448-
if ``None``, a reasonable default is used.
449-
:param int variants_chunk_size: Chunk size for the variants
450-
dimension; if ``None``, a reasonable default is used.
451-
"""
452421
if samples_chunk_size is None:
453422
samples_chunk_size = 10_000
454423
if variants_chunk_size is None:
@@ -535,10 +504,6 @@ def new(path, samples_chunk_size=None, variants_chunk_size=None):
535504

536505
@staticmethod
537506
def append_alignments(path, alignments):
538-
"""
539-
Append alignments to the store. If this method fails then the store
540-
should be considered corrupt.
541-
"""
542507
if len(alignments) == 0:
543508
return
544509
store = zarr.DirectoryStore(path)
@@ -565,10 +530,6 @@ def append_alignments(path, alignments):
565530

566531
@staticmethod
567532
def add_metadata(path, df, field_descriptions=dict()):
568-
"""
569-
Add metadata from the specified dataframe, indexed by sample ID.
570-
Each column will be added as a new array with prefix ``sample_``.
571-
"""
572533
store = zarr.DirectoryStore(path)
573534
root = zarr.open(store, mode="a")
574535

@@ -608,15 +569,6 @@ def add_metadata(path, df, field_descriptions=dict()):
608569

609570
@staticmethod
610571
def create_zip(in_path, out_path):
611-
"""
612-
Create a zipped version of a directory-backed dataset.
613-
614-
The contents of ``in_path`` are written into a ZIP file at
615-
``out_path`` in a form suitable for use with :class:`Dataset`.
616-
617-
:param str in_path: Path to an existing directory-backed dataset.
618-
:param str out_path: Path to the output ``.zip`` file.
619-
"""
620572
# Based on https://github.com/python/cpython/blob/3.13/Lib/zipfile/__init__.py
621573
def add_to_zip(zf, path, zippath):
622574
if os.path.isfile(path):

0 commit comments

Comments
 (0)