Skip to content

Commit 85d2f7c

Browse files
revised processing of orphanet signs and frequencies
1 parent 777a99b commit 85d2f7c

File tree

1 file changed

+53
-30
lines changed

1 file changed

+53
-30
lines changed

orphanet/orphanet.php

Lines changed: 53 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ class ORPHANETParser extends Bio2RDFizer
3636
private $filemap = array(
3737
'disease' => 'en_product1.xml',
3838
'epi' => 'en_product9_prev.xml',
39-
# 'd2s' => 'en_product4.xml',
39+
'phenotypefreq' => 'en_product4.xml',
4040
# 'signs' => 'en_product5.xml',
4141
'genes' => 'en_product6.xml'
4242
);
4343
function __construct($argv) {
4444
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');
4646
parent::addParameter('download_url',false,null,'http://www.orphadata.org/data/xml/');
4747
parent::initialize();
4848
}
@@ -282,41 +282,64 @@ function epi ($file)
282282
unset($xml);
283283
}
284284

285-
function d2s($file)
285+
function phenotypefreq($file)
286286
{
287287
/*
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&amp;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+
*/
298314
$xml = new CXML($file);
299-
while($xml->parse("DisorderList") == TRUE) {
315+
while($xml->parse("HPODisorderSetStatus") == TRUE) {
300316
$x = $xml->GetXMLRoot();
301317
foreach($x->Disorder AS $d) {
302318
$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;
319330
}
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+
);
320343
}
321344
parent::writeRDFBufferToWriteFile();
322345
}

0 commit comments

Comments
 (0)