diff --git a/+bids/layout.m b/+bids/layout.m index f10b3717..66ab55e1 100644 --- a/+bids/layout.m +++ b/+bids/layout.m @@ -92,12 +92,13 @@ %% BIDS structure % ========================================================================== - % BIDS.dir -- BIDS directory - % BIDS.description -- content of dataset_description.json - % BIDS.sessions -- cellstr of sessions - % BIDS.participants -- for participants.tsv - % BIDS.subjects -- structure array of subjects - % BIDS.root -- tsv and json files in the root folder + % BIDS.dir -- BIDS directory + % BIDS.is_datalad_ds -- BIDS directory + % BIDS.description -- content of dataset_description.json + % BIDS.sessions -- cellstr of sessions + % BIDS.participants -- for participants.tsv + % BIDS.subjects -- structure array of subjects + % BIDS.root -- tsv and json files in the root folder BIDS = struct('pth', root, ... 'description', struct([]), ... @@ -130,6 +131,11 @@ return end + BIDS.is_datalad_ds = false; + if isdir(fullfile(BIDS.pth, '.datalad')) && isdir(fullfile(BIDS.pth, '.git')) + BIDS.is_datalad_ds = true; + end + schema = bids.Schema(use_schema); schema.verbose = verbose; @@ -666,9 +672,13 @@ for iIntended = 1:numel(intended) dest = fullfile(BIDS.pth, BIDS.subjects(info_src.sub_idx).name, ... intended{iIntended}); + % only throw warning for non-datalad dataset + % to avoid excessive warning as sym link are not files if ~exist(dest, 'file') - msg = ['IntendedFor file ' dest ' from ' file.filename ' not found']; - bids.internal.error_handling(mfilename, 'IntendedForMissing', msg, tolerant, verbose); + if ~BIDS.is_datalad_ds + msg = ['IntendedFor file ' dest ' from ' file.filename ' not found']; + bids.internal.error_handling(mfilename, 'IntendedForMissing', msg, tolerant, verbose); + end continue end info_dest = bids.internal.return_file_info(BIDS, dest); diff --git a/demos/spm/facerep/code/spm_facerep.m b/demos/spm/facerep/code/spm_facerep.m index 5821cee6..107e51a5 100644 --- a/demos/spm/facerep/code/spm_facerep.m +++ b/demos/spm/facerep/code/spm_facerep.m @@ -28,20 +28,15 @@ 'demo', 'facerep', ... 'force', true, ... 'verbose', verbose, ... - 'out_path', fullfile(pwd, '..')); + 'out_path', fullfile(pwd, '..', 'sourcedata')); %% Move file into source folder source_path = fullfile(pwd, '..', 'sourcedata'); -bids.util.mkdir(source_path); - -movefile(fullfile(pwd, '..', 'face_rep', '*'), source_path); -rmdir(fullfile(pwd, '..', 'face_rep')); - +raw_path = fullfile(pwd, '..', 'raw'); derivatives_pth = fullfile(pth, 'derivatives'); %% CONVERT TO BIDS - -pth = convert_facerep_ds(); +pth = convert_facerep_ds(source_path, raw_path); %% COPY TO DERIVATIVES BIDS = bids.layout(pth, ...