KeyError: 'subject2MNI' when using input-type "ukb"

Summary of what happened:

I encountered a KeyError while using qsirecon with the input-type set to ukb. Could you please offer some guidance on this issue? I would greatly appreciate any assistance. Thank you very much!

Command used (and if a helper script was used, a link to the helper script or the command generated):

singularity run --cleanenv -B xxx/all_for_ukb:/mnt  xxxx/sif_images/qsirecon_0.23.2.sif   /mnt/new_ukb    /mnt/recon_output   participant    --recon_spec dsi_studio_gqi   --input-type ukb

Version:

0.23.2

Environment (Docker, Singularity / Apptainer, custom installation):

singularity

Data formatted according to a validatable standard? Please provide the output of the validator:

PASTE VALIDATOR OUTPUT HERE

Relevant log outputs (up to 20 lines):

Traceback (most recent call last):
  File "/opt/conda/envs/qsiprep/bin/qsirecon", line 8, in <module>
    sys.exit(main())
  File "/opt/conda/envs/qsiprep/lib/python3.10/site-packages/qsirecon/cli/run.py", line 42, in main
    parse_args()
  File "/opt/conda/envs/qsiprep/lib/python3.10/site-packages/qsirecon/cli/parser.py", line 501, in parse_args
    layouts = create_layout(
  File "/opt/conda/envs/qsiprep/lib/python3.10/site-packages/ingress2qsirecon/utils/functions.py", line 216, in create_layout
    subject_layout.update(make_bids_file_paths(subject_layout))
  File "/opt/conda/envs/qsiprep/lib/python3.10/site-packages/ingress2qsirecon/utils/functions.py", line 133, in make_bids_file_paths
    if subject_layout['subject2MNI']:
KeyError: 'subject2MNI'

Screenshots / relevant information:

My input data looks like this


Hi @Shanbin_Zhang,

That error should be fixed in the next Qsirecon release. There’s a PR already in place. Add UKB ingression by smeisler · Pull Request #147 · PennLINC/qsirecon · GitHub

Best,
Steven

Hi @Shanbin_Zhang,

I just merged the PR. I will let you know when a new container is available with the fixed UKB functionality.

As a note, the ingression runs serially, so I recommend having separate jobs for different subjects (e.g., a slurm job array). For example,

"singularity run -e \
--containall \
--writable-tmpfs \
$QSIRECON_IMG \
$UKB_HOME \
$OUTDIR \
participant \
-w $WORK \
--fs-license-file $LICENSE \
--participant-label 1032959_2_0 \
--input-type ukb \
--recon-spec dsi_studio_autotrack

Best,
Steven

Hi @Shanbin_Zhang,

Actually, looking at your screenshot, those folder names look strange, and might require a bit of coding on my end to accommodate. Can you return a list of all the subject folders you have in new_ukb?

For reference, my folder names look like “1032959_2_0” and “1033428_2_0”, where I parse the subject ID as 1032959 and session ID as 0200 based on the underscore separation. I haven’t seen a 3 underscore subject folder before. But at the very least, the data organization within the folders looks okay (that is, the DWI data are in the right place), so I don’t think implementing changes will be too difficult.

Perhaps this has to do with how /when you acquired the UKB data. Mind sharing any details?

Thanks for your patience,
Steven

EDIT: Hi @Shanbin_Zhang,

The unstable qsirecon branch should now have that PR merged, if you’d like to test. You may need to temporarily change the folder name to match the convention I showed above.

Best,
Steven