From c460477f751bfba24ece25775559a240dbd3377e Mon Sep 17 00:00:00 2001 From: jlefortbesnard Date: Tue, 13 Feb 2024 11:45:55 +0100 Subject: [PATCH 1/2] add first level script --- 27SS_description.md | 95 ++++++++++++++ 6VV2.md | 143 ++++++++++++++++++++++ narps_open/pipelines/team_27SS.firstlevel | 111 +++++++++++++++++ 3 files changed, 349 insertions(+) create mode 100644 27SS_description.md create mode 100644 6VV2.md create mode 100755 narps_open/pipelines/team_27SS.firstlevel diff --git a/27SS_description.md b/27SS_description.md new file mode 100644 index 00000000..e05321f8 --- /dev/null +++ b/27SS_description.md @@ -0,0 +1,95 @@ +# NARPS team description : 27SS +## General +* `teamID` : 27SS +* `NV_collection_link` : https://neurovault.org/collections/4975/ +* `results_comments` : We coded losses in our regression as positive values, meaning a POSITIVE parametric effect of losses indicates greater activity as the loss magnitude increases (i.e. more activity to -20 than -10). +* `preregistered` : No +* `link_preregistration_form` : NA +* `regions_definition` : For the ventral striatum and amygdala, bilateral regions of interest were defined using the MNI_152 atlas included with AFNI. For these regions, spherical ROIs with radius 5mm were specified with their center at the center of the region as defined by MNI atlas. For the vmPFC, we specified two possible distinct ROIs based on locations indicated by review papers on decision making literature. One vmPFC ROI was defined using a single centered spherical ROI with a 9mm radius based on Clithero & Rangel, 2014 (Table 6). Another was defined using bilateral spherical ROIs with 5mm radius using coordinates from Bartra, Mcguire & Kable, 2013 (Table 3). After visual inspection of the ROIs, we chose to use the Clithero & Rangel (2014) ROI as it was larger, and so a better choice given the uncertainty about the location of the VMPFC (and its susceptibility to fMRI artifacts). + +Amygdala L (-23, 5, -15) +Amygdala R (23, 5, -15) +VMPFC (0, 39, -3) +VS/NACC L (-12, -8, -8) +VS/NACC R (12, -8, -8) +* `softwares` : AFNI 18.3.12 +* `general_comments` : NA +## Exclusions +* `n_participants` : 108 +* `exclusions_details` : NA +## Preprocessing +* `used_fmriprep_data` : No +* `preprocessing_order` : 1. Slice time correction. +2. Alignment of anatomical and EPI image (intra-subject coregistration) +2. Non-linear warping of anatomical image into standard space +3. EPI volume registration to minimum outlier +4. Non-linear warping of volumes into standard space +5. Blurring with 6mm kernel size +6. Deconvolution of BOLD signal on task and nuisance regressors +* `brain_extraction` : Not performed beyond standard AFNI skull-stripping as part of anatomical alignment. +* `segmentation` : None +* `slice_time_correction` : AFNI's 3dTshift command. Performed before motion correction. Reference slice = 1. Used quintic (5th order) Lagrange polynomial interpolation. +* `motion_correction` : AFNI 3dvolreg command. Cubic polynomial interpolation to minimum outlier volume of each subject (align_to_MIN_OUTLIER) using iterated linearized weighted least squares. +* `motion` : +* `gradient_distortion_correction` : Not performed +* `intra_subject_coreg` : AFNI's align_epi_anat.py command. Aligns anatomical image to EPI image using affine transformation with the cost function lpc+ZZ (mainly uses the local pearson correlation, a nonlinear average of the Pearson's correlation over local neighborhoods). +* `distortion_correction` : Not performed +* `inter_subject_reg` : Each subject's anatomical/EPI volumes were warped non-linearly using auto_warp.py in AFNI, performing an affine transform, normalizing participants to the MNI 152 template. Anatomical images were warped first, with the resulting warp calculations later applied to EPI images after motion correction. +* `intensity_correction` : Not performed +* `intensity_normalization` : Scaling of each voxel time series to have mean intensity 100. +* `noise_removal` : AFNI 3dDeconvolve used demeaned motion parameters for roll, pitch, yaw, dS, dL, and dP during first-level regressions. +* `volume_censoring` : Motion outliers with framewise displacement (FD) greater than 1.5mm were also censored from analysis. +* `spatial_smoothing` : Blurring at 6mm FWHM kernel size using AFNI 3dmerge. Smoothing was performed as the final step (following motion correction, coregistration, and warping). +* `preprocessing_comments` : NA +## Analysis +* `data_submitted_to_model` : 108 participants' data were submitted for statistical modeling. As mentioned above, volumes with more than 1.5mm Framewise Displacement were censored from analysis. The following subjects had volumes removed from their analysis for motion: subject (# of volumes), 22 (2), 36 (2), 100 (2), 106 (2), 120 (2), 93 (4), 110 (6), 26 (7), 88 (12), 116 (13), 18 (15), 16 (19), 30 (312). Every subject had 1792 TRs per stimulus (less the number excluded for motion, where applicable). + +Additionally, trials with reaction times less than or equal to .001 seconds were considered missed trials and were thus excluded from analysis. Five participants total had this happen: subject (# of trials with responses that were considered as missed), 53 (3), 55 (1), 67 (1), 82 (2), 105 (4). +* `spatial_region_modeled` : Full brain was modeled at the individual subject level, unmasked. +* `independent_vars_first_level` : We modeled our first level analysis using regressors for trial onset, missed trials, and button press separately. Trial onset was additionally parametrically modulated by gain and loss and duration was set to the trial-level reaction time. Stimulus onset HRF was modeled as an event related canonical HRF with amplitude and duration modulation as described above (AFNI specifications stim_type AM2 and basis 'dmBLOCK(0)'). Missed trials and button presses HRFs were modeled using AFNI's 'GAM', which is a 12 second canonical HRF). + +Motion regressors were modeled according to demeaned motion in 6 directions: roll, pitch, yaw, dS, dL, and dP. No temporal derivitaves were used. AFNI standard mean and de-trending regressors were included for each run separately. +* `RT_modeling` : duration +* `movement_modeling` : 1 +* `independent_vars_higher_level` : No covariates were included in these group level models. For loss ER vs EI, these two groups were modeled according to 3dMEMA two-sample t-test specifications (i.e. using -groups command). + +We had five total models to test the nine questions: +gain_ei (modeled gain vs. 0 for only participants in the equal indifference condition) +gain_er (modeled gain vs. 0 for only participants in the equal range condition) +loss_ei (modeled loss vs. 0 for only participants in the equal indifference condition) +loss_er (modeled loss vs. 0 for only participants in the equal range condition) +loss_er_vs_loss_ei (modeled as loss for the ER group vs. loss for the EI group). + +The use of 3dMEMA in AFNI meant that 2nd-level analyses weighted (using the KH test) individual subjects' beta values with their individual t-statistic such that individuals with higher t-statistics were given greater voxelwise weight in the group-level analysis. +* `model_type` : Mass univariate. One and two-sample t-tests were modeled using AFNI '3dMEMA' specification, using mixed effects modeling. This model uses each individual subjects' REML-estimated coefficient and t-statistic. +* `model_settings` : First level model: a spatial autocorrelation function for each subject was estimated according to mixed-model ACF specified in the blur procedure of afni_proc.py. This computes an ACF blur estimate for each subject in the x,y, and z directions that is then averaged across subjects and used for cluster extent thresholding at the group level. Standard AFNI detrending and mean regressors were included in the first-level regressions for each run. Analyses used AFNI's 3dREMLfit function, which solves linear equations for each voxel in the generalized (prewhitened) least squares sense, using the REML estimation method to find a best-fit ARMA(1,1) model. + +Group level models were mixed-effects models using AFNI '3dMEMA' and individual subject's restricted maximum likelihood (REML) estimates of task and motion regressors. For Hypothesis 9 (contrasting the ER and EI groups), equal variance was assumed. +* `inference_contrast_effect` : All contrasts were two-sided, and were simple one-sample and two-sample (independent sample) t-tests subject to the 3dMEMA mixed effects adjustments (e.g. for gain vs. 0, we examined the main effect of parametric gain on whole brain BOLD signal). +* `search_region` : The group level models were constructed and subsequently thresholded on a whole-brain basis. These were then further masked according to anatomically defined ROIs as specified in Analysis: General (see above). +* `statistic_type` : Cluster-wise statistics were extracted from the ROI-masked whole brain model. This masked whole brain model (for each ROI separately) was first cluster thresholded according to AFNI's 3dClustSim -acf specification and the mean ACF values across subjects (using an uncorrected p value of 0.001, and a cluster threshold of 52 voxels to attain a final, whole-brain corrected p-value of 0.05). AFNI's cluster report was then used to determine the presence of any clusters remaining in the specified ROI, which formed the basis for the binary Yes/No decision for each of the 9 hypotheses. +* `pval_computation` : Parametric inference at the whole brain level assessed statistical significance. Using AFNI's 3dClustSim, it was determined that a p<.001 threshold with a cluster size extent of 52 voxels was equivalent to a whole-brain thresholded p-value of p < .05. Any clusters that were larger than 52 voxels in size at p<.001 in the whole brain model were considered statistically signficant. +* `multiple_testing_correction` : None. +* `comments_analysis` : In addition to the whole brain models run above, we also extracted mean beta and t-values for each subject (using restricted maximum likelihood estimates) from ROI masks before they were entered into a whole brain analysis and did post-hoc tests on the resulting betas (one for each subject, for each ROI). These tests, effectively small-volume corrected tests, identified, at the p < 0.01 level, the following answers to the 9 hypotheses: 1) No, 2) No, 3) Yes, 4) No, 5) Yes, 6) Yes, 7) No, 8), No, 9) No. We formed these binary judgments on the basis of non-parametric Wilcoxon signed-rank test. +## Categorized for analysis +* `region_definition_vmpfc` : Other +* `region_definition_striatum` : atlas MNI_152 +* `region_definition_amygdala` : atlas MNI_152 +* `analysis_SW` : AFNI +* `analysis_SW_with_version` : AFNI 18.3.12 +* `smoothing_coef` : 6 +* `testing` : parametric +* `testing_thresh` : p<0.001 +* `correction_method` : ClustSim +* `correction_thresh_` : p<0.05 +## Derived +* `n_participants` : 108 +* `excluded_participants` : n/a +* `func_fwhm` : 6 +* `con_fwhm` : +## Comments +* `excluded_from_narps_analysis` : No +* `exclusion_comment` : N/A +* `reproducibility` : 2 +* `reproducibility_comment` : + diff --git a/6VV2.md b/6VV2.md new file mode 100644 index 00000000..fa14d3a2 --- /dev/null +++ b/6VV2.md @@ -0,0 +1,143 @@ +# NARPS team description : 6VV2 +## General +* `teamID` : 6VV2 +* `NV_collection_link` : https://neurovault.org/collections/4883/ +* `results_comments` : NA +* `preregistered` : No +* `link_preregistration_form` : NA +* `regions_definition` : We used Neurosynth and did a term search for each of the brain regions. We identified the peak z-score in the left and right hemisphere for the ventral striatum and amygdala and extracted the coordinates. For the vmPFC we also identified the two largest z-scores (one more anterior and one more posterior) and extracted the coordinates of those peaks. Using those coordinates, we created a 5mm sphere around each of the six coordinates we had identified. Our criteria for whether an effect was found in a region was that our thresholded contrast maps had to cover 25% of the combined volume of the two sphere ROIs for each region. The MNI coordinates for the center of each ROI sphere are listed below: +Left Ventral Striatum: -10, 10, -6 +Right Ventral Striatum: 10, 10, -8 +Left Amygdala: -24, -2, -20 +Right Amygdala: 22, -4, -18 +Anterior vmPFC: 0, 58, -6 +Posterior vmPFC: 0, 46, -8 +* `softwares` : AFNI Version 19.0.01 Tiberius +* `general_comments` : When uploading to Neurovault, there are no regions appearing in the thresholded map for hypothesis 1 or 3. However, there are a few significant clusters in the parietal cortex when we look at the same files in the AFNI viewer. These clusters do not have any bearing on our evaluation of the requested hypotheses. We are not sure what is causing the discrepancy, but we would be happy to provide the exact .nii files if they would be helpful. We did download the problematic .nii file directly from Neurovault and those clusters are evident looking at that file in the AFNI viewer. It seems like the file is fine, but there is some issue with displaying the contents of the file in Neurovault. Please let us know if there is anything else we can do. +## Exclusions +* `n_participants` : 101 +* `exclusions_details` : sub-016, sub-018, sub-030, sub-088, sub-089, and sub-100 were excluded for motion (details in preprocessing explanation). Participants were excluded from the analysis if any of the four functional runs required censoring > 25% of TRs based on our pre-determined motion censoring thresholds (see preprocessing details). Sub-072 was excluded due to registration problems (scans appeared to be acquired in a different orientation and our preprocessing pipeline had problems aligning and transforming these scans into standard space). The same issue was observed in sub-089 who had already been excluded due to motion. +## Preprocessing +* `used_fmriprep_data` : No +* `preprocessing_order` : Data were processed with AFNI's proc.py pipeline. The processing steps we selected were: despike, tshift, align, tlrc, volreg, blur, mask, scale, regress. +* `brain_extraction` : NA +* `segmentation` : NA +* `slice_time_correction` : AFNI's tshift processing block in the proc.py pipeline was used with default parameters. This pipeline performs slice time correction prior to motion correction. Interpolation information is as follows: Used the quintic (5th order) Lagrange polynomial interpolation. Each slice was aligned to a time offset of 0. +* `motion_correction` : AFNI's volreg software was used through the proc.py pipeline. We used a 6 parameter rigid body transformation. The reference scan was identified as the volume with the smallest outlier fraction (option -volreg_align_to_MIN_OUTLIER). The image similarity metric used by volreg is an iterated linearized weighted least squares algorithm. Cubic interpolation was used. +* `motion` : +* `gradient_distortion_correction` : NA +* `intra_subject_coreg` : Function to structure coregistration was completed within the afni_proc.py pipeline. The type of transformation was a linear affine. The cost function we selected was "lpc+ZZ." This cost function begins with local Pearson correlations plus fractions of other cost functions and finishes with pure local Pearson correlation. The interpolation mode used to create the output dataset was cubic. +* `distortion_correction` : NA +* `inter_subject_reg` : Intersubject registration was again completed with the afni_proc.py pipeline. We registered volume data from the T1 scans. We used the "MNI152_T1_2009c" template included with AFNI distributions. The choice of warp was the default warp used by the AFNI 3dQwarp command called by the "-tlrc_NL_warp" option in the afni_proc.py pipeline. +* `intensity_correction` : NA +* `intensity_normalization` : Intensity normalization was completed with the scale processing block in the afni_proc.py pipeline. Each run mean was scaled to 100 for each voxel with a maximum value of 200. +* `noise_removal` : Artifact and structured noise removal was completed with the afni_proc.py pipeline. Demeaned motion parameters and the 1st temporal derivatives were used. +* `volume_censoring` : We used the despike processing block in the afni_proc.py pipeline. This used the default setting for AFNI's 3dDespike command. The first 3 volumes of each functional scan were also removed using the "-regress_censor_first_trs" option. Finally, we used the "-regress_censor_motion" option to identify TRs with a Euclidean norm value greater than 0.2 for censoring. The TR prior to flagged TRs is also censored. No interpolation was used as AFNI removes censored TRs from the regression model. +* `spatial_smoothing` : Spatial smoothing was conducted using the blur processing block in the afni_proc.py pipeline. A 4mm FWHM gaussian blur was used. Smoothing was only done in a mask of the entire brain volume (-blur_in automask option). This approach uses an iterative smoothing process until the data reaches the specified smoothness. Spatial smoothing is performed in MNI space. +* `preprocessing_comments` : Our afni_proc.py script including options and parameters can be found below: +afni_proc.py \ + -script ${expdir}/proc.${subject}.block \ + -scr_overwrite \ + -subj_id ${subject} \ + -out_dir ${expdir}/${subject}.results.block \ + -dsets ${subdir}/${subject}/func/${subject}_task-MGT_run-01_bold.nii.gz \ + ${subdir}/${subject}/func/${subject}_task-MGT_run-02_bold.nii.gz \ + ${subdir}/${subject}/func/${subject}_task-MGT_run-03_bold.nii.gz \ + ${subdir}/${subject}/func/${subject}_task-MGT_run-04_bold.nii.gz \ + -copy_anat ${subdir}/${subject}/anat/${subject}_T1w.nii.gz \ + -anat_has_skull yes \ + -blocks despike tshift align tlrc volreg blur mask scale regress \ + -despike_new yes \ + -tlrc_base MNI152_T1_2009c+tlrc \ + -tlrc_NL_warp \ + -align_opts_aea \ + -giant_move \ + -cost lpc+ZZ \ + -volreg_align_to MIN_OUTLIER \ + -volreg_tlrc_warp \ + -volreg_align_e2a \ + -blur_in_automask \ + -regress_stim_times \ + ${timdir}/${subject}-times+gain.1D \ + ${timdir}/${subject}-times+loss.1D \ + -regress_stim_types AM2 \ + -regress_stim_labels \ + GAIN \ + LOSS \ + -regress_basis \ + 'BLOCK(4,1)' \ + -mask_apply anat \ + -regress_motion_per_run \ + -test_stim_files no \ + -regress_opts_3dD \ + -GOFORIT 8 \ + -jobs 6 \ + -regress_censor_motion 0.2 \ + -regress_apply_mot_types demean deriv \ + -regress_censor_first_trs 3 \ + -regress_est_blur_errts \ + -remove_preproc_files \ + -execute +## Analysis +* `data_submitted_to_model` : This information is already specified in other portions of this form. +* `spatial_region_modeled` : Full brain. Decisions regarding hypotheses were based on anatomical regions defined in other portions of this form. +* `independent_vars_first_level` : All trials were modelled. The duration modelled was 4 seconds. We used parametric modulation with the gain and loss values for each trial (-regress_stim_times AM2 option is afni_proc.py pipeline). We used a canonical only HRF. We used the default AFNI canonical HRF which is a gamma variate function. Motion regressors were demeaned and we used the six motion parameters as well as their temporal derivatives. Baseline was modelled with a 4th degree polynomial as recommended by the AFNI 3dDeconvolve command. +* `RT_modeling` : none +* `movement_modeling` : 1 +* `independent_vars_higher_level` : Group effects were between the equal indifference and the equal range groups. Factor in the group model consisted of group membership (between) and the amplitude modulation beta values for gains and losses (within). +* `model_type` : We used a linear mixed effects model with the AFNI 3dLME program. +* `model_settings` : We used a linear mixed effect model with the AFNI program 3dLME. + +3dLME -prefix _3dLME_output -jobs 4 \ +-model 'group*cond' \ +-SS_type 3 \ +-ranEff '~1' \ +-num_glt 5 \ +-gltLabel 1 'GAIN_indiff' -gltCode 1 'group : 1*indiff cond : 1*GAIN' \ +-gltLabel 2 'GAIN_range' -gltCode 2 'group : 1*range cond : 1*GAIN' \ +-gltLabel 3 'LOSS_indiff' -gltCode 3 'group : 1*indiff cond : 1*LOSS' \ +-gltLabel 4 'LOSS_range' -gltCode 4 'group : 1*range cond : 1*LOSS' \ +-gltLabel 5 'LOSS_range-indiff' -gltCode 5 'group : 1*range -1*indiff cond : 1*LOSS' \ +-dataTable +Subj cond group InputFile \ +001 GAIN indiff results/sub-001.results.block/sub-001_GAIN.nii \ +001 LOSS indiff results/sub-001.results.block/sub-001_LOSS.nii \ +… +124 GAIN range results/sub-124.results.block/sub-124_GAIN.nii \ +124 LOSS range results/sub-124.results.block/sub-124_LOSS.nii +* `inference_contrast_effect` : Using AFNI's 3dLME we requested general linear tests to evaluate the hypotheses. These included: Gains for the equal indifference group, Losses for the equal indifference group, Gains for the equal range group, Losses for the equal range group, and the group effect (equal indifference vs equal range) restricted to the loss condition. All statistical tests were two-sided. +* `search_region` : Whole brain. Evaluation of the hypotheses in regard to anatomical regions is discussed in other portions of this form. +* `statistic_type` : Cluster size. Minimum cluster size was 12 voxels. Voxels clustered together if faces or edges were touching (AFNI option -NN2). +* `pval_computation` : Standard parametric inference. +* `multiple_testing_correction` : We used AFNI's 3dClustSim function to perform a FWE random field correction. As currently suggested, we included an estimate of the noise structure with a spatial autocorrelation function. These noise structure estimates were used to estimate the random field model. A voxel-wise threshold of uncorrected p<0.001 for two-tailed tests was used to determine the minimum cluster size threshold. +ACF values were extracted from the afni_proc.py output and averaged across subjects +3dClustSim \ +-mask mask_group+tlrc \ +-acf $acs \ +-MEGA \ +-both \ +-prefix 3dclustsim.block +The ACF values (mean across subjects) used in this step were: 0.674273, 2.12155, 3.7347 +* `comments_analysis` : One thing our team found strange was that the results were all corrected for whole brain analyses when there were very specific a priori hypotheses about regions of interest. Also, some of our scores regarding the similarity to other groups' results were influenced by looking at unthresholded data and observing that different ROI definitions or criteria would have potentially changed our answer for the hypothesis. We collectively discussed and made decisions about our ROI definition and how we would evaluate the hypotheses prior to data analysis. We did not alter the criteria we decided upon, but when looking at the results it was clear that it would have been possible to reach different conclusions had we made different choices about ROI definition and the exact criteria we used to evaluate the hypotheses. +## Categorized for analysis +* `region_definition_vmpfc` : neurosynth +* `region_definition_striatum` : neurosynth +* `region_definition_amygdala` : neurosynth +* `analysis_SW` : AFNI +* `analysis_SW_with_version` : AFNI 19.0.01 +* `smoothing_coef` : 4 +* `testing` : parametric +* `testing_thresh` : p<0.001 +* `correction_method` : GRTFWE cluster +* `correction_thresh_` : p<0.05 +## Derived +* `n_participants` : 101 +* `excluded_participants` : 016, 018, 030, 088, 089, 100, 072 +* `func_fwhm` : 4 +* `con_fwhm` : +## Comments +* `excluded_from_narps_analysis` : No +* `exclusion_comment` : N/A +* `reproducibility` : 2 +* `reproducibility_comment` : + diff --git a/narps_open/pipelines/team_27SS.firstlevel b/narps_open/pipelines/team_27SS.firstlevel new file mode 100755 index 00000000..9d1ba399 --- /dev/null +++ b/narps_open/pipelines/team_27SS.firstlevel @@ -0,0 +1,111 @@ +#!/bin/tcsh + +# Reproduction of 27SS pipeline by the Narps reproducibility team +# creation date: 13 February 2024 +# version afni used by the team: AFNI 18.3.12 +# version afni used by the reproducibility team: AFNI Version 23.0.02 Commodus + +# Store arguments (directory where to store results, subjects list, directory where data are stored) +set expdir="$1" # /home/jlefortb/narps_open_pipelines/data/results/team_27SS_afni/firstlevel/ +set subject="$2" # sub-001 +set datadir="$3" # /home/jlefortb/narps_open_pipelines/data/original/ds001734/ + +# In a terminal, path /home/jlefortb/narps_open_pipelines, run: +# /home/jlefortb/narps_open_pipelines/narps_open/pipelines/team_27SS.firstlevel /home/jlefortb/narps_open_pipelines/data/results/team_27SS_afni/firstlevel/, sub-001, /home/jlefortb/narps_open_pipelines/data/original/ds001734/ + + + + +# Store arguments (directory where to store results, subjects list, directory where data are stored) +set expdir="$1" +set subject="$2" +set datadir="$3" + + +afni_proc.py \ + # Spécification du script de sortie + -script ${expdir}/proc.${subject}.block \ + # Autoriser l'écrasement du script existant + -scr_overwrite \ + # Spécification de l'identifiant du sujet + -subj_id ${subject} \ + # Spécification du répertoire de sortie + -out_dir ${expdir}/${subject}.results.block \ + # Spécification des ensembles de données EPI + -dsets ${datadir}/${subject}/func/${subject}_task-MGT_run-01_bold.nii.gz \ + ${datadir}/${subject}/func/${subject}_task-MGT_run-02_bold.nii.gz \ + ${datadir}/${subject}/func/${subject}_task-MGT_run-03_bold.nii.gz \ + ${datadir}/${subject}/func/${subject}_task-MGT_run-04_bold.nii.gz \ + # Copie de l'image anatomique + -copy_anat ${datadir}/${subject}/anat/${subject}_T1w.nii.gz \ + # Spécification de la présence du crâne dans l'image anatomique + -anat_has_skull yes \ + # Blocs de prétraitement inclus dans le pipeline + -blocks despike tshift align tlrc volreg blur mask scale regress \ + # Option de déspike + -despike_new yes \ + # Spécification de la base TLRC + -tlrc_base MNI152_T1_2009c+tlrc \ + # Specify blur size + -blur_size 6.0 \ + # Options d'alignement + -align_opts_aea \ + # Déplacement géant + -giant_move \ + # Coût de l'alignement + -cost lpc+ZZ \ + # Options for temporal shift + -tshift_opts_ts -quintic \ + # Alignement des volumes EPI sur l'outlier minimal + -volreg_align_to MIN_OUTLIER \ + # Interpolation method for volume registration + -volreg_interp cubic \ + # Alignement EPI vers anatomique + -volreg_align_e2a \ + # Flou dans le masque automatique + -blur_in_automask \ + # Model motion per run + -regress_motion_per_run \ + # Censor motion outliers with framewise displacement greater than 1.5 mm + -regress_censor_motion 1.5 \ + # Specify the regressors and their corresponding labels + -regress_stim_times \ + ${datadir}/${subject}/func/times+gain.1D \ + ${datadir}/${subject}/func/times+loss.1D \ + -regress_stim_labels task nuisance \ + # Modélisation des régresseurs de stimulus + -regress_basis 'BLOCK(4,1)' \ + # Application du masque anatomique + -mask_apply anat \ + # Options supplémentaires pour 3dDeconvolve + -regress_opts_3dD \ + -GOFORIT 8 \ + -jobs 6 \ + -ortvec ${datadir}/${subject}/func/motion_parameters.1D motion_params \ + -allzero_OK \ + # Application des types de mouvement pour la régression + -regress_apply_mot_types demean \ + # Censure des premiers TRs + -regress_censor_first_trs 3 \ + # Estimation des erreurs de flou + # Estimate the blur epochs + -regress_est_blur_epits \ + # Estimate the blur error times + -regress_est_blur_errts \ + # Exécution du pipeline directement après création du script TCSH + + # No gradient distortion correction specified + # No distortion correction specified + # No intensity correction specified + # No intensity normalization specified + # No spatial smoothing specified + # Execute the pipeline script +# -execute + +# # extract beta values +# 3dbucket -prefix GAIN ${expdir}/${subject}.results.block/stats.sub-001+tlrc.BRIK[3] +# 3dbucket -prefix LOSS ${expdir}/${subject}.results.block/stats.sub-001+tlrc.BRIK[8] + +# # convert BRIK to nii +# 3dAFNItoNIFTI -prefix GAIN ${subject}_GAIN+tlrc +# 3dAFNItoNIFTI -prefix LOSS ${subject}_LOSS+tlrc \ No newline at end of file From e63f066263ffd8462ddce2256bf0523d6d2cedf9 Mon Sep 17 00:00:00 2001 From: jlefortbesnard Date: Tue, 13 Feb 2024 16:18:24 +0100 Subject: [PATCH 2/2] add first level 27SS --- narps_open/pipelines/team_27SS.firstlevel | 52 +---------- narps_open/pipelines/team_6VV2.firstlevel | 107 ++++++++++++++++++++++ 2 files changed, 112 insertions(+), 47 deletions(-) create mode 100644 narps_open/pipelines/team_6VV2.firstlevel diff --git a/narps_open/pipelines/team_27SS.firstlevel b/narps_open/pipelines/team_27SS.firstlevel index 9d1ba399..0531f48d 100755 --- a/narps_open/pipelines/team_27SS.firstlevel +++ b/narps_open/pipelines/team_27SS.firstlevel @@ -5,17 +5,10 @@ # version afni used by the team: AFNI 18.3.12 # version afni used by the reproducibility team: AFNI Version 23.0.02 Commodus -# Store arguments (directory where to store results, subjects list, directory where data are stored) -set expdir="$1" # /home/jlefortb/narps_open_pipelines/data/results/team_27SS_afni/firstlevel/ -set subject="$2" # sub-001 -set datadir="$3" # /home/jlefortb/narps_open_pipelines/data/original/ds001734/ - # In a terminal, path /home/jlefortb/narps_open_pipelines, run: # /home/jlefortb/narps_open_pipelines/narps_open/pipelines/team_27SS.firstlevel /home/jlefortb/narps_open_pipelines/data/results/team_27SS_afni/firstlevel/, sub-001, /home/jlefortb/narps_open_pipelines/data/original/ds001734/ - - # Store arguments (directory where to store results, subjects list, directory where data are stored) set expdir="$1" set subject="$2" @@ -23,84 +16,49 @@ set datadir="$3" afni_proc.py \ - # Spécification du script de sortie -script ${expdir}/proc.${subject}.block \ - # Autoriser l'écrasement du script existant -scr_overwrite \ - # Spécification de l'identifiant du sujet -subj_id ${subject} \ - # Spécification du répertoire de sortie -out_dir ${expdir}/${subject}.results.block \ - # Spécification des ensembles de données EPI -dsets ${datadir}/${subject}/func/${subject}_task-MGT_run-01_bold.nii.gz \ ${datadir}/${subject}/func/${subject}_task-MGT_run-02_bold.nii.gz \ ${datadir}/${subject}/func/${subject}_task-MGT_run-03_bold.nii.gz \ ${datadir}/${subject}/func/${subject}_task-MGT_run-04_bold.nii.gz \ - # Copie de l'image anatomique -copy_anat ${datadir}/${subject}/anat/${subject}_T1w.nii.gz \ - # Spécification de la présence du crâne dans l'image anatomique -anat_has_skull yes \ - # Blocs de prétraitement inclus dans le pipeline -blocks despike tshift align tlrc volreg blur mask scale regress \ - # Option de déspike -despike_new yes \ - # Spécification de la base TLRC -tlrc_base MNI152_T1_2009c+tlrc \ - # Specify blur size -blur_size 6.0 \ - # Options d'alignement -align_opts_aea \ - # Déplacement géant -giant_move \ - # Coût de l'alignement -cost lpc+ZZ \ - # Options for temporal shift -tshift_opts_ts -quintic \ - # Alignement des volumes EPI sur l'outlier minimal -volreg_align_to MIN_OUTLIER \ - # Interpolation method for volume registration -volreg_interp cubic \ - # Alignement EPI vers anatomique -volreg_align_e2a \ - # Flou dans le masque automatique -blur_in_automask \ - # Model motion per run -regress_motion_per_run \ - # Censor motion outliers with framewise displacement greater than 1.5 mm -regress_censor_motion 1.5 \ - # Specify the regressors and their corresponding labels -regress_stim_times \ ${datadir}/${subject}/func/times+gain.1D \ ${datadir}/${subject}/func/times+loss.1D \ - -regress_stim_labels task nuisance \ - # Modélisation des régresseurs de stimulus + -regress_stim_types AM2 \ + -regress_stim_labels \ + GAIN \ + LOSS \ -regress_basis 'BLOCK(4,1)' \ - # Application du masque anatomique -mask_apply anat \ - # Options supplémentaires pour 3dDeconvolve -regress_opts_3dD \ -GOFORIT 8 \ -jobs 6 \ -ortvec ${datadir}/${subject}/func/motion_parameters.1D motion_params \ -allzero_OK \ - # Application des types de mouvement pour la régression -regress_apply_mot_types demean \ - # Censure des premiers TRs -regress_censor_first_trs 3 \ - # Estimation des erreurs de flou - # Estimate the blur epochs -regress_est_blur_epits \ - # Estimate the blur error times -regress_est_blur_errts \ - # Exécution du pipeline directement après création du script TCSH - - # No gradient distortion correction specified - # No distortion correction specified - # No intensity correction specified - # No intensity normalization specified - # No spatial smoothing specified - # Execute the pipeline script -# -execute + # -execute # # extract beta values # 3dbucket -prefix GAIN ${expdir}/${subject}.results.block/stats.sub-001+tlrc.BRIK[3] diff --git a/narps_open/pipelines/team_6VV2.firstlevel b/narps_open/pipelines/team_6VV2.firstlevel new file mode 100644 index 00000000..e7d89ce7 --- /dev/null +++ b/narps_open/pipelines/team_6VV2.firstlevel @@ -0,0 +1,107 @@ +#!/bin/tcsh + +# created by team 6VV2, reproduced by Narps reproducibility team +# creation date: 22 June 2023 +# read and ran by team_6VV2.py script +# version afni used by the team : AFNI Version 19.0.01 Tiberius +# version afni used by the reproducibility team :AFNI Version 23.0.02 Commodus +# Last update: June 2023 + + +# exemple run: +# In a terminal, path /home/jlefortb/narps_open_pipelines, run: +# tcsh /home/jlefortb/narps_open_pipelines/narps_open/pipelines/team_6VV2.firstlevel /home/jlefortb/narps_open_pipelines/data/results/team_6VV2_afni/firstlevel/, sub-001, /home/jlefortb/narps_open_pipelines/data/original/ds001734/ + + + + +# Store arguments (directory where to store results, subjects list, directory where data are stored) +set expdir="$1" +set subject="$2" +set datadir="$3" + + +afni_proc.py \ + -script ${expdir}/proc.${subject}.block \ + -scr_overwrite \ + -subj_id ${subject} \ + -out_dir ${expdir}/${subject}.results.block \ + -dsets ${datadir}/${subject}/func/${subject}_task-MGT_run-01_bold.nii.gz \ + ${datadir}/${subject}/func/${subject}_task-MGT_run-02_bold.nii.gz \ + ${datadir}/${subject}/func/${subject}_task-MGT_run-03_bold.nii.gz \ + ${datadir}/${subject}/func/${subject}_task-MGT_run-04_bold.nii.gz \ + -copy_anat ${datadir}/${subject}/anat/${subject}_T1w.nii.gz \ + -anat_has_skull yes \ + -blocks despike tshift align tlrc volreg blur mask scale regress \ + -despike_new yes \ + -tlrc_base MNI152_T1_2009c+tlrc \ + -tlrc_NL_warp \ + -align_opts_aea \ + -giant_move \ + -cost lpc+ZZ \ + -volreg_align_to MIN_OUTLIER \ + -volreg_tlrc_warp \ + -volreg_align_e2a \ + -blur_in_automask \ + -regress_stim_times \ + ${datadir}/${subject}/func/times+gain.1D \ + ${datadir}/${subject}/func/times+loss.1D \ + -regress_stim_types AM2 \ + -regress_stim_labels \ + GAIN \ + LOSS \ + -regress_basis \ + 'BLOCK(4,1)' \ + -mask_apply anat \ + -regress_motion_per_run \ + -test_stim_files no \ + -regress_opts_3dD \ + -GOFORIT 8 \ + -jobs 6 \ + -regress_censor_motion 0.2 \ + -regress_apply_mot_types demean deriv \ + -regress_censor_first_trs 3 \ + -regress_est_blur_errts \ + # -execute + + +# # extract beta values +# 3dbucket -prefix GAIN ${expdir}/${subject}.results.block/stats.sub-001+tlrc.BRIK[3] +# 3dbucket -prefix LOSS ${expdir}/${subject}.results.block/stats.sub-001+tlrc.BRIK[8] + +# # convert BRIK to nii +# 3dAFNItoNIFTI -prefix GAIN ${subject}_GAIN+tlrc +# 3dAFNItoNIFTI -prefix LOSS ${subject}_LOSS+tlrc + + + +# run this file with "tcsh 6VV2_afni_proc.simple" + +# create 1D stimuli file : +# import pandas as pd + +# df_run1 = pd.read_csv("/home/jlefortb/narps_open_pipelines/data/original/ds001734/sub-001/func/sub-001_task-MGT_run-01_events.tsv", sep="\t") +# df_run1 = df_run1[["onset", "gain", "loss"]].T +# df_run2 = pd.read_csv("/home/jlefortb/narps_open_pipelines/data/original/ds001734/sub-001/func/sub-001_task-MGT_run-02_events.tsv", sep="\t") +# df_run2 = df_run2[["onset", "gain", "loss"]].T +# df_run3 = pd.read_csv("/home/jlefortb/narps_open_pipelines/data/original/ds001734/sub-001/func/sub-001_task-MGT_run-03_events.tsv", sep="\t") +# df_run3 = df_run3[["onset", "gain", "loss"]].T +# df_run4 = pd.read_csv("/home/jlefortb/narps_open_pipelines/data/original/ds001734/sub-001/func/sub-001_task-MGT_run-04_events.tsv", sep="\t") +# df_run4 = df_run4[["onset", "gain", "loss"]].T + +# df_gain = pd.DataFrame(index=range(0,4), columns=range(0,64)) +# df_gain.loc[0] = ["{}*{}".format(df_run1[col].loc['onset'], df_run1[col].loc['gain']) for col in range(0, 64)] +# df_gain.loc[1] = ["{}*{}".format(df_run2[col].loc['onset'], df_run2[col].loc['gain']) for col in range(0, 64)] +# df_gain.loc[2] = ["{}*{}".format(df_run3[col].loc['onset'], df_run3[col].loc['gain']) for col in range(0, 64)] +# df_gain.loc[3] = ["{}*{}".format(df_run4[col].loc['onset'], df_run4[col].loc['gain']) for col in range(0, 64)] +# df_loss = pd.DataFrame(index=range(0,4), columns=range(0,64)) +# df_loss.loc[0] = ["{}*{}".format(df_run1[col].loc['onset'], df_run1[col].loc['loss']) for col in range(0, 64)] +# df_loss.loc[1] = ["{}*{}".format(df_run2[col].loc['onset'], df_run2[col].loc['loss']) for col in range(0, 64)] +# df_loss.loc[2] = ["{}*{}".format(df_run3[col].loc['onset'], df_run3[col].loc['loss']) for col in range(0, 64)] +# df_loss.loc[3] = ["{}*{}".format(df_run4[col].loc['onset'], df_run4[col].loc['loss']) for col in range(0, 64)] + + +# df_gain.to_csv('/home/jlefortb/narps_open_pipelines/data/original/ds001734/sub-001/func/times+gain.1D', +# sep='\t', index=False, header=False) +# df_loss.to_csv('/home/jlefortb/narps_open_pipelines/data/original/ds001734/sub-001/func/times+loss.1D', +# sep='\t', index=False, header=False)