From 3d2fa6ddff1e2bcf2be99b04136fdfbed82fe2d8 Mon Sep 17 00:00:00 2001 From: Joyce Yan <5653616+joyceyan@users.noreply.github.com> Date: Thu, 5 Dec 2024 13:20:43 -0800 Subject: [PATCH] chore: add back return value from is_seurat_convertible (#1147) --- cellxgene_schema_cli/cellxgene_schema/validate.py | 11 ++++++----- cellxgene_schema_cli/tests/test_validate.py | 8 ++++---- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/cellxgene_schema_cli/cellxgene_schema/validate.py b/cellxgene_schema_cli/cellxgene_schema/validate.py index 4f92ef05..60d3a6ba 100644 --- a/cellxgene_schema_cli/cellxgene_schema/validate.py +++ b/cellxgene_schema_cli/cellxgene_schema/validate.py @@ -2115,7 +2115,7 @@ def validate( add_labels_file: str = None, ignore_labels: bool = False, verbose: bool = False, -) -> (bool, list): +) -> (bool, list, bool): from .write_labels import AnnDataLabelAppender """ @@ -2124,7 +2124,8 @@ def validate( :param Union[str, bytes, os.PathLike] h5ad_path: Path to h5ad file to validate :param str add_labels_file: Path to new h5ad file with ontology/gene labels added - :return (True, []) if successful validation, (False, [list_of_errors]) otherwise + :return (True, [], False) if successful validation, (False, [list_of_errors], False) otherwise; + last bool is for seurat convertability which is deprecated / unused :rtype tuple """ @@ -2138,7 +2139,7 @@ def validate( # Stop if validation was unsuccessful if not validator.is_valid: - return False, validator.errors + return False, validator.errors, False if add_labels_file: label_start = datetime.now() @@ -2149,6 +2150,6 @@ def validate( f"{writer.was_writing_successful}" ) - return (validator.is_valid and writer.was_writing_successful, validator.errors + writer.errors) + return (validator.is_valid and writer.was_writing_successful, validator.errors + writer.errors, False) - return True, validator.errors + return True, validator.errors, False diff --git a/cellxgene_schema_cli/tests/test_validate.py b/cellxgene_schema_cli/tests/test_validate.py index 9ea024b1..b60f2a19 100644 --- a/cellxgene_schema_cli/tests/test_validate.py +++ b/cellxgene_schema_cli/tests/test_validate.py @@ -297,7 +297,7 @@ def test__validate_with_h5ad_valid_and_labels(self): with tempfile.TemporaryDirectory() as temp_dir: labels_path = "/".join([temp_dir, "labels.h5ad"]) - success, errors = validate(h5ad_valid, labels_path) + success, errors, _ = validate(h5ad_valid, labels_path) import anndata as ad @@ -312,7 +312,7 @@ def test__validate_with_h5ad_valid_and_labels(self): assert original_hash != expected_hash, "Writing labels did not change the dataset from the original." def test__validate_with_h5ad_valid_and_without_labels(self): - success, errors = validate(h5ad_valid) + success, errors, _ = validate(h5ad_valid) assert success assert not errors @@ -321,14 +321,14 @@ def test__validate_with_h5ad_invalid_and_with_labels(self): with tempfile.TemporaryDirectory() as temp_dir: labels_path = "/".join([temp_dir, "labels.h5ad"]) - success, errors = validate(h5ad_invalid, labels_path) + success, errors, _ = validate(h5ad_invalid, labels_path) assert not success assert errors assert not os.path.exists(labels_path) def test__validate_with_h5ad_invalid_and_without_labels(self): - success, errors = validate(h5ad_invalid) + success, errors, _ = validate(h5ad_invalid) assert not success assert errors