help > no conditions found, please re-run first
Showing 1-1 of 1 posts
Display:
Results per page:
Nov 6, 2017  06:11 PM | Mengxing Liu
no conditions found, please re-run first
Hello conn group,

I was trying to do FC analysis with batch, and when I opened the GUI to see the results after all analysis were done, everything seemed fine but not second level results. It kept telling me that no conditions found, please re-run first level analysis. I checked the Setup with GUI and I was sure that conditions were defined. After I re-ran first level analysis by clicking done in first level setting widows, the second level results could be shown correctly with GUI.

I don't know what's wrong with my script below, could you help me checking it?

% set paths depending on the platform
if ispc; project_path = 'G:/Mengxing/fc_ana_PiN/'; data_path = 'G:/Mengxing/PiN/';
elseif isunix; project_path = '/bcbl/home/public/Mengxing/fc_ana_PiN/'; data_path = '/bcbl/home/public/Mengxing/PiN/';
end

run([data_path,'Print/groups.m']); % load the groups info
run_list = {'run1', 'run2', 'run3', 'run4', 'run5', 'run6'};
%% set batch
clear batch;
batch.filename = fullfile(project_path, 'conn_test.mat');
Hebrew = [Hebrew, '08H']; Hebrew = sort(Hebrew); % add 08H to Hebrew group
nsubjects = length(All);
batch.Setup.isnew = 1; % this is a new conn project
% batch.parallel.profile = 'Grid Engine'; % the default profle was set to Grid Engine at the GUI, no need to define here.
batch.parallel.N = nsubjects; % one process per subject
batch.Setup.nsubjects = nsubjects;
batch.Setup.RT = 2;
for nsub = 1: nsubjects;
run([data_path,'Print/onsets/', All{nsub}, '/vectors_Print.m']); % load the onsets variables for each subjects
for nrun = 1: length(run_list);
%% define the functional and structural files
func_path = [project_path, 'data/', All{nsub}, '/func/'];
struc_path = [project_path, 'data/', All{nsub}, '/anat/'];
if exist([func_path, run_list{nrun}, '.nii'], 'file')
batch.Setup.functionals{nsub}{nrun}{1} = [func_path, run_list{nrun},'.nii'];
batch.Setup.structurals{nsub}= [struc_path, 'c_highres.img'];
batch.Setup.masks.Grey.files = [struc_path, 'c1c_highres.nii'];
batch.Setup.masks.White.files = [struc_path, 'c2c_highres.nii'];
batch.Setup.masks.CSF.files = [struc_path, 'c3c_highres.nii'];
%% define condition and covariates
load([project_path, 'data/', All{nsub}, '/onsets.mat']);
% setup conditions of interested hit_clear
batch.Setup.conditions.names{1} = 'hit_clear';
batch.Setup.conditions.onsets{1}{nsub}{nrun} = onsets.(run_list{nrun}).hit.clear.fre.linl;
batch.Setup.conditions.durations{1}{nsub}{nrun} = 2;
batch.Setup.conditions.names{2} = 'hit_no1';
batch.Setup.conditions.onsets{2}{nsub}{nrun} = onsets.(run_list{nrun}).hit.no1.fre.linl;
batch.Setup.conditions.durations{2}{nsub}{nrun} = 2;
batch.Setup.conditions.names{3} = 'hit_no2';
batch.Setup.conditions.onsets{3}{nsub}{nrun} = onsets.(run_list{nrun}).hit.no2.fre.linl;
batch.Setup.conditions.durations{3}{nsub}{nrun} = 2;
batch.Setup.conditions.names{4} = 'incorrect_clear';
batch.Setup.conditions.onsets{4}{nsub}{nrun} = onsets.(run_list{nrun}).incorrect.clear.fre.linl;
batch.Setup.conditions.durations{4}{nsub}{nrun} = 2;
batch.Setup.conditions.names{5} = 'incorrect_no1';
batch.Setup.conditions.onsets{5}{nsub}{nrun} = onsets.(run_list{nrun}).incorrect.no1.fre.linl;
batch.Setup.conditions.durations{5}{nsub}{nrun} = 2;
batch.Setup.conditions.names{6} = 'incorrect_no2';
batch.Setup.conditions.onsets{6}{nsub}{nrun} = onsets.(run_list{nrun}).incorrect.no2.fre.linl;
batch.Setup.conditions.durations{6}{nsub}{nrun} = 2;
batch.Setup.conditions.names{7} = 'rest';
batch.Setup.conditions.onsets{7}{nsub}{nrun} = onsets.(run_list{nrun}).rest;
batch.Setup.conditions.durations{7}{nsub}{nrun} = 20;
% define head movement covariates
batch.Setup.covariates.names = {'head_movement'};
rp_file = [project_path, 'data/', All{nsub}, '/func/rp_', run_list{nrun}, '.txt'];
batch.Setup.covariates.files{1}{nsub}{nrun} = rp_file;
%batch.Setup.covariates.durations{1}{nsub}{nrun} = 2;
end
end
clear ons_*; % clear the onsets variables for the current subjects.
end
batch.Setup.roifunctionals.roiextract = 1; % source of functional data would be the same as functionals structure.
batch.Setup.conditions.missingdata = 1; % allowing missingdata
% define groups for each sub
cate_groups = ones(length(All), 1);
E = length(English); C = length(Chinese); S = length(Spanish); H = length(Hebrew);
cate_groups(E+1 : E + C, 1) = 2;
cate_groups(E+C+1 : E+C+S, 1) = 3;
cate_groups(E+C+S+1 : E+C+S+H, 1) = 4;
%batch.Setup.subjects.group_names = {'English', 'Chinese', 'Spanish', 'Hebrew'};
%batch.Setup.subjects.groups = cate_groups;
batch.Setup.subjects.effect_names{1} = 'Allsub';
batch.Setup.subjects.effects{1} = ones(length(All),1);
batch.Setup.subjects.effect_names{2} = 'English';
batch.Setup.subjects.effects{2} = [ones(E,1); zeros(nsub-E,1)];
batch.Setup.subjects.effect_names{3} = 'Chinese';
batch.Setup.subjects.effects{3} = [zeros(E,1); ones(C,1); zeros(nsub-E-C,1)];
batch.Setup.subjects.effect_names{4} = 'Spanish';
batch.Setup.subjects.effects{4} = [zeros(E+C,1); ones(S,1); zeros(nsub-E-C-S,1)];
batch.Setup.subjects.effect_names{5} = 'Hebrew';
batch.Setup.subjects.effects{5} = [zeros(E+C+S,1); ones(H,1)];
batch.Setup.done = 1;
batch.Setup.overwrite = 'Yes';
% set up ROIs
roi_list = {'vOT1', 'vOT2', 'IPL', 'laSTG', 'Oper', 'Trian'};
roi_dir = [project_path, 'data/rois/'];
for nroi = 1:length(roi_list)
batch.Setup.rois.names{nroi} = roi_list{nroi};
batch.Setup.rois.files{nroi} = [roi_dir, roi_list{nroi}, '.nii'];
end
batch.Setup.analyses = 2;
batch.Setup.voxelresolution = 3;
batch.Setup.analysisunits = 2; % BOLG signal unit is raw units.
batch.Setup.outputfiles(5) = 1;
batch.Preprocessing.done = 0;
% batch.Preprocessing.overwrite = '';
batch.Denoising.filter = [0.01, 0.1]; % frequency filter ( band-pass values, in Hz)
batch.Denoising.done = 1;
% batch.Denoising.overwrite = 1;
batch.Analysis.done = 1;
% batch.Analysis.overwrite = 1;
batch.Results.between_subjects.effect_names = {'Allsub', 'English', 'Chinese', 'Spanish', 'Hebrew'};
batch.Results.between_subjects.contrast = [1, 0, 0, 0, 0];
batch.Results.between_conditions.effect_names = {'hit_clear', 'hit_no1', 'hit_no2', ...
'incorrect_clear', 'incorrect_no1', ...
'incorrect_no2', 'rest'};
batch.Results.between_conditions.contrast = [1, 0, 0, 0, 0, 0, 0];
batch.Results.done = 1;
batch.Results.overwrite = 1;
conn_batch(batch)