diff --git a/CHANGELOG.md b/CHANGELOG.md index 76b45af..77fe2a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,8 +3,13 @@ Observes [Semantic Versioning](https://semver.org/spec/v2.0.0.html) standard and [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) convention. +## [0.1.1] - 2023-08-31 + ++ Update - Incorporate suggestions from previous PR to improve pytests + ## [0.1.0] - Unreleased + Add - Workflow pipeline, pytests, CICD +[0.1.1]: https://github.com/datajoint/workflow-zstack/releases/tag/0.1.1 [0.1.0]: https://github.com/datajoint/workflow-zstack/releases/tag/0.1.0 diff --git a/README.md b/README.md index 072f73d..be702e6 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ a tutorial environment and notebook to learn the pipeline. to ensure you have `resource-manager` permissions for your account. 2. Follow the instructions below to set up the [intern](https://github.com/jhuapl-boss/intern) REST API locally. - + Create a new folder `.intern` in your root directory. + + Create a new folder `.intern` in your user directory. + Create a configuration file `intern.cfg` within the `.intern` folder. The path to this file should be `~/.intern/intern.cfg`. + The `intern.cfg` file should contain the following exactly as shown below: diff --git a/tests/conftest.py b/tests/conftest.py index 2e15ba6..2d6b116 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -16,7 +16,7 @@ sessions_dirs = [ - "subject1", + "subject2", ] # ---------------------- FIXTURES ---------------------- @@ -57,7 +57,7 @@ def insert_upstream(pipeline): subject.Subject.insert1( dict( - subject="subject1", + subject="subject2", sex="M", subject_birth_date="2023-01-01", subject_description="Cellpose segmentation of volumetric data."), @@ -65,7 +65,7 @@ def insert_upstream(pipeline): ) session_key = dict( - subject="subject1", + subject="subject2", session_id=0, ) session.Session.insert1( @@ -77,7 +77,7 @@ def insert_upstream(pipeline): ) session.SessionDirectory.insert1( - dict(session_key, session_dir="subject1/session1"), + dict(session_key, session_dir="subject2"), skip_duplicates=True, ) scan.Scan.insert1( @@ -102,21 +102,20 @@ def volume_volume(pipeline): @pytest.fixture(scope="session") -def volume_segmentation_task(pipeline): +def volume_segmentation_param_set(pipeline): volume = pipeline["volume"] - key = (volume.Volume & "subject='subject1'").fetch1("KEY") + key = (volume.Volume & "subject='subject2'").fetch1("KEY") volume.SegmentationParamSet.insert_new_params( segmentation_method="cellpose", paramset_idx=1, params=dict( - diameter=8, + diameter=None, min_size=2, do_3d=False, anisotropy=0.5, model_type="nuclei", channels=[[0, 0]], z_axis=0, - skip_duplicates=True, ), ) yield @@ -125,6 +124,7 @@ def volume_segmentation_task(pipeline): @pytest.fixture(scope="session") def volume_segmentation_task(pipeline): volume = pipeline["volume"] + key = (volume.Volume & "subject='subject2'").fetch1("KEY") volume.SegmentationTask.insert1(dict( key, paramset_idx=1, @@ -135,7 +135,7 @@ def volume_segmentation_task(pipeline): @pytest.fixture(scope="session") def volume_segmentation(pipeline): volume = pipeline["volume"] - key = (volume.Volume & "subject='subject1'").fetch1("KEY") + key = (volume.Volume & "subject='subject2'").fetch1("KEY") volume.Segmentation.populate(key) yield @@ -143,7 +143,7 @@ def volume_segmentation(pipeline): @pytest.fixture(scope="session") def volume_voxel_size(pipeline): volume = pipeline["volume"] - key = (volume.Volume & "subject='subject1'").fetch1("KEY") + key = (volume.Volume & "subject='subject2'").fetch1("KEY") volume.VoxelSize.insert1( dict( key, @@ -158,10 +158,10 @@ def volume_voxel_size(pipeline): def bossdb_volume_upload_task(pipeline): bossdb = pipeline["bossdb"] volume = pipeline["volume"] - key = (volume.Segmentation & "subject='subject1'").fetch1("KEY") + key = (volume.Segmentation & "subject='subject2'").fetch1("KEY") col_name = "dataJointTestUpload" exp_name = "CaImagingFinal" - chn_name = "test1" + chn_name = "test2" bossdb.VolumeUploadTask.insert1( dict( diff --git a/tests/test_export.py b/tests/test_export.py index 096886e..c172ac5 100644 --- a/tests/test_export.py +++ b/tests/test_export.py @@ -15,7 +15,7 @@ def test_export(pipeline): subject.Subject.insert1( dict( - subject="subject1", + subject="subject2", sex="M", subject_birth_date="2023-01-01", subject_description="Cellpose segmentation of volumetric data."), @@ -23,7 +23,7 @@ def test_export(pipeline): ) session_key = dict( - subject="subject1", + subject="subject2", session_id=0, ) session.Session.insert1( @@ -35,7 +35,7 @@ def test_export(pipeline): ) session.SessionDirectory.insert1( - dict(session_key, session_dir="subject1/session1"), + dict(session_key, session_dir="subject2"), skip_duplicates=True, ) scan.Scan.insert1( @@ -46,11 +46,11 @@ def test_export(pipeline): ), skip_duplicates=True, ) - volume.Volume.populate() - key = (volume.Volume & "subject='subject1'").fetch1("KEY") + volume.Volume.populate(session_key) + key = (volume.Volume & "subject='subject2'").fetch1("KEY") volume.SegmentationParamSet.insert_new_params( segmentation_method="cellpose", - paramset_idx=2, + paramset_idx=1, params=dict( diameter=None, min_size=2, @@ -59,21 +59,21 @@ def test_export(pipeline): model_type="nuclei", channels=[[0, 0]], z_axis=0, - skip_duplicates=True, ), ) volume.SegmentationTask.insert1(dict( key, - paramset_idx=2, + paramset_idx=1, task_mode="trigger", ), skip_duplicates=True, ) - segmentation_key = (volume.SegmentationTask & "subject='subject1'").fetch1("KEY") + segmentation_key = (volume.SegmentationTask & "subject='subject2'").fetch1("KEY") volume.Segmentation.populate(segmentation_key) volume.VoxelSize.insert1( dict( - segmentation_key, + **session_key, + scan_id=0, width=0.001, height=0.001, depth=0.001, @@ -81,7 +81,7 @@ def test_export(pipeline): ) col_name = "dataJointTestUpload" exp_name = "CaImagingFinal" - chn_name = "test1" + chn_name = "test2" bossdb.VolumeUploadTask.insert1( dict( diff --git a/workflow_zstack/__init__.py b/workflow_zstack/__init__.py index 8d01cc8..a17bba4 100644 --- a/workflow_zstack/__init__.py +++ b/workflow_zstack/__init__.py @@ -14,4 +14,4 @@ "VOLUME_ROOT_DATA_DIR", dj.config["custom"].get("volume_root_data_dir", "") ) -db_prefix = dj.config["custom"].get("database.prefix", "") \ No newline at end of file +db_prefix = dj.config["custom"].get("database.prefix", "") diff --git a/workflow_zstack/paths.py b/workflow_zstack/paths.py index 9da17a0..1d45ddc 100644 --- a/workflow_zstack/paths.py +++ b/workflow_zstack/paths.py @@ -33,16 +33,18 @@ def get_volume_tif_file(scan_key): Raises: FileNotFoundError: If the tiff file(s) are not found. """ - # Folder structure: root / subject / session / .tif (raw) + # Folder structure: root / subject / session / .tif (raw) sess_dir = find_full_path( get_volume_root_data_dir(), pathlib.Path((session.SessionDirectory & scan_key).fetch1("session_dir")), ) - + tiff_filepaths = [fp.as_posix() for fp in sess_dir.rglob("*.tif")] if tiff_filepaths: - assert len(tiff_filepaths) == 1, "More than 1 `.tif` file in file path. Please ensure the session directory contains only 1 image file." + assert ( + len(tiff_filepaths) == 1 + ), "More than 1 `.tif` file in file path. Please ensure the session directory contains only 1 image file." return tiff_filepaths[0] else: raise FileNotFoundError(f"No tiff file found in {sess_dir}") diff --git a/workflow_zstack/reference.py b/workflow_zstack/reference.py index 0dfad14..af76def 100644 --- a/workflow_zstack/reference.py +++ b/workflow_zstack/reference.py @@ -7,20 +7,9 @@ @schema class Device(dj.Lookup): - """Table for managing lab equipment. - - Attributes: - device ( varchar(32) ): Device short name. - modality ( varchar(64) ): Modality for which this device is used. - description ( varchar(256) ): Optional. Description of device. - """ - definition = """ - device : varchar(32) + device_id : smallint --- - modality : varchar(64) - description=null : varchar(256) + device_name : varchar(32) # user-friendly name of the device + device_description : varchar(256) """ - contents = [ - ["scanner1", "fluorescence microscope", ""], - ] diff --git a/workflow_zstack/version.py b/workflow_zstack/version.py index ee6de92..21cb2ec 100644 --- a/workflow_zstack/version.py +++ b/workflow_zstack/version.py @@ -1,2 +1,2 @@ """Package metadata.""" -__version__ = "0.1.0" +__version__ = "0.1.1"