isabl-cli 2.0.0__tar.gz → 2.0.2__tar.gz

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 (55) hide show
  1. isabl_cli-2.0.2/PKG-INFO +222 -0
  2. isabl_cli-2.0.2/README.md +172 -0
  3. isabl_cli-2.0.2/isabl_cli/VERSION +1 -0
  4. {isabl_cli-2.0.0 → isabl_cli-2.0.2}/isabl_cli/__init__.py +1 -0
  5. {isabl_cli-2.0.0 → isabl_cli-2.0.2}/isabl_cli/app.py +20 -4
  6. {isabl_cli-2.0.0 → isabl_cli-2.0.2}/isabl_cli/data.py +1 -1
  7. {isabl_cli-2.0.0 → isabl_cli-2.0.2}/isabl_cli/settings.py +5 -2
  8. {isabl_cli-2.0.0 → isabl_cli-2.0.2}/isabl_cli/utils.py +33 -8
  9. isabl_cli-2.0.2/isabl_cli.egg-info/PKG-INFO +222 -0
  10. {isabl_cli-2.0.0 → isabl_cli-2.0.2}/isabl_cli.egg-info/SOURCES.txt +0 -1
  11. {isabl_cli-2.0.0 → isabl_cli-2.0.2}/isabl_cli.egg-info/requires.txt +1 -1
  12. isabl_cli-2.0.2/setup.py +70 -0
  13. {isabl_cli-2.0.0 → isabl_cli-2.0.2}/tests/test_app.py +8 -1
  14. isabl_cli-2.0.0/PKG-INFO +0 -49
  15. isabl_cli-2.0.0/README.md +0 -38
  16. isabl_cli-2.0.0/isabl_cli/VERSION +0 -1
  17. isabl_cli-2.0.0/isabl_cli.egg-info/PKG-INFO +0 -49
  18. isabl_cli-2.0.0/setup.json +0 -51
  19. isabl_cli-2.0.0/setup.py +0 -32
  20. {isabl_cli-2.0.0 → isabl_cli-2.0.2}/LICENSE.md +0 -0
  21. {isabl_cli-2.0.0 → isabl_cli-2.0.2}/MANIFEST.in +0 -0
  22. {isabl_cli-2.0.0 → isabl_cli-2.0.2}/isabl_cli/__main__.py +0 -0
  23. {isabl_cli-2.0.0 → isabl_cli-2.0.2}/isabl_cli/api.py +0 -0
  24. {isabl_cli-2.0.0 → isabl_cli-2.0.2}/isabl_cli/batch_systems/__init__.py +0 -0
  25. {isabl_cli-2.0.0 → isabl_cli-2.0.2}/isabl_cli/batch_systems/local.py +0 -0
  26. {isabl_cli-2.0.0 → isabl_cli-2.0.2}/isabl_cli/batch_systems/lsf.py +0 -0
  27. {isabl_cli-2.0.0 → isabl_cli-2.0.2}/isabl_cli/batch_systems/sge.py +0 -0
  28. {isabl_cli-2.0.0 → isabl_cli-2.0.2}/isabl_cli/batch_systems/slurm.py +0 -0
  29. {isabl_cli-2.0.0 → isabl_cli-2.0.2}/isabl_cli/cli.py +0 -0
  30. {isabl_cli-2.0.0 → isabl_cli-2.0.2}/isabl_cli/commands.py +0 -0
  31. {isabl_cli-2.0.0 → isabl_cli-2.0.2}/isabl_cli/data/README.md +0 -0
  32. {isabl_cli-2.0.0 → isabl_cli-2.0.2}/isabl_cli/exceptions.py +0 -0
  33. {isabl_cli-2.0.0 → isabl_cli-2.0.2}/isabl_cli/factories.py +0 -0
  34. {isabl_cli-2.0.0 → isabl_cli-2.0.2}/isabl_cli/options.py +0 -0
  35. {isabl_cli-2.0.0 → isabl_cli-2.0.2}/isabl_cli/signals.py +0 -0
  36. {isabl_cli-2.0.0 → isabl_cli-2.0.2}/isabl_cli/test/__init__.py +0 -0
  37. {isabl_cli-2.0.0 → isabl_cli-2.0.2}/isabl_cli/test/utils.py +0 -0
  38. {isabl_cli-2.0.0 → isabl_cli-2.0.2}/isabl_cli/validators.py +0 -0
  39. {isabl_cli-2.0.0 → isabl_cli-2.0.2}/isabl_cli.egg-info/dependency_links.txt +0 -0
  40. {isabl_cli-2.0.0 → isabl_cli-2.0.2}/isabl_cli.egg-info/entry_points.txt +0 -0
  41. {isabl_cli-2.0.0 → isabl_cli-2.0.2}/isabl_cli.egg-info/top_level.txt +0 -0
  42. {isabl_cli-2.0.0 → isabl_cli-2.0.2}/setup.cfg +0 -0
  43. {isabl_cli-2.0.0 → isabl_cli-2.0.2}/tests/__init__.py +0 -0
  44. {isabl_cli-2.0.0 → isabl_cli-2.0.2}/tests/conftest.py +0 -0
  45. {isabl_cli-2.0.0 → isabl_cli-2.0.2}/tests/test_api.py +0 -0
  46. {isabl_cli-2.0.0 → isabl_cli-2.0.2}/tests/test_batch_systems.py +0 -0
  47. {isabl_cli-2.0.0 → isabl_cli-2.0.2}/tests/test_cli.py +0 -0
  48. {isabl_cli-2.0.0 → isabl_cli-2.0.2}/tests/test_commands.py +0 -0
  49. {isabl_cli-2.0.0 → isabl_cli-2.0.2}/tests/test_data.py +0 -0
  50. {isabl_cli-2.0.0 → isabl_cli-2.0.2}/tests/test_options.py +0 -0
  51. {isabl_cli-2.0.0 → isabl_cli-2.0.2}/tests/test_signals.py +0 -0
  52. {isabl_cli-2.0.0 → isabl_cli-2.0.2}/tests/test_testutils.py +0 -0
  53. {isabl_cli-2.0.0 → isabl_cli-2.0.2}/tests/test_utils.py +0 -0
  54. {isabl_cli-2.0.0 → isabl_cli-2.0.2}/tests/test_validators.py +0 -0
  55. {isabl_cli-2.0.0 → isabl_cli-2.0.2}/tests/test_version.py +0 -0
@@ -0,0 +1,222 @@
1
+ Metadata-Version: 2.4
2
+ Name: isabl-cli
3
+ Version: 2.0.2
4
+ Summary: isabl_cli command line client.
5
+ Home-page: https://github.com/papaemmelab/isabl_cli
6
+ Author: Juan S. Medina
7
+ License: BSD
8
+ Classifier: Intended Audience :: Developers
9
+ Classifier: Intended Audience :: Science/Research
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Natural Language :: English
12
+ Classifier: Operating System :: Unix
13
+ Classifier: Operating System :: POSIX
14
+ Classifier: Topic :: Utilities
15
+ Description-Content-Type: text/markdown
16
+ License-File: LICENSE.md
17
+ Requires-Dist: analytics-python>=1.4.0
18
+ Requires-Dist: cached_property>=1.4.2
19
+ Requires-Dist: Click>=7.0.0
20
+ Requires-Dist: munch>=2.3.2
21
+ Requires-Dist: python-slugify>=1.1.2
22
+ Requires-Dist: pytz>=2018.4
23
+ Requires-Dist: PyYAML>=5.3
24
+ Requires-Dist: requests>=2.19.1
25
+ Requires-Dist: six>=1.11.0
26
+ Requires-Dist: packaging>=21.0
27
+ Provides-Extra: test
28
+ Requires-Dist: black>=18.9b0; extra == "test"
29
+ Requires-Dist: coverage>=4.4.2; extra == "test"
30
+ Requires-Dist: factory-boy>=2.11.1; extra == "test"
31
+ Requires-Dist: ipdb>=0.11; extra == "test"
32
+ Requires-Dist: pluggy>=0.7.1; extra == "test"
33
+ Requires-Dist: pydocstyle>=2.1.1; extra == "test"
34
+ Requires-Dist: pylint>=1.8.1; extra == "test"
35
+ Requires-Dist: pytest>=4.5; extra == "test"
36
+ Requires-Dist: pytest-cov>=2.5.1; extra == "test"
37
+ Requires-Dist: pytest-env>=0.6.2; extra == "test"
38
+ Requires-Dist: pytest-sugar==0.9.1; extra == "test"
39
+ Requires-Dist: tox>=2.9.1; extra == "test"
40
+ Dynamic: author
41
+ Dynamic: classifier
42
+ Dynamic: description
43
+ Dynamic: description-content-type
44
+ Dynamic: home-page
45
+ Dynamic: license
46
+ Dynamic: license-file
47
+ Dynamic: provides-extra
48
+ Dynamic: requires-dist
49
+ Dynamic: summary
50
+
51
+ # Isabl CLI
52
+
53
+ [![Run Isabl CLI tests][gh_actions_badge]][gh_actions_base]
54
+ [![pypi badge][pypi_badge]][pypi_base]
55
+ [![codecov badge][codecov_badge]][codecov_base]
56
+ [![code formatting][black_badge]][black_base]
57
+ [![MCP][mcp_badge]][mcp_base]
58
+
59
+ > **_Terms of Use: Academic Research_**
60
+
61
+ > [!TIP]
62
+ > Talk to your genomics data with AI. Try the [Isabl MCP Server](https://github.com/juanesarango/isabl-mcp) with Claude Code, Cursor, or your favorite agentic tool.
63
+
64
+ `isabl_cli` is a command line client and SDK for the Isabl Platform infrastructure.
65
+
66
+ ## 🧬 Isabl Platform
67
+
68
+ - Isabl is a platform for the integration, management, and processing of individual-centric multimodal data. Welcome to the Isabl Documentation!
69
+
70
+ - Isabl is a plug-and-play data science framework designed to support the processing of multimodal patient-centric data. Have questions? Ask here.
71
+
72
+ - Isabl has been developed by the [Elli Papaemmanuil's Lab](https://papaemmelab.org) at [Memorial Sloan Kettering Cancer Center](https://www.mskcc.org/research/ski), and it's currently used by multiple scientific groups and contributors.
73
+
74
+ - Learn more: [Isabl documentation][documentation].
75
+
76
+ ## 📓 Publication
77
+
78
+ >Medina-Martínez, J.S., Arango-Ossa, J.E., Levine, M.F. et al. Isabl Platform, a digital biobank for processing multimodal patient data. BMC Bioinformatics 21, 549 (2020).
79
+
80
+ <https://doi.org/10.1186/s12859-020-03879-7>
81
+
82
+ ## Installation
83
+
84
+ ```bash
85
+ pip install isabl_cli
86
+ ```
87
+
88
+ ## Development Setup
89
+
90
+ ### Prerequisites
91
+
92
+ - Python 3.6 or higher
93
+ - Docker and Docker Compose (for running integration tests)
94
+ - Git (for cloning the API repository during tests)
95
+
96
+ ### Setup Steps
97
+
98
+ 1. Clone the repository:
99
+
100
+ ```bash
101
+ git clone https://github.com/papaemmelab/isabl_cli.git
102
+ cd isabl_cli
103
+ ```
104
+
105
+ 2. Install the package in editable mode with test dependencies:
106
+
107
+ ```bash
108
+ pip install -e .[test]
109
+ ```
110
+
111
+ This installs the package in development mode along with all testing dependencies (pytest, coverage, black, etc.).
112
+
113
+ 3. Verify the installation:
114
+
115
+ ```bash
116
+ isabl --help
117
+ ```
118
+
119
+ ## Testing
120
+
121
+ The test suite can be run in two ways:
122
+
123
+ ### Running Tests via Script (Recommended)
124
+
125
+ The test script (`./tests/test-with-compose.sh`) automatically clones the `isabl_api` repository, starts the API and database through Docker containers, then executes the test suite using pytest with coverage reporting.
126
+
127
+ Run the full test suite:
128
+
129
+ ```bash
130
+ ./tests/test-with-compose.sh
131
+ ```
132
+
133
+ To skip the build step (faster for subsequent runs):
134
+
135
+ ```bash
136
+ ./tests/test-with-compose.sh --skip-build
137
+ ```
138
+
139
+ **Note**: The test script requires the API to be running. It will clone the `isabl_api` repository into a sibling `api` directory if it doesn't exist.
140
+
141
+ ### Running Tests Directly
142
+
143
+ If you have a local Isabl API instance running (e.g., via `docker compose up -d` in the `isabl_api` repository), you can run pytest commands directly:
144
+
145
+ ```bash
146
+ # Set required environment variables
147
+ export ISABL_CLIENT_ID=test-cli-client
148
+ export ISABL_API_URL=http://localhost:8000/api/v1/
149
+
150
+ # Run tests with coverage
151
+ pytest --cov=isabl_cli tests/
152
+ ```
153
+
154
+ This allows for faster iteration during development without rebuilding containers.
155
+
156
+ ### Running Specific Tests
157
+
158
+ You can run specific test files or test functions:
159
+
160
+ ```bash
161
+ # Run a specific test file
162
+ pytest tests/test_api.py
163
+
164
+ # Run a specific test function
165
+ pytest tests/test_api.py::test_function_name
166
+
167
+ # Run with verbose output
168
+ pytest -v tests/
169
+ ```
170
+
171
+ ## Usage
172
+
173
+ ```bash
174
+ # Set up your environment variables
175
+ export ISABL_API_URL="http://<your-isabl-instance>/api/v1/"
176
+ export CLIENT_ID="<your-client-id>"
177
+
178
+ # Authenticate and cache credentials
179
+ isabl login
180
+
181
+ # See all available commands
182
+ isabl --help
183
+ ```
184
+
185
+ ## CI/CD Setup
186
+
187
+ The GitHub Actions workflow requires the following secrets to be configured in the repository settings:
188
+
189
+ ### Required Secrets
190
+
191
+ - **`GH_PAT`**: GitHub Personal Access Token for authenticating with GitHub (used to clone the `isabl_api` repository during tests)
192
+ - **`DOCKER_USERNAME`**: Docker Hub username for the [papaemmelab organization](https://hub.docker.com/orgs/papaemmelab/repositories)
193
+ - **`DOCKER_PASSWORD`**: Docker Hub password or access token for the [papaemmelab organization](https://hub.docker.com/orgs/papaemmelab/repositories)
194
+ - **`CODECOV_TOKEN`**: Codecov token for the [papaemmelab/isabl_cli repository](https://app.codecov.io/gh/papaemmelab/isabl_cli)
195
+
196
+ Configure these secrets in your GitHub repository under **Settings → Secrets and variables → Actions**.
197
+
198
+ ## Contributing
199
+
200
+ Contributions are welcome and greatly appreciated, check our [contributing guidelines]!
201
+
202
+ ## License
203
+
204
+ isabl is free for academic and research use. For commercial use, please contact us.
205
+
206
+ ## Credits
207
+
208
+ Isabl was created at [Elli Papaemmanuil's lab].
209
+
210
+ [documentation]: https://docs.isabl.io
211
+ [contributing guidelines]: https://docs.isabl.io/contributing-guide
212
+ [elli papaemmanuil's lab]: https://www.mskcc.org/research-areas/labs/elli-papaemmanuil
213
+ [black_badge]: https://img.shields.io/badge/code%20style-black-000000.svg
214
+ [black_base]: https://github.com/ambv/black
215
+ [codecov_badge]: https://codecov.io/github/papaemmelab/isabl_cli/graph/badge.svg?token=ODJ8DU73PH
216
+ [codecov_base]: https://codecov.io/github/papaemmelab/isabl_cli
217
+ [pypi_badge]: https://img.shields.io/pypi/v/isabl_cli.svg
218
+ [pypi_base]: https://pypi.python.org/pypi/isabl_cli
219
+ [gh_actions_badge]: https://github.com/papaemmelab/isabl_cli/actions/workflows/run-test.yaml/badge.svg
220
+ [gh_actions_base]: https://github.com/papaemmelab/isabl_cli/actions/workflows/run-test.yaml
221
+ [mcp_badge]: https://img.shields.io/badge/MCP-compatible-blue
222
+ [mcp_base]: https://github.com/juanesarango/isabl-mcp
@@ -0,0 +1,172 @@
1
+ # Isabl CLI
2
+
3
+ [![Run Isabl CLI tests][gh_actions_badge]][gh_actions_base]
4
+ [![pypi badge][pypi_badge]][pypi_base]
5
+ [![codecov badge][codecov_badge]][codecov_base]
6
+ [![code formatting][black_badge]][black_base]
7
+ [![MCP][mcp_badge]][mcp_base]
8
+
9
+ > **_Terms of Use: Academic Research_**
10
+
11
+ > [!TIP]
12
+ > Talk to your genomics data with AI. Try the [Isabl MCP Server](https://github.com/juanesarango/isabl-mcp) with Claude Code, Cursor, or your favorite agentic tool.
13
+
14
+ `isabl_cli` is a command line client and SDK for the Isabl Platform infrastructure.
15
+
16
+ ## 🧬 Isabl Platform
17
+
18
+ - Isabl is a platform for the integration, management, and processing of individual-centric multimodal data. Welcome to the Isabl Documentation!
19
+
20
+ - Isabl is a plug-and-play data science framework designed to support the processing of multimodal patient-centric data. Have questions? Ask here.
21
+
22
+ - Isabl has been developed by the [Elli Papaemmanuil's Lab](https://papaemmelab.org) at [Memorial Sloan Kettering Cancer Center](https://www.mskcc.org/research/ski), and it's currently used by multiple scientific groups and contributors.
23
+
24
+ - Learn more: [Isabl documentation][documentation].
25
+
26
+ ## 📓 Publication
27
+
28
+ >Medina-Martínez, J.S., Arango-Ossa, J.E., Levine, M.F. et al. Isabl Platform, a digital biobank for processing multimodal patient data. BMC Bioinformatics 21, 549 (2020).
29
+
30
+ <https://doi.org/10.1186/s12859-020-03879-7>
31
+
32
+ ## Installation
33
+
34
+ ```bash
35
+ pip install isabl_cli
36
+ ```
37
+
38
+ ## Development Setup
39
+
40
+ ### Prerequisites
41
+
42
+ - Python 3.6 or higher
43
+ - Docker and Docker Compose (for running integration tests)
44
+ - Git (for cloning the API repository during tests)
45
+
46
+ ### Setup Steps
47
+
48
+ 1. Clone the repository:
49
+
50
+ ```bash
51
+ git clone https://github.com/papaemmelab/isabl_cli.git
52
+ cd isabl_cli
53
+ ```
54
+
55
+ 2. Install the package in editable mode with test dependencies:
56
+
57
+ ```bash
58
+ pip install -e .[test]
59
+ ```
60
+
61
+ This installs the package in development mode along with all testing dependencies (pytest, coverage, black, etc.).
62
+
63
+ 3. Verify the installation:
64
+
65
+ ```bash
66
+ isabl --help
67
+ ```
68
+
69
+ ## Testing
70
+
71
+ The test suite can be run in two ways:
72
+
73
+ ### Running Tests via Script (Recommended)
74
+
75
+ The test script (`./tests/test-with-compose.sh`) automatically clones the `isabl_api` repository, starts the API and database through Docker containers, then executes the test suite using pytest with coverage reporting.
76
+
77
+ Run the full test suite:
78
+
79
+ ```bash
80
+ ./tests/test-with-compose.sh
81
+ ```
82
+
83
+ To skip the build step (faster for subsequent runs):
84
+
85
+ ```bash
86
+ ./tests/test-with-compose.sh --skip-build
87
+ ```
88
+
89
+ **Note**: The test script requires the API to be running. It will clone the `isabl_api` repository into a sibling `api` directory if it doesn't exist.
90
+
91
+ ### Running Tests Directly
92
+
93
+ If you have a local Isabl API instance running (e.g., via `docker compose up -d` in the `isabl_api` repository), you can run pytest commands directly:
94
+
95
+ ```bash
96
+ # Set required environment variables
97
+ export ISABL_CLIENT_ID=test-cli-client
98
+ export ISABL_API_URL=http://localhost:8000/api/v1/
99
+
100
+ # Run tests with coverage
101
+ pytest --cov=isabl_cli tests/
102
+ ```
103
+
104
+ This allows for faster iteration during development without rebuilding containers.
105
+
106
+ ### Running Specific Tests
107
+
108
+ You can run specific test files or test functions:
109
+
110
+ ```bash
111
+ # Run a specific test file
112
+ pytest tests/test_api.py
113
+
114
+ # Run a specific test function
115
+ pytest tests/test_api.py::test_function_name
116
+
117
+ # Run with verbose output
118
+ pytest -v tests/
119
+ ```
120
+
121
+ ## Usage
122
+
123
+ ```bash
124
+ # Set up your environment variables
125
+ export ISABL_API_URL="http://<your-isabl-instance>/api/v1/"
126
+ export CLIENT_ID="<your-client-id>"
127
+
128
+ # Authenticate and cache credentials
129
+ isabl login
130
+
131
+ # See all available commands
132
+ isabl --help
133
+ ```
134
+
135
+ ## CI/CD Setup
136
+
137
+ The GitHub Actions workflow requires the following secrets to be configured in the repository settings:
138
+
139
+ ### Required Secrets
140
+
141
+ - **`GH_PAT`**: GitHub Personal Access Token for authenticating with GitHub (used to clone the `isabl_api` repository during tests)
142
+ - **`DOCKER_USERNAME`**: Docker Hub username for the [papaemmelab organization](https://hub.docker.com/orgs/papaemmelab/repositories)
143
+ - **`DOCKER_PASSWORD`**: Docker Hub password or access token for the [papaemmelab organization](https://hub.docker.com/orgs/papaemmelab/repositories)
144
+ - **`CODECOV_TOKEN`**: Codecov token for the [papaemmelab/isabl_cli repository](https://app.codecov.io/gh/papaemmelab/isabl_cli)
145
+
146
+ Configure these secrets in your GitHub repository under **Settings → Secrets and variables → Actions**.
147
+
148
+ ## Contributing
149
+
150
+ Contributions are welcome and greatly appreciated, check our [contributing guidelines]!
151
+
152
+ ## License
153
+
154
+ isabl is free for academic and research use. For commercial use, please contact us.
155
+
156
+ ## Credits
157
+
158
+ Isabl was created at [Elli Papaemmanuil's lab].
159
+
160
+ [documentation]: https://docs.isabl.io
161
+ [contributing guidelines]: https://docs.isabl.io/contributing-guide
162
+ [elli papaemmanuil's lab]: https://www.mskcc.org/research-areas/labs/elli-papaemmanuil
163
+ [black_badge]: https://img.shields.io/badge/code%20style-black-000000.svg
164
+ [black_base]: https://github.com/ambv/black
165
+ [codecov_badge]: https://codecov.io/github/papaemmelab/isabl_cli/graph/badge.svg?token=ODJ8DU73PH
166
+ [codecov_base]: https://codecov.io/github/papaemmelab/isabl_cli
167
+ [pypi_badge]: https://img.shields.io/pypi/v/isabl_cli.svg
168
+ [pypi_base]: https://pypi.python.org/pypi/isabl_cli
169
+ [gh_actions_badge]: https://github.com/papaemmelab/isabl_cli/actions/workflows/run-test.yaml/badge.svg
170
+ [gh_actions_base]: https://github.com/papaemmelab/isabl_cli/actions/workflows/run-test.yaml
171
+ [mcp_badge]: https://img.shields.io/badge/MCP-compatible-blue
172
+ [mcp_base]: https://github.com/juanesarango/isabl-mcp
@@ -0,0 +1 @@
1
+ 2.0.2
@@ -8,6 +8,7 @@ from isabl_cli.api import Analysis
8
8
  from isabl_cli.api import Assembly
9
9
  from isabl_cli.api import Experiment
10
10
  from isabl_cli.api import create_instance
11
+ from isabl_cli.api import delete_instance
11
12
  from isabl_cli.api import get_analyses
12
13
  from isabl_cli.api import get_experiments
13
14
  from isabl_cli.api import get_instance
@@ -406,6 +406,7 @@ class AbstractApplication: # pylint: disable=too-many-public-methods
406
406
  api.patch_analysis_status(analysis, "STARTED")
407
407
  merge_analyses(analysis, analyses)
408
408
  api.patch_analysis_status(analysis, "SUCCEEDED")
409
+ analysis.data["merged_analyses"] = len(analyses)
409
410
  except Exception as e: # pragma: no cover pylint: disable=W0703
410
411
  error_msg = traceback.format_exc()
411
412
  click.echo(error_msg, file=sys.stderr)
@@ -1159,6 +1160,7 @@ class AbstractApplication: # pylint: disable=too-many-public-methods
1159
1160
  app_name (str): `Application.name`.
1160
1161
  app_version (str): `Application.version`. If not defined, use
1161
1162
  any available. Use `any` if you want to use the latest available.
1163
+ app_assembly (str): `Application.assembly.name`. i.e: GRCh37
1162
1164
  linked (bool): if False, the analysis is not linked as a dependencie of
1163
1165
  the analysis. As adding new dependencies to an analysis forces isabl
1164
1166
  to not recognize existing ones (Default: True).
@@ -1182,6 +1184,9 @@ class AbstractApplication: # pylint: disable=too-many-public-methods
1182
1184
  result_args["application_key"] = dependency.get("app").primary_key
1183
1185
  result_args["application_name"] = dependency.get("app").NAME
1184
1186
 
1187
+ if "app_assembly" in dependency:
1188
+ result_args["application_assembly"] = dependency.get("app_assembly")
1189
+
1185
1190
  if "status" in dependency:
1186
1191
  result_args["status"] = dependency["status"]
1187
1192
 
@@ -1200,9 +1205,13 @@ class AbstractApplication: # pylint: disable=too-many-public-methods
1200
1205
  for name, result_specification in specification.items():
1201
1206
  pattern = result_specification.get("pattern")
1202
1207
  exclude = result_specification.get("exclude")
1208
+ optional = result_specification.get("optional")
1203
1209
  if pattern:
1204
1210
  results[name] = utils.first_matching_file(
1205
- analysis.storage_url, pattern, exclude
1211
+ directory=analysis.storage_url,
1212
+ pattern=pattern,
1213
+ exclude=exclude,
1214
+ optional=optional,
1206
1215
  )
1207
1216
  return results
1208
1217
 
@@ -1235,6 +1244,15 @@ class AbstractApplication: # pylint: disable=too-many-public-methods
1235
1244
  for i in specification:
1236
1245
  assert i in results, f"Missing expected result {i} in: {results}"
1237
1246
 
1247
+ # update bam with result if specified
1248
+ for key, attributes in specification.items():
1249
+ if attributes.get("store_as_bam") and results[key]:
1250
+ self.update_experiment_bam_file(
1251
+ experiment=analysis["targets"][0],
1252
+ bam_url=results[key],
1253
+ analysis_pk=analysis["pk"],
1254
+ )
1255
+
1238
1256
  return results
1239
1257
 
1240
1258
  # -----------------
@@ -1527,7 +1545,6 @@ class AbstractApplication: # pylint: disable=too-many-public-methods
1527
1545
  # validate existing analyses
1528
1546
  with click.progressbar(
1529
1547
  existing_analyses,
1530
- file=sys.stderr,
1531
1548
  label=f"Validating tuples of the {len(existing_analyses)} existing analyses...\t\t",
1532
1549
  ) as bar:
1533
1550
  for i in bar:
@@ -1543,7 +1560,6 @@ class AbstractApplication: # pylint: disable=too-many-public-methods
1543
1560
  # create new analyses and validate
1544
1561
  with click.progressbar(
1545
1562
  valid_tuples,
1546
- file=sys.stderr,
1547
1563
  label=f"Creating analyses for {len(valid_tuples)} tuples...\t\t",
1548
1564
  ) as bar:
1549
1565
  for i in bar:
@@ -1585,7 +1601,7 @@ class AbstractApplication: # pylint: disable=too-many-public-methods
1585
1601
  if not tuples: # pragma: no cover
1586
1602
  return [], []
1587
1603
 
1588
- click.echo("Checking for existing analyses...", file=sys.stderr)
1604
+ click.echo("Checking for existing analyses...")
1589
1605
  projects = {j["pk"] for i in tuples for j in i[0][0]["projects"]}
1590
1606
  cache = defaultdict(list)
1591
1607
  existing, missing = [], []
@@ -156,7 +156,7 @@ def trigger_analyses_merge(analysis):
156
156
  for i in projects.values():
157
157
  pending = api.get_instances_count(
158
158
  endpoint="analyses",
159
- status__in="STARTED,SUBMITTED",
159
+ status__in="STARTED,SUBMITTED,FINISHED",
160
160
  application=analysis["application"]["pk"],
161
161
  projects=i["pk"],
162
162
  )
@@ -130,6 +130,7 @@ class UserSettings:
130
130
  """A class used to manage user specific configurations."""
131
131
 
132
132
  settings_path = join(expanduser("~"), ".isabl", "settings.json")
133
+ api_url = os.environ.get("ISABL_API_URL", "http://localhost:8000/api/v1/")
133
134
 
134
135
  def __repr__(self): # pragma: no cover
135
136
  """Show all configurations in `settings_path`."""
@@ -141,7 +142,7 @@ class UserSettings:
141
142
 
142
143
  def __getattr__(self, name):
143
144
  """Get attribute from `settings_path`."""
144
- return self._read().get(name, None)
145
+ return self._read().get(self.api_url, {}).get(name, None)
145
146
 
146
147
  def _read(self):
147
148
  """Read settings.json."""
@@ -157,7 +158,9 @@ class UserSettings:
157
158
  data = self._read()
158
159
 
159
160
  with open(self.settings_path, "w") as f:
160
- data[name] = value
161
+ if self.api_url not in data:
162
+ data[self.api_url] = {}
163
+ data[self.api_url][name] = value
161
164
  json.dump(data, f, indent=4, sort_keys=True)
162
165
 
163
166
  os.chmod(self.settings_path, 0o600)
@@ -32,6 +32,7 @@ def get_results(
32
32
  application_key=None,
33
33
  application_name=None,
34
34
  application_version=None,
35
+ application_assembly=None,
35
36
  targets=None,
36
37
  references=None,
37
38
  analyses=None,
@@ -53,10 +54,11 @@ def get_results(
53
54
  application_key (int): key of the application that generated the result.
54
55
  application_name (str): name of the application that generated the result.
55
56
  application_version (str): version of the application that generated the result.
57
+ application_assembly (str): assembly name of the app. i.e: GRCh37.
56
58
  targets (list): target experiments dicts that must match.
57
59
  references (dict): reference experiments dicts that must match.
58
60
  analyses (dict): analyses dicts that must match.
59
- status (str): expected analysis status. For multiple, string with `\`.
61
+ status (str): expected analysis status. For multiple, string with `/`.
60
62
 
61
63
  Returns:
62
64
  list: of tuples (result_value, analysis primary key).
@@ -65,9 +67,15 @@ def get_results(
65
67
  references = {i.pk for i in references or []}
66
68
  analyses = {i.pk for i in analyses or []}
67
69
 
68
- # Filter candidates by same pk or name and/ version
70
+ # Filter candidates by app pk or name and/ version, and assembly, if provided.
69
71
  experiment_results = []
70
72
  for i in experiment.results:
73
+ if (
74
+ application_assembly
75
+ and "assembly" in i.application
76
+ and i.application.get("assembly") != application_assembly
77
+ ):
78
+ continue
71
79
  if application_key:
72
80
  if i.application.pk == application_key:
73
81
  experiment_results.append(i)
@@ -107,7 +115,7 @@ def get_results(
107
115
 
108
116
  # Return latest [`pk`] if more than 1 result and version is `latest`.
109
117
  if len(candidates) > 1 and application_version == "latest":
110
- candidates = [max(candidates, key=lambda x: x.pk)]
118
+ candidates = sorted(candidates, key=lambda x: int(x.pk), reverse=True)[:1]
111
119
 
112
120
  results = []
113
121
  for i in candidates:
@@ -136,13 +144,17 @@ def get_result(*args, **kwargs):
136
144
  args (list): see get_results.
137
145
  kwargs (dict): see get_results.
138
146
  application_name (str): app name to display a more explicit error.
147
+ application_assembly (str): app assembly name to display better error.
139
148
 
140
149
  Returns:
141
150
  tuple: result value, analysis pk that produced the result
142
151
  """
143
152
  app_name = kwargs.get("application_name") or kwargs.get("application_key")
153
+ app_assembly = kwargs.get("application_assembly")
144
154
  results = get_results(*args, **kwargs)
145
- assert results, f"No results found for application: {app_name}"
155
+ assert results, f"No results found for application: {app_name}" + (
156
+ f" for {app_assembly}) assembly" if app_assembly else ""
157
+ )
146
158
  if kwargs.get("application_version") != "latest":
147
159
  assert len(results) == 1, f"Multiple results returned {results}"
148
160
  result, key = results[0]
@@ -269,7 +281,7 @@ def echo_title(title, color="cyan", blink=False):
269
281
  """Echo a title."""
270
282
  title = "\n" + title.strip().upper() + "\n"
271
283
  title += "".join("-" for i in title.strip()) + "\n"
272
- click.secho(title, fg=color, file=sys.stderr, blink=blink)
284
+ click.secho(title, fg=color, blink=blink)
273
285
 
274
286
 
275
287
  def find_owner(filename):
@@ -316,13 +328,21 @@ def send_analytics(command): # noqa
316
328
  return update_wrapper(wrapper, command)
317
329
 
318
330
 
319
- def first_matching_file(directory, pattern, exclude=None):
331
+ def first_matching_file(
332
+ directory,
333
+ pattern,
334
+ exclude=None,
335
+ sort_by_newest=True,
336
+ optional=False,
337
+ ):
320
338
  """
321
339
  Recursively search within a directory for the first file that matches the pattern.
322
340
  Args:
323
341
  directory (str): the directory to search within.
324
342
  pattern (str): a glob pattern (e.g., '*.txt') to match filenames.
325
343
  exclude (str, optional): files containing this substring will be skipped.
344
+ sort_by_newest (bool, optional): sort by file's creation time, newer to older.
345
+ optional (bool): ok if none is found.
326
346
 
327
347
  Returns:
328
348
  str: the path to the first matching file as a string.
@@ -339,8 +359,13 @@ def first_matching_file(directory, pattern, exclude=None):
339
359
  file for file in root_path.rglob(pattern)
340
360
  if not (exclude and exclude in file.name)
341
361
  )
342
-
362
+ if sort_by_newest:
363
+ matching_files = iter(
364
+ sorted(matching_files, key=lambda f: f.stat().st_mtime, reverse=True)
365
+ )
343
366
  try:
344
367
  return str(next(matching_files))
345
368
  except StopIteration: # pragma: no cover
346
- raise FileNotFoundError(f"No file matching pattern '{pattern}' found in '{directory}'")
369
+ if optional:
370
+ return None
371
+ raise FileNotFoundError(f"No file matching pattern '{pattern}' found in '{directory}'")