Skip to content

Commit b59f939

Browse files
committed
Make running reports optional
1 parent 8867921 commit b59f939

4 files changed

Lines changed: 25 additions & 3 deletions

File tree

autonima/cli.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,13 +356,15 @@ def validate(config: str, output_folder: str | None, debug: bool):
356356
type=click.Path(exists=True, dir_okay=False),
357357
default=None,
358358
help='Path to text file with study IDs/PMIDs to include (one per line)')
359+
@click.option('--run-reports', is_flag=True,
360+
help='Generate NiMARE HTML reports (disabled by default to reduce memory use)')
359361
@click.option('--fail-fast', is_flag=True,
360362
help='Stop at the first failing annotation column')
361363
@click.option('--debug', is_flag=True,
362364
help='Enable debug mode; fail fast and enter post-mortem debugging on errors')
363365
def meta(output_folder: str, estimator: str, estimator_args: str,
364366
corrector: str, corrector_args: str, include_ids: str,
365-
fail_fast: bool, debug: bool):
367+
run_reports: bool, fail_fast: bool, debug: bool):
366368
"""
367369
Run meta-analyses on Autonima output using NiMARE.
368370
@@ -378,6 +380,7 @@ def meta(output_folder: str, estimator: str, estimator_args: str,
378380
--corrector Corrector to use (fdr, montecarlo, bonferroni)
379381
--corrector-args JSON string of arguments for the corrector
380382
--include-ids Path to newline-delimited study IDs/PMIDs for post-hoc filtering
383+
--run-reports Generate NiMARE HTML reports (default: off)
381384
--fail-fast Stop on the first failing annotation column
382385
--debug Enable fail-fast post-mortem debugging (ipdb/pdb)
383386
@@ -424,6 +427,7 @@ def meta(output_folder: str, estimator: str, estimator_args: str,
424427
include_ids=include_ids,
425428
fail_fast=(fail_fast or debug),
426429
debug=debug,
430+
generate_reports=run_reports,
427431
)
428432

429433
print(f"Completed meta-analyses for {len(results)} columns")

autonima/meta.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ def run_meta_analysis_for_column(
197197
corrector_name="fdr",
198198
corrector_args=None,
199199
include_ids=None,
200+
generate_reports=False,
200201
):
201202
"""Run meta-analysis for a specific annotation column."""
202203
del annotation # kept for backward compatibility with existing call sites
@@ -276,7 +277,8 @@ def run_meta_analysis_for_column(
276277
)
277278

278279
meta_results = workflow.fit(first_dataset)
279-
run_reports(meta_results, str(output_dir))
280+
if generate_reports:
281+
run_reports(meta_results, str(output_dir))
280282

281283
return meta_results
282284

@@ -294,6 +296,7 @@ def run_meta_analyses_from_files(
294296
columns=None,
295297
fail_fast=False,
296298
debug=False,
299+
generate_reports=False,
297300
):
298301
"""
299302
Run meta-analyses from explicit studyset + annotation file paths.
@@ -315,6 +318,8 @@ def run_meta_analyses_from_files(
315318
If True, re-raise on the first column-level exception instead of continuing.
316319
debug : bool
317320
If True and fail_fast is enabled, enter post-mortem debugging on error.
321+
generate_reports : bool
322+
If True, run NiMARE HTML report generation for each completed column.
318323
"""
319324
include_ids_set = _normalize_include_ids(include_ids)
320325

@@ -356,6 +361,7 @@ def run_meta_analyses_from_files(
356361
corrector_name,
357362
corrector_args,
358363
include_ids=include_ids_set,
364+
generate_reports=generate_reports,
359365
)
360366
if meta_results is not None:
361367
results[column] = meta_results
@@ -383,6 +389,7 @@ def run_meta_analyses(
383389
columns=None,
384390
fail_fast=False,
385391
debug=False,
392+
generate_reports=False,
386393
):
387394
"""Run meta-analyses on all boolean annotation columns in the NiMADS files."""
388395
output_folder = Path(output_folder) / "outputs"
@@ -404,6 +411,7 @@ def run_meta_analyses(
404411
columns=columns,
405412
fail_fast=fail_fast,
406413
debug=debug,
414+
generate_reports=generate_reports,
407415
)
408416

409417

@@ -459,6 +467,11 @@ def main():
459467
action="store_true",
460468
help="Enable post-mortem debugging (prefers ipdb) when used with --fail-fast",
461469
)
470+
parser.add_argument(
471+
"--run-reports",
472+
action="store_true",
473+
help="Generate NiMARE HTML reports (disabled by default to reduce memory use)",
474+
)
462475

463476
args = parser.parse_args()
464477

@@ -482,6 +495,7 @@ def main():
482495
include_ids=args.include_ids,
483496
fail_fast=args.fail_fast,
484497
debug=args.debug,
498+
generate_reports=args.run_reports,
485499
)
486500
print(f"Completed meta-analyses for {len(results)} columns")
487501

docs/guides/cli.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ autonima meta projects/cue_reactivity/default/outputs
8080
```
8181

8282
Optional parameters let you change the estimator, corrector, and include-ID filtering.
83+
Report generation is now opt-in via `--run-reports`.
8384
For large jobs, use `--fail-fast` (or `--debug`, which implies fail-fast) to stop on the
8485
first failing column instead of continuing.
8586

docs/guides/meta-analysis.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ autonima meta projects/cue_reactivity/default/outputs
3939
JSON string of corrector arguments
4040
- `--include-ids`
4141
Newline-delimited study IDs or PMIDs to include
42+
- `--run-reports`
43+
Generate NiMARE HTML reports (default: disabled to reduce memory use)
4244
- `--fail-fast`
4345
Stop on the first failing annotation column
4446
- `--debug`
@@ -63,7 +65,8 @@ Meta-analysis results are written under:
6365
This directory contains:
6466

6567
- one folder per boolean annotation column
66-
- NiMARE reports and statistical images
68+
- statistical images and result artifacts
69+
- NiMARE reports only when `--run-reports` is enabled
6770
- summary artifacts for each analysis set
6871

6972
## Common Failure Modes

0 commit comments

Comments
 (0)