[RESOLVED] 'unknown sequence label' when running setup_hcp

Hello, I’m trying to run the HCP pipeline using qunex_suite-0.97.1.sif on my institution’s HPC (running centOS 8) and am running into an issue with the setup_hcp step:

Running setup_hcp
================
===> Setting up HCP folder structure for 1133

 ---> Creating base folder /work/long/qunex//sessions/1133/hcp/1133/unprocessed
  ... skipping 4  [unknown sequence label, please check]
  ... skipping 3  [unknown sequence label, please check]
 ---> creating subfolder T2w
 ---> linking 2.nii.gz to 1133_T2w_SPC1.nii.gz
 ---> creating subfolder T1w
 ---> linking 1.nii.gz to 1133_T1w_MPR1.nii.gz

Here’s the command I’m running:

container=/path/to/qunex_suite-0.97.1.sif
qunex_container setup_hcp \
    --container="$container" \
    --bind=$qunexdir/ \
    --sourcefolder="$qunexdir/sessions/1133"

and here are the contents of the bids dir:

$ ls -l $qunexdir/sessions/1133/bids/sourcedata/sub-1133/*
-rw-r--r--. 1 ark19 root 514 Jun 15 12:16 /work/long/qunex/sessions/1133/bids/sourcedata/sub-1133/bids2nii.log

/work/long/qunex/sessions/1133/bids/sourcedata/sub-1133/anat:
total 21766
-rwxr-xr-x. 1 ark19 root     2465 Jun 15 12:16 sub-1133_acq-FLAIR_T2w.json
-rwxr-xr-x. 1 ark19 root  5906637 Jun 15 12:16 sub-1133_acq-FLAIR_T2w.nii.gz
-rwxr-xr-x. 1 ark19 root     2409 Jun 15 12:16 sub-1133_T1w.json
-rwxr-xr-x. 1 ark19 root 12311478 Jun 15 12:16 sub-1133_T1w.nii.gz

/work/long/qunex/sessions/1133/bids/sourcedata/sub-1133/fmap:
total 3614
-rwxr-xr-x. 1 ark19 root    3158 Jun 15 12:16 sub-1133_magnitude.json
-rwxr-xr-x. 1 ark19 root 1865576 Jun 15 12:16 sub-1133_magnitude.nii.gz
-rwxr-xr-x. 1 ark19 root    3227 Jun 15 12:16 sub-1133_phasediff.json
-rwxr-xr-x. 1 ark19 root 1132556 Jun 15 12:16 sub-1133_phasediff.nii.gz

and the hcp_mapping.txt file:

# -- This is the mapping file for a QuNex study

# -- Structural sequences
T1w            => T1w
T2w acq-FLAIR  => T2w
magnitude      => FM-Magnitude
phasediff      => FM-Phase

Previously, i had 2 magnitude images which were named “magnitude1” and “magnitude2” with corresponding lines in the mapping file in this step worked just fine, but then i ran into problems in the preFreesurfer step and realized that i needed to combine the two into a single 4D image (as I had done previously running the pipeline using the HCP bids container). i just made small tweaks to the file names / files to accommodate, so not sure why it stopped working then.

I also tried manually setting up the sessions/…/hcp/…/unprocessed dir following the structure from the previous successful runs with the 2 magnitude images, but then ran into this error when running a test of the preFreesurfer step, so i must have missed something:

------------------------------------------------------------
Session id: 1133
[started on Thursday, 15. June 2023 12:29:29]
Test running HCP PreFreeSurfer Pipeline [HCPStyleData] ...

---> T1w image file present.
---> T2w image file present.
---> Magnitude Field Map 1 file present.
---> Phase Field Map 1 file present.
ERROR: Unknown error occured:
...................................
Traceback (most recent call last):
  File "/opt/qunex/python/qx_utilities/hcp/process_hcp.py", line 764, in hcp_pre_freesurfer
    fmmag = hcp['fieldmap'][int(fmnum)]['magnitude']
TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'

what do i need to be checking to make sure i get the sequence label correct?

Thanks!

Could you please post the session.txtand session_hcp.txt file?

Lining

1 Like

Sure, thank you!

ark19@dcc-core-316  /work/long/qunex $ cat sessions/1133/session.txt
# Generated by QuNex 0.97.1 on 2023-06-14_13.55.08.305676
#
session: 1133
subject: 1133
bids: /work/long/qunex/sessions/1133/bids
raw_data: /work/long/qunex/sessions/1133/nii
hcp: /work/long/qunex/sessions/1133/hcp

1: T1w
2: T2w acq-FLAIR
3: magnitude
4: phasediff
ark19@dcc-core-316  /work/long/qunex $ cat sessions/1133/session_hcp.txt
# Generated by QuNex 0.97.1 on 2023-06-14_13.58.45.583701
#
session: 1133
subject: 1133
bids: /work/long/qunex/sessions/1133/bids
raw_data: /work/long/qunex/sessions/1133/nii
hcp: /work/long/qunex/sessions/1133/hcp
hcpready: true
1   :T1w             :T1w
2   :T2w             :T2w acq-FLAIR
3   :                :magnitude
4   :                :phasediff

This is really confusing to me. It seems like image 3 and 4 are not mapped properly. Did you update the mapping file after you ran setup_hcp? Maybe you need to set --overwrite=yes.

Also I just realized that the create_session_info command you used in the other thread was incorrect. The --sourcefile and --targetfile should be the name of the file (i.e. session.txt or session_hcp.txt) instead of path.

A correctly mapped session should look like this.

session: 1133
subject: 1133
bids: /work/long/qunex/sessions/1133/bids
raw_data: /work/long/qunex/sessions/1133/nii
hcp: /work/long/qunex/sessions/1133/hcp
hcpready: true
1   :T1w             :T1w: fm(1)
2   :T2w             :T2w acq-FLAIR: fm(1)
3   :FM-Magnitude    :magnitude: fm(1)
4   :FM-Phase        :phasediff: fm(1)

The error you got in hcp is complaining about missing tags like fm(1), which is automatically assigned during create_session_info.

Lining

1 Like

thank you for your response! I hadn’t made any updates to the mapping file so I’m really not sure what happened. Your comments helped me realize that I should try re-running from scratch (which I swear I already had tried), and now I’m embarrassed again because that seemed to solve things. thank you again!