Skip to content

Commit

Permalink
Merge pull request #394 from Remi-Gau/dependencies
Browse files Browse the repository at this point in the history
[ENH] allow to skip the "manage dependencies" step of the layout
  • Loading branch information
Remi-Gau authored Jun 16, 2022
2 parents 2c88063 + 7b27412 commit f603c81
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions +bids/layout.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
% BIDS = bids.layout(pwd, ...
% 'use_schema', true, ...
% 'index_derivatives', false, ...
% 'index_dependencies', true, ...
% 'tolerant', true, ...
% 'verbose', false)
%
Expand All @@ -26,6 +27,10 @@
% any ``derivatives`` folder in the BIDS dataset.
% :type index_derivatives: boolean
%
% :param index_dependencies: if ``true`` this will index the dependencies (json files,
% assiciated TSV files for each file...)
% :type index_dependencies: boolean
%
% :param tolerant: Set to ``true`` to turn validation errors into warnings
% :type tolerant: boolean
%
Expand All @@ -42,6 +47,7 @@

default_root = pwd;
default_index_derivatives = false;
default_index_dependencies = true;
default_tolerant = true;
default_use_schema = true;
default_verbose = false;
Expand All @@ -52,6 +58,7 @@

addOptional(args, 'root', default_root, is_dir_or_struct);
addParameter(args, 'index_derivatives', default_index_derivatives);
addParameter(args, 'index_dependencies', default_index_dependencies);
addParameter(args, 'tolerant', default_tolerant);
addParameter(args, 'use_schema', default_use_schema);
addParameter(args, 'verbose', default_verbose);
Expand All @@ -60,6 +67,7 @@

root = args.Results.root;
index_derivatives = args.Results.index_derivatives;
index_dependencies = args.Results.index_dependencies;
tolerant = args.Results.tolerant;
use_schema = args.Results.use_schema;
verbose = args.Results.verbose;
Expand Down Expand Up @@ -145,7 +153,7 @@

end

BIDS = manage_dependencies(BIDS, verbose);
BIDS = manage_dependencies(BIDS, index_dependencies, verbose);

BIDS = index_derivatives_dir(BIDS, index_derivatives, verbose);

Expand Down Expand Up @@ -549,11 +557,15 @@

end

function BIDS = manage_dependencies(BIDS, verbose)
function BIDS = manage_dependencies(BIDS, index_dependencies, verbose)
%
% Loops over all files and retrieve all files that current file depends on
%

if ~index_dependencies
return
end

tolerant = true;

file_list = bids.query(BIDS, 'data');
Expand Down

0 comments on commit f603c81

Please sign in to comment.