Skip to content

Instantly share code, notes, and snippets.

@hisplan
Last active June 10, 2020 10:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hisplan/d8fb7d2729bc74b740c9cdf09b4ec5ab to your computer and use it in GitHub Desktop.
Save hisplan/d8fb7d2729bc74b740c9cdf09b4ec5ab to your computer and use it in GitHub Desktop.
HGNC REST Service

HGNC REST Service

HGNC: Hugo Gene Nomenclature Committee

https://www.genenames.org/help/rest/

tl;dr;

  • fetch: returns all the fields, does not accept wild cards or multiple queries)
  • search: returns all possible entries with only the fields hgnc_id, symbol and score.

Setup

If you want the results to be returned in JSON format and to display nicely in the terminal:

homebrew install jq

Example

Fetch

wget -qO- --header='Accept:application/json' https://rest.genenames.org/fetch/ensembl_gene_id/ENSG00000157693 | jq
{
  "responseHeader": {
    "status": 0,
    "QTime": 2
  },
  "response": {
    "numFound": 1,
    "start": 0,
    "docs": [
      {
        "hgnc_id": "HGNC:24513",
        "symbol": "TMEM268",
        "name": "transmembrane protein 268",
        "status": "Approved",
        "locus_type": "gene with protein product",
        "prev_symbol": [
          "C9orf91"
        ],
        "prev_name": [
          "chromosome 9 open reading frame 91"
        ],
        "alias_symbol": [
          "DKFZp547P234",
          "FLJ38045"
        ],
        "location": "9q32",
        "date_approved_reserved": "2004-02-24T00:00:00Z",
        "date_modified": "2016-10-05T00:00:00Z",
        "date_name_changed": "2016-06-20T00:00:00Z",
        "ena": [
          "BX649023"
        ],
        "entrez_id": "203197",
        "mgd_id": [
          "MGI:1913920"
        ],
        "pubmed_id": [
          14702039
        ],
        "refseq_accession": [
          "NM_153045"
        ],
        "date_symbol_changed": "2016-06-20T00:00:00Z",
        "vega_id": "OTTHUMG00000020541",
        "ensembl_gene_id": "ENSG00000157693",
        "ccds_id": [
          "CCDS6808",
          "CCDS83405"
        ],
        "locus_group": "protein-coding gene",
        "uniprot_ids": [
          "Q5VZI3"
        ],
        "ucsc_id": "uc004bjd.5",
        "rgd_id": [
          "RGD:1304595"
        ],
        "location_sortable": "09q32",
        "agr": "HGNC:24513",
        "uuid": "2d56ee75-5c38-495f-901c-a63b3cba275f",
        "_version_": 1668828615378206700
      }
    ]
  }
}

Search

wget -qO- --header='Accept:application/json' https://rest.genenames.org/search/ensembl_gene_id/ENSG00000157693 | jq
{
  "responseHeader": {
    "status": 0,
    "QTime": 2
  },
  "response": {
    "numFound": 1,
    "start": 0,
    "maxScore": 10.99456,
    "docs": [
      {
        "hgnc_id": "HGNC:24513",
        "symbol": "TMEM268",
        "score": 10.99456
      }
    ]
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment