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

Hi Steven,
Thank you for pointing that out! This dataset was actually obtained through my supervisor’s application, but I’m not entirely clear on the specifics, such as when or how it was acquired. I’ll follow up and communicate with you if I learn more details. Apologies for the late reply!

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.

Thank you for the update! I’ll give it a try

By the way, I’d like to ask: when using qsirecon with MRtrix methods for reconstruction, does it estimate a separate response function for each subject image? Or is it possible for qsirecon to estimate a mean response function across all or a subset of subjects, and then use this unified response function for subsequent reconstruction steps for all subjects? From my understanding, using a unified response function could facilitate better comparability of results between subjects. Does qsirecon provide such an option?

Hi @Shanbin_Zhang,

Averaging response functions is not supported in Qsirecon at the moment, sorry.

Best,
Steven

1 Like