Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unclear documentation on how to define filepaths when creating .txt file for purge #338

Open
gabridele opened this issue Dec 10, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@gabridele
Copy link

gabridele commented Dec 10, 2024

Summary

Following the Example Walkthrough, when I get to the purge command, I noticed that the file paths I’m supposed to provide in the .txt file should be as if my current working directory were the BIDS dataset. Instead, the walkthrough suggests to write the absolute paths of the files. I realized this simply by adding printing statements where the parsing of the .txt file took place (cubids.py script, line 735). I noticed that the path to the BIDS directory was being automatically appended to the provided file paths. Therefore I realized the right path to provide would be relative to the BIDS directory; the appending of the BIDS directory file happens also if you provide an absolute path.

Additional details

  • CuBIDS version: 1.1.1 (git cloned latest version as of November 25th)
  • Datalad version: 1.1.4

What were you trying to do?

I was trying to run the purge command by providing a .txt file containing the paths of the files I wanted to remove from my dataset

What did you expect to happen?

I expected the program to read the .txt file and remove those files I specified in it

What actually happened?

It couldn't locate the files, raising an error claiming they didn't exist. As explained in the summary, this issue could be flagged as 'incorrect documentation'.

Reproducing the bug

This is the first version of the .txt file, where I wrote the paths according to the tutorial on the documentation, namely from outside of the BIDS directory:

bBIDS_Dataset_DataLad/sub-02/ses-phdiff/func/sub-02_ses-phdiff_task-rest_bold.nii.gz

When I edited the path(s) as if my current directory were the BIDS dataset, the purge command ran successfully:

sub-02/ses-phdiff/func/sub-02_ses-phdiff_task-rest_bold.nii.gz
@gabridele gabridele added the bug Something isn't working label Dec 10, 2024
@tsalo
Copy link
Member

tsalo commented Dec 16, 2024

Are you referring to this section of the Example Walkthrough? If so, the path in the example is an absolute path, not a relative path from outside the BIDS directory like you have in your bug reproduction. We can make the documentation more explicit about this.

@gabridele
Copy link
Author

Hi Taylor,
I failed to mention that I did try it with an absolute path as well, but it still wouldn't work. As far as I understood by looking at the source code, the (absolute) path of the BIDS directory (/home/x_gabde/test1612/BIDS_Dataset_Datalad) is being automatically appended to the provided file paths in the txt file, whether absolute path or relative. This was confirmed by some debugging printing statements that I added myself to make sure. Given this, I realized the right path to provide would be the one relative to the BIDS directory.

I tried this again today, to be sure, after git cloning the latest version. From the screenshot below, when I run cubids purge ... in the first line with the no_ped.txt file containing the absolute path, the first printing statement shows me that the path to my BIDS dataset has been added at the beginning of the string I provided. The following line is a printing statement that is supposed to truncate all paths to intendedfor reference format, as I read in the commented lines (cubids.py, from line 744). However, the intendedfor format should include the sub-* directory, which it doesn't in my case. Lastly, as the log line says, it didn't run any association removals.

After I modified the no_ped.txt file with the path relative to the BIDS directory, the cubids purge command worked perfectly and removed the scans and all associated data.

6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants