IGVF-DACC / igvf-python-client

Autogenerated Python client for the IGVF API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

igvf-client

The Python client is autogenerated based on this IGVF OpenAPI specification, which exposes search, collection, and other read endpoints from the IGVF Data Portal.

Note while the API endpoints are relatively stable, the underlying data model is still evolving, and changing fields/types can cause breaking changes. The latest version of the client reflects the latest version of the schema used by the API.

  • API version: 54.0.1
  • Package version: 54.0.1
  • Generator version: 7.7.0
  • Build package: org.openapitools.codegen.languages.PythonClientCodegen

Requirements.

Python 3.9+

Installation & Usage

Pip install:

$ pip install igvf-client

Or clone the repo and and install:

$ git clone https://github.com/IGVF-DACC/igvf-python-client
$ cd igvf-python-client
$ pip install -e .

Then import the package:

$ python
>>> import igvf_client

Examples

from igvf_client import IgvfApi

api = IgvfApi()

# Search for Software that matches query `abc`.
r = api.search(query='abc', type=['Software'])

# Print total number of results and list of results in `@graph`.
print(r.total)
print(r.graph)

# Pull first item, unwrap to underlying Software item with `actual_instance`.
software_item = r.graph[0].actual_instance

# Print Software item and specific fields.
print(software_item)
print(software_item.id)
print(software_item.description)

# Get the Lab item based on the lab @id in the Software item.
lab = api.get_by_id(software_item.lab)

# Print lab and specific field.
print(lab)
print(lab.title)

Optional authorization

You can make authenticated requests (e.g. to view unreleased data) if you pass the access key/secret key associated with your user when instantiating the client.

from igvf_client import Configuration
from igvf_client import ApiClient
from igvf_client import IgvfApi

config = Configuration(
    access_key = os.environ["IGVF_ACCESS_KEY"],
    secret_access_key = os.environ["IGVF_SECRET_ACCESS_KEY"]
)

client = ApiClient(config)

api = IgvfApi(client)

api.sequence_files(status=['in progress']).total # 8878

More examples

See other examples in examples.ipynb and test_endpoints.py

Refer to the documentation for a full specification of endpoint inputs and outputs and model fields.

Documentation for API Endpoints

General Endpoints

All URIs are relative to https://api.data.igvf.org

Class Method HTTP request Description
IgvfApi get_by_id GET /{resource_id} Get item information
IgvfApi search GET /search Search for items on the IGVF Data Portal.
IgvfApi schemas GET /profiles Retrieve JSON schemas for all item types
IgvfApi schema_for_item_type GET /profiles/{item_type} Retrieve JSON schema for item type
IgvfApi report GET /multireport.tsv Generate a TSV file report based on search query. All results are returned.
IgvfApi download GET /{file_id}/@@download Download file.
IgvfApi batch_download GET /batch-download List files to download based on search query. All results are returned.

Collection Endpoints

All URIs are relative to https://api.data.igvf.org

Class Method HTTP request Description
IgvfApi access_keys GET /access-keys/@@listing List items in the AccessKey collection.
IgvfApi alignment_files GET /alignment-files/@@listing List items in the AlignmentFile collection.
IgvfApi analysis_sets GET /analysis-sets/@@listing List items in the AnalysisSet collection.
IgvfApi analysis_step_versions GET /analysis-step-versions/@@listing List items in the AnalysisStepVersion collection.
IgvfApi analysis_steps GET /analysis-steps/@@listing List items in the AnalysisStep collection.
IgvfApi assay_terms GET /assay-terms/@@listing List items in the AssayTerm collection.
IgvfApi auxiliary_sets GET /auxiliary-sets/@@listing List items in the AuxiliarySet collection.
IgvfApi awards GET /awards/@@listing List items in the Award collection.
IgvfApi biomarkers GET /biomarkers/@@listing List items in the Biomarker collection.
IgvfApi configuration_files GET /configuration-files/@@listing List items in the ConfigurationFile collection.
IgvfApi construct_library_sets GET /construct-library-sets/@@listing List items in the ConstructLibrarySet collection.
IgvfApi crispr_modifications GET /crispr-modifications/@@listing List items in the CrisprModification collection.
IgvfApi curated_sets GET /curated-sets/@@listing List items in the CuratedSet collection.
IgvfApi degron_modifications GET /degron-modifications/@@listing List items in the DegronModification collection.
IgvfApi documents GET /documents/@@listing List items in the Document collection.
IgvfApi genes GET /genes/@@listing List items in the Gene collection.
IgvfApi genome_browser_annotation_files GET /genome-browser-annotation-files/@@listing List items in the GenomeBrowserAnnotationFile collection.
IgvfApi human_donors GET /human-donors/@@listing List items in the HumanDonor collection.
IgvfApi image_files GET /image-files/@@listing List items in the ImageFile collection.
IgvfApi images GET /images/@@listing List items in the Image collection.
IgvfApi in_vitro_systems GET /in-vitro-systems/@@listing List items in the InVitroSystem collection.
IgvfApi institutional_certificates GET /institutional-certificates/@@listing List items in the InstitutionalCertificate collection.
IgvfApi labs GET /labs/@@listing List items in the Lab collection.
IgvfApi matrix_files GET /matrix-files/@@listing List items in the MatrixFile collection.
IgvfApi measurement_sets GET /measurement-sets/@@listing List items in the MeasurementSet collection.
IgvfApi model_files GET /model-files/@@listing List items in the ModelFile collection.
IgvfApi model_sets GET /model-sets/@@listing List items in the ModelSet collection.
IgvfApi multiplexed_samples GET /multiplexed-samples/@@listing List items in the MultiplexedSample collection.
IgvfApi open_reading_frames GET /open-reading-frames/@@listing List items in the OpenReadingFrame collection.
IgvfApi pages GET /pages/@@listing List items in the Page collection.
IgvfApi phenotype_terms GET /phenotype-terms/@@listing List items in the PhenotypeTerm collection.
IgvfApi phenotypic_features GET /phenotypic-features/@@listing List items in the PhenotypicFeature collection.
IgvfApi platform_terms GET /platform-terms/@@listing List items in the PlatformTerm collection.
IgvfApi prediction_sets GET /prediction-sets/@@listing List items in the PredictionSet collection.
IgvfApi primary_cells GET /primary-cells/@@listing List items in the PrimaryCell collection.
IgvfApi publications GET /publications/@@listing List items in the Publication collection.
IgvfApi reference_files GET /reference-files/@@listing List items in the ReferenceFile collection.
IgvfApi rodent_donors GET /rodent-donors/@@listing List items in the RodentDonor collection.
IgvfApi sample_terms GET /sample-terms/@@listing List items in the SampleTerm collection.
IgvfApi sequence_files GET /sequence-files/@@listing List items in the SequenceFile collection.
IgvfApi signal_files GET /signal-files/@@listing List items in the SignalFile collection.
IgvfApi software GET /software/@@listing List items in the Software collection.
IgvfApi software_versions GET /software-versions/@@listing List items in the SoftwareVersion collection.
IgvfApi sources GET /sources/@@listing List items in the Source collection.
IgvfApi tabular_files GET /tabular-files/@@listing List items in the TabularFile collection.
IgvfApi technical_samples GET /technical-samples/@@listing List items in the TechnicalSample collection.
IgvfApi tissues GET /tissues/@@listing List items in the Tissue collection.
IgvfApi treatments GET /treatments/@@listing List items in the Treatment collection.
IgvfApi users GET /users/@@listing List items in the User collection.
IgvfApi whole_organisms GET /whole-organisms/@@listing List items in the WholeOrganism collection.
IgvfApi workflows GET /workflows/@@listing List items in the Workflow collection.

Documentation for Models

About

Autogenerated Python client for the IGVF API

License:MIT License


Languages

Language:Python 94.4%Language:Mustache 3.4%Language:Jupyter Notebook 2.1%Language:Shell 0.1%