Client for the HuBMAP Cells API
Project description
hubmap-api-py-client
Python client for the HuBMAP Cells API;
See also: cells-api-js-client
.
Contributors start here.
Usage
Install from pypi:
pip install hubmap-api-py-client
Find cells with different criteria, and intersect resulting sets:
>>> from hubmap_api_py_client import Client
>>> client = Client('https://cells.dev.hubmapconsortium.org/api/')
>>> [m for m in dir(client) if m.startswith('select_')]
['select_cells', 'select_clusters', 'select_genes', 'select_organs']
>>> cells_with_vim = client.select_cells(where='gene', has=['VIM > 0.5'], genomic_modality='rna')
>>> assert len(cells_with_vim) > 0
# Select cells from the datasets with the following UUIDs:
>>> dataset_a_uuid = '68159e4bd6a2cea1cd66e8f3050cfcb7'
>>> dataset_b_uuid = 'e8d642084fc5ec8b5d348ebab96a4b22'
>>> cells_in_a_len = len(client.select_cells(where='dataset', has=[dataset_a_uuid]))
>>> cells_in_b_len = len(client.select_cells(where='dataset', has=[dataset_b_uuid]))
>>> cells_in_datasets = client.select_cells(where='dataset', has=[dataset_a_uuid, dataset_b_uuid])
>>> cells_in_datasets_len = len(cells_in_datasets)
>>> assert cells_in_datasets_len > 0
>>> assert cells_in_datasets_len == cells_in_a_len + cells_in_b_len
# Combine criteria with intersection:
>>> cells_with_vim_in_datasets = cells_with_vim & cells_in_datasets
# Get a list; should run quickly:
>>> cell_list = cells_with_vim_in_datasets[0:10]
>>> assert len(cell_list) == 10
>>> assert cell_list[0].keys() == {'cell_id', 'modality', 'dataset', 'clusters', 'protein_mean', 'protein_total', 'protein_covar'}
Only some types of objects can be retrieved from other types of objects:
where=... |
cell |
cluster |
dataset |
gene |
organ |
protein |
---|---|---|---|---|---|---|
select_cells() |
✓ | ✓ | ✓ | ✓ | ||
select_clusters() |
✓ ✩ | ✩ | ✩ | |||
select_datasets() |
✶ | |||||
select_genes() |
✓ ✩ | ✓ ✩ | ✩ | |||
select_organs() |
✓ | ✩ | ✶ | ✓ ✩ | ✩ | |
select_proteins() |
✩ | ✩ | ✩ |
- "✓" = Supported by Cells API, and this client.
- "✶" = Supported by Entities API; support in this client is on the roadmap.
- "✩" = Possible connection to ASCT-B (Anatomical Structures / Cell Types / Biomarkers)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file hubmap-api-py-client-0.0.4.tar.gz
.
File metadata
- Download URL: hubmap-api-py-client-0.0.4.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.0.0.post20201207 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cd46c791bf089f39908e17be67dd7262ce647c9b566625cca30ad0cc2a85af15 |
|
MD5 | 00fa6c355aebdc2f8b7bb1b6a7c2b64f |
|
BLAKE2b-256 | aad9f43382d64441ef4fd6a95d1b3cfdd85d3e26ace5f7190cc29bd21cb3a43e |
File details
Details for the file hubmap_api_py_client-0.0.4-py3-none-any.whl
.
File metadata
- Download URL: hubmap_api_py_client-0.0.4-py3-none-any.whl
- Upload date:
- Size: 6.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.0.0.post20201207 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0d0057dfd0d21faacbfc913bd0e09d1b73628f313de383e4c8c160a3480dcd34 |
|
MD5 | 489b36bac17607910300aed0c1f34e56 |
|
BLAKE2b-256 | 74d032d49be029782f5b6f3ecc4f8645a6e26971eea7d390a098975b40a062bb |