diff --git a/manualTests/test_createDataDictionary.m b/manualTests/test_createDataDictionary.m index d1f71138..48611447 100644 --- a/manualTests/test_createDataDictionary.m +++ b/manualTests/test_createDataDictionary.m @@ -37,7 +37,7 @@ function test_createDataDictionaryBasic() funcDir = fullfile(outputDir, 'source', 'sub-001', 'ses-001', 'func'); jsonFilename = ['sub-001_ses-001_task-testtask_run-001_events_date-' ... - cfg.fileName.date '.json']; + cfg.fileName.date '.json']; % test assertTrue(exist(fullfile(funcDir, jsonFilename), 'file') == 2); @@ -47,7 +47,7 @@ function test_createDataDictionaryBasic() % data to test against expectedStruct = bids.util.jsondecode( ... - fullfile(pwd, 'testData', 'eventsDataDictionary.json')); + fullfile(pwd, 'testData', 'eventsDataDictionary.json')); % test assertTrue(isequal(expectedStruct, actualStruct)); diff --git a/manualTests/test_createJson.m b/manualTests/test_createJson.m index c2fd031f..47fbd6ad 100644 --- a/manualTests/test_createJson.m +++ b/manualTests/test_createJson.m @@ -36,13 +36,13 @@ function test_createJsonExtra() fileName = strrep(fileName, '.tsv', '.json'); actualStruct = bids.util.jsondecode(fullfile( ... - cfg.dir.outputSubject, ... - cfg.fileName.modality, ... - fileName)); + cfg.dir.outputSubject, ... + cfg.fileName.modality, ... + fileName)); % data to test against expectedStruct = bids.util.jsondecode( ... - fullfile(pwd, 'testData', 'extra_bold.json')); + fullfile(pwd, 'testData', 'extra_bold.json')); % test assertEqual(expectedStruct, actualStruct); diff --git a/manualTests/test_makeRawDataset.m b/manualTests/test_makeRawDataset.m index 896b9caf..485a912d 100644 --- a/manualTests/test_makeRawDataset.m +++ b/manualTests/test_makeRawDataset.m @@ -205,16 +205,16 @@ function test_makeRawDataset() boldFilename = 'sub-001_ses-001_task-testtask_run-001_bold.nii.gz'; copyfile( ... - fullfile('dummyData', 'dummyData.nii.gz'), ... - fullfile(funcDir, boldFilename)); + fullfile('dummyData', 'dummyData.nii.gz'), ... + fullfile(funcDir, boldFilename)); boldFilename = ['sub-001_ses-001_task-rest', ... - '_acq-newTYpe_ce-test_dir-yPos_rec-fastRecon', ... - '_run-001_echo-1_bold.nii.gz']; + '_acq-newTYpe_ce-test_dir-yPos_rec-fastRecon', ... + '_run-001_echo-1_bold.nii.gz']; copyfile( ... - fullfile('dummyData', 'dummyData.nii.gz'), ... - fullfile(funcDir, boldFilename)); + fullfile('dummyData', 'dummyData.nii.gz'), ... + fullfile(funcDir, boldFilename)); eegDir = fullfile(subjectDir, 'eeg'); megDir = fullfile(subjectDir, 'meg'); @@ -227,20 +227,20 @@ function test_makeRawDataset() behFilename = 'sub-001_ses-001_task-easyTargetPractice_run-001_beh.tsv'; copyfile( ... - fullfile('dummyData', 'dummyData.nii.gz'), ... - fullfile(eegDir, eegFilename)); + fullfile('dummyData', 'dummyData.nii.gz'), ... + fullfile(eegDir, eegFilename)); copyfile( ... - fullfile('dummyData', 'dummyData.nii.gz'), ... - fullfile(megDir, megFilename)); + fullfile('dummyData', 'dummyData.nii.gz'), ... + fullfile(megDir, megFilename)); copyfile( ... - fullfile('dummyData', 'dummyData.nii.gz'), ... - fullfile(ieegDir, ieegFilename)); + fullfile('dummyData', 'dummyData.nii.gz'), ... + fullfile(ieegDir, ieegFilename)); copyfile( ... - fullfile('dummyData', 'dummyData.nii.gz'), ... - fullfile(behDir, behFilename)); + fullfile('dummyData', 'dummyData.nii.gz'), ... + fullfile(behDir, behFilename)); %% actually do the conversion of the source data thus created clear; diff --git a/src/checkCFG.m b/src/checkCFG.m index 3c3f0a05..bde96564 100644 --- a/src/checkCFG.m +++ b/src/checkCFG.m @@ -23,9 +23,9 @@ fieldsToSet.fileName.dateFormat = 'yyyymmddHHMM'; fieldsToSet.dir.output = fullfile( ... - fileparts(mfilename('fullpath')), ... - '..', ... - 'output'); + fileparts(mfilename('fullpath')), ... + '..', ... + 'output'); fieldsToSet.subject.askGrpSess = [true true]; fieldsToSet.subject.sessionNb = 1; % in case no session was provided diff --git a/src/convertSourceToRaw.m b/src/convertSourceToRaw.m index 69caca0e..28153cad 100644 --- a/src/convertSourceToRaw.m +++ b/src/convertSourceToRaw.m @@ -16,14 +16,14 @@ function convertSourceToRaw(cfg) % add dummy README and CHANGE file copyfile(fullfile( ... - fileparts(mfilename('fullpath')), '..', 'manualTests', 'dummyData', 'README'), ... - sourceDir); + fileparts(mfilename('fullpath')), '..', 'manualTests', 'dummyData', 'README'), ... + sourceDir); copyfile(fullfile( ... - fileparts(mfilename('fullpath')), '..', 'manualTests', 'dummyData', 'CHANGES'), ... - sourceDir); + fileparts(mfilename('fullpath')), '..', 'manualTests', 'dummyData', 'CHANGES'), ... + sourceDir); copyfile(fullfile( ... - fileparts(mfilename('fullpath')), '..', 'manualTests', 'dummyData', '.bidsignore'), ... - sourceDir); + fileparts(mfilename('fullpath')), '..', 'manualTests', 'dummyData', '.bidsignore'), ... + sourceDir); copyfile(sourceDir, rawDir); diff --git a/src/createDataDictionary.m b/src/createDataDictionary.m index f635f833..6a123a64 100644 --- a/src/createDataDictionary.m +++ b/src/createDataDictionary.m @@ -9,24 +9,24 @@ function createDataDictionary(cfg, logFile) opts.Indent = ' '; - fileName = strrep(cfg.fileName.events, '.tsv', '.json'); + fileName = strrep(logFile.filename, '.tsv', '.json'); fileName = fullfile( ... - cfg.dir.outputSubject, ... - cfg.fileName.modality, ... - fileName); + cfg.dir.outputSubject, ... + cfg.fileName.modality, ... + fileName); jsonContent = struct( ... - 'onset', struct( ... - 'Description', 'time elapsed since experiment start', ... - 'Unit', 's'), ... - 'trial_type', struct( ... - 'Description', 'types of trial', ... - 'Levels', ''), ... - 'duration', struct( ... - 'Description', 'duration of the event or the block', ... - 'Unit', 's') ... - ); + 'onset', struct( ... + 'Description', 'time elapsed since experiment start', ... + 'Unit', 's'), ... + 'trial_type', struct( ... + 'Description', 'types of trial', ... + 'Levels', ''), ... + 'duration', struct( ... + 'Description', 'duration of the event or the block', ... + 'Unit', 's') ... + ); % transfer content of extra fields to json content namesExtraColumns = returnNamesExtraColumns(logFile); diff --git a/src/createDatasetDescription.m b/src/createDatasetDescription.m index a65959d9..38e44fa2 100644 --- a/src/createDatasetDescription.m +++ b/src/createDatasetDescription.m @@ -9,8 +9,8 @@ function createDatasetDescription(cfg) opts.Indent = ' '; fileName = fullfile( ... - cfg.dir.output, 'source', ... - 'dataset_description.json'); + cfg.dir.output, 'source', ... + 'dataset_description.json'); jsonContent = cfg.bids.datasetDescription; diff --git a/src/createFilename.m b/src/createFilename.m index 1baa3511..4f6addb7 100644 --- a/src/createFilename.m +++ b/src/createFilename.m @@ -84,10 +84,10 @@ % output dir cfg.dir.outputSubject = fullfile ( ... - cfg.dir.output, ... - 'source', ... - ['sub-' subjectGrp, sprintf(pattern, subjectNb)], ... - ['ses-', sprintf(pattern, sessionNb)]); + cfg.dir.output, ... + 'source', ... + ['sub-' subjectGrp, sprintf(pattern, subjectNb)], ... + ['ses-', sprintf(pattern, sessionNb)]); [~, ~, ~] = mkdir(cfg.dir.output); [~, ~, ~] = mkdir(cfg.dir.outputSubject); @@ -102,22 +102,22 @@ %% MRI % set values for the suffixes for the different fields in the BIDS name fields2Check = { ... - 'acquisition', ... - 'contrastEnhancement', ... - 'echo', ... - 'phaseEncodingDirection', ... - 'reconstruction', ... - 'recording' ... - }; + 'acquisition', ... + 'contrastEnhancement', ... + 'echo', ... + 'phaseEncodingDirection', ... + 'reconstruction', ... + 'recording' ... + }; targetFields = { ... - 'acq', ... - 'ce', ... - 'echo', ... - 'dir', ... - 'rec', ... - 'recording' ... - }; + 'acq', ... + 'ce', ... + 'echo', ... + 'dir', ... + 'rec', ... + 'recording' ... + }; for iField = 1:numel(fields2Check) @@ -158,14 +158,14 @@ thisDate = cfg.fileName.date; cfg.fileName.datasetDescription = fullfile ( ... - cfg.dir.output, ... - 'dataset_description.json'); + cfg.dir.output, ... + 'dataset_description.json'); % create base fileName fileNameBase = ... ['sub-', subjectGrp, sprintf(pattern, subjectNb), ... - '_ses-', sprintf(pattern, sessionNb), ... - '_task-', taskName]; + '_ses-', sprintf(pattern, sessionNb), ... + '_task-', taskName]; cfg.fileName.base = fileNameBase; switch modality @@ -173,16 +173,16 @@ case 'func' basename = [fileNameBase, ... - acqSuffix, ceSuffix, ... - dirSuffix, recSuffix, ... - runSuffix, echoSuffix]; + acqSuffix, ceSuffix, ... + dirSuffix, recSuffix, ... + runSuffix, echoSuffix]; case 'beh' basename = ... [fileNameBase, ... - acqSuffix, ... - runSuffix]; + acqSuffix, ... + runSuffix]; otherwise @@ -206,18 +206,18 @@ function talkToMe(cfg) if cfg.verbose > 0 fprintf(1, '\nData will be saved in this directory:\n\t%s\n', ... - fullfile(cfg.dir.outputSubject, cfg.fileName.modality)); + fullfile(cfg.dir.outputSubject, cfg.fileName.modality)); fprintf(1, '\nData will be saved in this file:\n\t%s\n', ... - cfg.fileName.events); + cfg.fileName.events); if cfg.eyeTracker.do fprintf(1, '\nEyetracking data will be saved in this directory:\n\t%s\n', ... - fullfile(cfg.dir.outputSubject, 'eyetracker')); + fullfile(cfg.dir.outputSubject, 'eyetracker')); fprintf(1, '\nEyetracking data will be saved in this file:\n\t%s\n', ... - cfg.fileName.eyetracker); + cfg.fileName.eyetracker); end diff --git a/src/createJson.m b/src/createJson.m index 0f57b39b..cff29ede 100644 --- a/src/createJson.m +++ b/src/createJson.m @@ -39,9 +39,9 @@ function createJson(varargin) fileName = strrep(fileName, '.tsv', '.json'); fileName = fullfile( ... - cfg.dir.outputSubject, ... - modality, ... - fileName); + cfg.dir.outputSubject, ... + modality, ... + fileName); %% add content of extraInfo to the JSON content @@ -115,11 +115,11 @@ function errorCreateJson(identifier, varargin) case 'wrongInputType' errorStruct.message = ['The second input must be a string (modality)' ... - 'or a structure (extraInfo)']; + 'or a structure (extraInfo)']; case 'wrongModalityInput' errorStruct.message = sprintf(['The given modality is not valid: %s.\n', ... - 'Only the following string are accepted: beh, func, eeg, ieeg, meg'], ... - varargin{1}); + 'Only the following string are accepted: beh, func, eeg, ieeg, meg'], ... + varargin{1}); end diff --git a/src/saveEventsFile.m b/src/saveEventsFile.m index e0b10873..42976359 100644 --- a/src/saveEventsFile.m +++ b/src/saveEventsFile.m @@ -154,11 +154,11 @@ % Initialize txt logfiles and empty fields for the standard BIDS % event file logFile(1).fileID = fopen( ... - fullfile( ... - cfg.dir.outputSubject, ... - cfg.fileName.modality, ... - logFile.filename), ... - 'w'); + fullfile( ... + cfg.dir.outputSubject, ... + cfg.fileName.modality, ... + logFile.filename), ... + 'w'); % print the basic BIDS columns fprintf(logFile(1).fileID, '%s\t%s\t%s', 'onset', 'duration', 'trial_type'); @@ -219,7 +219,7 @@ function printHeaderExtraColumns(logFile) if ~ischar(data) && any(isnan(data)) warning('saveEventsFile:missingData', ... - 'Missing some %s data for this event.', namesExtraColumns{iExtraColumn}); + 'Missing some %s data for this event.', namesExtraColumns{iExtraColumn}); if cfg.verbose > 1 disp(logFile(iEvent)); @@ -269,7 +269,7 @@ function printHeaderExtraColumns(logFile) data(end + 1:end + padding) = nan(1, padding); elseif ~isempty(expectedLength) && isnumeric(data) && max(size(data)) > expectedLength warning('saveEventsFile:arrayTooLong', ... - 'A field for this event is longer than expected. Truncating the extra values.'); + 'A field for this event is longer than expected. Truncating the extra values.'); data = data(1:expectedLength); end @@ -293,9 +293,9 @@ function printHeaderExtraColumns(logFile) any(isempty({onset duration})) warning('saveEventsFile:emptyEvent', ... - '\nSkipping saving this event.\n onset: %s \n duration: %s\n', ... - onset, ... - duration); + '\nSkipping saving this event.\n onset: %s \n duration: %s\n', ... + onset, ... + duration); else @@ -395,10 +395,10 @@ function talkToMe(cfg, logFile) if cfg.verbose > 0 fprintf(1, '\nData were saved in this file:\n\n%s\n\n', ... - fullfile( ... - cfg.dir.outputSubject, ... - cfg.fileName.modality, ... - logFile.filename)); + fullfile( ... + cfg.dir.outputSubject, ... + cfg.fileName.modality, ... + logFile.filename)); end diff --git a/src/subfun/askUserGui.m b/src/subfun/askUserGui.m index b563cfa4..a141c637 100644 --- a/src/subfun/askUserGui.m +++ b/src/subfun/askUserGui.m @@ -12,9 +12,9 @@ % keep asking the question till we get a positive integer value for each for iQuestion = 1:size(questions.questionsToAsk) questions.questionsToAsk{iQuestion} = sprintf('%s %s\n %s', ... - '\color{red}', ... - questions.questionsToAsk{iQuestion}, ... - questions.mustBePositiveInteger); + '\color{red}', ... + questions.questionsToAsk{iQuestion}, ... + questions.mustBePositiveInteger); end while 1 @@ -34,10 +34,10 @@ fieldDim = repmat([1 50], sum(isQuestionToAsk), 1); currentResp = inputdlg(quest.questionsToAsk(isQuestionToAsk, 1), ... - 'Subject info', ... - fieldDim, ... - resp(isQuestionToAsk), ... - opts); + 'Subject info', ... + fieldDim, ... + resp(isQuestionToAsk), ... + opts); resp(isQuestionToAsk) = currentResp; diff --git a/src/subfun/checkCppBidsDependencies.m b/src/subfun/checkCppBidsDependencies.m index 43d01ecc..c0d794ff 100644 --- a/src/subfun/checkCppBidsDependencies.m +++ b/src/subfun/checkCppBidsDependencies.m @@ -33,8 +33,8 @@ function checkSubmodule(pth) % and ask user to update submodules. if numel(dir(pth)) <= 2 % Means that the external is empty error(['Git submodules are not cloned!', ... - 'Try this in your terminal:', ... - ' git submodule update --recursive ']); + 'Try this in your terminal:', ... + ' git submodule update --recursive ']); else addpath(pth); end diff --git a/src/subfun/initializeExtraColumns.m b/src/subfun/initializeExtraColumns.m index 2797b937..ef1dad32 100644 --- a/src/subfun/initializeExtraColumns.m +++ b/src/subfun/initializeExtraColumns.m @@ -22,7 +22,7 @@ for iExtraColumn = 1:nbExtraColumns extraColumnName = logFile(1).extraColumns{iExtraColumn}; tmp.(extraColumnName) = struct( ... - 'length', 1); + 'length', 1); tmp.(extraColumnName) = setDefaultFields(tmp.(extraColumnName), fieldsToSet); end @@ -35,8 +35,8 @@ logFile(1).extraColumns.(namesExtraColumns{iExtraColumn}) = ... setDefaultFields( ... - logFile(1).extraColumns.(namesExtraColumns{iExtraColumn}), ... - fieldsToSet); + logFile(1).extraColumns.(namesExtraColumns{iExtraColumn}), ... + fieldsToSet); end diff --git a/src/subfun/isPositiveInteger.m b/src/subfun/isPositiveInteger.m index 6178b16b..e3598544 100644 --- a/src/subfun/isPositiveInteger.m +++ b/src/subfun/isPositiveInteger.m @@ -7,10 +7,10 @@ % trueOrFalse = ~any([ ... - ~isnumeric(input2check), ... - isnan(input2check), ... - fix(input2check) ~= input2check, ... - input2check < 0 ... - ]); + ~isnumeric(input2check), ... + isnan(input2check), ... + fix(input2check) ~= input2check, ... + input2check < 0 ... + ]); end diff --git a/src/subfun/printCreditsCppBids.m b/src/subfun/printCreditsCppBids.m index 172ab9b3..03947463 100644 --- a/src/subfun/printCreditsCppBids.m +++ b/src/subfun/printCreditsCppBids.m @@ -4,7 +4,7 @@ function printCreditsCppBids(cfg) try version = fileread(fullfile(fileparts(mfilename('fullpath')), ... - '..', '..', 'version.txt')); + '..', '..', 'version.txt')); catch version = 'v1.0.0'; end @@ -17,9 +17,9 @@ function printCreditsCppBids(cfg) if verbose > 1 contributors = { ... - 'Rémi Gau', ... - 'Marco Barilari', ... - 'Ceren Battal'}; + 'Rémi Gau', ... + 'Marco Barilari', ... + 'Ceren Battal'}; DOI_URL = 'https://doi.org/10.5281/zenodo.4007674'; diff --git a/src/subfun/removeAllDateSuffix.m b/src/subfun/removeAllDateSuffix.m index 7c64ab64..b9b5dcbb 100644 --- a/src/subfun/removeAllDateSuffix.m +++ b/src/subfun/removeAllDateSuffix.m @@ -14,23 +14,23 @@ function removeAllDateSuffix(rawDir, subjName, sesName) % do events filenames = file_utils('List', subjectPath, ... - sprintf('^%s.*_task-.*_events_date-.*$', subjName)); + sprintf('^%s.*_task-.*_events_date-.*$', subjName)); removeDateSuffix(filenames, subjectPath); for iLabel = 1:numel(labels) filenames = file_utils('List', subjectPath, ... - sprintf('^%s.*_task-.*_%s_date-.*$', subjName, labels{iLabel})); + sprintf('^%s.*_task-.*_%s_date-.*$', subjName, labels{iLabel})); removeDateSuffix(filenames, subjectPath); end % do stim filenames = file_utils('List', subjectPath, ... - sprintf('^%s.*_task-.*_stim_date-.*tsv$', subjName)); + sprintf('^%s.*_task-.*_stim_date-.*tsv$', subjName)); compressFiles(filenames, subjectPath); filenames = file_utils('List', subjectPath, ... - sprintf('^%s.*_task-.*_stim_date-.*tsv.gz$', subjName)); + sprintf('^%s.*_task-.*_stim_date-.*tsv.gz$', subjName)); removeDateSuffix(filenames, subjectPath); end diff --git a/src/subfun/removeDateSuffix.m b/src/subfun/removeDateSuffix.m index eb8ca73e..ab04cbb2 100644 --- a/src/subfun/removeDateSuffix.m +++ b/src/subfun/removeDateSuffix.m @@ -25,7 +25,7 @@ function removeDateSuffix(filenames, subjectPath) % remove suffix file if there was one if ~strcmp(filenames{i}, [parts{1} ext]) movefile(fullfile(subjectPath, filenames{i}), ... - fullfile(subjectPath, [parts{1} ext])); + fullfile(subjectPath, [parts{1} ext])); end end diff --git a/src/subfun/setDefaultFields.m b/src/subfun/setDefaultFields.m index 490b7cbd..6cfad781 100644 --- a/src/subfun/setDefaultFields.m +++ b/src/subfun/setDefaultFields.m @@ -22,9 +22,9 @@ else structure = setFieldToIfNotPresent( ... - structure, ... - names{i}, ... - thisField); + structure, ... + names{i}, ... + thisField); end end diff --git a/tests/test_createFilename.m b/tests/test_createFilename.m index 336eef0c..a1d0c622 100644 --- a/tests/test_createFilename.m +++ b/tests/test_createFilename.m @@ -18,10 +18,10 @@ function test_createFilenameBasic() behDir = fullfile(cfg.dir.output, 'source', 'sub-001', 'ses-001', 'beh'); eventFilename = ['sub-001_ses-001_task-testTask_run-001_events_date-'... - cfg.fileName.date '.tsv']; + cfg.fileName.date '.tsv']; stimFilename = ['sub-001_ses-001_task-testTask_run-001_stim_date-'... - cfg.fileName.date '.tsv']; + cfg.fileName.date '.tsv']; %% test @@ -56,11 +56,11 @@ function test_createFilenameMriEyetracker() baseFilename = 'sub-001_ses-001_task-testTask'; eventFilename = ['sub-001_ses-001_task-testTask_run-001_events_date-' ... - cfg.fileName.date '.tsv']; + cfg.fileName.date '.tsv']; eyetrackerFilename = [ ... - 'sub-001_ses-001_task-testTask_run-001_recording-eyetracking_physio_date-' ... - cfg.fileName.date '.edf']; + 'sub-001_ses-001_task-testTask_run-001_recording-eyetracking_physio_date-' ... + cfg.fileName.date '.edf']; %% tests % make sure the func dir is created @@ -100,14 +100,14 @@ function test_createFilenameMriSuffix() baseFilename = 'sub-001_ses-001_task-testTask'; eventFilename = ['sub-001_ses-001_task-testTask', ... - '_acq-newTYpe_ce-test_dir-yPos_rec-fastRecon', ... - '_run-001_echo-1_events_date-' ... - cfg.fileName.date '.tsv']; + '_acq-newTYpe_ce-test_dir-yPos_rec-fastRecon', ... + '_run-001_echo-1_events_date-' ... + cfg.fileName.date '.tsv']; stimFilename = ['sub-001_ses-001_task-testTask', ... - '_acq-newTYpe_ce-test_dir-yPos_rec-fastRecon', ... - '_run-001_echo-1_recording-respiPulse_stim_date-' ... - cfg.fileName.date '.tsv']; + '_acq-newTYpe_ce-test_dir-yPos_rec-fastRecon', ... + '_run-001_echo-1_recording-respiPulse_stim_date-' ... + cfg.fileName.date '.tsv']; %% tests % make sure the func dir is created @@ -144,14 +144,14 @@ function test_createFilenameBehSuffix() baseFilename = 'sub-001_ses-001_task-testTask'; eventFilename = ['sub-001_ses-001_task-testTask', ... - '_acq-newTYpe', ... - '_run-001_events_date-' ... - cfg.fileName.date '.tsv']; + '_acq-newTYpe', ... + '_run-001_events_date-' ... + cfg.fileName.date '.tsv']; stimFilename = ['sub-001_ses-001_task-testTask', ... - '_acq-newTYpe', ... - '_run-001_recording-respiPulse_stim_date-' ... - cfg.fileName.date '.tsv']; + '_acq-newTYpe', ... + '_run-001_recording-respiPulse_stim_date-' ... + cfg.fileName.date '.tsv']; %% tests % make sure the func dir is created @@ -188,12 +188,12 @@ function test_createFilenameEegSuffix() baseFilename = 'sub-001_ses-001_task-testTask'; eventFilename = ['sub-001_ses-001_task-testTask', ... - '_run-001_events_date-' ... - cfg.fileName.date '.tsv']; + '_run-001_events_date-' ... + cfg.fileName.date '.tsv']; stimFilename = ['sub-001_ses-001_task-testTask', ... - '_run-001_recording-respiPulse_stim_date-' ... - cfg.fileName.date '.tsv']; + '_run-001_recording-respiPulse_stim_date-' ... + cfg.fileName.date '.tsv']; %% tests % make sure the func dir is created @@ -220,7 +220,7 @@ function test_createFilenameEeg() eegDir = fullfile(cfg.dir.output, 'source', 'sub-001', 'ses-001', 'eeg'); eventFilename = ['sub-001_ses-001_task-testTask_run-001_events_date-'... - cfg.fileName.date '.tsv']; + cfg.fileName.date '.tsv']; %% test % make sure the func dir is created @@ -249,7 +249,7 @@ function test_createFilenameIeeg() assertTrue(exist(ieegDir, 'dir') == 7); eventFilename = ['sub-001_ses-001_task-testTask_run-001_events_date-'... - cfg.fileName.date '.tsv']; + cfg.fileName.date '.tsv']; end @@ -271,7 +271,7 @@ function test_createFilenameMeg() assertTrue(exist(megDir, 'dir') == 7); eventFilename = ['sub-001_ses-001_task-testTask_run-001_events_date-'... - cfg.fileName.date '.tsv']; + cfg.fileName.date '.tsv']; end diff --git a/tests/test_createJson.m b/tests/test_createJson.m index aace3715..e4f67b2b 100644 --- a/tests/test_createJson.m +++ b/tests/test_createJson.m @@ -23,7 +23,7 @@ function test_createJsonFunc() funcDir = fullfile(cfg.dir.output, 'source', 'sub-001', 'ses-001', 'func'); eventFilename = ['sub-001_ses-001_task-testtask_run-001_bold_date-' ... - cfg.fileName.date '.json']; + cfg.fileName.date '.json']; %% test assertTrue(exist(fullfile(funcDir, eventFilename), 'file') == 2); @@ -47,7 +47,7 @@ function test_createJsonBeh() funcDir = fullfile(cfg.dir.output, 'source', 'sub-001', 'ses-001', 'beh'); eventFilename = ['sub-001_ses-001_task-testtask_run-001_beh_date-' ... - cfg.fileName.date '.json']; + cfg.fileName.date '.json']; %% test assertTrue(exist(fullfile(funcDir, eventFilename), 'file') == 2); @@ -71,7 +71,7 @@ function test_createJsonEeg() funcDir = fullfile(cfg.dir.output, 'source', 'sub-001', 'ses-001', 'eeg'); eventFilename = ['sub-001_ses-001_task-testtask_run-001_eeg_date-' ... - cfg.fileName.date '.json']; + cfg.fileName.date '.json']; %% test assertTrue(exist(fullfile(funcDir, eventFilename), 'file') == 2); @@ -95,7 +95,7 @@ function test_createJsonMeg() funcDir = fullfile(cfg.dir.output, 'source', 'sub-001', 'ses-001', 'meg'); eventFilename = ['sub-001_ses-001_task-testtask_run-001_meg_date-' ... - cfg.fileName.date '.json']; + cfg.fileName.date '.json']; %% test assertTrue(exist(fullfile(funcDir, eventFilename), 'file') == 2); @@ -119,7 +119,7 @@ function test_createJsonIeeg() funcDir = fullfile(cfg.dir.output, 'source', 'sub-001', 'ses-001', 'ieeg'); eventFilename = ['sub-001_ses-001_task-testtask_run-001_ieeg_date-' ... - cfg.fileName.date '.json']; + cfg.fileName.date '.json']; %% test assertTrue(exist(fullfile(funcDir, eventFilename), 'file') == 2); diff --git a/tests/test_createQuestionList.m b/tests/test_createQuestionList.m index 999110ee..88a9e08c 100644 --- a/tests/test_createQuestionList.m +++ b/tests/test_createQuestionList.m @@ -14,10 +14,10 @@ function test_createQuestionListBasic() questions = createQuestionList(cfg); expectedCell = { ... - 'Enter subject group (leave empty if none): ', false; - 'Enter subject number (1-999): ', true; - 'Enter the session number (i.e day ; 1-999): ', true; - 'Enter the run number (1-999): ', true}; + 'Enter subject group (leave empty if none): ', false + 'Enter subject number (1-999): ', true + 'Enter the session number (i.e day ; 1-999): ', true + 'Enter the run number (1-999): ', true}; assertEqual(expectedCell(3, 1), questions.questionsToAsk(3, 1)); diff --git a/tests/test_getIsQuestionToAsk.m b/tests/test_getIsQuestionToAsk.m index 632668c6..a53b0892 100644 --- a/tests/test_getIsQuestionToAsk.m +++ b/tests/test_getIsQuestionToAsk.m @@ -9,18 +9,18 @@ function test_isPositiveIntegerBasic() questions.questionsToAsk = { ... - [], 1; ... - [], 0; ... - [], 1; ... - [], 0; ... - }; + [], 1; ... + [], 0; ... + [], 1; ... + [], 0 ... + }; responses = { ... - '1'; - '1'; - '-1'; - '-1'; - }; + '1' + '1' + '-1' + '-1' + }; isQuestionToAsk = getIsQuestionToAsk(questions, responses); diff --git a/tests/test_removeDateSuffix.m b/tests/test_removeDateSuffix.m index 67aa2a43..e1d85d6b 100644 --- a/tests/test_removeDateSuffix.m +++ b/tests/test_removeDateSuffix.m @@ -23,14 +23,14 @@ function test_removeDateSuffixBasic() stimNameZipped = 'test2_stim_date-202008050730.tsv.gz'; filesToProcess = { ... - boldName; - boldName2; - boldName3; - jsonName; - eventsName; - stimName; - stimNameZipped; - }; + boldName + boldName2 + boldName3 + jsonName + eventsName + stimName + stimNameZipped + }; % create new files for new tests for iFile = 1:numel(filesToProcess) diff --git a/tests/test_saveEventsFileOpen.m b/tests/test_saveEventsFileOpen.m index d04b2874..d09d9aaa 100644 --- a/tests/test_saveEventsFileOpen.m +++ b/tests/test_saveEventsFileOpen.m @@ -34,10 +34,11 @@ function test_saveEventsFileOpenBasic() %% data to test against funcDir = fullfile(outputDir, 'source', 'sub-001', 'ses-001', 'func'); eventFilename = ['sub-001_ses-001_task-testtask_run-001_events_date-' ... - cfg.fileName.date '.tsv']; + cfg.fileName.date '.tsv']; % check that the file has the right path and name assert(exist(fullfile(funcDir, eventFilename), 'file') == 2); + assert(exist(fullfile(funcDir, strrep(eventFilename, '.tsv', '.json')), 'file') == 2); FID = fopen(fullfile(funcDir, eventFilename), 'r'); C = textscan(FID, repmat('%s', 1, 3), 'Delimiter', '\t', 'EndOfLine', '\n'); @@ -78,10 +79,11 @@ function test_saveEventsFileOpenStimfile() %% data to test against funcDir = fullfile(outputDir, 'source', 'sub-001', 'ses-001', 'func'); eventFilename = ['sub-001_ses-001_task-testtask_run-001_stim_date-' ... - cfg.fileName.date '.tsv']; + cfg.fileName.date '.tsv']; % check that the file has the right path and name assert(exist(fullfile(funcDir, eventFilename), 'file') == 2); + assert(exist(fullfile(funcDir, strrep(eventFilename, '.tsv', '.json')), 'file') == 2); FID = fopen(fullfile(funcDir, eventFilename), 'r'); C = textscan(FID, repmat('%s', 1, 3), 'Delimiter', '\t', 'EndOfLine', '\n'); diff --git a/tests/test_saveEventsFileSave.m b/tests/test_saveEventsFileSave.m index 251df236..1a800178 100644 --- a/tests/test_saveEventsFileSave.m +++ b/tests/test_saveEventsFileSave.m @@ -187,10 +187,10 @@ function test_saveEventsFileSaveErrors() logFile = struct(); assertExceptionThrown(@()saveEventsFile('error', cfg, logFile), ... - 'saveEventsFile:unknownActionType'); + 'saveEventsFile:unknownActionType'); assertExceptionThrown(@()saveEventsFile('save', cfg, logFile), ... - 'saveEventsFile:missingFileID'); + 'saveEventsFile:missingFileID'); [cfg, logFile] = setUp(); @@ -203,7 +203,7 @@ function test_saveEventsFileSaveErrors() logFile(end, end).LHL24 = rand(1, 10); assertExceptionThrown(@()saveEventsFile('save', cfg, logFile), ... - 'saveEventsFile:wrongLogSize'); + 'saveEventsFile:wrongLogSize'); end