@@ -36,13 +36,13 @@ class ORPHANETParser extends Bio2RDFizer
36
36
private $ filemap = array (
37
37
'disease ' => 'en_product1.xml ' ,
38
38
'epi ' => 'en_product9_prev.xml ' ,
39
- # 'd2s' => 'en_product4.xml',
39
+ ' phenotypefreq ' => 'en_product4.xml ' ,
40
40
# 'signs' => 'en_product5.xml',
41
41
'genes ' => 'en_product6.xml '
42
42
);
43
43
function __construct ($ argv ) {
44
44
parent ::__construct ($ argv , "orphanet " );
45
- parent ::addParameter ('files ' ,true ,'all|disease|genes ' ,'all ' ,'all or comma-separated list of ontology short names to process ' );
45
+ parent ::addParameter ('files ' ,true ,'all|disease|phenotypefreq| genes ' ,'all ' ,'all or comma-separated list of ontology short names to process ' );
46
46
parent ::addParameter ('download_url ' ,false ,null ,'http://www.orphadata.org/data/xml/ ' );
47
47
parent ::initialize ();
48
48
}
@@ -282,41 +282,64 @@ function epi ($file)
282
282
unset($ xml );
283
283
}
284
284
285
- function d2s ($ file )
285
+ function phenotypefreq ($ file )
286
286
{
287
287
/*
288
- <DisorderSignList count="18">
289
- <DisorderSign>
290
- <ClinicalSign id="2040">
291
- <Name lang="en">Macrocephaly/macrocrania/megalocephaly/megacephaly</Name>
292
- </ClinicalSign>
293
- <SignFreq id="640">
294
- <Name lang="en">Very frequent</Name>
295
- </SignFreq>
296
- </DisorderSign>
297
- */
288
+ <HPODisorderSetStatus id="51">
289
+ <Disorder id="109">
290
+ <OrphaNumber>558</OrphaNumber>
291
+ <ExpertLink lang="en">http://www.orpha.net/consor/cgi-bin/OC_Exp.php?lng=en&Expert=558</ExpertLink>
292
+ <Name lang="en">Marfan syndrome</Name>
293
+ <DisorderType id="21394">
294
+ <Name lang="en">Disease</Name>
295
+ </DisorderType>
296
+ <DisorderGroup id="36547">
297
+ <Name lang="en">Disorder</Name>
298
+ </DisorderGroup>
299
+
300
+ <HPODisorderAssociationList count="59">
301
+ <HPODisorderAssociation id="207760">
302
+ <HPO id="104">
303
+ <HPOId>HP:0000768</HPOId>
304
+ <HPOTerm>Pectus carinatum</HPOTerm>
305
+ </HPO>
306
+ <HPOFrequency id="28412">
307
+ <Name lang="en">Very frequent (99-80%)</Name>
308
+ </HPOFrequency>
309
+ <DiagnosticCriteria id="28454">
310
+ <Name lang="en">Diagnostic criterion</Name>
311
+ </DiagnosticCriteria>
312
+ </HPODisorderAssociation>
313
+ */
298
314
$ xml = new CXML ($ file );
299
- while ($ xml ->parse ("DisorderList " ) == TRUE ) {
315
+ while ($ xml ->parse ("HPODisorderSetStatus " ) == TRUE ) {
300
316
$ x = $ xml ->GetXMLRoot ();
301
317
foreach ($ x ->Disorder AS $ d ) {
302
318
$ orphanet_id = parent ::getNamespace ().((string )$ d ->OrphaNumber );
303
- foreach ($ d ->DisorderSignList ->DisorderSign AS $ ds ) {
304
- $ sfid = parent ::getRes ().md5 ($ ds ->asXML ());
305
- if ($ ds ->ClinicalSign ) {
306
- $ sid = parent ::getVoc ().((string )$ ds ->ClinicalSign ->attributes ()->id );
307
- $ s = (string ) $ ds ->ClinicalSign ->Name ;
308
- $ fid = parent ::getRes ().((string ) $ ds ->SignFreq ->attributes ()->id );
309
- $ f = (string ) $ ds ->SignFreq ->Name ;
310
- parent ::addRDF (
311
- parent ::describeIndividual ($ sfid , "$ f $ s " ,parent ::getVoc ()."Clinical-Sign-And-Frequency " ).
312
- parent ::describeClass (parent ::getVoc ()."Clinical-Sign-And-Frequency " ,"Clinical Sign and Frequency " ).
313
- parent ::triplify ($ orphanet_id , parent ::getVoc ()."sign-freq " , $ sfid ).
314
- parent ::triplify ($ sfid ,parent ::getVoc ()."sign " , $ sid ).
315
- parent ::describeClass ($ sid ,$ s ,parent ::getVoc ()."Clinical-Sign " ).
316
- parent ::triplify ($ sfid ,parent ::getVoc ()."frequency " ,$ fid ).
317
- parent ::describeClass ($ fid ,$ f ,parent ::getVoc ()."Frequency " )
318
- );
319
+ $ disease_name = ((string )$ d ->Name );
320
+ foreach ($ d ->HPODisorderAssociationList ->HPODisorderAssociation AS $ ds ) {
321
+ $ sfid = parent ::getNamespace ().((string )$ ds ->attributes ()->id );
322
+ $ s = (string ) $ ds ->HPO ->HPOTerm ;
323
+ $ sid = $ ds ->HPO ->HPOId ;
324
+ $ f = (string ) $ ds ->HPOFrequency ->Name ;
325
+ $ fid = parent ::getRes ().((string ) $ ds ->HPOFrequency ->attributes ()->id );
326
+
327
+ $ diagnostic = false ;
328
+ if ($ ds ->DiagnosticCriteria ->Name ) {
329
+ $ diagnostic = true ;
319
330
}
331
+ $ sflabel = "$ f $ s " .(($ diagnostic == true )?" that is diagnostic " :"" )." for " .$ disease_name ;
332
+
333
+ parent ::addRDF (
334
+ parent ::describeIndividual ($ sfid , $ sflabel , parent ::getVoc ()."Clinical-Sign-And-Frequency " ).
335
+ parent ::describeClass (parent ::getVoc ()."Clinical-Sign-And-Frequency " ,"Clinical Sign and Frequency " ).
336
+ parent ::triplify ($ orphanet_id , parent ::getVoc ()."sign-freq " , $ sfid ).
337
+ parent ::triplify ($ sfid ,parent ::getVoc ()."sign " , $ sid ).
338
+ parent ::triplify ($ sfid ,parent ::getVoc ()."frequency " ,$ fid ).
339
+ parent ::triplifyString ($ sfid , parent ::getVoc ()."is-diagnostic " , (isset ($ diagnostic )?"true " :"false " )).
340
+ parent ::triplifyString ($ fid , "rdfs:label " , $ fid ).
341
+ parent ::describeClass ($ fid ,$ f ,parent ::getVoc ()."Frequency " )
342
+ );
320
343
}
321
344
parent ::writeRDFBufferToWriteFile ();
322
345
}
0 commit comments