[RESOLVED] hcp_msmall: Failed during processing of group DeDriftAndResample

Hi all,

I am trying to use MSMALL Pipeline to process my data. However, an unknown error occur:

-------- freesurfer-Linux-centos6_x86_64-stable-pub-v6.0.0-2beb96c --------
Setting up environment for FreeSurfer/FS-FAST (and FSL)
FREESURFER_HOME   /usr/local/freesurfer
FSFAST_HOME       /usr/local/freesurfer/fsfast
FSF_OUTPUT_FORMAT nii.gz
SUBJECTS_DIR      /usr/local/freesurfer/subjects
MNI_DIR           /usr/local/freesurfer/mni
FSL_DIR           /usr/local/fsl
ehui@ehuicompute:~$ tmux attach-session -t yumingz1
/opt/HCP/HCPpipelines/MSMAll/MSMAllPipeline.sh
    --path="/hdd1/qunex/cimt/sessions/001A/hcp"
    --subject="001A"
    --fmri-names-list="BOLD_1"
    --multirun-fix-names=""
    --multirun-fix-concat-name=""
    --multirun-fix-names-to-use=""
    --output-fmri-name="rfMRI_REST"
    --high-pass="2000"
    --fmri-proc-string="_Atlas_hp2000_clean"
    --msm-all-templates="/opt/HCP/HCPpipelines/global/templates/MSMAll"
    --output-registration-name="MSMAll_InitialReg"
    --high-res-mesh="164"
    --low-res-mesh="32"
    --input-registration-name="MSMSulc"
    --myelin-target-file="/opt/HCP/HCPpipelines/global/templates/MSMAll/Q1-Q6_RelatedParcellation210.MyelinMap_BC_MSMAll_2_d41_WRN_DeDrift.32k_fs_LR.dscalar.nii"
    --matlab-run-mode="0"
------------------------------------------------------------


Running HCP MSMAll
---> logfile: /hdd1/qunex/cimt/processing/logs/comlogs/done_hcp_msmall_rfMRI_REST_001A_2025-03-26_13.38.52.919390.log

------------------------------------------------------------
---> Processing DeDriftAndResample
     ... bold image BOLD_1 present
 --- Failed during processing of group DeDriftAndResample with error:
 Traceback (most recent call last):
  File "/opt/qunex/python/qx_utilities/hcp/process_hcp.py", line 8465, in executeHCPSingleDeDriftAndResample
    "highresmesh": options["hcp_highresmesh"],
                   ~~~~~~~^^^^^^^^^^^^^^^^^^^
KeyError: 'hcp_highresmesh'

Here are my commands:

		qunex_container hcp_icafix \
                    --sessionsfolder="${WORK_DIR}/${STUDY_NAME}/sessions" \
		    --batchfile="${WORK_DIR}/${STUDY_NAME}/processing/batch.txt" \
		    --parsessions="${PARSES}" \
                    --sessions="${SUBJ}" \
                    --hcp_icafix_bolds="rest" \
                    --bind="/hdd1:/hdd1" \
                    --container="${QUNEX_CONTAINER}"
	
		qunex_container hcp_post_fix \
                    --sessionsfolder="${WORK_DIR}/${STUDY_NAME}/sessions" \
		    --batchfile="${WORK_DIR}/${STUDY_NAME}/processing/batch.txt" \
		    --parsessions="${PARSES}" \
                    --hcp_icafix_bolds="rest" \
                    --hcp_matlab_mode="compiled" \
                    --bind="/hdd1:/hdd1" \
                    --container="${QUNEX_CONTAINER}"

		qunex_container hcp_reapply_fix \
                    --sessionsfolder="${WORK_DIR}/${STUDY_NAME}/sessions" \
		    --batchfile="${WORK_DIR}/${STUDY_NAME}/processing/batch.txt" \
		    --parsessions="${PARSES}" \
                    --sessions="${SUBJ}" \
                    --hcp_icafix_bolds="rest" \
		    --hcp_icafix_deleteintermediates="FALSE" \
                    --bind="/hdd1:/hdd1" \
                    --container="${QUNEX_CONTAINER}" \
		    --overwrite="yes"

		qunex_container hcp_msmall \
                    --sessionsfolder="${WORK_DIR}/${STUDY_NAME}/sessions" \
		    --batchfile="${WORK_DIR}/${STUDY_NAME}/processing/batch.txt" \
		    --hcp_icafix_bolds="rest" \
                    --hcp_icafix_highpass="2000" \
                    --bind="/hdd1:/hdd1" \
                    --container="${QUNEX_CONTAINER}"

where, my container is QUNEX_CONTAINER=“${SDIR}/qunex/qunexcontainer/qunex_suite-0.99.2d.sif”

Thanks for the help!

Best,
Acacius

Hi Acacius,

This is weird, can you try setting --hcp_highresmesh=164 to the command call. What is weird is that this is the default value and should be set. Do you maybe have hcp_highresmesh set to something weird in your batch file?

Also, I see you are using a container that is quite old, is this due to backwards compatibility? If this is not the case, then probably best to update.

Edit: I see this was fixed in 0.100.0:

* Fixed a wrong name for the `hcp_highresmesh` parameter.

Best, Jure

Thanks for your early reply! I used the old container for compatibility with data previously processed in this container, and I’ll try to run it in the newest container to see whether it works.

Best,
Acacius

Hi Jure,

It works now. However, I met a new question while running “fc_compute_roifc” in this old container. My command is:

   compute_roifc)
       qunex_container fc_compute_roifc \
        --sessionsfolder="${WORK_DIR}/${STUDY_NAME}/sessions" \
        --flist="/hdd1/qunex/lists/rest.list" \
        --roiinfo="/hdd1/qunex/script_yuming/result_fc_Gordon333/S900.sulc_MSMAll.32k_fs_LR.dscalar.nii" \
        --targetf="/hdd1/qunex/script_yuming/result_fc_Gordon333" \
        --options="sessions=all|roimethod=mean|eventdata=all|ignore=use,fidl|badevents=use|fcmeasure=r|debug=false|saveind=mat,long,wide_single|itargetf:gfolder" \
        --frames_info="5" \
        --bind="/hdd1:/hdd1" \
        --container="${QUNEX_CONTAINER}";

However, the parameter “–flist” and “frames_info” seems not to be passed, which error is:


 ---> Setting up Octave


 ........................ Running QuNex v0.99.2 ........................


--- Full QuNex call for command: fc_compute_roifc

gmri fc_compute_roifc --sessionsfolder="/hdd1/qunex/cimt/sessions" --flist="/hdd1/qunex/lists/rest.list" --roiinfo="/hdd1/qunex/script_yuming/result_fc_Gordon333/S900.sulc_MSMAll.32k_fs_LR.dscalar.nii" --targetf="/hdd1/qunex/script_yuming/result_fc_Gordon333" --frames_info="5" --sessions="sessions=all,roimethod=mean,eventdata=all,ignore=use,fidl,badevents=use,fcmeasure=r,debug=false,saveind=mat,long,wide_single,itargetf:gfolder"

---------------------------------------------------------



Running:
>>> fc_compute_roifc('', '/hdd1/qunex/script_yuming/result_fc_Gordon333/S900.sulc_MSMAll.32k_fs_LR.dscalar.nii', '', '/hdd1/qunex/script_yuming/result_fc_Gordon333', '')

... could not find a file (), please check your paths!
... could not find ROI definition file (/hdd1/qunex/script_yuming/result_fc_Gordon333/S900.sulc_MSMAll.32k_fs_LR.dscalar.nii), please check your paths!

Matlab Error! Processing Failed!
ERROR: Some files were not found. Please check the paths and start again!\n\n


ERROR: fc_compute_roifc failed! Please check output / log!

Thanks for the help!

Best,
Acacius

Hi Acacius,

Does this work with the new container?

There are two options here, it could be a bug that we already squashed.

Of it could be that something is wrong with your command call or input parameters. Maybe your rest.list is not prepared properly. Can you upload it here? Thanks.

Best, Jure

Hi Jure,

Here is my list file(To upload it on the forum, I modified its type):
rest.txt (1.2 KB)

I have also tried to use new container(v1.1.1), but a new error occured:


--> QuNex will run the command over 12 sessions. It will utilize:

    Maximum sessions run in parallel for a job: 1.
    Maximum elements run in parallel for a session: 1.
    Up to 1 processes will be utilized for a job.

    Job #1 will run sessions: sessions=all,roimethod=mean,eventdata=all,ignore=use,fidl,badevents=use,fcmeasure=r,debug=false,saveind=mat,long,wide_single,itargetf:gfolder
bash: /hdd1/qunex/cimt/processing/logs/batchlogs/qunex_container_command_2025-03-27_16.21.24.261080.sh: No such file or directory

It seems to be that the new container can’t bind to my working directory.

Best
Acacius

I remember now, this is a bug that caused all kinds of weird behavior if the string sessions= was present in the options string.

Can you try updating the qunex_container script first. I think using the new qunex_container script with the 0.99.2 container might do the trick. If that does not work, then you should use a newer container, the functionality is backwards compatible here, so you will get the same results.

Best, Jure

I have tried to use v1.1.1 qunex container script, but it sitll failed to process with the same error. Then, I updated my container to 1.1.1 but it showed error below:

bash: /hdd1/qunex/cimt/processing/logs/batchlogs/qunex_container_command_2025-03-27_19.12.10.278669.sh: No such file or directory

I thought it may have something wrong while updating my container. My steps to update container is:

docker pull gitlab.qunex.yale.edu:5002/qunex/qunexcontainer:1.1.1
PATH=/hdd1/qunex:${PATH}
chmod a+x /hdd1/qunex/qunex_container

To validate the container version, I printed it out:

ehui@ehuicompute:/hdd1/qunex$ export QUNEX_CONTAINER="gitlab.qunex.yale.edu:5002/qunex/qunexcontainer:1.1.1"
ehui@ehuicompute:/hdd1/qunex$ qunex_container

    qunex_container is a self-standing command that can run QuNex commands
    against a Singularity/Apptainer or a Docker QuNex container. To run an QuNex
    command  against a container the basic call is::

        qunex_container <qunex command> [parameters]         --container="<a path to the Singularity/Apptainer image or a Docker container name>" [additional options]

    `qunex command` is any command supported by QuNex. `parameters` are any
    parameters that should be passed to the qunex command. This part is the same
    as running::

        qunex <qunex command> [parameters]

    from within a container or on a self-standing QuNex installation. For list
    of commands and their parameters consult QuNex online or in-line
    documentation.

    Additionally qunex_container accepts the following parameters:

    INPUTS
    ======

    --container     specifies either the path to the Singularity/Apptainer
                    container image  or the full specification of the Docker
                    container to be used (e.g. qunex/qunex_suite:0_45_07).
    --bash_pre      If any additional commands have to be run in bash before the
                    execution of qunex_container command itself. Use a semicolon
                    separated list to chain multiple commands. ['']
    --bash_post     Used if any additional commands have to be run inside the
                    QuNex container before executing the desired QuNex command.
                    Use a semicolon separated list to chain multiple commands.
                    ['']
    --bind          Used for binding external folders in order for the system in
                    the container to have access to relvant data. Maps to -B
                    parameter of Singularity/Apptainer and -v parmaeter of
                    Docker.
    --nocleanenv    By default QuNex will use the --cleanenv flag of
                    Singularity/Apptainer so your local environment setup will
                    not be propagated into the container. If you want to disable
                    this functionality use this flag. The flag is not set by
                    default.
    --cuda          Use in order to prepare the container for CUDA usage. This
                    flag is not set by default.
    --cuda_path     Can be used to bind a local CUDA version over the one in the
                    system.
    --nv            An old way of using using CUDA inside Singularity/Apptainer.
                    If provided then --nv option will be used when executing.
    --script        If a script is to be run against the Singularity/Apptainer
                    container rather than a single command, the path to the
                    script to be run is specified here. ['']
    --containeropt  A string that lists the additional options to be used when
                    running the container. The parameters are to be specified in
                    a string exactly as they would be on a command line, e.g.
                    to run Docker in detached mode and mount a specific folder
                    use::

                        "-d -v /host/directory:/container/directory"

    --scheduler     A string that specifies the details to use to submit the
                    container job to a scheduling system.
    --console_out   A string specifying where to redirect the standard output
                    and error when using the scheduler. See "Redirecting
                    output" for details!
    --parjobs       Specify the maximum amount of jobs that will be created
                    and run in parallel. By default this equals the number
                    of sessions your provided.
    --parsessions   Specify the amount of sessions that will be run in parallel
                    inside each created job. [1]
    --parelements   Specify the amount of elements that will be run in parallel
                    inside each session (for example BOLDs in hcp_fmri_volume).
                    [1]
    --parinfo       If this flag is set then qunex_container will not execute
                    the command, it will only printout the parallelism
                    information, e.g. how many jobs will be spawned, how many
                    sessions will be run in parallel, etc.

    RESULTS
    =======

    `qunex_container` will compile a temporary file with the relevant commands to
    submit to the container. The file will be created in the users home folder
    and will be deleted as the last action completed by the container. In case
    of a Docker container, to give access to the compiled script, the user's
    home folder will be mounted as `/root` in the container, which is the home
    folder within the container.

    If a script parameter is specified, in case of a Singularity/Apptainer
    container, the script will be executed using the `bash <script>` command.
    In case of a Docker container, the content of the script will be appended
    to the temporary script generated by the `qunex_container`. Do note that in
    the case of the Singularity/Apptainer container the script can reference
    paths on the host computer, whereas in the case of the Docker container,
    the script has to reference the paths and mounts as they are visible within
    the Docker container.

    Scheduling jobs
    ---------------

    Container commands can be submitted to a scheduling system by specifying
    the `--scheduler` parameter with a settings string. The settings string
    should be a comma separated list of parameters. The first parameter has to
    be the scheduler name (PBS, SLURM or GridEngine), the rest of the parameters
    are key-value pairs that are to be passed as settings to the scheduler.

    Example settings strings::

        "SLURM,jobname=hcp_freesurfer,time=03-24:00:00,cpus-per-task=2,mem-per-cpu=2500,partition=week"

    Scheduling multiple jobs in parallel
    ------------------------------------

    If the parameters provided include --parjobs, --parsessions, --scheduler
    and --sessions or --batchfile, then qunex_container will spread the execution
    of the command by scheduling multiple jobs to run on separate nodes. Specifically,
    if --parjobs is not provided then QuNex will schedule a job for each of the
    sessions. If --parjobs is provided then QuNex will schedule at most the
    requested amount of jobs, inside each job QuNex will run at most
    --parsessions in parallel.  E.g. if 10 sessions are specified, parjobs
    is set to 3 and parsessions is set to 4, QuNex will schedule 3 jobs. The first
    job will run 4 sessions in parallel and the other 2 jobs will run 3 sessions
    in parallel.

    Redirecting output
    ------------------

    By default, QuNex will try to put scheduler logs into the
    <study>/processing/logs/batchlogs folder. If not possible QuNex will put them
    in your home folder. You can also put them in a custom location by specifying
    the `console_out` parameter. The parameter supports three different directives
    provided by "<key>:<value>" pairs in a pipe separated string:

    stdout
        specifies a path to a log file that should store standard output of the
        submitted job
    stderr
        specified a path to a log file that should store error output of the
        submitted job
    both
        specifies a path to a log file that should store joint standard and
        error outputs of the submitted job

    Examples:

    - "stdout:processing.log"
    - "stdout:processing.output.log|stderr:processing.error.log"
    - "both:processing.log"

    Do not specify error and standard outputs both using --console_out parameter
    and scheduler specific options within settings string. It is best to provide
    full absolute paths to the desired log.

    EXAMPLE USE
    ===========

    ::

        qunex_container hcp_freesurfer \
            --sessionsfolder=/data/study/sessions \
            --batchfile=/data/study/processing/batch.txt \
            --parsessions=4 \
            --container=/apptainer/qunex_suite-0_38_10.sif \
            --scheduler="SLURM,time=2-00:00:00,cpus-per-task=2,mem-per-cpu=15000,partition=week"

I still can’t run my code in the new container, what is the reason for this?

Best
Acacius

Hi,

docker pull will update the Docker container, but not the qunex_container script. To do that run:

cd /hdd1/qunex
rm qunex_container
wget http://jd.mblab.si/qunex/qunex_container
chmod a+x qunex_container

Best, Jure

Hi Jure,

I have run v1.1.1 successfully. However, it still have a unknown error:


.......................... Running QuNex v1.1.1 [QIO] ..........................


--- Full QuNex call for command: fc_compute_roifc

qunex fc_compute_roifc --sessionsfolder="/hdd1/qunex/cimt/sessions" --flist="/hdd1/qunex/lists/rest.list" --roiinfo="/hdd1/qunex/script_yuming/result_fc_Gordon333/S900.sulc_MSMAll.32k_fs_LR.dscalar.nii" --targetf="/hdd1/qunex/script_yuming/result_fc_Gordon333" --options="sessions=all|roimethod=mean|eventdata=all|ignore=use,fidl|badevents=use|fcmeasure=r|debug=false|saveind=mat|itargetf:gfolder" --frames_info="5"

---------------------------------------------------------
Running:
>>> fc_compute_roifc('/hdd1/qunex/lists/rest.list', '/hdd1/qunex/script_yuming/result_fc_Gordon333/AAL116_1mm.nii', '', '/hdd1/qunex/script_yuming/result_fc_Gordon333', 'sessions=all|roimethod=mean|eventdata=all|ignore=use,fidl|badevents=use|fcmeasure=r|debug=false|saveind=mat|itargetf:gfolder')

error: pkg: cannot create file
error: called from
    pkg at line 670 column 13
    /home/ehui/.octaverc at line 5 column 1

Checking ...
 ... listing files to process
 ... reading file list:
     - session id: 001A

     - session id: 001B

     - session id: 001C

     - session id: 001D

     - session id: 002A

     - session id: 002B

     - session id: 002C

     - session id: 003A

     - session id: 003B

     - session id: 003C

     - session id: 003D

     - session id: 004A

     - session id: 004B

     - session id: 004C

     - session id: 006A

     - session id: 006C

     - session id: 009A

     - session id: 009C

     - session id: 009D

     - session id: 010A

     - session id: 010C

     - session id: 010D

     - session id: 010D_

     - session id: 012A

     - session id: 012A_

     - session id: 012C

     - session id: 014A

     - session id: 014D

     - session id: 016A

     - session id: 016C

     - session id: 017A

     - session id: 017C

     - session id: 018A

     - session id: 018C

     - session id: 019A

     - session id: 019C

     - session id: 020A

     - session id: 020C

     - session id: 021A

     - session id: 021C

     - session id: 022A

     - session id: 023A

     - session id: 024A

     - session id: 024C

     - session id: 025A

     - session id: 025C

     - session id: 026A

     - session id: 027A

     - session id: 027C

     - session id: 027D

     - session id: 028A

     - session id: 029A

     - session id: 029C

     - session id: 029D

     - session id: 030A

     - session id: 030D

     - session id: 031A

     - session id: 031D

     - session id: 032A

     - session id: 033A

     - session id: 034A

     - session id: 035A

     - session id: 035C

     - session id: 035D

     - session id: 036A

     - session id: 037A

     - session id: 038A

     - session id: 038C

     - session id: 039A

     - session id: 039C

 ... done ... done.

---------------------------------
Processing session 001A ... ERROR: 001A missing bold or conc file specification!

Matlab Error! Processing Failed!
'bolds' undefined near line 525, column 16


ERROR: fc_compute_roifc failed! Please check output / log!

It seems like my list files have something wrong–the data path didn’t generate into list files. I will post my question to another post.

Best
Acacius

Hi,

error: pkg: cannot create file
error: called from
    pkg at line 670 column 13
    /home/ehui/.octaverc at line 5 column 1

It seems like you have an .octaverc file in your home folder that is not compatible with the Octave version inside the continer. Can you remove this file, or just temproraly rename it?

But this is not the issue for what you are seeing, we can probably treat this as a warning. Let me marke this topic as RESOLVED and continue the discussion in the other one you opened. We are conflating many things here, this is supposed to be a hcp_msmall topic, but now contains many other things :slight_smile:.

Best, Jure

OK, sorry for asking too many question in this post. Thanks for the help!

Best
Acacius