FCP-INDI / C-PAC

Configurable Pipeline for the Analysis of Connectomes
https://fcp-indi.github.io/
GNU Lesser General Public License v3.0
64 stars 40 forks source link

šŸ› `TypeError: string indices must be integers` when forking on `space: ['native', 'template']` #2018

Closed shnizzedy closed 3 weeks ago

shnizzedy commented 11 months ago

Describe the bug

Traceback (most recent call last):
  File "/code/CPAC/pipeline/cpac_pipeline.py", line 445, in run_workflow
    subject_id, sub_dict, c, p_name, num_ants_cores
  File "/code/CPAC/pipeline/cpac_pipeline.py", line 1464, in build_workflow
    wf = connect_pipeline(wf, cfg, rpool, pipeline_blocks)
  File "/code/CPAC/pipeline/cpac_pipeline.py", line 1102, in connect_pipeline
    wf = nb.connect_block(wf, cfg, rpool)
  File "/code/CPAC/pipeline/engine.py", line 1426, in connect_block
    pipe_x, opt)
  File "/code/CPAC/nuisance/nuisance.py", line 2678, in nuisance_regression_template
    'template')
  File "/code/CPAC/nuisance/nuisance.py", line 2475, in nuisance_regression
    if res is None else
TypeError: string indices must be integers

To reproduce

Run C-PAC 1.8.5 with

nuisance_corrections:
  2-nuisance_regression:
    space: ['native', 'template']

Preconfig

Custom pipeline configuration

nuisance_corrections:
  2-nuisance_regression:
    space: ['native', 'template']

Run command

No response

Expected behavior

A double-set of outputs of nuisance regression and everything downstream

Acceptance criteria

Screenshots

No response

C-PAC version

v1.8.5

Container platform

No response

Docker and/or Singularity version(s)

No response

Additional context

The root cause is that regressors (in 1.8.5, renamed to desc-confounds_timeseries in 1.8.6) is both an input and an output here (the nuisance_regression_native NodeBlock), so when template-space tries to run, it wants to run on the outputs of native-space-regression. I think thereā€™s probably a few pretty graceful solutions here, but I donā€™t know enough about nuisance regression to know how weā€™d want to tackle it.

  1. Depending on whether weā€™re generating the regressors only or generating and running, we want the outputs to be named the same either way? (I believe thatā€™s the current behavior)
  2. When we run nuisance regression, we donā€™t need the generated-not-run version anymore? (I believe it gets overwritten currently)
  3. Iā€™m not sure how this interacts with ingressing regressors
---
title: "Resource: 'regressors'"
---
flowchart TD
subgraph "generate only"
    nuisance_regressors_generation
end
subgraph "one space"
    nuisance_regressors_generation_1[nuisance_regressors_generation] --regressors--> nuisance_regression_1[nuisance_regression]
end
subgraph "forking (intended)"
    nuisance_regressors_generation_2[nuisance_regressors_generation] --regressors--> nuisance_regression_native_2[nuisance_regression_native]
    nuisance_regressors_generation_2 --regressors--> nuisance_regression_template_2[nuisance_regression_template]
end
subgraph "forking (actual)"
    nuisance_regressors_generation_3[nuisance_regressors_generation] --regressors--> nuisance_regression_native_3[nuisance_regression_native] --regressors--> nuisance_regression_template_3[nuisance_regression_template]
end
nuisance_regressors_generation --regressors--> output_directory
nuisance_regression_1 --regressors--> output_directory
nuisance_regression_native_2 --regressors--> output_directory
nuisance_regression_template_2 --regressors--> output_directory
nuisance_regression_template_3 --> crash_typeError[`TypeError: string indices must be integers`]