pyxetabase 4.0.0.dev29__py3-none-any.whl → 4.0.0.dev35__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.
@@ -1,7 +1,6 @@
1
- import os
2
- import requests
1
+ import json
3
2
 
4
- from pyxetabase.commons import execute, _create_rest_url, snake_to_camel_case
3
+ from pyxetabase.commons import execute
5
4
  from pyxetabase.rest_response import RestResponse
6
5
  from pyxetabase.retry import retry
7
6
 
@@ -88,23 +87,18 @@ class _ParentRestClient(object):
88
87
  def _post(self, category, resource, data=None, query_id=None, subcategory=None,
89
88
  second_query_id=None, **options):
90
89
  """Queries the REST service and returns the result"""
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)
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
+ )
95
96
  else:
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
- )
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
+ )
108
102
 
109
103
  def _delete(self, category, resource, query_id=None, subcategory=None,
110
104
  second_query_id=None, **options):
@@ -114,31 +108,3 @@ class _ParentRestClient(object):
114
108
  subcategory=subcategory, second_query_id=second_query_id,
115
109
  **options
116
110
  )
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()
@@ -350,32 +350,6 @@ 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
-
379
353
  def run_interpreter_exomiser(self, data=None, **options):
380
354
  """
381
355
  Run exomiser interpretation analysis.
@@ -401,62 +375,26 @@ class ClinicalAnalysis(_ParentRestClient):
401
375
 
402
376
  return self._post(category='analysis', resource='run', subcategory='clinical/interpreter/exomiser', data=data, **options)
403
377
 
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):
378
+ def query_interpreter_rd(self, **options):
430
379
  """
431
- Run tiering interpretation analysis.
432
- PATH: /{apiVersion}/analysis/clinical/interpreter/tiering/run
380
+ RD interpretation analysis.
381
+ PATH: /{apiVersion}/analysis/clinical/interpreter/rd/query
433
382
 
434
- :param dict data: Tiering interpretation analysis params. (REQUIRED)
383
+ :param str clinical_analysis_id: Comma separated list of clinical
384
+ analysis IDs or names up to a maximum of 100.
435
385
  :param str study: Study [[organization@]project:]study where study and
436
386
  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.
450
387
  """
451
388
 
452
- return self._post(category='analysis', resource='run', subcategory='clinical/interpreter/tiering', data=data, **options)
389
+ return self._get(category='analysis', resource='query', subcategory='clinical/interpreter/rd', **options)
453
390
 
454
- def run_interpreter_zetta(self, data=None, **options):
391
+ def run_interpreter_rd(self, data=None, **options):
455
392
  """
456
- Run Zetta interpretation analysis.
457
- PATH: /{apiVersion}/analysis/clinical/interpreter/zetta/run
393
+ Run clinical interpretation analysis for rare diseases.
394
+ PATH: /{apiVersion}/analysis/clinical/interpreter/rd/run
458
395
 
459
- :param dict data: Zetta interpretation analysis params. (REQUIRED)
396
+ :param dict data: Parameters to execute the rare disease
397
+ interpretation analysis. (REQUIRED)
460
398
  :param str study: Study [[organization@]project:]study where study and
461
399
  project can be either the ID or UUID.
462
400
  :param str job_id: Job ID. It must be a unique string within the
@@ -474,7 +412,7 @@ class ClinicalAnalysis(_ParentRestClient):
474
412
  execution, but the job will not actually run.
475
413
  """
476
414
 
477
- return self._post(category='analysis', resource='run', subcategory='clinical/interpreter/zetta', data=data, **options)
415
+ return self._post(category='analysis', resource='run', subcategory='clinical/interpreter/rd', data=data, **options)
478
416
 
479
417
  def load(self, data=None, **options):
480
418
  """
@@ -192,19 +192,6 @@ 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.
208
195
  :param dict data: Panel parameters.
209
196
  """
210
197
 
@@ -627,6 +627,33 @@ 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
+
630
657
  def setup_variant(self, data=None, **options):
631
658
  """
632
659
  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.dev29
3
+ Version: 4.0.0.dev35
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
@@ -6,13 +6,13 @@ pyxetabase/opencga_config.py,sha256=RK23fextK79S5wq4FaQygwuPnE4p4J9GbjY6hJ0Krxc,
6
6
  pyxetabase/rest_response.py,sha256=TgwTI2LZFF_jV9-HSawGkF_qZ88n-dxEtIKiFcfPyDk,8635
7
7
  pyxetabase/retry.py,sha256=LjViQOaa_GkpDFkcRq9jIS183mE9t4Rq0uls9PV_mfI,2297
8
8
  pyxetabase/rest_clients/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
- pyxetabase/rest_clients/_parent_rest_clients.py,sha256=OuCnmaziUCENpmpA3CzKJGEhMY_Z-7Q_rlkH75QDi7I,5854
9
+ pyxetabase/rest_clients/_parent_rest_clients.py,sha256=ZL9VxTxS1cRcg-ofrE9QJXYL8mlVkbXpvFvwhofo-uI,4280
10
10
  pyxetabase/rest_clients/admin_client.py,sha256=WebfbQVa7CjiaNcp5MqwAkgDTqCfW-v5AgTaxmL5EF0,6927
11
11
  pyxetabase/rest_clients/alignment_client.py,sha256=srY1fmjMZCPWlbqhrD2gYVhS2zu7fgPx61tZOqQi4Wc,18509
12
- pyxetabase/rest_clients/clinical_analysis_client.py,sha256=j2LmLT8wg3C9srRMB2mksEVFnqN22Anb7HxZCbdF50c,69126
12
+ pyxetabase/rest_clients/clinical_analysis_client.py,sha256=7JN6mg0QoKaC4yGVr5ujXymh6Dn4Ua4g-9ptb66Fi7A,65708
13
13
  pyxetabase/rest_clients/cohort_client.py,sha256=D-su-AFOziztVMI-oAcr5G2Uq_psbLV8Wt0bqZ7zZgI,16324
14
14
  pyxetabase/rest_clients/cvdb_client.py,sha256=V7ny5nQEeJqsbALAe7JLyoV6b0XyYF7c9lsn-qK-i8o,143102
15
- pyxetabase/rest_clients/disease_panel_client.py,sha256=GAYRyAfoB_VunskXOhAzMNbsrFupb6M2QbRK3x1Y5vo,18513
15
+ pyxetabase/rest_clients/disease_panel_client.py,sha256=WhYn08O4CjfZN-kDZjZgiJge1cfzlGvGL2OO8zUhW_A,17721
16
16
  pyxetabase/rest_clients/family_client.py,sha256=n-kyjnrV09R50JxyiHjFs8rCQkOKFU0Z1O7oVYuaKxg,18586
17
17
  pyxetabase/rest_clients/federation_client.py,sha256=p5B8dRq9gj-fdgIfIPhmkT7mNU65cRFtH06kaGtmbWE,5066
18
18
  pyxetabase/rest_clients/file_client.py,sha256=fwTWnZtprYNDUBvRetLLe6PTBxW_M8LxN6OlAMGWXC4,33730
@@ -26,10 +26,10 @@ pyxetabase/rest_clients/sample_client.py,sha256=VOsPAhw9HwaEHzzw_5gcVQ1v2xSesvzN
26
26
  pyxetabase/rest_clients/study_client.py,sha256=STtboEiGP-lQ1UptjHxk-ANd3uG6cA6U3srvOO4UQIE,21491
27
27
  pyxetabase/rest_clients/user_client.py,sha256=frA7-rMii-yoRyca_Orkj1T80OeEe-zCdWZCHKn1sio,7683
28
28
  pyxetabase/rest_clients/variant_client.py,sha256=mmBuVE0JBThJr5zsLGci5nykNcCKyfZXRKl-h3HT9PA,75436
29
- pyxetabase/rest_clients/variant_operation_client.py,sha256=ceZ2-ii0D1oCDMRz_EURwUf_VjtsV5lzJuY-ZwG1b6Q,36840
29
+ pyxetabase/rest_clients/variant_operation_client.py,sha256=z_9qEpZEoHF8lLfBq-i3wROnoiNjPjBavqPBepiTIyk,38246
30
30
  pyxetabase/rest_clients/workflow_client.py,sha256=QYnyI17aNCjq-uXlguaSj78F0xupeWwmf8uYK1Y5tf4,12482
31
- pyxetabase-4.0.0.dev29.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
32
- pyxetabase-4.0.0.dev29.dist-info/METADATA,sha256=TL6HOzwe313tz-0JeNMPB2aGt2WsY0qniQ1Xl2oxiUc,5540
33
- pyxetabase-4.0.0.dev29.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
34
- pyxetabase-4.0.0.dev29.dist-info/top_level.txt,sha256=0m5pDpBX-lM8QpPl7bTpTQAm4kgu2-nr-pcaEu4Tn_8,11
35
- pyxetabase-4.0.0.dev29.dist-info/RECORD,,
31
+ pyxetabase-4.0.0.dev35.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
32
+ pyxetabase-4.0.0.dev35.dist-info/METADATA,sha256=JZ5oFXMccuHKeBA7TwyQqRD4nPcUQhFXJOgfmaKJPpE,5540
33
+ pyxetabase-4.0.0.dev35.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
34
+ pyxetabase-4.0.0.dev35.dist-info/top_level.txt,sha256=0m5pDpBX-lM8QpPl7bTpTQAm4kgu2-nr-pcaEu4Tn_8,11
35
+ pyxetabase-4.0.0.dev35.dist-info/RECORD,,