From 9d97d1d297ac85f9b4aadbd05704e9df6e8fe98a Mon Sep 17 00:00:00 2001 From: codycbakerphd Date: Tue, 30 Jan 2024 22:13:28 -0500 Subject: [PATCH] expand docs and changelog --- CHANGELOG.md | 6 ++++++ docs/best_practices/nwbfile_metadata.rst | 2 ++ src/nwbinspector/nwbinspector.py | 10 ++++++++-- tests/test_inspector.py | 4 ++-- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 705f3f30c..7b0a4e6fc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,12 @@ * Use cached extension namespaces when calling pynwb validate instead of just the core namespace. [#425](https://github.com/NeurodataWithoutBorders/nwbinspector/pull/425) +### Improvements + +* Added automatic suppression of certain subject related checks when inspecting files using the "dandi" configuration that have a `subject_id` that starts with the keyphrase "invitro"; _e.g._, "invitroCaMPARI3" to indicate the _in vitro_ subject of the experiment is a purified CaMPARI3 protein. + + + # v0.4.30 ### Fixes diff --git a/docs/best_practices/nwbfile_metadata.rst b/docs/best_practices/nwbfile_metadata.rst index 1915172f9..1b80be17a 100644 --- a/docs/best_practices/nwbfile_metadata.rst +++ b/docs/best_practices/nwbfile_metadata.rst @@ -184,6 +184,8 @@ A ``subject_id`` is required for upload to the :dandi-archive:`DANDI archive <>` not intended for DANDI upload, if the :ref:`nwb-schema:sec-Subject` is specified at all it should be given a ``subject_id`` for reference. +In the special case of *in vitro* studies where the 'subject' of scientific interest may not have been a biological sample obtained from a living subject, such as the case of a purified protein, suppression of validation for additional subject attributes is possible by prepending the keyphrase "invitro" to the subject ID; *e.g*, "invitroCaMPARI3". In the case where the *in vitro* experiment is performed on an extracted or cultured biological sample, the other subject attributes (such as age and sex) should be specified as their values at the time the sample was collected. + Check function: :py:meth:`~nwbinspector.checks.nwbfile_metadata.check_subject_id_exists` diff --git a/src/nwbinspector/nwbinspector.py b/src/nwbinspector/nwbinspector.py index e8b9bf95f..3a3927b0c 100644 --- a/src/nwbinspector/nwbinspector.py +++ b/src/nwbinspector/nwbinspector.py @@ -604,8 +604,14 @@ def inspect_nwbfile( ) +# TODO: deprecate once subject types and dandi schemas have been extended def _intercept_in_vitro(nwbfile_object: pynwb.NWBFile, checks: Optional[list] = None) -> List[callable]: - """If the special 'in_vitro' subject_id is specified, return a truncated list of checks to run.""" + """ + If the special 'invitro' subject_id is specified, return a truncated list of checks to run. + + This is a temporary method for allowing upload of in vitro data to DANDI and + is expected to replaced in future versions. + """ subject_related_check_names = [ "check_subject_exists", "check_subject_id_exists", @@ -623,7 +629,7 @@ def _intercept_in_vitro(nwbfile_object: pynwb.NWBFile, checks: Optional[list] = if ( any(subject_related_dandi_requirements) and subject is not None - and getattr(subject, "subject_id", "").startswith("in_vitro_") + and getattr(subject, "subject_id", "").startswith("invitro") ): non_subject_checks = [check for check in checks if check.__name__ not in subject_related_check_names] return non_subject_checks diff --git a/tests/test_inspector.py b/tests/test_inspector.py index a8dd21b8f..b3e24f364 100644 --- a/tests/test_inspector.py +++ b/tests/test_inspector.py @@ -730,9 +730,9 @@ def test_check_unique_identifiers_fail(self): def test_dandi_config_in_vitro_injection(): - """Test that a subject_id starting with 'in_vitro_' excludes meaningless CRITICAL-elevated subject checks.""" + """Test that a subject_id starting with 'invitro' excludes meaningless CRITICAL-elevated subject checks.""" nwbfile = mock_NWBFile( - subject=Subject(subject_id="in_vitro_CaMPARI3", description="A detailed description about the in vitro setup.") + subject=Subject(subject_id="invitroCaMPARI3", description="A detailed description about the in vitro setup.") ) config = load_config(filepath_or_keyword="dandi") importance_threshold = "CRITICAL"