PHP code example of omnilab / hgnc

1. Go to this page and download the library: Download omnilab/hgnc library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

omnilab / hgnc example snippets


$hgnc = (new HgncSourceFactory($http))->create(['mailto' => '[email protected]']);
$gene = $hgnc->entity('HBB');                // or 'HGNC:4827', 'ENSG00000244734', 'omim:141900'
$gene->id->display();                         // HGNC:4827
$gene->description;                           // hemoglobin subunit beta
$gene->value('map_location');                 // 11p15.4
$gene->identifiers()->keys();                 // hgnc:4827, ncbi.gene:3043, ensembl:ENSG00000244734, uniprot:P68871, omim:141900
$hgnc->entity('FAM46C')->label;               // TENT5C
$hgnc->search(new Query('hemoglobin', limit: 5));   // 15 genes



mnilab\Hgnc\HgncSourceFactory;

$hgnc = (new HgncSourceFactory())->create(['mailto' => '[email protected]']);   // your address, in the User-Agent
$gene = $hgnc->entity('HBB');
echo $gene->id->display(), ' ', $gene->label, ': ', $gene->description, ', ', $gene->value('map_location'), "\n";