dxpy 0.361.0__tar.gz → 0.363.0__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.
- {dxpy-0.361.0 → dxpy-0.363.0}/PKG-INFO +1 -1
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/bindings/search.py +6 -2
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/cli/dataset_utilities.py +32 -9
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/dx_extract_utils/cohort_filter_payload.py +6 -5
- dxpy-0.363.0/dxpy/toolkit_version.py +1 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy.egg-info/PKG-INFO +1 -1
- {dxpy-0.361.0 → dxpy-0.363.0}/test/test_create_cohort.py +4 -2
- dxpy-0.361.0/dxpy/toolkit_version.py +0 -1
- {dxpy-0.361.0 → dxpy-0.363.0}/MANIFEST.in +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/Readme.md +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/__init__.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/api.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/app_builder.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/app_categories.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/asset_builder.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/bindings/__init__.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/bindings/auth.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/bindings/download_all_inputs.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/bindings/dxanalysis.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/bindings/dxapp.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/bindings/dxapp_container_functions.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/bindings/dxapplet.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/bindings/dxdatabase.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/bindings/dxdatabase_functions.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/bindings/dxdataobject_functions.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/bindings/dxfile.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/bindings/dxfile_functions.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/bindings/dxglobalworkflow.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/bindings/dxjob.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/bindings/dxproject.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/bindings/dxrecord.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/bindings/dxworkflow.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/bindings/mount_all_inputs.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/cli/__init__.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/cli/cp.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/cli/download.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/cli/exec_io.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/cli/org.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/cli/parsers.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/cli/workflow.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/compat.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/dx_extract_utils/Homo_sapiens_genes_manifest.json +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/dx_extract_utils/Homo_sapiens_genes_manifest_staging.json +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/dx_extract_utils/Homo_sapiens_genes_manifest_staging_vep.json +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/dx_extract_utils/Homo_sapiens_genes_manifest_vep.json +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/dx_extract_utils/__init__.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/dx_extract_utils/column_conditions.json +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/dx_extract_utils/column_conversion.json +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/dx_extract_utils/filter_to_payload.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/dx_extract_utils/input_validation.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/dx_extract_utils/input_validation_somatic.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/dx_extract_utils/retrieve_allele_schema.json +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/dx_extract_utils/retrieve_annotation_schema.json +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/dx_extract_utils/retrieve_bins.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/dx_extract_utils/retrieve_genotype_schema.json +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/dx_extract_utils/return_columns_allele.json +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/dx_extract_utils/return_columns_annotation.json +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/dx_extract_utils/return_columns_genotype.json +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/dx_extract_utils/somatic_filter_payload.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/dxlog.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/exceptions.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/executable_builder.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/nextflow/ImageRefParser.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/nextflow/__init__.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/nextflow/nextaur_assets.json +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/nextflow/nextaur_assets.staging.json +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/nextflow/nextflow_assets.json +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/nextflow/nextflow_assets.staging.json +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/nextflow/nextflow_builder.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/nextflow/nextflow_templates.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/nextflow/nextflow_utils.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/packages/__init__.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/scripts/__init__.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/scripts/dx.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/scripts/dx_app_wizard.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/scripts/dx_build_app.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/scripts/dx_build_applet.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/ssh_tunnel_app_support.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/system_requirements.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/templating/__init__.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/templating/bash.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/templating/python.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/templating/templates/Readme.md +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/templating/templates/bash/basic/dxapp.json +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/templating/templates/bash/basic/src/code.sh +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/templating/templates/bash/parallelized/dxapp.json +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/templating/templates/bash/parallelized/src/code.sh +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/templating/templates/bash/scatter-process-gather/dxapp.json +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/templating/templates/bash/scatter-process-gather/src/code.sh +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/templating/templates/nextflow/dxapp.json +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/templating/templates/nextflow/src/nextflow.sh +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/templating/templates/python/basic/dxapp.json +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/templating/templates/python/basic/src/code.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/templating/templates/python/basic/test/test.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/templating/templates/python/parallelized/dxapp.json +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/templating/templates/python/parallelized/src/code.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/templating/templates/python/parallelized/test/test.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/templating/templates/python/scatter-process-gather/dxapp.json +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/templating/templates/python/scatter-process-gather/src/code.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/templating/templates/python/scatter-process-gather/test/test.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/templating/utils.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/utils/__init__.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/utils/batch_utils.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/utils/completer.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/utils/config.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/utils/describe.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/utils/exec_utils.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/utils/executable_unbuilder.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/utils/file_handle.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/utils/file_load_utils.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/utils/genomic_utils.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/utils/job_log_client.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/utils/local_exec_utils.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/utils/pathmatch.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/utils/pretty_print.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/utils/printing.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/utils/resolver.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/utils/spelling_corrector.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy/workflow_builder.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy.egg-info/SOURCES.txt +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy.egg-info/dependency_links.txt +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy.egg-info/entry_points.txt +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy.egg-info/not-zip-safe +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy.egg-info/requires.txt +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/dxpy.egg-info/top_level.txt +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/requirements.txt +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/requirements_backports.txt +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/requirements_setuptools.txt +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/requirements_test.txt +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/scripts/dx-clone-asset +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/scripts/dx-docker +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/scripts/dx-download-all-inputs +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/scripts/dx-fetch-bundled-depends +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/scripts/dx-generate-dxapp +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/scripts/dx-jobutil-add-output +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/scripts/dx-jobutil-dxlink +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/scripts/dx-jobutil-new-job +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/scripts/dx-jobutil-parse-link +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/scripts/dx-jobutil-report-error +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/scripts/dx-log-stream +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/scripts/dx-mount-all-inputs +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/scripts/dx-notebook-reconnect +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/scripts/dx-print-bash-vars +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/scripts/dx-upload-all-outputs +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/setup.cfg +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/setup.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/test/nextflow/__init__.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/test/test_batch.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/test/test_describe.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/test/test_dx-docker.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/test/test_dx_app_wizard.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/test/test_dx_bash_helpers.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/test/test_dx_completion.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/test/test_dx_symlink.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/test/test_dxabs.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/test/test_dxasset.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/test/test_dxclient.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/test/test_dxpy.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/test/test_dxpy_utils.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/test/test_dxunpack.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/test/test_extract_assay.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/test/test_extract_dataset.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/test/test_extract_somatic.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/test/test_nextflow.py +0 -0
- {dxpy-0.361.0 → dxpy-0.363.0}/test/test_nextflow_ImageRefParser.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: dxpy
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.363.0
|
|
4
4
|
Summary: DNAnexus Platform API bindings for Python
|
|
5
5
|
Home-page: https://github.com/dnanexus/dx-toolkit
|
|
6
6
|
Author: Aleksandra Zalcman, Andrey Kislyuk, Anurag Biyani, Geet Duggal, Katherine Lai, Kurt Jensen, Marek Hrvol, Ohad Rodeh, Phil Sung
|
|
@@ -114,7 +114,7 @@ def find_data_objects(classname=None, state=None, visibility=None,
|
|
|
114
114
|
modified_after=None, modified_before=None,
|
|
115
115
|
created_after=None, created_before=None,
|
|
116
116
|
describe=False, limit=None, level=None, region=None,
|
|
117
|
-
return_handler=False, first_page_size=100,
|
|
117
|
+
archival_state=None, return_handler=False, first_page_size=100,
|
|
118
118
|
**kwargs):
|
|
119
119
|
"""
|
|
120
120
|
:param classname:
|
|
@@ -160,9 +160,11 @@ def find_data_objects(classname=None, state=None, visibility=None,
|
|
|
160
160
|
things, be used to customize the set of fields that is returned)
|
|
161
161
|
:type describe: bool or dict
|
|
162
162
|
:param level: The minimum permissions level for which results should be returned (one of "VIEW", "UPLOAD", "CONTRIBUTE", or "ADMINISTER")
|
|
163
|
+
:type level: string
|
|
163
164
|
:param region: Filter on result set by the given region(s).
|
|
164
165
|
:type region: string or list of strings
|
|
165
|
-
:
|
|
166
|
+
:param archival_state: Filter by the given archival state (one of "archived", "live", "archival", “unarchiving”, or "any"). Requires classname="file", project, and folder arguments to be provided.
|
|
167
|
+
:type archival_state: string
|
|
166
168
|
:param limit: The maximum number of results to be returned (if not specified, the number of results is unlimited)
|
|
167
169
|
:type limit: int
|
|
168
170
|
:param first_page_size: The number of results that the initial API call will return. Subsequent calls will raise this by multiplying by 2 up to a maximum of 1000.
|
|
@@ -260,6 +262,8 @@ def find_data_objects(classname=None, state=None, visibility=None,
|
|
|
260
262
|
query['level'] = level
|
|
261
263
|
if region is not None:
|
|
262
264
|
query['region'] = region
|
|
265
|
+
if archival_state is not None:
|
|
266
|
+
query['archivalState'] = archival_state
|
|
263
267
|
if limit is not None:
|
|
264
268
|
query["limit"] = limit
|
|
265
269
|
|
|
@@ -28,6 +28,7 @@ import csv
|
|
|
28
28
|
import dxpy
|
|
29
29
|
import codecs
|
|
30
30
|
import subprocess
|
|
31
|
+
from functools import reduce
|
|
31
32
|
from ..utils.printing import fill
|
|
32
33
|
from ..bindings import DXRecord
|
|
33
34
|
from ..bindings.dxdataobject_functions import is_dxlink, describe
|
|
@@ -35,6 +36,7 @@ from ..bindings.dxfile import DXFile
|
|
|
35
36
|
from ..utils.resolver import resolve_existing_path, is_hashid, ResolutionError, resolve_path, check_folder_exists
|
|
36
37
|
from ..utils.file_handle import as_handle
|
|
37
38
|
from ..utils.describe import print_desc
|
|
39
|
+
from ..compat import USING_PYTHON2
|
|
38
40
|
from ..exceptions import (
|
|
39
41
|
err_exit,
|
|
40
42
|
PermissionDenied,
|
|
@@ -1127,13 +1129,29 @@ def resolve_validate_dx_path(path):
|
|
|
1127
1129
|
class VizserverError(Exception):
|
|
1128
1130
|
pass
|
|
1129
1131
|
|
|
1130
|
-
def validate_cohort_ids(descriptor, project, resp,ids):
|
|
1132
|
+
def validate_cohort_ids(descriptor, project, resp, ids):
|
|
1131
1133
|
# Usually the name of the table
|
|
1132
1134
|
entity_name = descriptor.model["global_primary_key"]["entity"]
|
|
1133
1135
|
# The name of the column or field in the table
|
|
1134
1136
|
field_name = descriptor.model["global_primary_key"]["field"]
|
|
1135
1137
|
|
|
1138
|
+
# Get data type of global primay key field
|
|
1139
|
+
gpk_type = descriptor.model["entities"][entity_name]["fields"][field_name]["mapping"]["column_sql_type"]
|
|
1136
1140
|
# Prepare a payload to find entries matching the input ids in the dataset
|
|
1141
|
+
if gpk_type in ["integer", "bigint"]:
|
|
1142
|
+
if USING_PYTHON2:
|
|
1143
|
+
lambda_for_list_conv = lambda a, b: a+[long(b)]
|
|
1144
|
+
else:
|
|
1145
|
+
lambda_for_list_conv = lambda a, b: a+[int(b)]
|
|
1146
|
+
elif gpk_type in ["float", "double"]:
|
|
1147
|
+
lambda_for_list_conv = lambda a, b: a+[float(b)]
|
|
1148
|
+
elif gpk_type in ["string"]:
|
|
1149
|
+
lambda_for_list_conv = lambda a, b: a+[str(b)]
|
|
1150
|
+
else:
|
|
1151
|
+
err_msg = "Invalid input record. Cohort ID field in the input dataset or cohortbrowser record is of type, {type}. Support is currently only available for Cohort ID fields having one of the following types; string, integer and float".format(type = gpk_type)
|
|
1152
|
+
raise ValueError(err_msg)
|
|
1153
|
+
id_list = reduce(lambda_for_list_conv, ids, [])
|
|
1154
|
+
|
|
1137
1155
|
entity_field_name = "{}${}".format(entity_name, field_name)
|
|
1138
1156
|
fields_list = [{field_name: entity_field_name}]
|
|
1139
1157
|
|
|
@@ -1145,7 +1163,7 @@ def validate_cohort_ids(descriptor, project, resp,ids):
|
|
|
1145
1163
|
"pheno_filters": {
|
|
1146
1164
|
"filters": {
|
|
1147
1165
|
entity_field_name: [
|
|
1148
|
-
{"condition": "in", "values":
|
|
1166
|
+
{"condition": "in", "values": id_list}
|
|
1149
1167
|
]
|
|
1150
1168
|
}
|
|
1151
1169
|
}
|
|
@@ -1167,11 +1185,13 @@ def validate_cohort_ids(descriptor, project, resp,ids):
|
|
|
1167
1185
|
discovered_ids.add(result[field_name])
|
|
1168
1186
|
|
|
1169
1187
|
# Compare the discovered cohort ids to the user-provided cohort ids
|
|
1170
|
-
if discovered_ids != set(
|
|
1188
|
+
if discovered_ids != set(id_list):
|
|
1171
1189
|
# Find which given samples are not present in the dataset
|
|
1172
|
-
missing_ids = set(
|
|
1190
|
+
missing_ids = set(id_list).difference(discovered_ids)
|
|
1173
1191
|
err_msg = "The following supplied IDs do not match IDs in the main entity of dataset, {dataset_name}: {ids}".format(dataset_name = resp["dataset"], ids = missing_ids)
|
|
1174
1192
|
raise ValueError(err_msg)
|
|
1193
|
+
|
|
1194
|
+
return id_list, lambda_for_list_conv
|
|
1175
1195
|
|
|
1176
1196
|
|
|
1177
1197
|
def has_access_level(project, access_level):
|
|
@@ -1249,23 +1269,26 @@ def create_cohort(args):
|
|
|
1249
1269
|
rec_descriptor = DXDataset(resp["dataset"], project=dataset_project).get_descriptor()
|
|
1250
1270
|
|
|
1251
1271
|
try:
|
|
1252
|
-
validate_cohort_ids(rec_descriptor, dataset_project, resp, samples)
|
|
1272
|
+
list_of_ids, lambda_for_list_conv = validate_cohort_ids(rec_descriptor, dataset_project, resp, samples)
|
|
1253
1273
|
except ValueError as err:
|
|
1254
|
-
err_exit(str(err))
|
|
1274
|
+
err_exit(str(err), expected_exceptions=(ValueError,))
|
|
1255
1275
|
except VizserverError as err:
|
|
1256
|
-
err_exit(str(err))
|
|
1276
|
+
err_exit(str(err), expected_exceptions=(VizserverError,))
|
|
1257
1277
|
except Exception as err:
|
|
1258
1278
|
err_exit(str(err))
|
|
1259
1279
|
# Input cohort IDs have been succesfully validated
|
|
1260
1280
|
|
|
1281
|
+
# converting list of IDs to list of string IDs
|
|
1282
|
+
|
|
1261
1283
|
base_sql = resp.get("baseSql", resp.get("base_sql"))
|
|
1262
1284
|
try:
|
|
1263
1285
|
raw_cohort_query_payload = cohort_filter_payload(
|
|
1264
|
-
|
|
1286
|
+
list_of_ids,
|
|
1265
1287
|
rec_descriptor.model["global_primary_key"]["entity"],
|
|
1266
1288
|
rec_descriptor.model["global_primary_key"]["field"],
|
|
1267
1289
|
resp.get("filters", {}),
|
|
1268
1290
|
from_project,
|
|
1291
|
+
lambda_for_list_conv,
|
|
1269
1292
|
base_sql,
|
|
1270
1293
|
)
|
|
1271
1294
|
except Exception as e:
|
|
@@ -1321,7 +1344,7 @@ class DXDataset(DXRecord):
|
|
|
1321
1344
|
assert self._record_type in self.types
|
|
1322
1345
|
assert "descriptor" in self.details
|
|
1323
1346
|
if is_dxlink(self.details["descriptor"]):
|
|
1324
|
-
self.descriptor_dxfile = DXFile(self.details["descriptor"], mode="rb")
|
|
1347
|
+
self.descriptor_dxfile = DXFile(self.details["descriptor"], mode="rb", project=project)
|
|
1325
1348
|
else:
|
|
1326
1349
|
err_exit("%s : Invalid cohort or dataset" % self.details["descriptor"])
|
|
1327
1350
|
self.descriptor = None
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import copy
|
|
2
|
+
from functools import reduce
|
|
2
3
|
|
|
3
4
|
|
|
4
|
-
def generate_pheno_filter(values, entity, field, filters):
|
|
5
|
+
def generate_pheno_filter(values, entity, field, filters, lambda_for_list_conv):
|
|
5
6
|
|
|
6
7
|
if "pheno_filters" not in filters:
|
|
7
8
|
# Create a pheno_filter if none exists. This will be a compound filter
|
|
@@ -33,9 +34,9 @@ def generate_pheno_filter(values, entity, field, filters):
|
|
|
33
34
|
if primary_filter["condition"] == "exists":
|
|
34
35
|
pass
|
|
35
36
|
elif primary_filter["condition"] == "in":
|
|
36
|
-
values = sorted(set(values).intersection(set(primary_filter["values"])))
|
|
37
|
+
values = sorted(set(values).intersection(set(reduce(lambda_for_list_conv, primary_filter["values"], []))))
|
|
37
38
|
elif primary_filter["condition"] == "not-in":
|
|
38
|
-
values = sorted(set(values) - set(primary_filter["values"]))
|
|
39
|
+
values = sorted(set(values) - set(reduce(lambda_for_list_conv, primary_filter["values"], [])))
|
|
39
40
|
else:
|
|
40
41
|
raise ValueError("Invalid input cohort."
|
|
41
42
|
" Cohorts cannot have conditions other than \"in\", \"not-in\", or \"exists\" on the primary entity and field.")
|
|
@@ -82,11 +83,11 @@ def generate_pheno_filter(values, entity, field, filters):
|
|
|
82
83
|
return filters
|
|
83
84
|
|
|
84
85
|
|
|
85
|
-
def cohort_filter_payload(values, entity, field, filters, project_context, base_sql=None):
|
|
86
|
+
def cohort_filter_payload(values, entity, field, filters, project_context, lambda_for_list_conv, base_sql=None):
|
|
86
87
|
if "logic" in filters and filters["logic"] != "and":
|
|
87
88
|
raise ValueError("Invalid input cohort. Cohorts must have 'and' logic on the primary entity and field.")
|
|
88
89
|
filter_payload = {}
|
|
89
|
-
filter_payload["filters"] = generate_pheno_filter(values, entity, field, filters)
|
|
90
|
+
filter_payload["filters"] = generate_pheno_filter(values, entity, field, filters, lambda_for_list_conv)
|
|
90
91
|
if "logic" not in filter_payload["filters"]:
|
|
91
92
|
filter_payload["filters"]["logic"] = "and"
|
|
92
93
|
filter_payload["project_context"] = project_context
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
version = '0.363.0'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: dxpy
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.363.0
|
|
4
4
|
Summary: DNAnexus Platform API bindings for Python
|
|
5
5
|
Home-page: https://github.com/dnanexus/dx-toolkit
|
|
6
6
|
Author: Aleksandra Zalcman, Andrey Kislyuk, Anurag Biyani, Geet Duggal, Katherine Lai, Kurt Jensen, Marek Hrvol, Ohad Rodeh, Phil Sung
|
|
@@ -419,8 +419,9 @@ class TestCreateCohort(unittest.TestCase):
|
|
|
419
419
|
"logic": "and",
|
|
420
420
|
}
|
|
421
421
|
expected_sql = "SELECT `patient_1`.`patient_id` AS `patient_id` FROM `database_yyyyyyyyyyyyyyyyyyyyyyyy__create_cohort_pheno_database`.`patient` AS `patient_1` WHERE `patient_1`.`patient_id` IN ('patient_1', 'patient_2');"
|
|
422
|
+
lambda_for_list_conv = lambda a, b: a+[str(b)]
|
|
422
423
|
|
|
423
|
-
generated_filter = generate_pheno_filter(values, entity, field, filters)
|
|
424
|
+
generated_filter = generate_pheno_filter(values, entity, field, filters, lambda_for_list_conv)
|
|
424
425
|
self.assertEqual(expected_filter, generated_filter)
|
|
425
426
|
|
|
426
427
|
# Testing raw cohort query api
|
|
@@ -471,8 +472,9 @@ class TestCreateCohort(unittest.TestCase):
|
|
|
471
472
|
visualize_response = json.load(f)
|
|
472
473
|
filters = visualize_response.get("filters", {})
|
|
473
474
|
base_sql = visualize_response.get("baseSql", visualize_response.get("base_sql"))
|
|
475
|
+
lambda_for_list_conv = lambda a, b: a+[str(b)]
|
|
474
476
|
|
|
475
|
-
test_payload = cohort_filter_payload(values, entity, field, filters, project_context, base_sql)
|
|
477
|
+
test_payload = cohort_filter_payload(values, entity, field, filters, project_context, lambda_for_list_conv, base_sql)
|
|
476
478
|
|
|
477
479
|
with open(os.path.join(self.payloads_dir, "raw-cohort-query_input", "{}.json".format(payload_name))) as f:
|
|
478
480
|
valid_payload = json.load(f)
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
version = '0.361.0'
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dxpy-0.361.0 → dxpy-0.363.0}/dxpy/dx_extract_utils/Homo_sapiens_genes_manifest_staging.json
RENAMED
|
File without changes
|
{dxpy-0.361.0 → dxpy-0.363.0}/dxpy/dx_extract_utils/Homo_sapiens_genes_manifest_staging_vep.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dxpy-0.361.0 → dxpy-0.363.0}/dxpy/templating/templates/bash/scatter-process-gather/dxapp.json
RENAMED
|
File without changes
|
{dxpy-0.361.0 → dxpy-0.363.0}/dxpy/templating/templates/bash/scatter-process-gather/src/code.sh
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dxpy-0.361.0 → dxpy-0.363.0}/dxpy/templating/templates/python/scatter-process-gather/dxapp.json
RENAMED
|
File without changes
|
{dxpy-0.361.0 → dxpy-0.363.0}/dxpy/templating/templates/python/scatter-process-gather/src/code.py
RENAMED
|
File without changes
|
{dxpy-0.361.0 → dxpy-0.363.0}/dxpy/templating/templates/python/scatter-process-gather/test/test.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|