junifer 0.0.5__py3-none-any.whl → 0.0.5.dev24__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.
Files changed (194) hide show
  1. junifer/__init__.py +0 -17
  2. junifer/_version.py +2 -2
  3. junifer/api/__init__.py +1 -4
  4. junifer/api/cli.py +1 -91
  5. junifer/api/decorators.py +0 -9
  6. junifer/api/functions.py +10 -56
  7. junifer/api/parser.py +0 -3
  8. junifer/api/queue_context/__init__.py +1 -4
  9. junifer/api/res/afni/run_afni_docker.sh +1 -1
  10. junifer/api/res/ants/run_ants_docker.sh +1 -1
  11. junifer/api/res/fsl/run_fsl_docker.sh +1 -1
  12. junifer/api/tests/test_api_utils.py +2 -4
  13. junifer/api/tests/test_cli.py +0 -83
  14. junifer/api/tests/test_functions.py +2 -27
  15. junifer/configs/__init__.py +1 -1
  16. junifer/configs/juseless/__init__.py +1 -4
  17. junifer/configs/juseless/datagrabbers/__init__.py +1 -10
  18. junifer/configs/juseless/datagrabbers/aomic_id1000_vbm.py +0 -3
  19. junifer/configs/juseless/datagrabbers/camcan_vbm.py +0 -3
  20. junifer/configs/juseless/datagrabbers/ixi_vbm.py +0 -3
  21. junifer/configs/juseless/datagrabbers/tests/test_ucla.py +3 -1
  22. junifer/configs/juseless/datagrabbers/ucla.py +9 -12
  23. junifer/configs/juseless/datagrabbers/ukb_vbm.py +0 -3
  24. junifer/data/__init__.py +1 -21
  25. junifer/data/coordinates.py +19 -10
  26. junifer/data/masks.py +87 -58
  27. junifer/data/parcellations.py +3 -14
  28. junifer/data/template_spaces.py +1 -4
  29. junifer/data/tests/test_masks.py +37 -26
  30. junifer/data/utils.py +0 -3
  31. junifer/datagrabber/__init__.py +1 -18
  32. junifer/datagrabber/aomic/__init__.py +0 -3
  33. junifer/datagrabber/aomic/id1000.py +37 -70
  34. junifer/datagrabber/aomic/piop1.py +36 -69
  35. junifer/datagrabber/aomic/piop2.py +38 -71
  36. junifer/datagrabber/aomic/tests/test_id1000.py +99 -44
  37. junifer/datagrabber/aomic/tests/test_piop1.py +108 -65
  38. junifer/datagrabber/aomic/tests/test_piop2.py +102 -45
  39. junifer/datagrabber/base.py +6 -13
  40. junifer/datagrabber/datalad_base.py +1 -13
  41. junifer/datagrabber/dmcc13_benchmark.py +53 -36
  42. junifer/datagrabber/hcp1200/__init__.py +0 -3
  43. junifer/datagrabber/hcp1200/datalad_hcp1200.py +0 -3
  44. junifer/datagrabber/hcp1200/hcp1200.py +1 -4
  45. junifer/datagrabber/multiple.py +6 -45
  46. junifer/datagrabber/pattern.py +62 -170
  47. junifer/datagrabber/pattern_datalad.py +12 -25
  48. junifer/datagrabber/tests/test_datagrabber_utils.py +218 -0
  49. junifer/datagrabber/tests/test_datalad_base.py +4 -4
  50. junifer/datagrabber/tests/test_dmcc13_benchmark.py +19 -46
  51. junifer/datagrabber/tests/test_multiple.py +84 -161
  52. junifer/datagrabber/tests/test_pattern.py +0 -45
  53. junifer/datagrabber/tests/test_pattern_datalad.py +4 -4
  54. junifer/datagrabber/utils.py +230 -0
  55. junifer/datareader/__init__.py +1 -4
  56. junifer/datareader/default.py +43 -95
  57. junifer/external/__init__.py +1 -1
  58. junifer/external/nilearn/__init__.py +1 -5
  59. junifer/external/nilearn/junifer_nifti_spheres_masker.py +9 -23
  60. junifer/external/nilearn/tests/test_junifer_nifti_spheres_masker.py +1 -76
  61. junifer/markers/__init__.py +1 -23
  62. junifer/markers/base.py +28 -68
  63. junifer/markers/collection.py +2 -10
  64. junifer/markers/complexity/__init__.py +0 -10
  65. junifer/markers/complexity/complexity_base.py +43 -26
  66. junifer/markers/complexity/hurst_exponent.py +0 -3
  67. junifer/markers/complexity/multiscale_entropy_auc.py +0 -3
  68. junifer/markers/complexity/perm_entropy.py +0 -3
  69. junifer/markers/complexity/range_entropy.py +0 -3
  70. junifer/markers/complexity/range_entropy_auc.py +0 -3
  71. junifer/markers/complexity/sample_entropy.py +0 -3
  72. junifer/markers/complexity/tests/test_hurst_exponent.py +3 -11
  73. junifer/markers/complexity/tests/test_multiscale_entropy_auc.py +3 -11
  74. junifer/markers/complexity/tests/test_perm_entropy.py +3 -11
  75. junifer/markers/complexity/tests/test_range_entropy.py +3 -11
  76. junifer/markers/complexity/tests/test_range_entropy_auc.py +3 -11
  77. junifer/markers/complexity/tests/test_sample_entropy.py +3 -11
  78. junifer/markers/complexity/tests/test_weighted_perm_entropy.py +3 -11
  79. junifer/markers/complexity/weighted_perm_entropy.py +0 -3
  80. junifer/markers/ets_rss.py +42 -27
  81. junifer/markers/falff/__init__.py +0 -3
  82. junifer/markers/falff/_afni_falff.py +2 -5
  83. junifer/markers/falff/_junifer_falff.py +0 -3
  84. junifer/markers/falff/falff_base.py +46 -20
  85. junifer/markers/falff/falff_parcels.py +27 -56
  86. junifer/markers/falff/falff_spheres.py +29 -60
  87. junifer/markers/falff/tests/test_falff_parcels.py +23 -39
  88. junifer/markers/falff/tests/test_falff_spheres.py +23 -39
  89. junifer/markers/functional_connectivity/__init__.py +0 -9
  90. junifer/markers/functional_connectivity/crossparcellation_functional_connectivity.py +60 -63
  91. junifer/markers/functional_connectivity/edge_functional_connectivity_parcels.py +32 -45
  92. junifer/markers/functional_connectivity/edge_functional_connectivity_spheres.py +36 -49
  93. junifer/markers/functional_connectivity/functional_connectivity_base.py +70 -71
  94. junifer/markers/functional_connectivity/functional_connectivity_parcels.py +25 -34
  95. junifer/markers/functional_connectivity/functional_connectivity_spheres.py +30 -40
  96. junifer/markers/functional_connectivity/tests/test_crossparcellation_functional_connectivity.py +7 -11
  97. junifer/markers/functional_connectivity/tests/test_edge_functional_connectivity_parcels.py +7 -27
  98. junifer/markers/functional_connectivity/tests/test_edge_functional_connectivity_spheres.py +12 -28
  99. junifer/markers/functional_connectivity/tests/test_functional_connectivity_parcels.py +11 -35
  100. junifer/markers/functional_connectivity/tests/test_functional_connectivity_spheres.py +62 -36
  101. junifer/markers/parcel_aggregation.py +61 -47
  102. junifer/markers/reho/__init__.py +0 -3
  103. junifer/markers/reho/_afni_reho.py +2 -5
  104. junifer/markers/reho/_junifer_reho.py +1 -4
  105. junifer/markers/reho/reho_base.py +27 -8
  106. junifer/markers/reho/reho_parcels.py +17 -28
  107. junifer/markers/reho/reho_spheres.py +18 -27
  108. junifer/markers/reho/tests/test_reho_parcels.py +3 -8
  109. junifer/markers/reho/tests/test_reho_spheres.py +3 -8
  110. junifer/markers/sphere_aggregation.py +59 -43
  111. junifer/markers/temporal_snr/__init__.py +0 -3
  112. junifer/markers/temporal_snr/temporal_snr_base.py +32 -23
  113. junifer/markers/temporal_snr/temporal_snr_parcels.py +6 -9
  114. junifer/markers/temporal_snr/temporal_snr_spheres.py +6 -9
  115. junifer/markers/temporal_snr/tests/test_temporal_snr_parcels.py +3 -6
  116. junifer/markers/temporal_snr/tests/test_temporal_snr_spheres.py +3 -6
  117. junifer/markers/tests/test_collection.py +8 -9
  118. junifer/markers/tests/test_ets_rss.py +9 -15
  119. junifer/markers/tests/test_markers_base.py +18 -17
  120. junifer/markers/tests/test_parcel_aggregation.py +32 -93
  121. junifer/markers/tests/test_sphere_aggregation.py +19 -72
  122. junifer/onthefly/__init__.py +1 -4
  123. junifer/onthefly/read_transform.py +0 -3
  124. junifer/pipeline/__init__.py +1 -9
  125. junifer/pipeline/pipeline_step_mixin.py +4 -21
  126. junifer/pipeline/registry.py +0 -3
  127. junifer/pipeline/singleton.py +0 -3
  128. junifer/pipeline/tests/test_registry.py +1 -1
  129. junifer/pipeline/update_meta_mixin.py +0 -3
  130. junifer/pipeline/utils.py +1 -67
  131. junifer/pipeline/workdir_manager.py +0 -3
  132. junifer/preprocess/__init__.py +2 -9
  133. junifer/preprocess/ants/__init__.py +4 -0
  134. junifer/preprocess/ants/ants_apply_transforms_warper.py +185 -0
  135. junifer/preprocess/ants/tests/test_ants_apply_transforms_warper.py +56 -0
  136. junifer/preprocess/base.py +3 -6
  137. junifer/preprocess/bold_warper.py +265 -0
  138. junifer/preprocess/confounds/__init__.py +0 -3
  139. junifer/preprocess/confounds/fmriprep_confound_remover.py +60 -47
  140. junifer/preprocess/confounds/tests/test_fmriprep_confound_remover.py +113 -72
  141. junifer/preprocess/fsl/__init__.py +4 -0
  142. junifer/preprocess/fsl/apply_warper.py +179 -0
  143. junifer/preprocess/fsl/tests/test_apply_warper.py +45 -0
  144. junifer/preprocess/smoothing/__init__.py +0 -3
  145. junifer/preprocess/smoothing/_afni_smoothing.py +1 -1
  146. junifer/preprocess/tests/test_bold_warper.py +159 -0
  147. junifer/preprocess/warping/__init__.py +0 -3
  148. junifer/preprocess/warping/_ants_warper.py +0 -3
  149. junifer/preprocess/warping/_fsl_warper.py +0 -3
  150. junifer/stats.py +1 -4
  151. junifer/storage/__init__.py +1 -9
  152. junifer/storage/base.py +1 -40
  153. junifer/storage/hdf5.py +9 -71
  154. junifer/storage/pandas_base.py +0 -3
  155. junifer/storage/sqlite.py +0 -3
  156. junifer/storage/tests/test_hdf5.py +10 -82
  157. junifer/storage/utils.py +0 -9
  158. junifer/testing/__init__.py +1 -4
  159. junifer/testing/datagrabbers.py +6 -13
  160. junifer/testing/tests/test_partlycloudytesting_datagrabber.py +7 -7
  161. junifer/testing/utils.py +0 -3
  162. junifer/utils/__init__.py +2 -13
  163. junifer/utils/fs.py +0 -3
  164. junifer/utils/helpers.py +1 -32
  165. junifer/utils/logging.py +4 -33
  166. junifer/utils/tests/test_logging.py +0 -8
  167. {junifer-0.0.5.dist-info → junifer-0.0.5.dev24.dist-info}/METADATA +16 -17
  168. junifer-0.0.5.dev24.dist-info/RECORD +265 -0
  169. {junifer-0.0.5.dist-info → junifer-0.0.5.dev24.dist-info}/WHEEL +1 -1
  170. junifer/api/res/freesurfer/mri_binarize +0 -3
  171. junifer/api/res/freesurfer/mri_mc +0 -3
  172. junifer/api/res/freesurfer/mri_pretess +0 -3
  173. junifer/api/res/freesurfer/mris_convert +0 -3
  174. junifer/api/res/freesurfer/run_freesurfer_docker.sh +0 -61
  175. junifer/data/masks/ukb/UKB_15K_GM_template.nii.gz +0 -0
  176. junifer/datagrabber/pattern_validation_mixin.py +0 -388
  177. junifer/datagrabber/tests/test_pattern_validation_mixin.py +0 -249
  178. junifer/external/BrainPrint/brainprint/__init__.py +0 -4
  179. junifer/external/BrainPrint/brainprint/_version.py +0 -3
  180. junifer/external/BrainPrint/brainprint/asymmetry.py +0 -91
  181. junifer/external/BrainPrint/brainprint/brainprint.py +0 -441
  182. junifer/external/BrainPrint/brainprint/surfaces.py +0 -258
  183. junifer/external/BrainPrint/brainprint/utils/__init__.py +0 -1
  184. junifer/external/BrainPrint/brainprint/utils/_config.py +0 -112
  185. junifer/external/BrainPrint/brainprint/utils/utils.py +0 -188
  186. junifer/external/nilearn/junifer_connectivity_measure.py +0 -483
  187. junifer/external/nilearn/tests/test_junifer_connectivity_measure.py +0 -1089
  188. junifer/markers/brainprint.py +0 -459
  189. junifer/markers/tests/test_brainprint.py +0 -58
  190. junifer-0.0.5.dist-info/RECORD +0 -275
  191. {junifer-0.0.5.dist-info → junifer-0.0.5.dev24.dist-info}/AUTHORS.rst +0 -0
  192. {junifer-0.0.5.dist-info → junifer-0.0.5.dev24.dist-info}/LICENSE.md +0 -0
  193. {junifer-0.0.5.dist-info → junifer-0.0.5.dev24.dist-info}/entry_points.txt +0 -0
  194. {junifer-0.0.5.dist-info → junifer-0.0.5.dev24.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.dev24'
16
+ __version_tuple__ = version_tuple = (0, 0, 5, 'dev24')
junifer/api/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
- """Public API and CLI components."""
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, Optional, Tuple, Union
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
- constructor.
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
- constructor.
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 constructor (default None).
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
- constructor.
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 job storage directory
349
- for file in storage_uri.parent.iterdir():
344
+ # Delete files in the directory
345
+ for file in storage_uri.iterdir():
350
346
  file.unlink(missing_ok=True)
351
- # Remove job storage directory
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 parent directory (if empty)
367
- if not next(os.scandir(job_dir.parent), None):
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
@@ -14,9 +14,6 @@ from ..utils.logging import logger, raise_error
14
14
  from .utils import yaml
15
15
 
16
16
 
17
- __all__ = ["parse_yaml"]
18
-
19
-
20
17
  def parse_yaml(filepath: Union[str, Path]) -> Dict:
21
18
  """Parse YAML.
22
19
 
@@ -1,4 +1,4 @@
1
- """Context adapters for queueing."""
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 AFNI: ${corrected_args[*]}" >&2
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 ANTs: ${corrected_args[*]}" >&2
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 FSL: ${corrected_args[*]}" >&2
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
- if sys.version_info < (3, 11):
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
@@ -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, Optional, Tuple, Union
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, list_elements, queue, reset, run
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
@@ -1,4 +1,4 @@
1
- """Custom components for specific platforms."""
1
+ """Provide imports for configs sub-package."""
2
2
 
3
3
  # Authors: Federico Raimondo <f.raimondo@fz-juelich.de>
4
4
  # License: AGPL
@@ -1,9 +1,6 @@
1
- """Custom components for FZJ INM-7's beloved juseless."""
1
+ """Provide imports for juseless sub-package."""
2
2
 
3
3
  # Authors: Federico Raimondo <f.raimondo@fz-juelich.de>
4
4
  # License: AGPL
5
5
 
6
6
  from . import datagrabbers
7
-
8
-
9
- __all__ = ["datagrabbers"]
@@ -1,4 +1,4 @@
1
- """Custom DataGrabbers for FZJ INM-7's beloved juseless."""
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", "VBM_CSF"],
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", "VBM_WM"} or \
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
- "confounds": {
83
- "pattern": (
84
- "{subject}/func/{subject}_"
85
- "task-{task}_bold_confounds.tsv"
86
- ),
87
- "space": "fmriprep",
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.