Skip to contents

The functions follow the HGNC REST API documentation at https://www.genenames.org/help/rest/. There are three main operations that can be performed with this package: fetching information about a specific gene (hgnc_fetch), searching for genes based on a query (hgnc_search), and fetching general information about the HGNC database (hgnc_info).

Usage

hgnc_info()

searchableFields(service = c("HGNC", "VGNC"))

hgnc_fetch(searchableField, value)

hgnc_search(searchableField = NULL, query)

Arguments

service

character(1) Either "HGNC" or "VGNC".

searchableField

character(1) A field as provided by searchableFields().

value

character(1) A value to search for in the searchableField.

query

character() A query string to search for in the HGNC database. The query string can be a single string or a vector of strings. If the query is a vector, the strings are concatenated with a "+". The query string can contain logical operators such as "AND", "OR", and "NOT". The query string can also contain field-value pairs separated by a colon. For example, to search for genes with the symbol starting with "ZNF" and the status "Approved", the query string would be c("ZNF*", "AND", "status:Approved").

Value

hgnc_info: A list of general information about the HGNC database. It includes searchableFields and storedFields metadata.

searchableFields: A character vector of searchable fields in the HGNC or VGNC database.

hgnc_fetch: A tibble with information about the gene specified by the searchableField and value arguments.

hgnc_search: A data.frame with information about the genes that match the query.

Examples

hgnc_info()
#> $lastModified
#> [1] "2025-05-06T13:38:21.968Z"
#> 
#> $numDoc
#> [1] 45901
#> 
#> $responseHeader
#> $responseHeader$QTime
#> [1] 1
#> 
#> $responseHeader$status
#> [1] 0
#> 
#> 
#> $searchableFields
#>  [1] "rna_central_id"   "hgnc_id"          "alias_name"       "locus_group"     
#>  [5] "mane_select"      "name"             "location"         "symbol"          
#>  [9] "status"           "rgd_id"           "entrez_id"        "alias_symbol"    
#> [13] "uniprot_ids"      "ccds_id"          "ucsc_id"          "omim_id"         
#> [17] "mgd_id"           "prev_symbol"      "curator_notes"    "ena"             
#> [21] "refseq_accession" "ensembl_gene_id"  "locus_type"       "prev_name"       
#> [25] "vega_id"         
#> 
#> $storedFields
#>  [1] "gene_group"             "lncipedia"              "snornabase"            
#>  [4] "prev_name"              "merops"                 "ucsc_id"               
#>  [7] "ensembl_gene_id"        "date_name_changed"      "vega_id"               
#> [10] "prev_symbol"            "curator_notes"          "mirbase"               
#> [13] "location"               "ena"                    "mamit-trnadb"          
#> [16] "cd"                     "date_modified"          "gencc"                 
#> [19] "locus_group"            "orphanet"               "lncrnadb"              
#> [22] "iuphar"                 "hgnc_id"                "gene_group_id"         
#> [25] "pseudogene.org"         "agr"                    "uniprot_ids"           
#> [28] "imgt"                   "mane_select"            "symbol"                
#> [31] "entrez_id"              "rgd_id"                 "mgd_id"                
#> [34] "homeodb"                "alias_name"             "omim_id"               
#> [37] "gtrnadb"                "locus_type"             "prev_name"             
#> [40] "enzyme_id"              "horde_id"               "bioparadigms_slc"      
#> [43] "date_symbol_changed"    "refseq_accession"       "alias_name"            
#> [46] "_version_"              "cosmic"                 "rna_central_id"        
#> [49] "alias_symbol"           "pubmed_id"              "date_approved_reserved"
#> [52] "ccds_id"                "name"                   "location"              
#> [55] "lsdb"                   "status"                 "uuid"                  
#> 
searchableFields()
#>  [1] "status"           "rgd_id"           "entrez_id"        "name"            
#>  [5] "mane_select"      "symbol"           "location"         "ccds_id"         
#>  [9] "alias_symbol"     "uniprot_ids"      "hgnc_id"          "rna_central_id"  
#> [13] "locus_group"      "alias_name"       "ena"              "refseq_accession"
#> [17] "curator_notes"    "prev_symbol"      "prev_name"        "vega_id"         
#> [21] "ensembl_gene_id"  "locus_type"       "omim_id"          "ucsc_id"         
#> [25] "mgd_id"          
hgnc_fetch("ena", "BC040926")
#> # A tibble: 1 × 27
#>   date_approved_reserved gene_group_id hgnc_id  alias_symbol date_symbol_changed
#>   <chr>                  <list>        <chr>    <list>       <chr>              
#> 1 2009-07-20T00:00:00Z   <int [1]>     HGNC:37… <chr [1]>    2010-11-25T00:00:0…
#> # ℹ 22 more variables: locus_group <chr>, refseq_accession <list>,
#> #   lncipedia <chr>, vega_id <chr>, name <chr>, uuid <chr>, status <chr>,
#> #   locus_type <chr>, prev_symbol <list>, ena <list>, symbol <chr>,
#> #   entrez_id <chr>, gene_group <list>, date_name_changed <chr>,
#> #   ensembl_gene_id <chr>, location_sortable <chr>, prev_name <list>,
#> #   ucsc_id <chr>, rna_central_id <list>, date_modified <chr>, location <chr>,
#> #   agr <chr>
hgnc_search(query = "BRAF")
#>      hgnc_id  symbol     score
#> 1  HGNC:1097    BRAF 187.79634
#> 2 HGNC:43877   BANCR 126.68584
#> 3 HGNC:18615  BRAFP1 126.68584
#> 4  HGNC:1098 BRAFPS1 126.68584
#> 5   HGNC:379   AKAP9  30.33242
hgnc_search("symbol", "ZNF*") |>
    head()
#>    symbol    hgnc_id score
#> 1    ZNF1 HGNC:12878     1
#> 2    ZNF2 HGNC:12991     1
#> 3    ZNF3 HGNC:13089     1
#> 4    ZNF7 HGNC:13139     1
#> 5    ZNF8 HGNC:13154     1
#> 6 ZNF8-DT HGNC:55280     1
hgnc_search("symbol", c("ZNF*", "AND", "status:Approved")) |>
    head()
#>      hgnc_id       symbol    score
#> 1 HGNC:12991         ZNF2 1.018147
#> 2 HGNC:13089         ZNF3 1.018147
#> 3 HGNC:13139         ZNF7 1.018147
#> 4 HGNC:13154         ZNF8 1.018147
#> 5 HGNC:55280      ZNF8-DT 1.018147
#> 6 HGNC:56757 ZNF8-ERVK3-1 1.018147
hgnc_search("symbol", c("ZNF3", "OR", "ZNF12"))
#>      hgnc_id symbol      score
#> 1 HGNC:12902  ZNF12 187.796340
#> 2 HGNC:13089   ZNF3   4.694909
hgnc_search("symbol", c("ZNF*", "NOT", "status:Approved")) |>
    head()
#>    symbol    hgnc_id score
#> 1    ZNF1 HGNC:12878     1
#> 2 ZNF15L2 HGNC:12946     1
#> 3  ZNF35P HGNC:13100     1
#> 4  ZNF43L HGNC:13106     1
#> 5  ZNF53A HGNC:13119     1
#> 6  ZNF53B HGNC:13120     1
hgnc_search("symbol", c("ZNF*", "AND", 'status:Entry withdrawn')) |>
    head()
#> list()
hgnc_search(
    "name",
    c("MAPK interacting", "AND", "locus_type:gene with protein product")
)
#> list()