Module: ncbi.datasets.openapi.api.gene_api

NCBI Datasets API

Module: ncbi.datasets.openapi.api.gene_api

NCBI Datasets API

### NCBI Datasets is a resource that lets you easily gather data from NCBI. The Datasets version 1 API is considred stable and will not be subject to breaking changes. For some larger downloads, you may want to download a [dehydrated bag](https://0-www-ncbi-nlm-nih-gov.brum.beds.ac.uk/datasets/docs/v1/how-tos/genomes/large-download/), and retrieve the individual data files at a later time. # noqa: E501

The version of the OpenAPI document: v1 Generated by: https://openapi-generator.tech

class ncbi.datasets.openapi.api.gene_api.GeneApi(api_client=None)

Bases: object

NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech

Do not edit the class manually.

download_gene_package(gene_ids, **kwargs)

Get a gene dataset by gene ID # noqa: E501

Get a gene dataset including gene, transcript and protein fasta sequence, annotation and metadata by gene ID. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True

>>> thread = api.download_gene_package(gene_ids, async_req=True)
>>> result = thread.get()
Parameters

gene_ids ([int]) – NCBI gene ids

Keyword Arguments
  • include_annotation_type ([V1Fasta]) – Select additional types of annotation to include in the data package. If unset, no annotation is provided.. [optional]

  • fasta_filter ([str]) – Limit the FASTA sequences in the datasets package to these transcript and protein accessions. [optional]

  • filename (str) – Output file name.. [optional] if omitted the server will use the default value of “ncbi_dataset.zip”

  • _return_http_data_only (bool) – response data without head status code and headers. Default is True.

  • _preload_content (bool) – if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True.

  • _request_timeout (int/float/tuple) – timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. Default is None.

  • _check_input_type (bool) – specifies if type checking should be done one the data sent to the server. Default is True.

  • _check_return_type (bool) – specifies if type checking should be done one the data received from the server. Default is True.

  • _host_index (int/None) – specifies the index of the server that we want to use. Default is read from the configuration.

  • async_req (bool) – execute request asynchronously

Returns

file_type

If the method is called asynchronously, returns the request thread.

download_gene_package_post(v1_gene_dataset_request, **kwargs)

Get a gene dataset by POST # noqa: E501

Get a gene dataset including gene, transcript and protein fasta sequence, annotation and metadata by POST. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True

>>> thread = api.download_gene_package_post(v1_gene_dataset_request, async_req=True)
>>> result = thread.get()
Parameters

v1_gene_dataset_request (V1GeneDatasetRequest) –

Keyword Arguments
  • filename (str) – Output file name.. [optional] if omitted the server will use the default value of “ncbi_dataset.zip”

  • _return_http_data_only (bool) – response data without head status code and headers. Default is True.

  • _preload_content (bool) – if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True.

  • _request_timeout (int/float/tuple) – timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. Default is None.

  • _check_input_type (bool) – specifies if type checking should be done one the data sent to the server. Default is True.

  • _check_return_type (bool) – specifies if type checking should be done one the data received from the server. Default is True.

  • _host_index (int/None) – specifies the index of the server that we want to use. Default is read from the configuration.

  • async_req (bool) – execute request asynchronously

Returns

file_type

If the method is called asynchronously, returns the request thread.

gene_download_summary_by_accession(accessions, **kwargs)

Get gene download summary by RefSeq Accession # noqa: E501

Get gene download summary by RefSeq Accession in a JSON output format. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True

>>> thread = api.gene_download_summary_by_accession(accessions, async_req=True)
>>> result = thread.get()
Parameters

accessions ([str]) – RNA or Protein accessions.

Keyword Arguments
  • fasta_filter ([str]) – Limit the FASTA sequences in the datasets package to these transcript and protein accessions. [optional]

  • _return_http_data_only (bool) – response data without head status code and headers. Default is True.

  • _preload_content (bool) – if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True.

  • _request_timeout (int/float/tuple) – timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. Default is None.

  • _check_input_type (bool) – specifies if type checking should be done one the data sent to the server. Default is True.

  • _check_return_type (bool) – specifies if type checking should be done one the data received from the server. Default is True.

  • _host_index (int/None) – specifies the index of the server that we want to use. Default is read from the configuration.

  • async_req (bool) – execute request asynchronously

Returns

V1DownloadSummary

If the method is called asynchronously, returns the request thread.

gene_download_summary_by_id(gene_ids, **kwargs)

Get gene download summary by GeneID # noqa: E501

Get a download summary by GeneID in a JSON output format. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True

>>> thread = api.gene_download_summary_by_id(gene_ids, async_req=True)
>>> result = thread.get()
Parameters

gene_ids ([int]) – NCBI gene ids

Keyword Arguments
  • fasta_filter ([str]) – Limit the FASTA sequences in the datasets package to these transcript and protein accessions. [optional]

  • _return_http_data_only (bool) – response data without head status code and headers. Default is True.

  • _preload_content (bool) – if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True.

  • _request_timeout (int/float/tuple) – timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. Default is None.

  • _check_input_type (bool) – specifies if type checking should be done one the data sent to the server. Default is True.

  • _check_return_type (bool) – specifies if type checking should be done one the data received from the server. Default is True.

  • _host_index (int/None) – specifies the index of the server that we want to use. Default is read from the configuration.

  • async_req (bool) – execute request asynchronously

Returns

V1DownloadSummary

If the method is called asynchronously, returns the request thread.

gene_download_summary_by_post(v1_gene_dataset_request, **kwargs)

Get gene download summary # noqa: E501

Get gene download summary in a JSON output format. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True

>>> thread = api.gene_download_summary_by_post(v1_gene_dataset_request, async_req=True)
>>> result = thread.get()
Parameters

v1_gene_dataset_request (V1GeneDatasetRequest) –

Keyword Arguments
  • _return_http_data_only (bool) – response data without head status code and headers. Default is True.

  • _preload_content (bool) – if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True.

  • _request_timeout (int/float/tuple) – timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. Default is None.

  • _check_input_type (bool) – specifies if type checking should be done one the data sent to the server. Default is True.

  • _check_return_type (bool) – specifies if type checking should be done one the data received from the server. Default is True.

  • _host_index (int/None) – specifies the index of the server that we want to use. Default is read from the configuration.

  • async_req (bool) – execute request asynchronously

Returns

V1DownloadSummary

If the method is called asynchronously, returns the request thread.

gene_download_summary_by_tax_and_symbol(symbols, taxon, **kwargs)

Get gene download summary by gene symbol # noqa: E501

Get gene download summary by gene symbol in a JSON output format. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True

>>> thread = api.gene_download_summary_by_tax_and_symbol(symbols, taxon, async_req=True)
>>> result = thread.get()
Parameters
  • symbols ([str]) – Gene symbol

  • taxon (str) – Taxon for provided gene symbol

Keyword Arguments
  • fasta_filter ([str]) – Limit the FASTA sequences in the datasets package to these transcript and protein accessions. [optional]

  • _return_http_data_only (bool) – response data without head status code and headers. Default is True.

  • _preload_content (bool) – if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True.

  • _request_timeout (int/float/tuple) – timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. Default is None.

  • _check_input_type (bool) – specifies if type checking should be done one the data sent to the server. Default is True.

  • _check_return_type (bool) – specifies if type checking should be done one the data received from the server. Default is True.

  • _host_index (int/None) – specifies the index of the server that we want to use. Default is read from the configuration.

  • async_req (bool) – execute request asynchronously

Returns

V1DownloadSummary

If the method is called asynchronously, returns the request thread.

gene_metadata_by_accession(accessions, **kwargs)

Get gene metadata by RefSeq Accession # noqa: E501

Get detailed gene metadata by RefSeq Accession in a JSON output format. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True

>>> thread = api.gene_metadata_by_accession(accessions, async_req=True)
>>> result = thread.get()
Parameters

accessions ([str]) – RNA or Protein accessions.

Keyword Arguments
  • returned_content (V1GeneDatasetRequestContentType) – Return either gene-ids, or entire gene metadata. [optional]

  • sort_schema_field (V1GeneDatasetRequestSortField) – Select a field to sort on.. [optional]

  • sort_schema_direction (V1SortDirection) – Select a direction for the sort.. [optional]

  • limit (str) – Limit the number of returned results (“all”, “none”, otherwise an integer value). [optional]

  • _return_http_data_only (bool) – response data without head status code and headers. Default is True.

  • _preload_content (bool) – if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True.

  • _request_timeout (int/float/tuple) – timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. Default is None.

  • _check_input_type (bool) – specifies if type checking should be done one the data sent to the server. Default is True.

  • _check_return_type (bool) – specifies if type checking should be done one the data received from the server. Default is True.

  • _host_index (int/None) – specifies the index of the server that we want to use. Default is read from the configuration.

  • async_req (bool) – execute request asynchronously

Returns

V1GeneMetadata

If the method is called asynchronously, returns the request thread.

gene_metadata_by_id(gene_ids, **kwargs)

Get gene metadata by GeneID # noqa: E501

Get detailed gene metadata by GeneID in a JSON output format. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True

>>> thread = api.gene_metadata_by_id(gene_ids, async_req=True)
>>> result = thread.get()
Parameters

gene_ids ([int]) – NCBI gene ids

Keyword Arguments
  • returned_content (V1GeneDatasetRequestContentType) – Return either gene-ids, or entire gene metadata. [optional]

  • sort_schema_field (V1GeneDatasetRequestSortField) – Select a field to sort on.. [optional]

  • sort_schema_direction (V1SortDirection) – Select a direction for the sort.. [optional]

  • limit (str) – Limit the number of returned results (“all”, “none”, otherwise an integer value). [optional]

  • _return_http_data_only (bool) – response data without head status code and headers. Default is True.

  • _preload_content (bool) – if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True.

  • _request_timeout (int/float/tuple) – timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. Default is None.

  • _check_input_type (bool) – specifies if type checking should be done one the data sent to the server. Default is True.

  • _check_return_type (bool) – specifies if type checking should be done one the data received from the server. Default is True.

  • _host_index (int/None) – specifies the index of the server that we want to use. Default is read from the configuration.

  • async_req (bool) – execute request asynchronously

Returns

V1GeneMetadata

If the method is called asynchronously, returns the request thread.

gene_metadata_by_post(v1_gene_dataset_request, **kwargs)

Get gene metadata as JSON # noqa: E501

Get detailed gene metadata in a JSON output format. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True

>>> thread = api.gene_metadata_by_post(v1_gene_dataset_request, async_req=True)
>>> result = thread.get()
Parameters

v1_gene_dataset_request (V1GeneDatasetRequest) –

Keyword Arguments
  • _return_http_data_only (bool) – response data without head status code and headers. Default is True.

  • _preload_content (bool) – if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True.

  • _request_timeout (int/float/tuple) – timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. Default is None.

  • _check_input_type (bool) – specifies if type checking should be done one the data sent to the server. Default is True.

  • _check_return_type (bool) – specifies if type checking should be done one the data received from the server. Default is True.

  • _host_index (int/None) – specifies the index of the server that we want to use. Default is read from the configuration.

  • async_req (bool) – execute request asynchronously

Returns

V1GeneMetadata

If the method is called asynchronously, returns the request thread.

gene_metadata_by_tax_and_symbol(symbols, taxon, **kwargs)

Get gene metadata by gene symbol # noqa: E501

Get detailed gene metadata by gene symbol in a JSON output format. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True

>>> thread = api.gene_metadata_by_tax_and_symbol(symbols, taxon, async_req=True)
>>> result = thread.get()
Parameters
  • symbols ([str]) – Gene symbol

  • taxon (str) – Taxon for provided gene symbol

Keyword Arguments
  • accessions ([str]) – RNA or Protein accessions.. [optional]

  • returned_content (V1GeneDatasetRequestContentType) – Return either gene-ids, or entire gene metadata. [optional]

  • sort_schema_field (V1GeneDatasetRequestSortField) – Select a field to sort on.. [optional]

  • sort_schema_direction (V1SortDirection) – Select a direction for the sort.. [optional]

  • limit (str) – Limit the number of returned results (“all”, “none”, otherwise an integer value). [optional]

  • _return_http_data_only (bool) – response data without head status code and headers. Default is True.

  • _preload_content (bool) – if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True.

  • _request_timeout (int/float/tuple) – timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. Default is None.

  • _check_input_type (bool) – specifies if type checking should be done one the data sent to the server. Default is True.

  • _check_return_type (bool) – specifies if type checking should be done one the data received from the server. Default is True.

  • _host_index (int/None) – specifies the index of the server that we want to use. Default is read from the configuration.

  • async_req (bool) – execute request asynchronously

Returns

V1GeneMetadata

If the method is called asynchronously, returns the request thread.

gene_metadata_stream_by_post(v1_gene_dataset_request, **kwargs)

Get gene metadata # noqa: E501

Get detailed gene metadata in a streaming, JSON-lines output format. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True

>>> thread = api.gene_metadata_stream_by_post(v1_gene_dataset_request, async_req=True)
>>> result = thread.get()
Parameters

v1_gene_dataset_request (V1GeneDatasetRequest) –

Keyword Arguments
  • _return_http_data_only (bool) – response data without head status code and headers. Default is True.

  • _preload_content (bool) – if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True.

  • _request_timeout (int/float/tuple) – timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. Default is None.

  • _check_input_type (bool) – specifies if type checking should be done one the data sent to the server. Default is True.

  • _check_return_type (bool) – specifies if type checking should be done one the data received from the server. Default is True.

  • _host_index (int/None) – specifies the index of the server that we want to use. Default is read from the configuration.

  • async_req (bool) – execute request asynchronously

Returns

V1GeneMatch

If the method is called asynchronously, returns the request thread.

gene_orthologs_by_id(gene_id, **kwargs)

Get gene orthologs by gene ID # noqa: E501

Get detailed gene metadata for an ortholog set by gene ID in a JSON output format. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True

>>> thread = api.gene_orthologs_by_id(gene_id, async_req=True)
>>> result = thread.get()
Parameters

gene_id (int) –

Keyword Arguments
  • returned_content (V1OrthologRequestContentType) – Return either gene-ids, or entire gene metadata. [optional]

  • taxon_filter ([str]) – Filter genes by taxa. [optional]

  • _return_http_data_only (bool) – response data without head status code and headers. Default is True.

  • _preload_content (bool) – if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True.

  • _request_timeout (int/float/tuple) – timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. Default is None.

  • _check_input_type (bool) – specifies if type checking should be done one the data sent to the server. Default is True.

  • _check_return_type (bool) – specifies if type checking should be done one the data received from the server. Default is True.

  • _host_index (int/None) – specifies the index of the server that we want to use. Default is read from the configuration.

  • async_req (bool) – execute request asynchronously

Returns

V1OrthologSet

If the method is called asynchronously, returns the request thread.

gene_tax_name_query(taxon_query, **kwargs)

Get a list of taxonomy names and IDs found in the gene dataset given a partial taxonomic name # noqa: E501

This endpoint retrieves a list of taxonomy names and IDs found in the gene dataset given a partial taxonomic name of any rank. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True

>>> thread = api.gene_tax_name_query(taxon_query, async_req=True)
>>> result = thread.get()
Parameters

taxon_query (str) – NCBI Taxonomy ID or name (common or scientific) at any taxonomic rank

Keyword Arguments
  • tax_rank_filter (V1OrganismQueryRequestTaxRankFilter) – Set the scope of searched tax ranks. [optional]

  • _return_http_data_only (bool) – response data without head status code and headers. Default is True.

  • _preload_content (bool) – if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True.

  • _request_timeout (int/float/tuple) – timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. Default is None.

  • _check_input_type (bool) – specifies if type checking should be done one the data sent to the server. Default is True.

  • _check_return_type (bool) – specifies if type checking should be done one the data received from the server. Default is True.

  • _host_index (int/None) – specifies the index of the server that we want to use. Default is read from the configuration.

  • async_req (bool) – execute request asynchronously

Returns

V1SciNameAndIds

If the method is called asynchronously, returns the request thread.

gene_tax_tree(taxon, **kwargs)

Get a taxonomic subtree by taxonomic identifier # noqa: E501

Using an NCBI Taxonomy ID or name (common or scientific) at any rank, get a subtree filtered for species with assembled genomes. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True

>>> thread = api.gene_tax_tree(taxon, async_req=True)
>>> result = thread.get()
Parameters

taxon (str) – NCBI Taxonomy ID or name (common or scientific) at any taxonomic rank

Keyword Arguments
  • children_only (bool) – Only report the children of the requested taxon and not their descendants. [optional] if omitted the server will use the default value of False

  • _return_http_data_only (bool) – response data without head status code and headers. Default is True.

  • _preload_content (bool) – if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True.

  • _request_timeout (int/float/tuple) – timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. Default is None.

  • _check_input_type (bool) – specifies if type checking should be done one the data sent to the server. Default is True.

  • _check_return_type (bool) – specifies if type checking should be done one the data received from the server. Default is True.

  • _host_index (int/None) – specifies the index of the server that we want to use. Default is read from the configuration.

  • async_req (bool) – execute request asynchronously

Returns

V1Organism

If the method is called asynchronously, returns the request thread.

Generated December 6, 2022