Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ENH] allow to skip the "manage dependencies" step of the layout #394

Merged
merged 1 commit into from
Jun 16, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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