junifer 0.0.5__py3-none-any.whl → 0.0.5.dev11__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- junifer/__init__.py +0 -17
- junifer/_version.py +2 -2
- junifer/api/__init__.py +1 -4
- junifer/api/cli.py +1 -91
- junifer/api/decorators.py +0 -9
- junifer/api/functions.py +10 -56
- junifer/api/parser.py +0 -3
- junifer/api/queue_context/__init__.py +1 -4
- junifer/api/res/afni/run_afni_docker.sh +1 -1
- junifer/api/res/ants/run_ants_docker.sh +1 -1
- junifer/api/res/fsl/run_fsl_docker.sh +1 -1
- junifer/api/tests/test_api_utils.py +2 -4
- junifer/api/tests/test_cli.py +0 -83
- junifer/api/tests/test_functions.py +2 -27
- junifer/configs/__init__.py +1 -1
- junifer/configs/juseless/__init__.py +1 -4
- junifer/configs/juseless/datagrabbers/__init__.py +1 -10
- junifer/configs/juseless/datagrabbers/aomic_id1000_vbm.py +0 -3
- junifer/configs/juseless/datagrabbers/camcan_vbm.py +0 -3
- junifer/configs/juseless/datagrabbers/ixi_vbm.py +0 -3
- junifer/configs/juseless/datagrabbers/tests/test_ucla.py +3 -1
- junifer/configs/juseless/datagrabbers/ucla.py +9 -12
- junifer/configs/juseless/datagrabbers/ukb_vbm.py +0 -3
- junifer/data/__init__.py +1 -21
- junifer/data/coordinates.py +19 -10
- junifer/data/masks.py +87 -58
- junifer/data/parcellations.py +3 -14
- junifer/data/template_spaces.py +1 -4
- junifer/data/tests/test_masks.py +37 -26
- junifer/data/utils.py +0 -3
- junifer/datagrabber/__init__.py +1 -18
- junifer/datagrabber/aomic/__init__.py +0 -3
- junifer/datagrabber/aomic/id1000.py +37 -70
- junifer/datagrabber/aomic/piop1.py +36 -69
- junifer/datagrabber/aomic/piop2.py +38 -71
- junifer/datagrabber/aomic/tests/test_id1000.py +99 -44
- junifer/datagrabber/aomic/tests/test_piop1.py +108 -65
- junifer/datagrabber/aomic/tests/test_piop2.py +102 -45
- junifer/datagrabber/base.py +6 -13
- junifer/datagrabber/datalad_base.py +1 -13
- junifer/datagrabber/dmcc13_benchmark.py +53 -36
- junifer/datagrabber/hcp1200/__init__.py +0 -3
- junifer/datagrabber/hcp1200/datalad_hcp1200.py +0 -3
- junifer/datagrabber/hcp1200/hcp1200.py +1 -4
- junifer/datagrabber/multiple.py +6 -45
- junifer/datagrabber/pattern.py +62 -170
- junifer/datagrabber/pattern_datalad.py +12 -25
- junifer/datagrabber/tests/test_datagrabber_utils.py +218 -0
- junifer/datagrabber/tests/test_datalad_base.py +4 -4
- junifer/datagrabber/tests/test_dmcc13_benchmark.py +19 -46
- junifer/datagrabber/tests/test_multiple.py +84 -161
- junifer/datagrabber/tests/test_pattern.py +0 -45
- junifer/datagrabber/tests/test_pattern_datalad.py +4 -4
- junifer/datagrabber/utils.py +230 -0
- junifer/datareader/__init__.py +1 -4
- junifer/datareader/default.py +43 -95
- junifer/external/__init__.py +1 -1
- junifer/external/nilearn/__init__.py +1 -5
- junifer/external/nilearn/junifer_nifti_spheres_masker.py +9 -23
- junifer/external/nilearn/tests/test_junifer_nifti_spheres_masker.py +1 -76
- junifer/markers/__init__.py +1 -23
- junifer/markers/base.py +28 -68
- junifer/markers/collection.py +2 -10
- junifer/markers/complexity/__init__.py +0 -10
- junifer/markers/complexity/complexity_base.py +43 -26
- junifer/markers/complexity/hurst_exponent.py +0 -3
- junifer/markers/complexity/multiscale_entropy_auc.py +0 -3
- junifer/markers/complexity/perm_entropy.py +0 -3
- junifer/markers/complexity/range_entropy.py +0 -3
- junifer/markers/complexity/range_entropy_auc.py +0 -3
- junifer/markers/complexity/sample_entropy.py +0 -3
- junifer/markers/complexity/tests/test_hurst_exponent.py +3 -11
- junifer/markers/complexity/tests/test_multiscale_entropy_auc.py +3 -11
- junifer/markers/complexity/tests/test_perm_entropy.py +3 -11
- junifer/markers/complexity/tests/test_range_entropy.py +3 -11
- junifer/markers/complexity/tests/test_range_entropy_auc.py +3 -11
- junifer/markers/complexity/tests/test_sample_entropy.py +3 -11
- junifer/markers/complexity/tests/test_weighted_perm_entropy.py +3 -11
- junifer/markers/complexity/weighted_perm_entropy.py +0 -3
- junifer/markers/ets_rss.py +42 -27
- junifer/markers/falff/__init__.py +0 -3
- junifer/markers/falff/_afni_falff.py +2 -5
- junifer/markers/falff/_junifer_falff.py +0 -3
- junifer/markers/falff/falff_base.py +46 -20
- junifer/markers/falff/falff_parcels.py +27 -56
- junifer/markers/falff/falff_spheres.py +29 -60
- junifer/markers/falff/tests/test_falff_parcels.py +23 -39
- junifer/markers/falff/tests/test_falff_spheres.py +23 -39
- junifer/markers/functional_connectivity/__init__.py +0 -9
- junifer/markers/functional_connectivity/crossparcellation_functional_connectivity.py +60 -63
- junifer/markers/functional_connectivity/edge_functional_connectivity_parcels.py +32 -45
- junifer/markers/functional_connectivity/edge_functional_connectivity_spheres.py +36 -49
- junifer/markers/functional_connectivity/functional_connectivity_base.py +70 -71
- junifer/markers/functional_connectivity/functional_connectivity_parcels.py +25 -34
- junifer/markers/functional_connectivity/functional_connectivity_spheres.py +30 -40
- junifer/markers/functional_connectivity/tests/test_crossparcellation_functional_connectivity.py +7 -11
- junifer/markers/functional_connectivity/tests/test_edge_functional_connectivity_parcels.py +7 -27
- junifer/markers/functional_connectivity/tests/test_edge_functional_connectivity_spheres.py +12 -28
- junifer/markers/functional_connectivity/tests/test_functional_connectivity_parcels.py +11 -35
- junifer/markers/functional_connectivity/tests/test_functional_connectivity_spheres.py +62 -36
- junifer/markers/parcel_aggregation.py +61 -47
- junifer/markers/reho/__init__.py +0 -3
- junifer/markers/reho/_afni_reho.py +2 -5
- junifer/markers/reho/_junifer_reho.py +1 -4
- junifer/markers/reho/reho_base.py +27 -8
- junifer/markers/reho/reho_parcels.py +17 -28
- junifer/markers/reho/reho_spheres.py +18 -27
- junifer/markers/reho/tests/test_reho_parcels.py +3 -8
- junifer/markers/reho/tests/test_reho_spheres.py +3 -8
- junifer/markers/sphere_aggregation.py +59 -43
- junifer/markers/temporal_snr/__init__.py +0 -3
- junifer/markers/temporal_snr/temporal_snr_base.py +32 -23
- junifer/markers/temporal_snr/temporal_snr_parcels.py +6 -9
- junifer/markers/temporal_snr/temporal_snr_spheres.py +6 -9
- junifer/markers/temporal_snr/tests/test_temporal_snr_parcels.py +3 -6
- junifer/markers/temporal_snr/tests/test_temporal_snr_spheres.py +3 -6
- junifer/markers/tests/test_collection.py +8 -9
- junifer/markers/tests/test_ets_rss.py +9 -15
- junifer/markers/tests/test_markers_base.py +18 -17
- junifer/markers/tests/test_parcel_aggregation.py +32 -93
- junifer/markers/tests/test_sphere_aggregation.py +19 -72
- junifer/onthefly/__init__.py +1 -4
- junifer/onthefly/read_transform.py +0 -3
- junifer/pipeline/__init__.py +1 -9
- junifer/pipeline/pipeline_step_mixin.py +4 -21
- junifer/pipeline/registry.py +0 -3
- junifer/pipeline/singleton.py +0 -3
- junifer/pipeline/tests/test_registry.py +1 -1
- junifer/pipeline/update_meta_mixin.py +0 -3
- junifer/pipeline/utils.py +1 -67
- junifer/pipeline/workdir_manager.py +0 -3
- junifer/preprocess/__init__.py +2 -10
- junifer/preprocess/ants/__init__.py +4 -0
- junifer/preprocess/ants/ants_apply_transforms_warper.py +185 -0
- junifer/preprocess/ants/tests/test_ants_apply_transforms_warper.py +56 -0
- junifer/preprocess/base.py +3 -6
- junifer/preprocess/bold_warper.py +265 -0
- junifer/preprocess/confounds/__init__.py +0 -3
- junifer/preprocess/confounds/fmriprep_confound_remover.py +60 -47
- junifer/preprocess/confounds/tests/test_fmriprep_confound_remover.py +113 -72
- junifer/preprocess/fsl/__init__.py +4 -0
- junifer/preprocess/fsl/apply_warper.py +179 -0
- junifer/preprocess/fsl/tests/test_apply_warper.py +45 -0
- junifer/preprocess/tests/test_bold_warper.py +159 -0
- junifer/preprocess/warping/__init__.py +0 -3
- junifer/preprocess/warping/_ants_warper.py +0 -3
- junifer/preprocess/warping/_fsl_warper.py +0 -3
- junifer/stats.py +1 -4
- junifer/storage/__init__.py +1 -9
- junifer/storage/base.py +1 -40
- junifer/storage/hdf5.py +9 -71
- junifer/storage/pandas_base.py +0 -3
- junifer/storage/sqlite.py +0 -3
- junifer/storage/tests/test_hdf5.py +10 -82
- junifer/storage/utils.py +0 -9
- junifer/testing/__init__.py +1 -4
- junifer/testing/datagrabbers.py +6 -13
- junifer/testing/tests/test_partlycloudytesting_datagrabber.py +7 -7
- junifer/testing/utils.py +0 -3
- junifer/utils/__init__.py +2 -13
- junifer/utils/fs.py +0 -3
- junifer/utils/helpers.py +1 -32
- junifer/utils/logging.py +4 -33
- junifer/utils/tests/test_logging.py +0 -8
- {junifer-0.0.5.dist-info → junifer-0.0.5.dev11.dist-info}/METADATA +16 -17
- junifer-0.0.5.dev11.dist-info/RECORD +259 -0
- {junifer-0.0.5.dist-info → junifer-0.0.5.dev11.dist-info}/WHEEL +1 -1
- junifer/api/res/freesurfer/mri_binarize +0 -3
- junifer/api/res/freesurfer/mri_mc +0 -3
- junifer/api/res/freesurfer/mri_pretess +0 -3
- junifer/api/res/freesurfer/mris_convert +0 -3
- junifer/api/res/freesurfer/run_freesurfer_docker.sh +0 -61
- junifer/data/masks/ukb/UKB_15K_GM_template.nii.gz +0 -0
- junifer/datagrabber/pattern_validation_mixin.py +0 -388
- junifer/datagrabber/tests/test_pattern_validation_mixin.py +0 -249
- junifer/external/BrainPrint/brainprint/__init__.py +0 -4
- junifer/external/BrainPrint/brainprint/_version.py +0 -3
- junifer/external/BrainPrint/brainprint/asymmetry.py +0 -91
- junifer/external/BrainPrint/brainprint/brainprint.py +0 -441
- junifer/external/BrainPrint/brainprint/surfaces.py +0 -258
- junifer/external/BrainPrint/brainprint/utils/__init__.py +0 -1
- junifer/external/BrainPrint/brainprint/utils/_config.py +0 -112
- junifer/external/BrainPrint/brainprint/utils/utils.py +0 -188
- junifer/external/nilearn/junifer_connectivity_measure.py +0 -483
- junifer/external/nilearn/tests/test_junifer_connectivity_measure.py +0 -1089
- junifer/markers/brainprint.py +0 -459
- junifer/markers/tests/test_brainprint.py +0 -58
- junifer/preprocess/smoothing/__init__.py +0 -9
- junifer/preprocess/smoothing/_afni_smoothing.py +0 -119
- junifer/preprocess/smoothing/_fsl_smoothing.py +0 -116
- junifer/preprocess/smoothing/_nilearn_smoothing.py +0 -69
- junifer/preprocess/smoothing/smoothing.py +0 -174
- junifer/preprocess/smoothing/tests/test_smoothing.py +0 -94
- junifer-0.0.5.dist-info/RECORD +0 -275
- {junifer-0.0.5.dist-info → junifer-0.0.5.dev11.dist-info}/AUTHORS.rst +0 -0
- {junifer-0.0.5.dist-info → junifer-0.0.5.dev11.dist-info}/LICENSE.md +0 -0
- {junifer-0.0.5.dist-info → junifer-0.0.5.dev11.dist-info}/entry_points.txt +0 -0
- {junifer-0.0.5.dist-info → junifer-0.0.5.dev11.dist-info}/top_level.txt +0 -0
junifer/__init__.py
CHANGED
@@ -20,20 +20,3 @@ from . import (
|
|
20
20
|
onthefly,
|
21
21
|
)
|
22
22
|
from ._version import __version__
|
23
|
-
|
24
|
-
|
25
|
-
__all__ = [
|
26
|
-
"api",
|
27
|
-
"configs",
|
28
|
-
"data",
|
29
|
-
"datagrabber",
|
30
|
-
"datareader",
|
31
|
-
"markers",
|
32
|
-
"pipeline",
|
33
|
-
"preprocess",
|
34
|
-
"stats",
|
35
|
-
"storage",
|
36
|
-
"utils",
|
37
|
-
"external",
|
38
|
-
"onthefly",
|
39
|
-
]
|
junifer/_version.py
CHANGED
@@ -12,5 +12,5 @@ __version__: str
|
|
12
12
|
__version_tuple__: VERSION_TUPLE
|
13
13
|
version_tuple: VERSION_TUPLE
|
14
14
|
|
15
|
-
__version__ = version = '0.0.5'
|
16
|
-
__version_tuple__ = version_tuple = (0, 0, 5)
|
15
|
+
__version__ = version = '0.0.5.dev11'
|
16
|
+
__version_tuple__ = version_tuple = (0, 0, 5, 'dev11')
|
junifer/api/__init__.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
"""
|
1
|
+
"""Provide imports for api sub-package."""
|
2
2
|
|
3
3
|
# Authors: Federico Raimondo <f.raimondo@fz-juelich.de>
|
4
4
|
# Synchon Mandal <s.mandal@fz-juelich.de>
|
@@ -7,6 +7,3 @@
|
|
7
7
|
from . import decorators
|
8
8
|
from .cli import cli
|
9
9
|
from .functions import collect, queue, run
|
10
|
-
|
11
|
-
|
12
|
-
__all__ = ["decorators", "cli", "collect", "queue", "run"]
|
junifer/api/cli.py
CHANGED
@@ -8,7 +8,7 @@ import pathlib
|
|
8
8
|
import subprocess
|
9
9
|
import sys
|
10
10
|
from pathlib import Path
|
11
|
-
from typing import Dict, List,
|
11
|
+
from typing import Dict, List, Tuple, Union
|
12
12
|
|
13
13
|
import click
|
14
14
|
import pandas as pd
|
@@ -20,7 +20,6 @@ from ..utils.logging import (
|
|
20
20
|
warn_with_log,
|
21
21
|
)
|
22
22
|
from .functions import collect as api_collect
|
23
|
-
from .functions import list_elements as api_list_elements
|
24
23
|
from .functions import queue as api_queue
|
25
24
|
from .functions import reset as api_reset
|
26
25
|
from .functions import run as api_run
|
@@ -452,69 +451,6 @@ def reset(
|
|
452
451
|
api_reset(config)
|
453
452
|
|
454
453
|
|
455
|
-
@cli.command()
|
456
|
-
@click.argument(
|
457
|
-
"filepath",
|
458
|
-
type=click.Path(
|
459
|
-
exists=True, readable=True, dir_okay=False, path_type=pathlib.Path
|
460
|
-
),
|
461
|
-
)
|
462
|
-
@click.option("--element", type=str, multiple=True)
|
463
|
-
@click.option(
|
464
|
-
"-o",
|
465
|
-
"--output-file",
|
466
|
-
type=click.Path(dir_okay=False, writable=True, path_type=pathlib.Path),
|
467
|
-
)
|
468
|
-
@click.option(
|
469
|
-
"-v",
|
470
|
-
"--verbose",
|
471
|
-
type=click.UNPROCESSED,
|
472
|
-
callback=_validate_verbose,
|
473
|
-
default="info",
|
474
|
-
)
|
475
|
-
def list_elements(
|
476
|
-
filepath: click.Path,
|
477
|
-
element: Tuple[str],
|
478
|
-
output_file: Optional[click.Path],
|
479
|
-
verbose: Union[str, int],
|
480
|
-
) -> None:
|
481
|
-
"""Element listing command for CLI.
|
482
|
-
|
483
|
-
\f
|
484
|
-
|
485
|
-
Parameters
|
486
|
-
----------
|
487
|
-
filepath : click.Path
|
488
|
-
The filepath to the configuration file.
|
489
|
-
element : tuple of str
|
490
|
-
The element to operate on.
|
491
|
-
output_file : click.Path or None
|
492
|
-
The path to write the output to. If not None, writing to
|
493
|
-
stdout is not performed.
|
494
|
-
verbose : click.Choice
|
495
|
-
The verbosity level: warning, info or debug (default "info").
|
496
|
-
|
497
|
-
"""
|
498
|
-
configure_logging(level=verbose)
|
499
|
-
# Parse YAML
|
500
|
-
config = parse_yaml(filepath) # type: ignore
|
501
|
-
# Fetch datagrabber
|
502
|
-
datagrabber = config["datagrabber"]
|
503
|
-
# Parse elements
|
504
|
-
elements = _parse_elements(element, config)
|
505
|
-
# Perform operation
|
506
|
-
listed_elements = api_list_elements(
|
507
|
-
datagrabber=datagrabber,
|
508
|
-
elements=elements,
|
509
|
-
)
|
510
|
-
# Check if output file is provided
|
511
|
-
if output_file is not None:
|
512
|
-
output_file.touch()
|
513
|
-
output_file.write_text(listed_elements)
|
514
|
-
else:
|
515
|
-
click.secho(listed_elements, fg="blue")
|
516
|
-
|
517
|
-
|
518
454
|
@cli.group()
|
519
455
|
def setup() -> None: # pragma: no cover
|
520
456
|
"""Configure commands for Junifer."""
|
@@ -588,29 +524,3 @@ def ants_docker() -> None: # pragma: no cover
|
|
588
524
|
export PATH="$PATH:{ants_wrappers_path}"
|
589
525
|
"""
|
590
526
|
click.secho(msg, fg="blue")
|
591
|
-
|
592
|
-
|
593
|
-
@setup.command("freesurfer-docker")
|
594
|
-
def freesurfer_docker() -> None: # pragma: no cover
|
595
|
-
"""Configure FreeSurfer-Docker wrappers."""
|
596
|
-
import junifer
|
597
|
-
|
598
|
-
pkg_path = Path(junifer.__path__[0]) # type: ignore
|
599
|
-
fs_wrappers_path = pkg_path / "api" / "res" / "freesurfer"
|
600
|
-
msg = f"""
|
601
|
-
Installation instructions for FreeSurfer-Docker wrappers:
|
602
|
-
|
603
|
-
1. Install Docker: https://docs.docker.com/get-docker/
|
604
|
-
|
605
|
-
2. Get the FreeSurfer-Docker image by running this on the command line:
|
606
|
-
|
607
|
-
docker pull freesurfer/freesurfer
|
608
|
-
|
609
|
-
3. Get license from: https://surfer.nmr.mgh.harvard.edu/registration.html .
|
610
|
-
You can skip this step if you already have one.
|
611
|
-
|
612
|
-
4. Add this line to the ~/.bashrc or ~/.zshrc file:
|
613
|
-
|
614
|
-
export PATH="$PATH:{fs_wrappers_path}"
|
615
|
-
"""
|
616
|
-
click.secho(msg, fg="blue")
|
junifer/api/decorators.py
CHANGED
@@ -10,15 +10,6 @@ from typing import Type
|
|
10
10
|
from ..pipeline.registry import register
|
11
11
|
|
12
12
|
|
13
|
-
__all__ = [
|
14
|
-
"register_datagrabber",
|
15
|
-
"register_datareader",
|
16
|
-
"register_preprocessor",
|
17
|
-
"register_marker",
|
18
|
-
"register_storage",
|
19
|
-
]
|
20
|
-
|
21
|
-
|
22
13
|
def register_datagrabber(klass: Type) -> Type:
|
23
14
|
"""Register DataGrabber.
|
24
15
|
|
junifer/api/functions.py
CHANGED
@@ -5,7 +5,6 @@
|
|
5
5
|
# Synchon Mandal <s.mandal@fz-juelich.de>
|
6
6
|
# License: AGPL
|
7
7
|
|
8
|
-
import os
|
9
8
|
import shutil
|
10
9
|
import typing
|
11
10
|
from pathlib import Path
|
@@ -23,9 +22,6 @@ from .queue_context import GnuParallelLocalAdapter, HTCondorAdapter
|
|
23
22
|
from .utils import yaml
|
24
23
|
|
25
24
|
|
26
|
-
__all__ = ["run", "collect", "queue", "reset", "list_elements"]
|
27
|
-
|
28
|
-
|
29
25
|
def _get_datagrabber(datagrabber_config: Dict) -> BaseDataGrabber:
|
30
26
|
"""Get DataGrabber.
|
31
27
|
|
@@ -95,7 +91,7 @@ def run(
|
|
95
91
|
datagrabber : dict
|
96
92
|
DataGrabber to use. Must have a key ``kind`` with the kind of
|
97
93
|
DataGrabber to use. All other keys are passed to the DataGrabber
|
98
|
-
|
94
|
+
init function.
|
99
95
|
markers : list of dict
|
100
96
|
List of markers to extract. Each marker is a dict with at least two
|
101
97
|
keys: ``name`` and ``kind``. The ``name`` key is used to name the
|
@@ -105,11 +101,11 @@ def run(
|
|
105
101
|
storage : dict
|
106
102
|
Storage to use. Must have a key ``kind`` with the kind of
|
107
103
|
storage to use. All other keys are passed to the storage
|
108
|
-
|
104
|
+
init function.
|
109
105
|
preprocessors : list of dict, optional
|
110
106
|
List of preprocessors to use. Each preprocessor is a dict with at
|
111
107
|
least a key ``kind`` specifying the preprocessor to use. All other keys
|
112
|
-
are passed to the preprocessor
|
108
|
+
are passed to the preprocessor init function (default None).
|
113
109
|
elements : str or tuple or list of str or tuple, optional
|
114
110
|
Element(s) to process. Will be used to index the DataGrabber
|
115
111
|
(default None).
|
@@ -191,7 +187,7 @@ def collect(storage: Dict) -> None:
|
|
191
187
|
storage : dict
|
192
188
|
Storage to use. Must have a key ``kind`` with the kind of
|
193
189
|
storage to use. All other keys are passed to the storage
|
194
|
-
|
190
|
+
init function.
|
195
191
|
|
196
192
|
"""
|
197
193
|
storage_params = storage.copy()
|
@@ -343,12 +339,12 @@ def reset(config: Dict) -> None:
|
|
343
339
|
storage = config["storage"]
|
344
340
|
storage_uri = Path(storage["uri"])
|
345
341
|
logger.info(f"Deleting {storage_uri.resolve()!s}")
|
346
|
-
# Delete storage
|
342
|
+
# Delete storage; will be str
|
347
343
|
if storage_uri.exists():
|
348
|
-
# Delete files in the
|
349
|
-
for file in storage_uri.
|
344
|
+
# Delete files in the directory
|
345
|
+
for file in storage_uri.iterdir():
|
350
346
|
file.unlink(missing_ok=True)
|
351
|
-
# Remove
|
347
|
+
# Remove directory
|
352
348
|
storage_uri.parent.rmdir()
|
353
349
|
|
354
350
|
# Fetch job name (if present)
|
@@ -363,47 +359,5 @@ def reset(config: Dict) -> None:
|
|
363
359
|
if job_dir.exists():
|
364
360
|
# Remove files and directories
|
365
361
|
shutil.rmtree(job_dir)
|
366
|
-
# Remove
|
367
|
-
|
368
|
-
job_dir.parent.rmdir()
|
369
|
-
|
370
|
-
|
371
|
-
def list_elements(
|
372
|
-
datagrabber: Dict,
|
373
|
-
elements: Union[str, List[Union[str, Tuple]], Tuple, None] = None,
|
374
|
-
) -> str:
|
375
|
-
"""List elements of the datagrabber filtered using `elements`.
|
376
|
-
|
377
|
-
Parameters
|
378
|
-
----------
|
379
|
-
datagrabber : dict
|
380
|
-
DataGrabber to index. Must have a key ``kind`` with the kind of
|
381
|
-
DataGrabber to use. All other keys are passed to the DataGrabber
|
382
|
-
constructor.
|
383
|
-
elements : str or tuple or list of str or tuple, optional
|
384
|
-
Element(s) to filter using. Will be used to index the DataGrabber
|
385
|
-
(default None).
|
386
|
-
|
387
|
-
"""
|
388
|
-
# Get datagrabber to use
|
389
|
-
datagrabber_object = _get_datagrabber(datagrabber)
|
390
|
-
|
391
|
-
# Fetch elements
|
392
|
-
raw_elements_to_list = []
|
393
|
-
with datagrabber_object:
|
394
|
-
if elements is not None:
|
395
|
-
for element in datagrabber_object.filter(elements):
|
396
|
-
raw_elements_to_list.append(element)
|
397
|
-
else:
|
398
|
-
for element in datagrabber_object:
|
399
|
-
raw_elements_to_list.append(element)
|
400
|
-
|
401
|
-
elements_to_list = []
|
402
|
-
for element in raw_elements_to_list:
|
403
|
-
# Stringify elements if tuple for operation
|
404
|
-
str_element = (
|
405
|
-
",".join(element) if isinstance(element, tuple) else element
|
406
|
-
)
|
407
|
-
elements_to_list.append(str_element)
|
408
|
-
|
409
|
-
return "\n".join(elements_to_list)
|
362
|
+
# Remove directory
|
363
|
+
job_dir.parent.rmdir()
|
junifer/api/parser.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
"""
|
1
|
+
"""Provide imports for queue context sub-package."""
|
2
2
|
|
3
3
|
# Authors: Synchon Mandal <s.mandal@fz-juelich.de>
|
4
4
|
# License: AGPL
|
@@ -6,6 +6,3 @@
|
|
6
6
|
from .queue_context_adapter import QueueContextAdapter
|
7
7
|
from .htcondor_adapter import HTCondorAdapter
|
8
8
|
from .gnu_parallel_local_adapter import GnuParallelLocalAdapter
|
9
|
-
|
10
|
-
|
11
|
-
__all__ = ["QueueContextAdapter", "HTCondorAdapter", "GnuParallelLocalAdapter"]
|
@@ -31,7 +31,7 @@ if [ -d "${var}" ]; then
|
|
31
31
|
done
|
32
32
|
|
33
33
|
echo "Docker args: ${docker_args[*]}" >&2
|
34
|
-
echo "Corrected args for
|
34
|
+
echo "Corrected args for afni: ${corrected_args[*]}" >&2
|
35
35
|
|
36
36
|
cwd=$(pwd)
|
37
37
|
cmd="docker run --rm ${docker_args[*]} -v ${cwd}:${cwd} -w ${cwd} afni/afni_make_build ${corrected_args[*]}"
|
@@ -31,7 +31,7 @@ if [ -d "${var}" ]; then
|
|
31
31
|
done
|
32
32
|
|
33
33
|
echo "Docker args: ${docker_args[*]}" >&2
|
34
|
-
echo "Corrected args for
|
34
|
+
echo "Corrected args for fsl: ${corrected_args[*]}" >&2
|
35
35
|
|
36
36
|
cwd=$(pwd)
|
37
37
|
cmd="docker run --rm ${docker_args[*]} -v ${cwd}:${cwd} -w ${cwd} antsx/ants ${corrected_args[*]}"
|
@@ -31,7 +31,7 @@ if [ -d "${var}" ]; then
|
|
31
31
|
done
|
32
32
|
|
33
33
|
echo "Docker args: ${docker_args[*]}" >&2
|
34
|
-
echo "Corrected args for
|
34
|
+
echo "Corrected args for fsl: ${corrected_args[*]}" >&2
|
35
35
|
|
36
36
|
cwd=$(pwd)
|
37
37
|
cmd="docker run --rm ${docker_args[*]} -v ${cwd}:${cwd} -w ${cwd} brainlife/fsl ${corrected_args[*]}"
|
@@ -4,7 +4,6 @@
|
|
4
4
|
# License: AGPL
|
5
5
|
|
6
6
|
import platform as pl
|
7
|
-
import sys
|
8
7
|
|
9
8
|
import pytest
|
10
9
|
|
@@ -46,11 +45,11 @@ def test_get_dependency_information_short() -> None:
|
|
46
45
|
"httpx",
|
47
46
|
"tqdm",
|
48
47
|
"templateflow",
|
49
|
-
"lapy",
|
50
48
|
"looseversion",
|
51
49
|
]
|
52
50
|
|
53
|
-
|
51
|
+
python_minor_version = int(pl.python_version_tuple()[1])
|
52
|
+
if python_minor_version < 10:
|
54
53
|
dependency_list.append("importlib_metadata")
|
55
54
|
|
56
55
|
assert frozenset(dependency_information.keys()) == frozenset(
|
@@ -75,7 +74,6 @@ def test_get_dependency_information_long() -> None:
|
|
75
74
|
"httpx",
|
76
75
|
"tqdm",
|
77
76
|
"templateflow",
|
78
|
-
"lapy",
|
79
77
|
]
|
80
78
|
for key in dependency_list:
|
81
79
|
assert key in dependency_information_keys
|
junifer/api/tests/test_cli.py
CHANGED
@@ -14,7 +14,6 @@ from ruamel.yaml import YAML
|
|
14
14
|
from junifer.api.cli import (
|
15
15
|
_parse_elements_file,
|
16
16
|
collect,
|
17
|
-
list_elements,
|
18
17
|
queue,
|
19
18
|
reset,
|
20
19
|
run,
|
@@ -298,88 +297,6 @@ def test_reset(
|
|
298
297
|
assert reset_result.exit_code == 0
|
299
298
|
|
300
299
|
|
301
|
-
@pytest.mark.parametrize(
|
302
|
-
"elements",
|
303
|
-
[
|
304
|
-
("sub-01", "sub-02"),
|
305
|
-
("sub-03", "sub-04"),
|
306
|
-
],
|
307
|
-
)
|
308
|
-
def test_list_elements_stdout(
|
309
|
-
elements: Tuple[str, ...],
|
310
|
-
) -> None:
|
311
|
-
"""Test elements listing to stdout.
|
312
|
-
|
313
|
-
Parameters
|
314
|
-
----------
|
315
|
-
elements : tuple of str
|
316
|
-
The parametrized elements for filtering.
|
317
|
-
|
318
|
-
"""
|
319
|
-
# Get test config
|
320
|
-
infile = Path(__file__).parent / "data" / "partly_cloudy_agg_mean_tian.yml"
|
321
|
-
# List elements command arguments
|
322
|
-
list_elements_args = [
|
323
|
-
str(infile.absolute()),
|
324
|
-
"--verbose",
|
325
|
-
"debug",
|
326
|
-
"--element",
|
327
|
-
elements[0],
|
328
|
-
"--element",
|
329
|
-
elements[1],
|
330
|
-
]
|
331
|
-
# Invoke list elements command
|
332
|
-
list_elements_result = runner.invoke(list_elements, list_elements_args)
|
333
|
-
# Check
|
334
|
-
assert list_elements_result.exit_code == 0
|
335
|
-
assert f"{elements[0]}\n{elements[1]}" in list_elements_result.stdout
|
336
|
-
|
337
|
-
|
338
|
-
@pytest.mark.parametrize(
|
339
|
-
"elements",
|
340
|
-
[
|
341
|
-
("sub-01", "sub-02"),
|
342
|
-
("sub-03", "sub-04"),
|
343
|
-
],
|
344
|
-
)
|
345
|
-
def test_list_elements_output_file(
|
346
|
-
tmp_path: Path,
|
347
|
-
elements: Tuple[str, ...],
|
348
|
-
) -> None:
|
349
|
-
"""Test elements listing to output file.
|
350
|
-
|
351
|
-
Parameters
|
352
|
-
----------
|
353
|
-
tmp_path : pathlib.Path
|
354
|
-
The path to the test directory.
|
355
|
-
elements : tuple of str
|
356
|
-
The parametrized elements for filtering.
|
357
|
-
|
358
|
-
"""
|
359
|
-
# Get test config
|
360
|
-
infile = Path(__file__).parent / "data" / "partly_cloudy_agg_mean_tian.yml"
|
361
|
-
# Output file
|
362
|
-
output_file = tmp_path / "elements.txt"
|
363
|
-
# List elements command arguments
|
364
|
-
list_elements_args = [
|
365
|
-
str(infile.absolute()),
|
366
|
-
"--verbose",
|
367
|
-
"debug",
|
368
|
-
"--element",
|
369
|
-
elements[0],
|
370
|
-
"--element",
|
371
|
-
elements[1],
|
372
|
-
"--output-file",
|
373
|
-
str(output_file.resolve()),
|
374
|
-
]
|
375
|
-
# Invoke list elements command
|
376
|
-
list_elements_result = runner.invoke(list_elements, list_elements_args)
|
377
|
-
# Check
|
378
|
-
assert list_elements_result.exit_code == 0
|
379
|
-
with open(output_file) as f:
|
380
|
-
assert f"{elements[0]}\n{elements[1]}" == f.read()
|
381
|
-
|
382
|
-
|
383
300
|
def test_wtf_short() -> None:
|
384
301
|
"""Test short version of wtf command."""
|
385
302
|
# Invoke wtf command
|
@@ -7,13 +7,13 @@
|
|
7
7
|
|
8
8
|
import logging
|
9
9
|
from pathlib import Path
|
10
|
-
from typing import Dict, List,
|
10
|
+
from typing import Dict, List, Tuple, Union
|
11
11
|
|
12
12
|
import pytest
|
13
13
|
from ruamel.yaml import YAML
|
14
14
|
|
15
15
|
import junifer.testing.registry # noqa: F401
|
16
|
-
from junifer.api.functions import collect,
|
16
|
+
from junifer.api.functions import collect, queue, reset, run
|
17
17
|
from junifer.datagrabber.base import BaseDataGrabber
|
18
18
|
from junifer.pipeline.registry import build
|
19
19
|
|
@@ -637,28 +637,3 @@ def test_reset_queue(
|
|
637
637
|
|
638
638
|
assert not Path(storage["uri"]).exists()
|
639
639
|
assert not (tmp_path / "junifer_jobs" / job_name).exists()
|
640
|
-
|
641
|
-
|
642
|
-
@pytest.mark.parametrize(
|
643
|
-
"elements",
|
644
|
-
[
|
645
|
-
["sub-01"],
|
646
|
-
None,
|
647
|
-
],
|
648
|
-
)
|
649
|
-
def test_list_elements(
|
650
|
-
datagrabber: Dict[str, str],
|
651
|
-
elements: Optional[List[str]],
|
652
|
-
) -> None:
|
653
|
-
"""Test elements listing.
|
654
|
-
|
655
|
-
Parameters
|
656
|
-
----------
|
657
|
-
datagrabber : dict
|
658
|
-
Testing datagrabber as dictionary.
|
659
|
-
elements : str of list of str
|
660
|
-
The parametrized elements for filtering.
|
661
|
-
|
662
|
-
"""
|
663
|
-
listed_elements = list_elements(datagrabber, elements)
|
664
|
-
assert "sub-01" in listed_elements
|
junifer/configs/__init__.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
"""
|
1
|
+
"""Provide imports for datagrabbers sub-package."""
|
2
2
|
|
3
3
|
# Authors: Federico Raimondo <f.raimondo@fz-juelich.de>
|
4
4
|
# Leonard Sasse <l.sasse@fz-juelich.de>
|
@@ -10,12 +10,3 @@ from .camcan_vbm import JuselessDataladCamCANVBM
|
|
10
10
|
from .ixi_vbm import JuselessDataladIXIVBM
|
11
11
|
from .ucla import JuselessUCLA
|
12
12
|
from .ukb_vbm import JuselessDataladUKBVBM
|
13
|
-
|
14
|
-
|
15
|
-
__all__ = [
|
16
|
-
"JuselessDataladAOMICID1000VBM",
|
17
|
-
"JuselessDataladCamCANVBM",
|
18
|
-
"JuselessDataladIXIVBM",
|
19
|
-
"JuselessUCLA",
|
20
|
-
"JuselessDataladUKBVBM",
|
21
|
-
]
|
@@ -11,9 +11,6 @@ from ....api.decorators import register_datagrabber
|
|
11
11
|
from ....datagrabber import PatternDataladDataGrabber
|
12
12
|
|
13
13
|
|
14
|
-
__all__ = ["JuselessDataladAOMICID1000VBM"]
|
15
|
-
|
16
|
-
|
17
14
|
@register_datagrabber
|
18
15
|
class JuselessDataladAOMICID1000VBM(PatternDataladDataGrabber):
|
19
16
|
"""Concrete implementation for Juseless AOMIC ID1000 VBM data fetching.
|
@@ -12,9 +12,6 @@ from ....api.decorators import register_datagrabber
|
|
12
12
|
from ....datagrabber import PatternDataladDataGrabber
|
13
13
|
|
14
14
|
|
15
|
-
__all__ = ["JuselessDataladCamCANVBM"]
|
16
|
-
|
17
|
-
|
18
15
|
@register_datagrabber
|
19
16
|
class JuselessDataladCamCANVBM(PatternDataladDataGrabber):
|
20
17
|
"""Concrete implementation for Juseless CamCAN VBM data fetching.
|
@@ -13,9 +13,6 @@ from ....datagrabber import PatternDataladDataGrabber
|
|
13
13
|
from ....utils import raise_error
|
14
14
|
|
15
15
|
|
16
|
-
__all__ = ["JuselessDataladIXIVBM"]
|
17
|
-
|
18
|
-
|
19
16
|
@register_datagrabber
|
20
17
|
class JuselessDataladIXIVBM(PatternDataladDataGrabber):
|
21
18
|
"""Concrete implementation for Juseless IXI VBM data fetching.
|
@@ -27,6 +27,7 @@ def test_JuselessUCLA() -> None:
|
|
27
27
|
|
28
28
|
types = [
|
29
29
|
"BOLD",
|
30
|
+
"BOLD_confounds",
|
30
31
|
"T1w",
|
31
32
|
"VBM_CSF",
|
32
33
|
"VBM_GM",
|
@@ -42,11 +43,12 @@ def test_JuselessUCLA() -> None:
|
|
42
43
|
"types",
|
43
44
|
[
|
44
45
|
"BOLD",
|
46
|
+
"BOLD_confounds",
|
45
47
|
"T1w",
|
46
48
|
"VBM_CSF",
|
47
49
|
"VBM_GM",
|
48
50
|
"VBM_WM",
|
49
|
-
["BOLD", "
|
51
|
+
["BOLD", "BOLD_confounds"],
|
50
52
|
["T1w", "VBM_CSF"],
|
51
53
|
["VBM_GM", "VBM_WM"],
|
52
54
|
["BOLD", "T1w"],
|
@@ -12,9 +12,6 @@ from ....datagrabber import PatternDataGrabber
|
|
12
12
|
from ....utils import raise_error
|
13
13
|
|
14
14
|
|
15
|
-
__all__ = ["JuselessUCLA"]
|
16
|
-
|
17
|
-
|
18
15
|
@register_datagrabber
|
19
16
|
class JuselessUCLA(PatternDataGrabber):
|
20
17
|
"""Concrete implementation for Juseless UCLA data fetching.
|
@@ -26,8 +23,8 @@ class JuselessUCLA(PatternDataGrabber):
|
|
26
23
|
datadir : str or Path, optional
|
27
24
|
The directory where the dataset is stored.
|
28
25
|
(default "/data/project/psychosis_thalamus/data/fmriprep").
|
29
|
-
types: {"BOLD", "T1w", "VBM_CSF", "VBM_GM",
|
30
|
-
list of the options, optional
|
26
|
+
types: {"BOLD", "BOLD_confounds", "T1w", "VBM_CSF", "VBM_GM", \
|
27
|
+
"VBM_WM"} or a list of the options, optional
|
31
28
|
UCLA data types. If None, all available data types are selected.
|
32
29
|
(default None).
|
33
30
|
tasks : {"rest", "bart", "bht", "pamenc", "pamret", \
|
@@ -79,13 +76,13 @@ class JuselessUCLA(PatternDataGrabber):
|
|
79
76
|
"MNI152NLin2009cAsym_preproc.nii.gz"
|
80
77
|
),
|
81
78
|
"space": "MNI152NLin2009cAsym",
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
79
|
+
},
|
80
|
+
"BOLD_confounds": {
|
81
|
+
"pattern": (
|
82
|
+
"{subject}/func/{subject}_"
|
83
|
+
"task-{task}_bold_confounds.tsv"
|
84
|
+
),
|
85
|
+
"space": "fmriprep",
|
89
86
|
},
|
90
87
|
"T1w": {
|
91
88
|
"pattern": (
|
@@ -12,9 +12,6 @@ from ....api.decorators import register_datagrabber
|
|
12
12
|
from ....datagrabber import PatternDataladDataGrabber
|
13
13
|
|
14
14
|
|
15
|
-
__all__ = ["JuselessDataladUKBVBM"]
|
16
|
-
|
17
|
-
|
18
15
|
@register_datagrabber
|
19
16
|
class JuselessDataladUKBVBM(PatternDataladDataGrabber):
|
20
17
|
"""Concrete implementation for Juseless UKB VBM data fetching.
|