pyxetabase 4.0.0.dev36__tar.gz → 4.0.0.dev40__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 (40) hide show
  1. {pyxetabase-4.0.0.dev36 → pyxetabase-4.0.0.dev40}/PKG-INFO +1 -1
  2. {pyxetabase-4.0.0.dev36 → pyxetabase-4.0.0.dev40}/pyxetabase/rest_clients/_parent_rest_clients.py +47 -13
  3. {pyxetabase-4.0.0.dev36 → pyxetabase-4.0.0.dev40}/pyxetabase/rest_clients/admin_client.py +4 -7
  4. {pyxetabase-4.0.0.dev36 → pyxetabase-4.0.0.dev40}/pyxetabase/rest_clients/clinical_analysis_client.py +74 -17
  5. {pyxetabase-4.0.0.dev36 → pyxetabase-4.0.0.dev40}/pyxetabase/rest_clients/cohort_client.py +11 -0
  6. {pyxetabase-4.0.0.dev36 → pyxetabase-4.0.0.dev40}/pyxetabase/rest_clients/disease_panel_client.py +13 -0
  7. {pyxetabase-4.0.0.dev36 → pyxetabase-4.0.0.dev40}/pyxetabase/rest_clients/variant_operation_client.py +0 -27
  8. {pyxetabase-4.0.0.dev36 → pyxetabase-4.0.0.dev40}/pyxetabase.egg-info/PKG-INFO +1 -1
  9. {pyxetabase-4.0.0.dev36 → pyxetabase-4.0.0.dev40}/setup.py +1 -1
  10. {pyxetabase-4.0.0.dev36 → pyxetabase-4.0.0.dev40}/LICENSE +0 -0
  11. {pyxetabase-4.0.0.dev36 → pyxetabase-4.0.0.dev40}/README.rst +0 -0
  12. {pyxetabase-4.0.0.dev36 → pyxetabase-4.0.0.dev40}/pyxetabase/__init__.py +0 -0
  13. {pyxetabase-4.0.0.dev36 → pyxetabase-4.0.0.dev40}/pyxetabase/commons.py +0 -0
  14. {pyxetabase-4.0.0.dev36 → pyxetabase-4.0.0.dev40}/pyxetabase/exceptions.py +0 -0
  15. {pyxetabase-4.0.0.dev36 → pyxetabase-4.0.0.dev40}/pyxetabase/opencga_client.py +0 -0
  16. {pyxetabase-4.0.0.dev36 → pyxetabase-4.0.0.dev40}/pyxetabase/opencga_config.py +0 -0
  17. {pyxetabase-4.0.0.dev36 → pyxetabase-4.0.0.dev40}/pyxetabase/rest_clients/__init__.py +0 -0
  18. {pyxetabase-4.0.0.dev36 → pyxetabase-4.0.0.dev40}/pyxetabase/rest_clients/alignment_client.py +0 -0
  19. {pyxetabase-4.0.0.dev36 → pyxetabase-4.0.0.dev40}/pyxetabase/rest_clients/cvdb_client.py +0 -0
  20. {pyxetabase-4.0.0.dev36 → pyxetabase-4.0.0.dev40}/pyxetabase/rest_clients/family_client.py +0 -0
  21. {pyxetabase-4.0.0.dev36 → pyxetabase-4.0.0.dev40}/pyxetabase/rest_clients/federation_client.py +0 -0
  22. {pyxetabase-4.0.0.dev36 → pyxetabase-4.0.0.dev40}/pyxetabase/rest_clients/file_client.py +0 -0
  23. {pyxetabase-4.0.0.dev36 → pyxetabase-4.0.0.dev40}/pyxetabase/rest_clients/ga4gh_client.py +0 -0
  24. {pyxetabase-4.0.0.dev36 → pyxetabase-4.0.0.dev40}/pyxetabase/rest_clients/individual_client.py +0 -0
  25. {pyxetabase-4.0.0.dev36 → pyxetabase-4.0.0.dev40}/pyxetabase/rest_clients/job_client.py +0 -0
  26. {pyxetabase-4.0.0.dev36 → pyxetabase-4.0.0.dev40}/pyxetabase/rest_clients/meta_client.py +0 -0
  27. {pyxetabase-4.0.0.dev36 → pyxetabase-4.0.0.dev40}/pyxetabase/rest_clients/organization_client.py +0 -0
  28. {pyxetabase-4.0.0.dev36 → pyxetabase-4.0.0.dev40}/pyxetabase/rest_clients/project_client.py +0 -0
  29. {pyxetabase-4.0.0.dev36 → pyxetabase-4.0.0.dev40}/pyxetabase/rest_clients/sample_client.py +0 -0
  30. {pyxetabase-4.0.0.dev36 → pyxetabase-4.0.0.dev40}/pyxetabase/rest_clients/study_client.py +0 -0
  31. {pyxetabase-4.0.0.dev36 → pyxetabase-4.0.0.dev40}/pyxetabase/rest_clients/user_client.py +0 -0
  32. {pyxetabase-4.0.0.dev36 → pyxetabase-4.0.0.dev40}/pyxetabase/rest_clients/variant_client.py +0 -0
  33. {pyxetabase-4.0.0.dev36 → pyxetabase-4.0.0.dev40}/pyxetabase/rest_clients/workflow_client.py +0 -0
  34. {pyxetabase-4.0.0.dev36 → pyxetabase-4.0.0.dev40}/pyxetabase/rest_response.py +0 -0
  35. {pyxetabase-4.0.0.dev36 → pyxetabase-4.0.0.dev40}/pyxetabase/retry.py +0 -0
  36. {pyxetabase-4.0.0.dev36 → pyxetabase-4.0.0.dev40}/pyxetabase.egg-info/SOURCES.txt +0 -0
  37. {pyxetabase-4.0.0.dev36 → pyxetabase-4.0.0.dev40}/pyxetabase.egg-info/dependency_links.txt +0 -0
  38. {pyxetabase-4.0.0.dev36 → pyxetabase-4.0.0.dev40}/pyxetabase.egg-info/requires.txt +0 -0
  39. {pyxetabase-4.0.0.dev36 → pyxetabase-4.0.0.dev40}/pyxetabase.egg-info/top_level.txt +0 -0
  40. {pyxetabase-4.0.0.dev36 → pyxetabase-4.0.0.dev40}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyxetabase
3
- Version: 4.0.0.dev36
3
+ Version: 4.0.0.dev40
4
4
  Summary: A REST client for OpenCGA enterprise REST web services
5
5
  Author: Daniel Perez-Gil
6
6
  Author-email: daniel.perez@zettagenomics.com
@@ -1,6 +1,7 @@
1
- import json
1
+ import os
2
+ import requests
2
3
 
3
- from pyxetabase.commons import execute
4
+ from pyxetabase.commons import execute, _create_rest_url, snake_to_camel_case
4
5
  from pyxetabase.rest_response import RestResponse
5
6
  from pyxetabase.retry import retry
6
7
 
@@ -87,18 +88,23 @@ class _ParentRestClient(object):
87
88
  def _post(self, category, resource, data=None, query_id=None, subcategory=None,
88
89
  second_query_id=None, **options):
89
90
  """Queries the REST service and returns the result"""
90
- if data is not None:
91
- return self._rest_retry(
92
- method='post', category=category, resource=resource, query_id=query_id,
93
- subcategory=subcategory, second_query_id=second_query_id,
94
- data=data, **options
95
- )
91
+ # Special treatment for the "/{apiVersion}/files/upload" endpoint
92
+ if category == 'files' and resource == 'upload':
93
+ response = self._upload(category=category, resource=resource, **options)
94
+ return RestResponse(response)
96
95
  else:
97
- return self._rest_retry(
98
- method='post', category=category, resource=resource, query_id=query_id,
99
- subcategory=subcategory, second_query_id=second_query_id,
100
- **options
101
- )
96
+ if data is not None:
97
+ return self._rest_retry(
98
+ method='post', category=category, resource=resource, query_id=query_id,
99
+ subcategory=subcategory, second_query_id=second_query_id,
100
+ data=data, **options
101
+ )
102
+ else:
103
+ return self._rest_retry(
104
+ method='post', category=category, resource=resource, query_id=query_id,
105
+ subcategory=subcategory, second_query_id=second_query_id,
106
+ **options
107
+ )
102
108
 
103
109
  def _delete(self, category, resource, query_id=None, subcategory=None,
104
110
  second_query_id=None, **options):
@@ -108,3 +114,31 @@ class _ParentRestClient(object):
108
114
  subcategory=subcategory, second_query_id=second_query_id,
109
115
  **options
110
116
  )
117
+
118
+ def _upload(self, category, resource, **options):
119
+ """Upload files"""
120
+
121
+ # Checking that the parameter file contains the file path to upload
122
+ if 'file' not in options or not isinstance(options['file'], str):
123
+ raise ValueError('To upload a file, please specify the file path as the "file" parameter.')
124
+
125
+ # Creating URL and headers
126
+ url, header = _create_rest_url(host=self._cfg.host, version=self._cfg.version, sid=self.token,
127
+ category=category, resource=resource, options=options)
128
+
129
+ # Creating data
130
+ data = {}
131
+ for k, v in options.items():
132
+ if k == 'file': # Param "file" is not included in data
133
+ continue
134
+ data[snake_to_camel_case(k)] = v
135
+
136
+ # Uploading
137
+ fpath = os.path.realpath(os.path.expanduser(options['file']))
138
+ with open(fpath, "rb") as f:
139
+ fhand = {"file": (fpath, f, "application/octet-stream")}
140
+ response = requests.post(url, headers=header, files=fhand, data=data or None)
141
+ if response.status_code != 200:
142
+ raise Exception(response.content)
143
+
144
+ return response.json()
@@ -54,16 +54,13 @@ class Admin(_ParentRestClient):
54
54
 
55
55
  return self._post(category='admin', resource='install', subcategory='catalog', data=data, **options)
56
56
 
57
- def jwt_catalog(self, data=None, **options):
57
+ def list_organizations(self, **options):
58
58
  """
59
- Change JWT secret key.
60
- PATH: /{apiVersion}/admin/catalog/jwt
61
-
62
- :param dict data: JSON containing the parameters. (REQUIRED)
63
- :param str organization: Organization id.
59
+ List current Organizations.
60
+ PATH: /{apiVersion}/admin/organizations/list
64
61
  """
65
62
 
66
- return self._post(category='admin', resource='jwt', subcategory='catalog', data=data, **options)
63
+ return self._get(category='admin', resource='list', subcategory='organizations', **options)
67
64
 
68
65
  def fetch_resource(self, data=None, **options):
69
66
  """
@@ -350,6 +350,32 @@ class ClinicalAnalysis(_ParentRestClient):
350
350
 
351
351
  return self._get(category='analysis', resource='info', subcategory='clinical/interpretation', second_query_id=interpretations, **options)
352
352
 
353
+ def run_interpreter_cancer_tiering(self, data=None, **options):
354
+ """
355
+ Run cancer tiering interpretation analysis.
356
+ PATH: /{apiVersion}/analysis/clinical/interpreter/cancerTiering/run
357
+
358
+ :param dict data: Cancer tiering interpretation analysis params.
359
+ (REQUIRED)
360
+ :param str study: Study [[organization@]project:]study where study and
361
+ project can be either the ID or UUID.
362
+ :param str job_id: Job ID. It must be a unique string within the
363
+ study. An ID will be autogenerated automatically if not provided.
364
+ :param str job_description: Job description.
365
+ :param str job_depends_on: Comma separated list of existing job IDs
366
+ the job will depend on.
367
+ :param str job_tags: Job tags.
368
+ :param str job_scheduled_start_time: Time when the job is scheduled to
369
+ start.
370
+ :param str job_priority: Priority of the job.
371
+ :param bool job_dry_run: Flag indicating that the job will be executed
372
+ in dry-run mode. In this mode, OpenCGA will validate that all
373
+ parameters and prerequisites are correctly set for successful
374
+ execution, but the job will not actually run.
375
+ """
376
+
377
+ return self._post(category='analysis', resource='run', subcategory='clinical/interpreter/cancerTiering', data=data, **options)
378
+
353
379
  def run_interpreter_exomiser(self, data=None, **options):
354
380
  """
355
381
  Run exomiser interpretation analysis.
@@ -375,31 +401,62 @@ class ClinicalAnalysis(_ParentRestClient):
375
401
 
376
402
  return self._post(category='analysis', resource='run', subcategory='clinical/interpreter/exomiser', data=data, **options)
377
403
 
378
- def query_interpreter_rd(self, **options):
404
+ def run_interpreter_team(self, data=None, **options):
405
+ """
406
+ Run TEAM interpretation analysis.
407
+ PATH: /{apiVersion}/analysis/clinical/interpreter/team/run
408
+
409
+ :param dict data: TEAM interpretation analysis params. (REQUIRED)
410
+ :param str study: Study [[organization@]project:]study where study and
411
+ project can be either the ID or UUID.
412
+ :param str job_id: Job ID. It must be a unique string within the
413
+ study. An ID will be autogenerated automatically if not provided.
414
+ :param str job_description: Job description.
415
+ :param str job_depends_on: Comma separated list of existing job IDs
416
+ the job will depend on.
417
+ :param str job_tags: Job tags.
418
+ :param str job_scheduled_start_time: Time when the job is scheduled to
419
+ start.
420
+ :param str job_priority: Priority of the job.
421
+ :param bool job_dry_run: Flag indicating that the job will be executed
422
+ in dry-run mode. In this mode, OpenCGA will validate that all
423
+ parameters and prerequisites are correctly set for successful
424
+ execution, but the job will not actually run.
425
+ """
426
+
427
+ return self._post(category='analysis', resource='run', subcategory='clinical/interpreter/team', data=data, **options)
428
+
429
+ def run_interpreter_tiering(self, data=None, **options):
379
430
  """
380
- RD interpretation analysis.
381
- PATH: /{apiVersion}/analysis/clinical/interpreter/rd/query
431
+ Run tiering interpretation analysis.
432
+ PATH: /{apiVersion}/analysis/clinical/interpreter/tiering/run
382
433
 
383
- :param str clinical_analysis_id: Clinical analysis ID.
384
- :param str proband_id: Proband ID.
385
- :param str family_id: Family ID.
386
- :param str panel_ids: List of panel IDs (separated by commas).
387
- :param str disorder_id: Disorder ID.
388
- :param str config_file: RD interpretation configuration file
389
- (otherwise the default one will be used).
434
+ :param dict data: Tiering interpretation analysis params. (REQUIRED)
390
435
  :param str study: Study [[organization@]project:]study where study and
391
436
  project can be either the ID or UUID.
437
+ :param str job_id: Job ID. It must be a unique string within the
438
+ study. An ID will be autogenerated automatically if not provided.
439
+ :param str job_description: Job description.
440
+ :param str job_depends_on: Comma separated list of existing job IDs
441
+ the job will depend on.
442
+ :param str job_tags: Job tags.
443
+ :param str job_scheduled_start_time: Time when the job is scheduled to
444
+ start.
445
+ :param str job_priority: Priority of the job.
446
+ :param bool job_dry_run: Flag indicating that the job will be executed
447
+ in dry-run mode. In this mode, OpenCGA will validate that all
448
+ parameters and prerequisites are correctly set for successful
449
+ execution, but the job will not actually run.
392
450
  """
393
451
 
394
- return self._get(category='analysis', resource='query', subcategory='clinical/interpreter/rd', **options)
452
+ return self._post(category='analysis', resource='run', subcategory='clinical/interpreter/tiering', data=data, **options)
395
453
 
396
- def run_interpreter_rd(self, data=None, **options):
454
+ def run_interpreter_zetta(self, data=None, **options):
397
455
  """
398
- Run clinical interpretation analysis for rare diseases.
399
- PATH: /{apiVersion}/analysis/clinical/interpreter/rd/run
456
+ Run Zetta interpretation analysis.
457
+ PATH: /{apiVersion}/analysis/clinical/interpreter/zetta/run
400
458
 
401
- :param dict data: Parameters to execute the rare disease
402
- interpretation analysis. (REQUIRED)
459
+ :param dict data: Zetta interpretation analysis params. (REQUIRED)
403
460
  :param str study: Study [[organization@]project:]study where study and
404
461
  project can be either the ID or UUID.
405
462
  :param str job_id: Job ID. It must be a unique string within the
@@ -417,7 +474,7 @@ class ClinicalAnalysis(_ParentRestClient):
417
474
  execution, but the job will not actually run.
418
475
  """
419
476
 
420
- return self._post(category='analysis', resource='run', subcategory='clinical/interpreter/rd', data=data, **options)
477
+ return self._post(category='analysis', resource='run', subcategory='clinical/interpreter/zetta', data=data, **options)
421
478
 
422
479
  def load(self, data=None, **options):
423
480
  """
@@ -61,6 +61,9 @@ class Cohort(_ParentRestClient):
61
61
  :param str status: status.
62
62
  :param str internal_status: internalStatus.
63
63
  :param str annotation: Cohort annotation.
64
+ :param str tags: Tags. Also admits basic regular expressions using the
65
+ operator '~', i.e. '~{perl-regex}' e.g. '~value' for case
66
+ sensitive, '~/value/i' for case insensitive search.
64
67
  :param str acl: acl.
65
68
  :param str samples: Cohort sample IDs.
66
69
  :param str num_samples: Number of samples.
@@ -137,6 +140,9 @@ class Cohort(_ParentRestClient):
137
140
  :param str uuid: Comma separated list of cohort IDs up to a maximum of
138
141
  100.
139
142
  :param str type: Cohort type.
143
+ :param str tags: Tags. Also admits basic regular expressions using the
144
+ operator '~', i.e. '~{perl-regex}' e.g. '~value' for case
145
+ sensitive, '~/value/i' for case insensitive search.
140
146
  :param str creation_date: creationDate.
141
147
  :param str modification_date: modificationDate.
142
148
  :param bool deleted: deleted.
@@ -223,6 +229,9 @@ class Cohort(_ParentRestClient):
223
229
  :param str uuid: Comma separated list of cohort IDs up to a maximum of
224
230
  100.
225
231
  :param str type: Cohort type.
232
+ :param str tags: Tags. Also admits basic regular expressions using the
233
+ operator '~', i.e. '~{perl-regex}' e.g. '~value' for case
234
+ sensitive, '~/value/i' for case insensitive search.
226
235
  :param str creation_date: creationDate.
227
236
  :param str modification_date: modificationDate.
228
237
  :param bool deleted: deleted.
@@ -303,6 +312,8 @@ class Cohort(_ParentRestClient):
303
312
  :param str annotation_sets_action: Action to be performed if the array
304
313
  of annotationSets is being updated. Allowed values: ['ADD SET
305
314
  REMOVE']
315
+ :param str tags_action: Action to be performed if the array of tags is
316
+ being updated. Allowed values: ['ADD SET REMOVE']
306
317
  :param bool include_result: Flag indicating to include the created or
307
318
  updated document result in the response.
308
319
  :param dict data: body.
@@ -192,6 +192,19 @@ class DiseasePanel(_ParentRestClient):
192
192
 
193
193
  :param str study: Study [[organization@]project:]study where study and
194
194
  project can be either the ID or UUID.
195
+ :param str job_id: Job ID. It must be a unique string within the
196
+ study. An ID will be autogenerated automatically if not provided.
197
+ :param str job_depends_on: Comma separated list of existing job IDs
198
+ the job will depend on.
199
+ :param str job_description: Job description.
200
+ :param str job_tags: Job tags.
201
+ :param str job_scheduled_start_time: Time when the job is scheduled to
202
+ start.
203
+ :param str job_priority: Priority of the job.
204
+ :param bool job_dry_run: Flag indicating that the job will be executed
205
+ in dry-run mode. In this mode, OpenCGA will validate that all
206
+ parameters and prerequisites are correctly set for successful
207
+ execution, but the job will not actually run.
195
208
  :param dict data: Panel parameters.
196
209
  """
197
210
 
@@ -627,33 +627,6 @@ class VariantOperation(_ParentRestClient):
627
627
 
628
628
  return self._post(category='operation', resource='secondaryIndex', subcategory='variant', data=data, **options)
629
629
 
630
- def delete_variant_secondary_index(self, **options):
631
- """
632
- Remove a secondary index from the search engine for a specific set of
633
- samples.
634
- PATH: /{apiVersion}/operation/variant/secondaryIndex/delete
635
-
636
- :param str job_id: Job ID. It must be a unique string within the
637
- study. An ID will be autogenerated automatically if not provided.
638
- :param str job_description: Job description.
639
- :param str job_depends_on: Comma separated list of existing job IDs
640
- the job will depend on.
641
- :param str job_tags: Job tags.
642
- :param str job_scheduled_start_time: Time when the job is scheduled to
643
- start.
644
- :param str job_priority: Priority of the job.
645
- :param bool job_dry_run: Flag indicating that the job will be executed
646
- in dry-run mode. In this mode, OpenCGA will validate that all
647
- parameters and prerequisites are correctly set for successful
648
- execution, but the job will not actually run.
649
- :param str study: Study [[organization@]project:]study where study and
650
- project can be either the ID or UUID.
651
- :param str samples: Samples to remove. Needs to provide all the
652
- samples in the secondary index.
653
- """
654
-
655
- return self._delete(category='operation', resource='delete', subcategory='variant/secondaryIndex', **options)
656
-
657
630
  def setup_variant(self, data=None, **options):
658
631
  """
659
632
  Execute Variant Setup to allow using the variant engine. This setup is
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyxetabase
3
- Version: 4.0.0.dev36
3
+ Version: 4.0.0.dev40
4
4
  Summary: A REST client for OpenCGA enterprise REST web services
5
5
  Author: Daniel Perez-Gil
6
6
  Author-email: daniel.perez@zettagenomics.com
@@ -14,7 +14,7 @@ with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
14
14
 
15
15
  setup(
16
16
  name='pyxetabase',
17
- version='4.0.0.dev36',
17
+ version='4.0.0.dev40',
18
18
  description='A REST client for OpenCGA enterprise REST web services',
19
19
  long_description=long_description,
20
20
  long_description_content_type='text/x-rst',