sina-mansour / UKB-connectomics

This repository will host scripts used to map structural and functional brain connectivity matrices for the UK biobank dataset.
https://www.biorxiv.org/content/10.1101/2023.03.10.532036v1
62 stars 7 forks source link

5ttgen error on spartan #32

Closed sina-mansour closed 2 years ago

sina-mansour commented 2 years ago

Today, I was running the scripts for a single subject on Spartan and the following error stops the pipeline:

When using the 5ttgen script which uses the first output on spartan, the following error occurred:

5ttgen: [ERROR] VTK files in FIRST directory "/data/scratch/projects/punim1566/UKB-download/1000094_2_0/T1/T1_first" do not all possess same prefix

I'm not sure why this happens, hence I shared this here. @Lestropie Do you know what's possibly going wrong?

Here are the contents of the T1_first directory for your reference:

$ ls /data/scratch/projects/punim1566/UKB-download/1000094_2_0/T1/T1_first
T1_first_all_fast_firstseg.nii.gz  T1_first-L_Accu_first.vtk    T1_first-L_Caud_first.vtk    T1_first-L_Pall_first.vtk    T1_first-L_Thal_first.vtk    T1_first-R_Amyg_first.vtk    T1_first-R_Hipp_first.vtk    T1_first-R_Puta_first.vtk
T1_first-BrStem_first.bvars        T1_first-L_Amyg_first.bvars  T1_first-L_Hipp_first.bvars  T1_first-L_Puta_first.bvars  T1_first-R_Accu_first.bvars  T1_first-R_Caud_first.bvars  T1_first-R_Pall_first.bvars  T1_first-R_Thal_first.bvars
T1_first-BrStem_first.vtk          T1_first-L_Amyg_first.vtk    T1_first-L_Hipp_first.vtk    T1_first-L_Puta_first.vtk    T1_first-R_Accu_first.vtk    T1_first-R_Caud_first.vtk    T1_first-R_Pall_first.vtk    T1_first-R_Thal_first.vtk
T1_first-L_Accu_first.bvars        T1_first-L_Caud_first.bvars  T1_first-L_Pall_first.bvars  T1_first-L_Thal_first.bvars  T1_first-R_Amyg_first.bvars  T1_first-R_Hipp_first.bvars  T1_first-R_Puta_first.bvars

I think it's this bit of code giving the error, but I'm not sure as to why it happens.

Lestropie commented 2 years ago

Presumably it has worked for some number of exemplar subjects previously, but it has then somehow crashed out on this one?

It looks right, based on a copy&paste of ls to text; but there could be nasty hidden or Unicode character loitering in there somewhere. You'll need to add some code in there before the exception is raised. Something like:

    if not all(os.path.basename(vtk_file.split('-')[0]) == os.path.basename(vtk_filelist[0]).split('-')[0] for vtk_file in vtk_filelist[1:]):
        app.var(vtk_filelist[0])
        for vtk_file in vtk_filelist[1:]:
            if os.path.basename(vtk_file.split('-')[0]) != os.path.basename(vtk_filelist[0]).split('-')[0]:
                app.var(vtk_file)
        raise MRtrixError('VTK files in FIRST directory "' + first_path + '" do not all possess same prefix')

Though I think I just spotted the mistake... I'll make a PR momentarily.

Lestropie commented 2 years ago

https://github.com/MRtrix3/mrtrix3/commit/b7bc265dd9857d6d20b8ed4d90466c504709e74d

Lestropie commented 2 years ago

Correction: https://github.com/MRtrix3/mrtrix3/commit/eeab681d3e0cb004cf1d1d31579d3892197ef5b6 🤦‍♂️

sina-mansour commented 2 years ago

Thanks for this prompt fix Rob, this solved the issue.