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.15.0
  • Generator version: 7.19.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 a organelle data package by accesions
OrganelleApi download_organelle_package_by_post POST /organelle/download Get a organelle data package by post
OrganelleApi organelle_datareport_by_accession GET /organelle/accessions/{accessions}/dataset_report Get Organelle dataset report by accession
OrganelleApi organelle_datareport_by_post POST /organelle/dataset_report Get Organelle dataset report by http post
OrganelleApi organelle_datareport_by_taxon GET /organelle/taxon/{taxons}/dataset_report Get Organelle dataset report by taxons
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 tax 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 given a partial taxonomic name
TaxonomyApi tax_name_query_by_post POST /taxonomy/taxon_suggest Get a list of taxonomy names and IDs given a partial taxonomic name
TaxonomyApi taxonomy_data_report GET /taxonomy/taxon/{taxons}/dataset_report Use taxonomic identifiers to get taxonomic data report
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 Use taxonomic identifiers to get a filtered taxonomic subtree
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 Retrieve image metadata associated with a taxonomic identifier
TaxonomyApi taxonomy_image_metadata_post POST /taxonomy/image/metadata Retrieve image metadata associated with a taxonomic identifier by post
TaxonomyApi taxonomy_image_post POST /taxonomy/image Get a taxonomy image by taxon
TaxonomyApi taxonomy_links GET /taxonomy/taxon/{taxon}/links Retrieve external links associated with a taxonomic identifier.
TaxonomyApi taxonomy_links_by_post POST /taxonomy/links Retrieve external links associated with a taxonomic identifier.
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 Use taxonomic identifiers to get taxonomic names data report
TaxonomyApi taxonomy_names_post POST /taxonomy/name_report Use taxonomic identifiers to get taxonomic names data report by post
TaxonomyApi taxonomy_related_ids GET /taxonomy/taxon/{tax_id}/related_ids Use taxonomic identifier to get related taxonomic identifiers, such as children
TaxonomyApi taxonomy_related_ids_post POST /taxonomy/related_ids Use taxonomic identifier to get related taxonomic identifiers, such as children
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.15.0.tar.gz (237.8 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.15.0-py3-none-any.whl (498.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ncbi_datasets_pyclient-18.15.0.tar.gz
  • Upload date:
  • Size: 237.8 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.15.0.tar.gz
Algorithm Hash digest
SHA256 13a33fe05aa95204a27cae24bfe435fbf2184d3c3696865b1882cc3459568236
MD5 ef2751d93b71b7683952df4444e187a9
BLAKE2b-256 37ab87128cf551729d3782b7e0cbeec5f4c9ff561e21505093f33d198ba0c3ca

See more details on using hashes here.

Provenance

The following attestation bundles were made for ncbi_datasets_pyclient-18.15.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.15.0-py3-none-any.whl.

File metadata

File hashes

Hashes for ncbi_datasets_pyclient-18.15.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fa68b9d7af0ca417d9d7d37006dcc4712d95e73228877330c24eacb4b143b171
MD5 b7685edcfb4e521e14a37173f0a8ce56
BLAKE2b-256 355a8e3f078dccefeaee24826c5637f72b4c8b2af73bb7d36c2b12f343df4ae1

See more details on using hashes here.

Provenance

The following attestation bundles were made for ncbi_datasets_pyclient-18.15.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