From 5af7c9f42e951f80f1b979c8d11be34d880e6990 Mon Sep 17 00:00:00 2001 From: Tien Tong Date: Thu, 19 Dec 2024 11:21:04 -0500 Subject: [PATCH 1/2] Add specification to use relative path for files listed in scans.txt used in cubids purge --- cubids/cli.py | 7 ++++++- cubids/cubids.py | 2 +- docs/example.rst | 4 +++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/cubids/cli.py b/cubids/cli.py index cf48cf9a..6fe7ef8d 100644 --- a/cubids/cli.py +++ b/cubids/cli.py @@ -578,7 +578,12 @@ def _parse_purge(): "scans", type=IsFile, action="store", - help="path to the txt file of scans whose associations should be purged.", + help=( + "path to the txt file of scans whose associations should be purged. " + "When specifying files in this txt file, " + "always use relative paths starting from your BIDS directory. " + "e.g., ``sub-01/ses-01/func/sub-01_ses-01_task-rest_bold.nii.gz``" + ), ) parser.add_argument( "--use-datalad", diff --git a/cubids/cubids.py b/cubids/cubids.py index 81781596..286ca0b3 100644 --- a/cubids/cubids.py +++ b/cubids/cubids.py @@ -726,7 +726,7 @@ def purge(self, scans_txt): scans_txt : str path to the .txt file that lists the scans you want to be deleted from the dataset, along - with thier associations. + with their associations. example path: /Users/Covitz/CCNP/scans_to_delete.txt """ self.scans_txt = scans_txt diff --git a/docs/example.rst b/docs/example.rst index 0f50ca80..48874ad7 100644 --- a/docs/example.rst +++ b/docs/example.rst @@ -211,13 +211,15 @@ To do this, we run the ``cubids purge`` command. ``cubids purge`` requires as input a list of files to cleanly "purge" from the dataset. You can create this file in any text editor, as long as it is saved as plain text ``.txt``. +When specifying files in this text file, +always use relative paths starting from your BIDS directory. For this example, we created the following file: .. code-block:: console $ cat no_ped.txt - /AN/EXAMPLE/PATH/CuBIDS_Test/BIDS_Dataset_Datalad/sub-02/ses-phdiff/func/sub-02_ses-phdiff_task-rest_bold.nii.gz + sub-02/ses-phdiff/func/sub-02_ses-phdiff_task-rest_bold.nii.gz and saved it in our ``CuBIDS_Test directory``. From c830ba39cd314d41a59768010dd0368813b5c0ff Mon Sep 17 00:00:00 2001 From: Tien Tong Date: Thu, 19 Dec 2024 11:24:00 -0500 Subject: [PATCH 2/2] fix lint issue --- cubids/cli.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cubids/cli.py b/cubids/cli.py index 6fe7ef8d..1ccb65aa 100644 --- a/cubids/cli.py +++ b/cubids/cli.py @@ -583,7 +583,7 @@ def _parse_purge(): "When specifying files in this txt file, " "always use relative paths starting from your BIDS directory. " "e.g., ``sub-01/ses-01/func/sub-01_ses-01_task-rest_bold.nii.gz``" - ), + ), ) parser.add_argument( "--use-datalad",