Genomic Data Commons API wrapper
A simple Python wrapper for the GDC Application Programming Interface (API)
The GDC API drives the GDC Data and Submission Portals and provides programmatic access to GDC functionality. This includes searching for, downloading, and submitting data and metadata.
Features implemented
- Downloading a Single File using GET
- Downloading Multiple Files using POST
Usage
Installation
pip install gdc-api-wrapper
TCGA API Reference
Download single file
from gdcapiwrapper.tcga import Data
Data.download(uuid="uuid-file-you-wanna-download", path="/local/path", name="filename")
NOTE: path and name are optional, by default path is your current directory and if name is
not provided it will be saved with the UUID as filname.
Download multiple files
from gdcapiwrapper.tcga import Data
response, filename =Data.download_multiple(uuid_list=["UUID1", "UUID2", "UUID3"], path="/local/path")
NOTE: path is optional, by default path is your current directory.
TCIA API Reference
Get a list of SOPInstanceUID for a given series
from gdcapiwrapper.tcia import Data
# Example for CSV, HTML, XML
response, filename = Data.sop_instance_uids(
series_instance_uid="uid.series.instance",
format_="JSON",
path="/local/path",
name="filename"
)
# Example for JSON
response, json = Data.sop_instance_uids(series_instance_uid="uid.series.instance")
Formats allowed: ["CSV", "HTML", "JSON", "XML"], default: JSON. When JSON is requested the API will not save any
json file on disk, returns an in memory json object.
NOTE: path and name are optional, by default path is your current directory and if name is
not provided it will be saved with the SeriesInstance as filename.
Download Single DICOM image
from gdcapiwrapper.tcia import Data
response, filename = Data.download_single_image(
series_instance_uid="uid.series.instance",
sop_instance_uid="uid.sop.instance",
path="/local/path",
name="filename.dcm",
)
NOTE: path and name are optional, by default path is your current directory and if name is
not provided it will be saved with the SOPInstanceUID as filename.
Download set of images in a zip file
from gdcapiwrapper.tcia import Data
response, filename = Data.download_series_instance_images(
series_instance_uid="uid.series.instance",
path="/local/path",
name="filename.zip")
NOTE: path and name are optional, by default path is your current directory and if name is
not provided it will be saved with the SOPInstanceUID as filename.
Changelog
0.1
- TCGA Api endpoints
0.2
- Bug Fix on TCGA Apis
- Public interface refactoring [breaking change]
- TCIA Api endpoints
Metadata
Release files for gdc-api-wrapper 0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| gdc-api-wrapper-0.2.tar.gz | 5.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| gdc_api_wrapper-0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 17.1 kB
Release files / gdc-api-wrapper-0.2.tar.gz
| Download URL | gdc-api-wrapper-0.2.tar.gz |
|---|---|
| Size | 5.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
95fa32bfcbffe63b30984c539b6e46123b049b729247167807a376ad70f6f893
|
|
BLAKE2b-256 checksum How to use checksums |
f1a207d0532cd061e2c088f7c88b35509738281a61f6cd723a069f9c9d164c1e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.7.3
|
Release files / gdc_api_wrapper-0.2-py3-none-any.whl
| Download URL | gdc_api_wrapper-0.2-py3-none-any.whl |
|---|---|
| Size | 11.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9bdbb97b50b0a45dad293e539b26da3b64b4e3b4e91ed64a1dd3d61bc3c598c7
|
|
BLAKE2b-256 checksum How to use checksums |
21f2909d9552d2d9bdb0d3a371f4444f951c36c046ce7e19c2cf270966dc9334
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.7.3
|