@@ -34,7 +34,8 @@ function __construct($argv) {
3434 parent ::__construct ($ argv , 'omim ' );
3535 parent ::addParameter ('files ' ,true ,null ,'all|omim# ' ,'entries to process: comma-separated list or hyphen-separated range ' );
3636 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 ' );
3839 parent ::initialize ();
3940 }
4041
@@ -43,6 +44,18 @@ function Run()
4344 // directory shortcuts
4445 $ ldir = parent ::getParameterValue ('indir ' );
4546 $ 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+ }
4659
4760 // get the list of mim2gene entries
4861 $ entries = $ this ->GetListOfEntries ($ ldir );
@@ -480,15 +493,19 @@ function ParseEntry($obj, $type)
480493 foreach ($ o ['phenotypeMapList ' ] AS $ i => $ phenotypeMap ) {
481494 $ phenotypeMap = $ phenotypeMap ['phenotypeMap ' ];
482495 $ 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+ );
484501
485502 foreach (array_keys ($ phenotypeMap ) AS $ k ) {
486503 if (in_array ($ k , array ("mimNumber " ,"phenotypeMimNumber " ,"phenotypicSeriesMimNumber " ))) {
487504 parent ::addRDF (parent ::triplify ($ pm_uri , parent ::getVoc ().$ k , "omim: " .$ phenotypeMap [$ k ]));
488505 } else if ($ k == "geneSymbols " ) {
489506 $ l = explode (", " ,$ phenotypeMap [$ k ]);
490507 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 ));
492509 }
493510 } else if ($ k == "phenotypeMappingKey " ) {
494511 $ l = $ this ->get_phenotype_mapping_method_type ($ phenotypeMap [$ k ]);
@@ -519,7 +536,8 @@ function ParseEntry($obj, $type)
519536 // external ids
520537 if (isset ($ o ['externalLinks ' ])) {
521538 foreach ($ o ['externalLinks ' ] AS $ k => $ id ) {
522-
539+ if ($ id === false ) continue ;
540+
523541 $ ns = '' ;
524542 switch ($ k ) {
525543 case 'approvedGeneSymbols ' : $ ns = 'symbol ' ;break ;
@@ -544,10 +562,12 @@ function ParseEntry($obj, $type)
544562 case 'icd9cmIDs ' : $ ns = 'icd9 ' ;break ;
545563 case 'umlsIDs ' : $ ns = 'umls ' ;break ;
546564 case 'wormbaseIDs ' : $ ns = 'wormbase ' ;break ;
547- case 'diseaseOntologyIDs ' : $ ns = 'do ' ;break ;
565+
566+ case 'diseaseOntologyIDs ' : $ ns = 'do ' ;break ;
548567
549568 // specifically ignorning
550569 case 'geneTests ' :
570+ case 'cmgGene ' :
551571 case 'geneticAllianceIDs ' : // #
552572 case 'nextGxDx ' :
553573 case 'nbkIDs ' : // NBK1207;;Alport Syndrome and Thin Basement Membrane Nephropathy
@@ -560,7 +580,11 @@ function ParseEntry($obj, $type)
560580 case 'coriellDiseases ' :
561581 case 'clinicalDiseaseIDs ' :
562582 case 'possumSyndromes ' :
583+ case 'keggPathways ' :
584+ case 'gtr ' :
585+ case 'gwasCatalog ' :
563586 case 'mgiHumanDisease ' :
587+ case 'wormbaseDO ' :
564588 case 'dermAtlas ' : // true/false
565589 break ;
566590
@@ -571,11 +595,15 @@ function ParseEntry($obj, $type)
571595 $ ids = explode (", " ,$ id );
572596 foreach ($ ids AS $ id ) {
573597 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+ }
579607 }
580608 }
581609 }
0 commit comments