From 2bf612996b51b92bf3251bbb245e6fc97e94096f Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Mon, 1 Nov 2021 11:22:58 -0400 Subject: [PATCH 1/3] Ensure report directory exists before writing --- fitlins/viz/reports.py | 1 + 1 file changed, 1 insertion(+) diff --git a/fitlins/viz/reports.py b/fitlins/viz/reports.py index c28b1acf..be345c47 100644 --- a/fitlins/viz/reports.py +++ b/fitlins/viz/reports.py @@ -130,4 +130,5 @@ def write_full_report(report_dict, run_context, deriv_dir): deriv_dir, fl_layout.build_path( {'model': model}, PATH_PATTERNS, validate=False)) html = tpl.render(deroot({**report_dict, **run_context}, op.dirname(target_file))) + Path(target_file).parent.mkdir(parents=True, exist_ok=True) Path(target_file).write_text(html) From fbe70ec35946fa86de74b5d4553e0d0501ff3e24 Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Mon, 1 Nov 2021 11:51:16 -0400 Subject: [PATCH 2/3] Use absolute paths for database files --- fitlins/cli/run.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fitlins/cli/run.py b/fitlins/cli/run.py index a403c37f..ba571c4b 100755 --- a/fitlins/cli/run.py +++ b/fitlins/cli/run.py @@ -100,7 +100,7 @@ def get_parser(): help='regex pattern or string to ignore files') g_bids.add_argument('--desc-label', action='store', default='preproc', help="use BOLD files with the provided description label") - g_bids.add_argument('--database-path', action='store', default=None, + g_bids.add_argument('--database-path', action='store', default=None, type=op.abspath, help="Path to directory containing SQLite database indices " "for this BIDS dataset. " "If a value is passed and the file already exists, " From 13e50710053ef6f1c77662fe64173f09f130848b Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Mon, 8 Nov 2021 09:13:56 -0500 Subject: [PATCH 3/3] FIX: Sort subjects --- fitlins/utils/bids.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/fitlins/utils/bids.py b/fitlins/utils/bids.py index 5f5932c1..a546fcf2 100644 --- a/fitlins/utils/bids.py +++ b/fitlins/utils/bids.py @@ -71,7 +71,7 @@ def collect_participants(layout, participant_label=None, strict=False): """ - all_participants = layout.get_subjects() + all_participants = sorted(layout.get_subjects()) # Error: bids_dir does not contain subjects if not all_participants: @@ -87,9 +87,10 @@ def collect_participants(layout, participant_label=None, strict=False): return all_participants # Drop sub- prefixes - participant_label = [sub[4:] if sub.startswith('sub-') else sub for sub in participant_label] + participant_label = [sub[4:] if sub.startswith('sub-') else sub + for sub in participant_label] - found_label = layout.get_subjects(subject=participant_label) + found_label = sorted(layout.get_subjects(subject=participant_label)) if not found_label: raise BIDSError('Could not find participants [{}]'.format(