@@ -34,7 +34,8 @@ function __construct($argv) {
34
34
parent ::__construct ($ argv , 'omim ' );
35
35
parent ::addParameter ('files ' ,true ,null ,'all|omim# ' ,'entries to process: comma-separated list or hyphen-separated range ' );
36
36
parent ::addParameter ('omim_api_url ' ,false ,null ,'http://api.omim.org/api/entry?include=all&format=json ' );
37
- parent ::addParameter ('omim_api_key ' ,false ,null ,'D43076A680B921682DA253BEFE05DE998957B3FC ' );
37
+ parent ::addParameter ('omim_api_key ' ,false ,null );
38
+ parent ::addParameter ('omim_api_key_file ' ,false ,null ,'omim.key ' ,'A file containing your omim KEY ' );
38
39
parent ::initialize ();
39
40
}
40
41
@@ -43,6 +44,18 @@ function Run()
43
44
// directory shortcuts
44
45
$ ldir = parent ::getParameterValue ('indir ' );
45
46
$ odir = parent ::getParameterValue ('outdir ' );
47
+ if (parent ::getParameterValue ('omim_api_key ' ) == '' ) {
48
+ if (parent ::getParameterValue ('omim_api_key_file ' ) != '' ) {
49
+ if (file_exists (parent ::getParameterValue ('omim_api_key_file ' ))) {
50
+ $ key = file_get_contents (parent ::getParameterValue ('omim_api_key_file ' ));
51
+ if ($ key ) {
52
+ parent ::setParameterValue ('omim_api_key ' , $ key );
53
+ } else {
54
+ trigger_error ("No OMIM key has been provided either by commmand line or in the expected omim key file " ,E_USER_WARNING );
55
+ }
56
+ }
57
+ }
58
+ }
46
59
47
60
// get the list of mim2gene entries
48
61
$ entries = $ this ->GetListOfEntries ($ ldir );
@@ -480,15 +493,19 @@ function ParseEntry($obj, $type)
480
493
foreach ($ o ['phenotypeMapList ' ] AS $ i => $ phenotypeMap ) {
481
494
$ phenotypeMap = $ phenotypeMap ['phenotypeMap ' ];
482
495
$ pm_uri = parent ::getRes ().$ omim_id ."_pm_ " .($ i +1 );
483
- parent ::addRDF (parent ::triplify ($ omim_uri , parent ::getVoc ()."phenotype-map " , $ pm_uri ));
496
+ parent ::addRDF (
497
+ parent ::describeIndividual ($ pm_uri ,"phenotype mapping for $ omim_id " , parent ::getVoc ()."Phenotype-Map " ).
498
+ parent ::describeClass (parent ::getVoc ()."Phenotype-Map " ,"OMIM Phenotype-Map " ).
499
+ parent ::triplify ($ omim_uri , parent ::getVoc ()."phenotype-map " , $ pm_uri )
500
+ );
484
501
485
502
foreach (array_keys ($ phenotypeMap ) AS $ k ) {
486
503
if (in_array ($ k , array ("mimNumber " ,"phenotypeMimNumber " ,"phenotypicSeriesMimNumber " ))) {
487
504
parent ::addRDF (parent ::triplify ($ pm_uri , parent ::getVoc ().$ k , "omim: " .$ phenotypeMap [$ k ]));
488
505
} else if ($ k == "geneSymbols " ) {
489
506
$ l = explode (", " ,$ phenotypeMap [$ k ]);
490
507
foreach ($ l AS $ gene ) {
491
- parent ::addRDF (parent ::triplify ($ pm_uri , parent ::getVoc ().$ k , "hgnc.symbol: " .$ gene ));
508
+ parent ::addRDF (parent ::triplify ($ pm_uri , parent ::getVoc ()." gene-symbol " , "hgnc.symbol: " .$ gene ));
492
509
}
493
510
} else if ($ k == "phenotypeMappingKey " ) {
494
511
$ l = $ this ->get_phenotype_mapping_method_type ($ phenotypeMap [$ k ]);
@@ -519,7 +536,8 @@ function ParseEntry($obj, $type)
519
536
// external ids
520
537
if (isset ($ o ['externalLinks ' ])) {
521
538
foreach ($ o ['externalLinks ' ] AS $ k => $ id ) {
522
-
539
+ if ($ id === false ) continue ;
540
+
523
541
$ ns = '' ;
524
542
switch ($ k ) {
525
543
case 'approvedGeneSymbols ' : $ ns = 'symbol ' ;break ;
@@ -544,10 +562,12 @@ function ParseEntry($obj, $type)
544
562
case 'icd9cmIDs ' : $ ns = 'icd9 ' ;break ;
545
563
case 'umlsIDs ' : $ ns = 'umls ' ;break ;
546
564
case 'wormbaseIDs ' : $ ns = 'wormbase ' ;break ;
547
- case 'diseaseOntologyIDs ' : $ ns = 'do ' ;break ;
565
+
566
+ case 'diseaseOntologyIDs ' : $ ns = 'do ' ;break ;
548
567
549
568
// specifically ignorning
550
569
case 'geneTests ' :
570
+ case 'cmgGene ' :
551
571
case 'geneticAllianceIDs ' : // #
552
572
case 'nextGxDx ' :
553
573
case 'nbkIDs ' : // NBK1207;;Alport Syndrome and Thin Basement Membrane Nephropathy
@@ -560,7 +580,11 @@ function ParseEntry($obj, $type)
560
580
case 'coriellDiseases ' :
561
581
case 'clinicalDiseaseIDs ' :
562
582
case 'possumSyndromes ' :
583
+ case 'keggPathways ' :
584
+ case 'gtr ' :
585
+ case 'gwasCatalog ' :
563
586
case 'mgiHumanDisease ' :
587
+ case 'wormbaseDO ' :
564
588
case 'dermAtlas ' : // true/false
565
589
break ;
566
590
@@ -571,11 +595,15 @@ function ParseEntry($obj, $type)
571
595
$ ids = explode (", " ,$ id );
572
596
foreach ($ ids AS $ id ) {
573
597
if ($ ns ) {
574
- $ b = explode (";; " ,$ id ); // multiple ids//names
575
- foreach ($ b AS $ c ) {
576
- preg_match ("/([a-z])/ " ,$ c ,$ m );
577
- if (!isset ($ m [1 ])) {
578
- parent ::addRDF (parent ::triplify ($ omim_uri , parent ::getVoc ()."x- $ ns " , $ ns .': ' .$ c ));
598
+ if (strstr ($ id ,";; " ) === FALSE ) {
599
+ parent ::addRDF (parent ::triplify ($ omim_uri , parent ::getVoc ()."x- $ ns " , $ ns .': ' .$ id ));
600
+ } else {
601
+ $ b = explode (";; " ,$ id ); // multiple ids//names
602
+ foreach ($ b AS $ c ) {
603
+ preg_match ("/([a-z])/ " ,$ c ,$ m );
604
+ if (!isset ($ m [1 ])) {
605
+ parent ::addRDF (parent ::triplify ($ omim_uri , parent ::getVoc ()."x- $ ns " , $ ns .': ' .$ c ));
606
+ }
579
607
}
580
608
}
581
609
}
0 commit comments