From ecf0a51bfc213028b0a06bbff2b90b91273c0f94 Mon Sep 17 00:00:00 2001 From: gabridele Date: Thu, 19 Dec 2024 13:19:32 +0100 Subject: [PATCH 1/7] Changed type of parsing from IsFile to Path to allow filename only input --- cubids/cli.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cubids/cli.py b/cubids/cli.py index cf48cf9a..6a80069d 100644 --- a/cubids/cli.py +++ b/cubids/cli.py @@ -261,7 +261,7 @@ def _parse_apply(): ) parser.add_argument( "edited_summary_tsv", - type=IsFile, + type=Path, action="store", help=( "path to the _summary.tsv that has been edited " @@ -273,7 +273,7 @@ def _parse_apply(): ) parser.add_argument( "files_tsv", - type=IsFile, + type=Path, action="store", help=( "path to the _files.tsv that has been edited " From 6b77aee4f4d9694e64a498407ebcfa08deb69434 Mon Sep 17 00:00:00 2001 From: gabridele Date: Thu, 19 Dec 2024 13:23:47 +0100 Subject: [PATCH 2/7] changed type of parsing to Path to allow dir/file-name only input --- cubids/cli.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cubids/cli.py b/cubids/cli.py index 6a80069d..2d494c5e 100644 --- a/cubids/cli.py +++ b/cubids/cli.py @@ -440,7 +440,7 @@ def _parse_copy_exemplars(): ) parser.add_argument( "exemplars_dir", - type=PathExists, + type=Path, action="store", help=( "absolute path to the root of a BIDS dataset " @@ -451,7 +451,7 @@ def _parse_copy_exemplars(): ) parser.add_argument( "exemplars_tsv", - type=IsFile, + type=Path, action="store", help=( "absolute path to the .tsv file that lists one " From 4f9beb01f172de9764a87ca27f706a0b49ab4b6b Mon Sep 17 00:00:00 2001 From: gabridele Date: Thu, 19 Dec 2024 13:27:33 +0100 Subject: [PATCH 3/7] modified naming of shell script used in apply function, to be saved into BIDS dir, as expected --- cubids/cubids.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cubids/cubids.py b/cubids/cubids.py index 81781596..0a9934ea 100644 --- a/cubids/cubids.py +++ b/cubids/cubids.py @@ -416,7 +416,7 @@ def apply_tsv_changes(self, summary_tsv, files_tsv, new_prefix, raise_on_error=T full_cmd = "\n".join(merge_commands + move_ops) if full_cmd: - renames = new_prefix + "_full_cmd.sh" + renames = str(Path(self.path) / (new_prefix + "_full_cmd.sh")) # write full_cmd to a .sh file with open(renames, "w") as fo: From 50ab1aec756113b68850d3fc2cec9a7f3274e413 Mon Sep 17 00:00:00 2001 From: gabridele Date: Thu, 19 Dec 2024 13:30:43 +0100 Subject: [PATCH 4/7] added code lines to build exemplars_tsv path --- cubids/cubids.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cubids/cubids.py b/cubids/cubids.py index 0a9934ea..4ff4154f 100644 --- a/cubids/cubids.py +++ b/cubids/cubids.py @@ -683,7 +683,11 @@ def copy_exemplars(self, exemplars_dir, exemplars_tsv, min_group_size): exemplars_dir, ] ) - + if "/" not in str(exemplars_tsv): + if not self.cubids_code_dir: + self.create_cubids_code_dir() + exemplars_tsv = self.path + "/code/CuBIDS/" + exemplars_tsv + # load the exemplars tsv subs = pd.read_table(exemplars_tsv) From 0002465a74ad144f98a8c2c631edeca9c2b8bafc Mon Sep 17 00:00:00 2001 From: gabridele Date: Thu, 19 Dec 2024 13:32:39 +0100 Subject: [PATCH 5/7] added parsing of --force-unlock argument --- cubids/cli.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cubids/cli.py b/cubids/cli.py index 2d494c5e..baeb449a 100644 --- a/cubids/cli.py +++ b/cubids/cli.py @@ -489,6 +489,12 @@ def _parse_copy_exemplars(): action="store", help="Docker image tag or Singularity image file.", ) + parser.add_argument( + "--force-unlock", + action="store_true", + default=False, + help="unlock dataset before adding nifti info ", + ) return parser From 3b85e55d22dd168f071f3b6ca43fae5446ba19cf Mon Sep 17 00:00:00 2001 From: gabridele Date: Fri, 20 Dec 2024 17:19:00 +0100 Subject: [PATCH 6/7] deleted whitespaces on blank line --- cubids/cubids.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cubids/cubids.py b/cubids/cubids.py index 1c389f80..0faab08e 100644 --- a/cubids/cubids.py +++ b/cubids/cubids.py @@ -687,7 +687,7 @@ def copy_exemplars(self, exemplars_dir, exemplars_tsv, min_group_size): if not self.cubids_code_dir: self.create_cubids_code_dir() exemplars_tsv = self.path + "/code/CuBIDS/" + exemplars_tsv - + # load the exemplars tsv subs = pd.read_table(exemplars_tsv) From e645b824df1344d1412eeb94cee2b838fbd3c67e Mon Sep 17 00:00:00 2001 From: gabridele Date: Fri, 20 Dec 2024 18:22:01 +0100 Subject: [PATCH 7/7] Adjusted parser.add_argument help sections according to previous edits --- cubids/cli.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/cubids/cli.py b/cubids/cli.py index 1205c978..e62a8985 100644 --- a/cubids/cli.py +++ b/cubids/cli.py @@ -443,8 +443,8 @@ def _parse_copy_exemplars(): type=Path, action="store", help=( - "absolute path to the root of a BIDS dataset " - "containing one subject from each Acquisition Group. " + "name of the directory to create where to store exemplar dataset. " + "It will include one subject from each Acquisition Group. " "It should contain sub-X directories and " "dataset_description.json." ), @@ -454,9 +454,12 @@ def _parse_copy_exemplars(): type=Path, action="store", help=( - "absolute path to the .tsv file that lists one " + "path to the .tsv that lists one " "subject from each Acquisition Group " - "(*_AcqGrouping.tsv from the cubids-group output)" + "(*_AcqGrouping.tsv from the cubids-group output). " + "If the file is located in the code/CuBIDS " + "directory, then users can just pass the .tsv " + "filename instead of the full path " ), ) parser.add_argument(