cnlab / cnlab_pipeline

Python code for nipype pipelines used for GLM and functional connectivity analysis
MIT License
2 stars 1 forks source link

First level pipeline adaption for MURI data - muri branch #10

Open mbod opened 4 years ago

mbod commented 4 years ago

The first pass refactor of first_level.py 09adcff works with the megameta project data where the data were preprocessed to be resampled and smoothed and as .nii not .nii.gz files.

/data00/projects/MURI/scripts/jupyterhub_users/CNLab/first_level_models/model_specifications/muri_model_cuereact_alcohol-reactivity_RF.json

/data00/projects/MURI/scripts/jupyterhub_users/CNLab/first_level_models/cuereact_alcohol-reactivity/muri_model_cuereact_alcohol-reactivity_REFACTORED.ipynb

mbod commented 4 years ago

1. Import

sys.path.append('/data00/tools/cnlab_pipeline/')
from cnlab.GLM import first_level

2. Setup model (from JSON and add other options)

MODEL_SPEC_FILE = 'muri_model_cuereact_alcohol-reactivity_RF.json' # replace with filename of JSON file

MODEL_PATH = os.path.abspath(
                    os.path.join('../model_specifications',
                                  MODEL_SPEC_FILE)
)

include_subjects = ['sub-MURIP041', 'sub-MURIP067', 'sub-MURIP115', 'sub-MURIP393', 'sub-MURIP549']

model_def=first_level.setup_pipeline(MODEL_PATH,
                          include_subjects=include_subjects,
                          DEBUG=True)
{
    "ProjectID": "MURI",
    "TR": 1.0,
    "BaseDirectory": "/data00/projects",
    "ModelName": "alcohol_reactivity",
    "TaskName": "cuereact",
    "LongName": "model with event regressors",
    "Conditions": {
        "cue": [
            "cue_nonalc_react",
            "cue_alc_react",
            "cue_alc_mindful",
            "cue_alc_friend1",
            "cue_alc_friend2",
            "cue_alc_friend3",
            "cue_alc_friend4"
        ],
        "nonalc_react": [
            "pic_nonalc_react"
        ],
        "alc_react": [
            "pic_alc_react"
        ],
        "downreg": [
            "pic_alc_mindful",
            "pic_alc_friend3",
            "pic_alc_friend4"
        ],
        "upreg": [
            "pic_alc_friend1",
            "pic_alc_friend2"
        ],
        "rating": [
            "rating_nonalc_react",
            "rating_alc_react",
            "rating_alc_mindful",
            "rating_alc_friend1",
            "rating_alc_friend2",
            "rating_alc_friend3",
            "rating_alc_friend4"
        ]
    },
    "Contrasts": [
        {
            "name": "alc_v_nonalc",
            "pos": [
                "alc_react"
            ],
            "neg": [
                "nonalc_react"
            ]
        },
        {
            "name": "upreg_v_downreg",
            "pos": [
                "upreg"
            ],
            "neg": [
                "downreg"
            ]
        },
        {
            "name": "downreg_v_alc_react",
            "pos": [
                "downreg"
            ],
            "neg": [
                "alc_react"
            ]
        },
        {
            "name": "upreg_v_alc_react",
            "pos": [
                "upreg"
            ],
            "neg": [
                "alc_react"
            ]
        }
    ],
    "Runs": [
        "1",
        "2",
        "3",
        "4"
    ],
    "subject_list": [
        "sub-MURIP041",
        "sub-MURIP067",
        "sub-MURIP115",
        "sub-MURIP393",
        "sub-MURIP549"
    ],
    "output_dir": "/data00/projects/MURI/derivatives/nipype/model_CUEREACT_alcohol_reactivity",
    "working_dir": "/data00/projects/MURI/working/nipype/workingdir_model_CUEREACT_alcohol_reactivity",
    "model_path": "/fmriNASTest/data00/projects/MURI/scripts/jupyterhub_users/CNLab/first_level_models/model_specifications/muri_model_cuereact_alcohol-reactivity_RF.json",
    "SUBJ_DIR": "/data00/projects/MURI/data/BIDS/derivatives/fmriprep",
    "PROJECT_DIR": "/data00/projects/MURI",
    "generate_residuals": true,
    "unzip_and_smooth": true
}

3. Build pipeline

pipeline=first_level.build_pipeline(model_def)

This looks reasonable for what I think we had for the MURI processing and includes unzip and smooth and the residuals which were options added into the model spec.

image