Skip to main content

NCBI Datasets API

Project description

ncbi-datasets-pyclient

NCBI Datasets is a resource that lets you easily gather data from NCBI.

The NCBI Datasets version 2 API is updated often to add new features, fix bugs, and enhance usability.

This Python package is automatically generated by the OpenAPI Generator project:

  • API version: v2
  • Package version: v18.18.0
  • Generator version: 7.20.0
  • Build package: org.openapitools.codegen.languages.PythonClientCodegen

Requirements.

Python 3.9+

Installation & Usage

pip install

If the python package is hosted on a repository, you can install directly using:

pip install git+https://github.com/misialq/ncbi-datasets-pyclient.git

(you may need to run pip with root permission: sudo pip install git+https://github.com/misialq/ncbi-datasets-pyclient.git)

Then import the package:

import ncbi.datasets.openapi

Setuptools

Install via Setuptools.

python setup.py install --user

(or sudo python setup.py install to install the package for all users)

Then import the package:

import ncbi.datasets.openapi

Tests

Execute pytest to run the tests.

Getting Started

Please follow the installation procedure and then run the following:

import ncbi.datasets.openapi
from ncbi.datasets.openapi.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.ncbi.nlm.nih.gov/datasets/v2
# See configuration.py for a list of all supported configuration parameters.
configuration = ncbi.datasets.openapi.Configuration(
    host = "https://api.ncbi.nlm.nih.gov/datasets/v2"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: ApiKeyAuthHeader
configuration.api_key['ApiKeyAuthHeader'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['ApiKeyAuthHeader'] = 'Bearer'


# Enter a context with an instance of the API client
with ncbi.datasets.openapi.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = ncbi.datasets.openapi.BioSampleApi(api_client)
    accessions = ['SAMN15960293'] # List[str] | 

    try:
        # Get BioSample dataset reports by accession(s)
        api_response = api_instance.bio_sample_dataset_report(accessions)
        print("The response of BioSampleApi->bio_sample_dataset_report:\n")
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling BioSampleApi->bio_sample_dataset_report: %s\n" % e)

Documentation for API Endpoints

All URIs are relative to https://api.ncbi.nlm.nih.gov/datasets/v2

Class Method HTTP request Description
BioSampleApi bio_sample_dataset_report GET /biosample/accession/{accessions}/biosample_report Get BioSample dataset reports by accession(s)
GeneApi download_gene_package GET /gene/id/{gene_ids}/download Get a gene data package by GeneID
GeneApi download_gene_package_post POST /gene/download Get a gene data package
GeneApi gene_chromosome_summary GET /gene/taxon/{taxon}/annotation/{annotation_name}/chromosome_summary Get gene counts per chromosome by taxon and annotation name
GeneApi gene_counts_for_taxon GET /gene/taxon/{taxon}/counts Get gene counts by taxon
GeneApi gene_counts_for_taxon_by_post POST /gene/taxon/counts Get gene counts by taxon
GeneApi gene_dataset_report POST /gene/dataset_report Get a gene data report
GeneApi gene_dataset_report_by_accession GET /gene/accession/{accessions}/dataset_report Get a gene data report by RefSeq nucleotide or protein accession
GeneApi gene_dataset_report_by_tax_and_symbol GET /gene/symbol/{symbols}/taxon/{taxon}/dataset_report Get a gene data report by symbol and taxon
GeneApi gene_dataset_reports_by_id GET /gene/id/{gene_ids}/dataset_report Get a gene data report by GeneID
GeneApi gene_dataset_reports_by_locus_tag GET /gene/locus_tag/{locus_tags}/dataset_report Get a gene data report by locus tag
GeneApi gene_dataset_reports_by_taxon GET /gene/taxon/{taxon}/dataset_report Get a gene data report by taxon
GeneApi gene_download_summary_by_id GET /gene/id/{gene_ids}/download_summary Get a download summary of a gene data package by GeneID
GeneApi gene_download_summary_by_post POST /gene/download_summary Get a download summary of a gene data package
GeneApi gene_links_by_id GET /gene/id/{gene_ids}/links Get gene links by GeneID
GeneApi gene_links_by_id_by_post POST /gene/links Get gene links by GeneID
GeneApi gene_metadata_by_accession GET /gene/accession/{accessions} Get gene metadata by RefSeq Accession (deprecated)
GeneApi gene_metadata_by_post POST /gene Get gene metadata as JSON (deprecated)
GeneApi gene_metadata_by_tax_and_symbol GET /gene/symbol/{symbols}/taxon/{taxon} Get gene metadata by gene symbol (deprecated)
GeneApi gene_orthologs_by_id GET /gene/id/{gene_id}/orthologs Get a gene data report for a gene ortholog set by GeneID
GeneApi gene_orthologs_by_post POST /gene/orthologs Get a gene data report for a gene ortholog set by GeneID
GeneApi gene_product_report POST /gene/product_report Get a gene product report
GeneApi gene_product_report_by_accession GET /gene/accession/{accessions}/product_report Get a gene product report by RefSeq nucleotide or protein accession
GeneApi gene_product_report_by_tax_and_symbol GET /gene/symbol/{symbols}/taxon/{taxon}/product_report Get a gene product report by symbol and taxon
GeneApi gene_product_reports_by_id GET /gene/id/{gene_ids}/product_report Get a gene product report by GeneID
GeneApi gene_product_reports_by_locus_tags GET /gene/locus_tag/{locus_tags}/product_report Get a gene product report by locus tag
GeneApi gene_product_reports_by_taxon GET /gene/taxon/{taxon}/product_report Get a gene product report by taxon
GeneApi gene_reports_by_id GET /gene/id/{gene_ids} Get gene reports by GeneID (deprecated)
GeneApi gene_reports_by_taxon GET /gene/taxon/{taxon} Get gene reports by taxonomic identifier (deprecated)
GenomeApi annotation_report_facets_by_accession GET /genome/accession/{accession}/annotation_summary Get genome annotation report summary information by genome assembly accession
GenomeApi annotation_report_facets_by_post POST /genome/annotation_summary Get genome annotation report summary information by genome assembly accession
GenomeApi assembly_accessions_for_sequence_accession GET /genome/sequence_accession/{accession}/sequence_assemblies Get a genome assembly accession for a nucleotide sequence accession
GenomeApi assembly_accessions_for_sequence_accession_by_post POST /genome/sequence_assemblies Get a genome assembly accession for a nucleotide sequence accession
GenomeApi assembly_revision_history_by_get GET /genome/accession/{accession}/revision_history Get a revision history for a genome assembly by genome assembly accession
GenomeApi assembly_revision_history_by_post POST /genome/revision_history Get a revision history for a genome assembly by genome assembly accession
GenomeApi check_assembly_availability GET /genome/accession/{accessions}/check Check the validity of a genome assembly accession
GenomeApi check_assembly_availability_post POST /genome/check Check the validity of a genome assembly accession
GenomeApi checkm_histogram_by_taxon GET /genome/taxon/{species_taxon}/checkm_histogram Get CheckM histogram data by species taxon
GenomeApi checkm_histogram_by_taxon_by_post POST /genome/checkm_histogram Get CheckM histogram data by species taxon
GenomeApi download_assembly_package GET /genome/accession/{accessions}/download Get a genome data package by genome assembly accession
GenomeApi download_assembly_package_post POST /genome/download Get a genome data package by genome assembly accession
GenomeApi download_genome_annotation_package GET /genome/accession/{accession}/annotation_report/download Get a genome annotation data package by genome assembly accession
GenomeApi download_genome_annotation_package_by_post POST /genome/annotation_report/download Get a genome annotation data package by genome assembly accession
GenomeApi genome_annotation_download_summary GET /genome/accession/{accession}/annotation_report/download_summary Get a download summary (preview) of a genome annotation data package by genome assembly accession
GenomeApi genome_annotation_download_summary_by_post POST /genome/annotation_report/download_summary Get a download summary (preview) of a genome annotation data package by genome assembly accession
GenomeApi genome_annotation_report GET /genome/accession/{accession}/annotation_report Get genome annotation reports by genome assembly accession
GenomeApi genome_annotation_report_by_post POST /genome/annotation_report Get genome annotation reports by genome assembly accession
GenomeApi genome_dataset_report GET /genome/accession/{accessions}/dataset_report Get a genome assembly report by genome assembly accession
GenomeApi genome_dataset_report_by_post POST /genome/dataset_report Get a genome assembly report
GenomeApi genome_dataset_reports_by_assembly_name GET /genome/assembly_name/{assembly_names}/dataset_report Get genome assembly reports by assembly name
GenomeApi genome_dataset_reports_by_bioproject GET /genome/bioproject/{bioprojects}/dataset_report Get genome assembly reports by BioProject accession
GenomeApi genome_dataset_reports_by_biosample_id GET /genome/biosample/{biosample_ids}/dataset_report Get genome assembly reports by BioSample accession
GenomeApi genome_dataset_reports_by_taxon GET /genome/taxon/{taxons}/dataset_report Get a genome assembly report by taxon
GenomeApi genome_dataset_reports_by_wgs GET /genome/wgs/{wgs_accessions}/dataset_report Get a genome assembly data report by WGS accession
GenomeApi genome_download_summary GET /genome/accession/{accessions}/download_summary Get a download summary (preview) of a genome data package by genome assembly accession
GenomeApi genome_download_summary_by_post POST /genome/download_summary Get a download summary (preview) of a genome data package by genome assembly accession
GenomeApi genome_links_by_accession GET /genome/accession/{accessions}/links Get assembly links by genome assembly accession
GenomeApi genome_links_by_accession_by_post POST /genome/links Get assembly links by genome assembly accession
GenomeApi genome_sequence_report GET /genome/accession/{accession}/sequence_reports Get a genome sequence report by genome assembly accession
GenomeApi genome_sequence_report_by_post POST /genome/sequence_reports Get a genome sequence report by genome assembly accession
OrganelleApi download_organelle_package GET /organelle/accession/{accessions}/download Get an organelle data package by nucleotide accession
OrganelleApi download_organelle_package_by_post POST /organelle/download Get an organelle data package
OrganelleApi organelle_datareport_by_accession GET /organelle/accessions/{accessions}/dataset_report Get an organelle data report by nucleotide accession
OrganelleApi organelle_datareport_by_post POST /organelle/dataset_report Get an organelle data report
OrganelleApi organelle_datareport_by_taxon GET /organelle/taxon/{taxons}/dataset_report Get an organelle data report by taxon
ProkaryoteApi download_prokaryote_gene_package GET /protein/accession/{accessions}/download Get a prokaryote gene data package by RefSeq protein accession
ProkaryoteApi download_prokaryote_gene_package_post POST /protein/accession/download Get a prokaryote gene data package by RefSeq protein accession
TaxonomyApi download_taxonomy_package GET /taxonomy/taxon/{tax_ids}/download Get a taxonomy data package by Taxonomy ID
TaxonomyApi download_taxonomy_package_by_post POST /taxonomy/download Get a taxonomy data package by Taxonomy ID
TaxonomyApi tax_name_query GET /taxonomy/taxon_suggest/{taxon_query} Get a list of taxonomy names and IDs by partial taxonomic name
TaxonomyApi tax_name_query_by_post POST /taxonomy/taxon_suggest Get a list of taxonomy names and IDs by partial taxonomic name
TaxonomyApi taxonomy_data_report GET /taxonomy/taxon/{taxons}/dataset_report Get a taxonomy data report by taxon
TaxonomyApi taxonomy_data_report_post POST /taxonomy/dataset_report Get a taxonomy data report by taxon
TaxonomyApi taxonomy_filtered_subtree GET /taxonomy/taxon/{taxons}/filtered_subtree Get a filtered taxonomic subtree by taxon
TaxonomyApi taxonomy_filtered_subtree_post POST /taxonomy/filtered_subtree Get a filtered taxonomic subtree by taxon
TaxonomyApi taxonomy_image GET /taxonomy/taxon/{taxon}/image Get a taxonomy image by taxon
TaxonomyApi taxonomy_image_metadata GET /taxonomy/taxon/{taxon}/image/metadata Get taxonomy image metadata by Taxonomy ID
TaxonomyApi taxonomy_image_metadata_post POST /taxonomy/image/metadata Get taxonomy image metadata by Taxonomy ID
TaxonomyApi taxonomy_image_post POST /taxonomy/image Get a taxonomy image by taxon
TaxonomyApi taxonomy_links GET /taxonomy/taxon/{taxon}/links Get external links by Taxonomy ID
TaxonomyApi taxonomy_links_by_post POST /taxonomy/links Get external links by Taxonomy ID
TaxonomyApi taxonomy_metadata GET /taxonomy/taxon/{taxons} Use taxonomic identifiers to get taxonomic metadata (deprecated)
TaxonomyApi taxonomy_metadata_post POST /taxonomy Get taxonomy metadata by taxon (deprecated)
TaxonomyApi taxonomy_names GET /taxonomy/taxon/{taxons}/name_report Get a taxonomy names report by taxon
TaxonomyApi taxonomy_names_post POST /taxonomy/name_report Get a taxonomy names report by taxon
TaxonomyApi taxonomy_related_ids GET /taxonomy/taxon/{tax_id}/related_ids Get child nodes, and optionally parent nodes, for a given taxon by Taxonomy ID
TaxonomyApi taxonomy_related_ids_post POST /taxonomy/related_ids Get child nodes, and optionally parent nodes, for a given taxon by Taxonomy ID
VersionApi version GET /version Retrieve service version
VirusApi sars2_protein_download GET /virus/taxon/sars2/protein/{proteins}/download Get a SARS-CoV-2 protein data package by protein name
VirusApi sars2_protein_download_post POST /virus/taxon/sars2/protein/download Get a SARS-CoV-2 protein data package
VirusApi sars2_protein_summary GET /virus/taxon/sars2/protein/{proteins} Get a download summary of a SARS-CoV-2 protein data package by protein name
VirusApi sars2_protein_summary_by_post POST /virus/taxon/sars2/protein Get a download summary of a SARS-CoV-2 protein data package by protein name
VirusApi sars2_protein_table GET /virus/taxon/sars2/protein/{proteins}/table Get SARS-CoV-2 protein metadata in a tabular format by protein name
VirusApi virus_accession_availability GET /virus/accession/{accessions}/check Check the validity of a virus genome nucleotide accession
VirusApi virus_accession_availability_post POST /virus/check Check the validity of a virus genome nucleotide accession
VirusApi virus_annotation_reports_by_acessions GET /virus/accession/{accessions}/annotation_report Get a virus annotation report by nucleotide accession
VirusApi virus_annotation_reports_by_post POST /virus/annotation_report Get a virus annotation report
VirusApi virus_annotation_reports_by_taxon GET /virus/taxon/{taxon}/annotation_report Get a virus annotation report by taxon
VirusApi virus_genome_download GET /virus/taxon/{taxon}/genome/download Get a virus genome data package by taxon
VirusApi virus_genome_download_accession GET /virus/accession/{accessions}/genome/download Get a virus genome data package by nucleotide accession
VirusApi virus_genome_download_post POST /virus/genome/download Get a virus genome data package
VirusApi virus_genome_summary GET /virus/taxon/{taxon}/genome Get a download summary of a virus genome data package by taxon
VirusApi virus_genome_summary_by_post POST /virus/genome Get a download summary of a virus genome data package
VirusApi virus_genome_table GET /virus/taxon/{taxon}/genome/table Get virus genome metadata in a tabular format (deprecated)
VirusApi virus_reports_by_acessions GET /virus/accession/{accessions}/dataset_report Get a virus data report by nucleotide accession
VirusApi virus_reports_by_post POST /virus Get a virus data report
VirusApi virus_reports_by_taxon GET /virus/taxon/{taxon}/dataset_report Get a virus data report by taxon

Documentation For Models

Documentation For Authorization

Authentication schemes defined for the API:

ApiKeyAuth

  • Type: API key
  • API key parameter name: api_key
  • Location: URL query string

ApiKeyAuthHeader

  • Type: API key
  • API key parameter name: api-key
  • Location: HTTP header

Author

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

ncbi_datasets_pyclient-18.18.0.tar.gz (238.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ncbi_datasets_pyclient-18.18.0-py3-none-any.whl (503.4 kB view details)

Uploaded Python 3

File details

Details for the file ncbi_datasets_pyclient-18.18.0.tar.gz.

File metadata

  • Download URL: ncbi_datasets_pyclient-18.18.0.tar.gz
  • Upload date:
  • Size: 238.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ncbi_datasets_pyclient-18.18.0.tar.gz
Algorithm Hash digest
SHA256 4b4e59329a99778fa112d6f77600a5acd87ba8a88428eb5e9d8f4dc2d9c52178
MD5 09ad0d9d21a37ff73ecee9beb1f643ec
BLAKE2b-256 d768fe2f77b80f208f4276ce07ed867b3c8a331f6b8491afa0288b262052544d

See more details on using hashes here.

Provenance

The following attestation bundles were made for ncbi_datasets_pyclient-18.18.0.tar.gz:

Publisher: publish.yaml on misialq/ncbi-datasets-pyclient

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ncbi_datasets_pyclient-18.18.0-py3-none-any.whl.

File metadata

File hashes

Hashes for ncbi_datasets_pyclient-18.18.0-py3-none-any.whl
Algorithm Hash digest
SHA256 45a9ec8339cf765a022dea551ecf919c8e19a47f938f9a6fde7b5d2c01683d56
MD5 658b914eb95fddda5e573f6d594f2d00
BLAKE2b-256 cffc62c92817499512be6f25ad86dd141e50976c45f78badc47d7bb8f8ae5eaa

See more details on using hashes here.

Provenance

The following attestation bundles were made for ncbi_datasets_pyclient-18.18.0-py3-none-any.whl:

Publisher: publish.yaml on misialq/ncbi-datasets-pyclient

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page