@@ -357,6 +357,7 @@ function genes()
357357
358358 $ url = false ;
359359 $ x = $ this ->MapXrefs ($ xref , $ url , $ ns , $ id2 );
360+ $ ns = str_replace (' ' ,'' ,$ ns );
360361 if ($ url == true ) {
361362 parent ::addRDF (
362363 parent ::QQuadO_URL ($ id , parent ::getVoc ()."x- $ ns " , $ x )
@@ -399,15 +400,15 @@ function MapXrefs($xref, &$url = false, &$ns = null, &$id = null)
399400 "ucscgenomebrowser " => "refseq " ,
400401 "uniprotkb " => "uniprot " ,
401402 'genecard ' =>'genecards ' ,
402- 'ucsc genome browser ' => 'refseq ' ,
403- 'refseq rna ' => 'refseq ' ,
404- 'refseq protein ' => 'refseq ' ,
405- 'refseq dna ' => 'refseq ' ,
406- 'comparative toxicogenomics database ' => 'ctd ' ,
407- 'humancyc gene ' => 'humancyc '
403+ 'ucscgenomebrowser ' => 'refseq ' ,
404+ 'refseqrna ' => 'refseq ' ,
405+ 'refseqprotein ' => 'refseq ' ,
406+ 'refseqdna ' => 'refseq ' ,
407+ 'comparativetoxicogenomicsdatabase ' => 'ctd ' ,
408+ 'humancycgene ' => 'humancyc '
408409 );
409410 $ this ->getRegistry ()->ParseQName ($ xref ,$ ns ,$ id );
410- $ ns = str_replace ('" ' ,'' ,$ ns );
411+ $ ns = str_replace (array ( '" ' , ' ' ) ,'' ,$ ns );
411412 if (isset ($ xrefs [$ ns ])) {
412413 $ ns = $ xrefs [$ ns ];
413414 }
@@ -503,10 +504,11 @@ function drugs()
503504 if (trim ($ a [6 ])) {
504505 // Cross References
505506 // drugBank:DB00789,keggDrug:D01707,pubChemCompound:55466,pubChemSubstance:192903,url:http://en.wikipedia.org/wiki/Gadopentetate_dimeglumine
506- $ b = explode (', ' ,trim ($ a [6 ]));
507+ $ b = explode (', ' ,trim (str_replace ( ' " ' , '' , $ a [6 ]) ));
507508 foreach ($ b as $ c ) {
508509 $ this ->getRegistry ()->parseQName ($ c ,$ ns ,$ id1 );
509- $ ns = str_replace (array ('keggcompound ' ,'keggdrug ' ,'drugbank ' ,'uniprotkb ' ,'clinicaltrials.gov ' ,'drugs product database (dpd) ' ,'national drug code directory ' ,'therapeutic targets database ' ,'fda drug label at dailymed ' ),
510+ $ ns = str_replace (array ('" ' ,' ' ),'' ,$ ns );
511+ $ ns = str_replace (array ('keggcompound ' ,'keggdrug ' ,'drugbank ' ,'uniprotkb ' ,'clinicaltrials.gov ' ,'drugsproductdatabase(dpd) ' ,'nationaldrugcodedirectory ' ,'therapeutictargetsdatabase ' ,'fdadruglabelatdailymed ' ),
510512 array ('kegg ' ,'kegg ' ,'drugbank ' , 'uniprot ' ,'clinicaltrials ' ,'dpd ' ,'ndc ' ,'ttd ' ,'dailymed ' ),
511513 strtolower (str_replace ('" ' ,'' ,$ ns )));
512514 if ($ ns == "url " ) {
@@ -562,7 +564,7 @@ function diseases()
562564
563565 while ($ l = $ this ->GetReadFile ()->Read (10000 )) {
564566 $ a = explode ("\t" ,$ l );
565-
567+
566568 $ id = parent ::getNamespace ().$ a [0 ];
567569 $ label = str_replace ("' " , "\\\' " , $ a [1 ]);
568570
@@ -595,19 +597,23 @@ function diseases()
595597 parent ::addRDF (
596598 parent ::triplify ($ id , "owl:sameAs " , $ sameID )
597599 );
598- if (isset ($ a [4 ]) && trim ($ a [4 ]) != '' ) {
599- $ d = preg_match_all ('/[,]?([^\:]+):([A-Za-z0-9]+)\(([^\)]+)\)/ ' ,$ a [4 ],$ m , PREG_SET_ORDER );
600- foreach ($ m AS $ n ) {
601- if (isset ($ n [1 ]) && isset ($ n [2 ]) && !strstr ($ n [1 ]," " )) {
602- $ n [1 ] = str_replace ("), " ,"" ,strtolower ($ n [1 ]));
603- $ id2 = $ n [1 ].': ' .$ n [2 ];
604- parent ::addRDF (
605- parent ::triplify ($ id , "pharmgkb_vocabulary:x- " .$ n [1 ], $ id2 )
606- );
607- if (isset ($ n [3 ]) && $ n [2 ] != $ n [3 ]){
600+ if (isset ($ a [4 ]) && trim ($ a [4 ]) != '' ) {
601+ $ xrefs = explode ('"," ' , $ a [4 ]);
602+ foreach ($ xrefs AS $ xref ) {
603+ $ xref = str_replace ('" ' ,'' ,$ xref );
604+ $ d = preg_match_all ('/[,]?([^\:]+):([A-Za-z0-9]+)\(([^\)]+)\)/ ' ,$ xref ,$ m , PREG_SET_ORDER );
605+ foreach ($ m AS $ n ) {
606+ if (isset ($ n [1 ]) && isset ($ n [2 ]) && !strstr ($ n [1 ]," " )) {
607+ $ n [1 ] = str_replace ("), " ,"" ,strtolower ($ n [1 ]));
608+ $ id2 = $ n [1 ].': ' .$ n [2 ];
608609 parent ::addRDF (
609- parent ::triplifyString ( $ id2 , "rdfs:label " , str_replace ( array ( " \' " , "\"" ), array ( "\\ \' " , "" ), $ n [3 ]) )
610+ parent ::triplify ( $ id , "pharmgkb_vocabulary:x- " . $ n [1 ], $ id2 )
610611 );
612+ if (isset ($ n [3 ]) && $ n [2 ] != $ n [3 ]){
613+ parent ::addRDF (
614+ parent ::triplifyString ($ id2 , "rdfs:label " , str_replace (array ("\' " , "\"" ),array ("\\\' " , "" ),$ n [3 ]))
615+ );
616+ }
611617 }
612618 }
613619 }
0 commit comments