Get gene metadata
Retrieve gene metadata by NCBI Gene ID, gene symbol or RefSeq accession.
Get gene metadata
Retrieve gene metadata by NCBI Gene ID, gene symbol or RefSeq accession.
Retrieve gene metadata as a gene data report from NCBI Datasets through the easy-to-use website, command line tool or programming languages. For an overview of available metadata, see Datasets gene data report schemas .
Using NCBI Gene IDs
One way to access gene data reports is by their numeric id, or gene-id.
- Visit the gene data table .
- Click Get Started.
- Paste
1,2,3,9,10,11,12,13,14,15,16,17into the Gene IDs box. - Click Add.
- Click Select Columns to add or remove metadata from the table.
- Select the checkboxes for each gene you wish to download.
- Click Download Table to download the columns you have displayed in tabular format.
- Name your file and click Download.
datasets summary gene gene-id 1,2,3,9,10,11,12,13,14,15,16,17For more information, see the Datasets Python API reference documentation
In this example, we are using the print_gene_metadata_by_fields method from ncbi-datasets-pylib.
from typing import List
from ncbi.datasets.openapi import ApiClient as DatasetsApiClient
from ncbi.datasets.openapi import ApiException as DatasetsApiException
from ncbi.datasets.openapi import GeneApi as DatasetsGeneApi
from ncbi.datasets.metadata.gene import print_gene_metadata_by_fields
# Provide your own gene ids as a list of integers
input_gene_ids: List[int] = [1, 2, 3, 9, 10, 11, 12, 13, 14, 15, 16, 17]
def gene_infor_for_geneids(gene_ids: List[int]):
if len(gene_ids) == 0:
print('Please provide at least one gene-id')
return
with DatasetsApiClient() as api_client:
gene_api = DatasetsGeneApi(api_client)
try:
gene_reply = gene_api.gene_metadata_by_id(gene_ids)
for gene in gene_reply.genes:
print_gene_metadata_by_fields(gene, fields=['gene_id', 'symbol'])
except DatasetsApiException as e:
print(f'Exception when calling GeneApi: {e}\n')For more information, see the [Datasets R API reference documentation](/datasets/docs/languages/r/).
api.gene_instance <- GeneApi$new()
result_gene <- api.gene_instance$GeneMetadataById(
'1,2,3,9,10,11,12,13,14,15,16,17',
returned.content='COMPLETE',
sort.schema.field='SORT_FIELD_GENE_ID'
)
prettify(result_gene$toJSONString())
for (gene_match in result_gene$genes) {
cat(gene_match$gene$gene_id, " - ", gene_match$gene$symbol, "\n")
}Using gene symbols
Similarly, gene data reports may be retrieved by their gene symbol.
- Visit the gene data table .
- Click Get Started.
- Select Gene Symbol in the Identifier type dropdown.
- Paste
ACRV1,A2Minto the Gene Symbols box, and leaveHumanin the Organism field. - Click Add.
- Click Select Columns to add or remove metadata from the table.
- Select the checkboxes for each gene you wish to download.
- Click Download Table to download the columns you have displayed in tabular format.
- Name your file and click Download.
datasets summary gene symbol ACRV1 A2M --taxon human
Using transcript or protein accessions
Finally, gene data reports may be retrieved by a RefSeq transcript or protein accession.
- Visit the gene data table .
- Click Get Started.
- Select Accession in the Identifier type dropdown.
- Paste
NM_020107.5,NP_001334352.2into the Accessions box. No Organism is required. - Click Add.
- Click Select Columns to add or remove metadata from the table.
- Select the checkboxes for each gene you wish to download.
- Click Download Table to download the columns you have displayed in tabular format.
- Name your file and click Download.
datasets summary gene accession NM_020107.5 NP_001334352.2
Related information
Generated April 27, 2021