Skip to content

Commit 0432492

Browse files
added dataset description and id selector
1 parent dcdd08b commit 0432492

File tree

1 file changed

+49
-13
lines changed

1 file changed

+49
-13
lines changed

interpro/interpro.php

Lines changed: 49 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -74,20 +74,50 @@ function Run()
7474
parent::writeRDFBufferToWriteFile();
7575
parent::getWriteFile()->close();
7676
echo "Done!".PHP_EOL;
77+
78+
79+
80+
parent::setGraphURI(parent::getDatasetURI());
81+
82+
// dataset description
83+
$source_version = parent::getDatasetVersion();
84+
$source_file = (new DataResource($this))
85+
->setURI($rfile)
86+
->setTitle("InterPro v$source_version")
87+
->setRetrievedDate( date ("Y-m-d\TG:i:s\Z", filemtime($lfile)))
88+
->setFormat("application/xml")
89+
->setFormat("application/g-zip")
90+
->setPublisher("http://www.ebi.ac.uk/")
91+
->setHomepage("http://www.ebi.ac.uk/interpro/")
92+
->setRights("InterPro - Integrated Resource Of Protein Domains And Functional Sites. Copyright (C) 2001 The InterPro Consortium")
93+
->setLicense("http://www.ebi.ac.uk/interpro/faqs.html")
94+
->setDataset("http://identifiers.org/interpro/");
7795

78-
// generate the release file
79-
$desc = parent::getBio2RDFDatasetDescription(
80-
parent::getPrefix(),
81-
"https://github.com/bio2rdf/bio2rdf-scripts/blob/master/interpro/intepro.php",
82-
parent::getBio2RDFDownloadURL(parent::getPrefix()).$outfile,
83-
"http://www.ebi.ac.uk/interpro/",
84-
array("use-share-modify"),
85-
null, // license
86-
parent::getParameterValue('download_url'),
87-
$this->version
88-
);
89-
parent::setWriteFile($odir.parent::getBio2RDFReleaseFile(parent::getPrefix()));
90-
parent::getWriteFile()->write($desc);
96+
$prefix = parent::getPrefix();
97+
$bVersion = parent::getParameterValue('bio2rdf_release');
98+
$date = date ("Y-m-d\TG:i:s\Z");
99+
$output_file = (new DataResource($this))
100+
->setURI("http://download.bio2df.org/release/$bVersion/$prefix/$outfile")
101+
->setTitle("Bio2RDF v$bVersion RDF version of $prefix v$source_version")
102+
->setSource($source_file->getURI())
103+
->setCreator("https://github.com/bio2rdf/bio2rdf-scripts/blob/master/interpro/interpro.php")
104+
->setCreateDate($date)
105+
->setHomepage("http://download.bio2rdf.org/release/$bVersion/$prefix/$prefix.html")
106+
->setPublisher("http://bio2rdf.org")
107+
->setRights("use-share-modify")
108+
->setRights("by-attribution")
109+
->setRights("restricted-by-source-license")
110+
->setLicense("http://creativecommons.org/licenses/by/3.0/")
111+
->setDataset(parent::getDatasetURI());
112+
113+
if($gz) $output_file->setFormat("application/gzip");
114+
if(strstr(parent::getParameterValue('output_format'),"nt")) $output_file->setFormat("application/n-triples");
115+
else $output_file->setFormat("application/n-quads");
116+
117+
$dataset_description = $source_file->toRDF().$output_file->toRDF();
118+
119+
parent::setWriteFile($odir.parent::getBio2RDFReleaseFile());
120+
parent::getWriteFile()->write($dataset_description);
91121
parent::getWriteFile()->close();
92122

93123
return true;
@@ -105,11 +135,17 @@ function Parse($xml)
105135
parent::setDatasetVersion($o->attributes()->version);
106136
}
107137
}
138+
// get a potential id list
139+
$id_list = explode(",",parent::getParameterValue("id_list"));
140+
108141
// now interate over the entries
109142
foreach($xml->interpro AS $o) {
110143
parent::writeRDFBufferToWriteFile();
111144

112145
$interpro_id = $o->attributes()->id;
146+
if(isset($id_list) && !in_array($interpro_id,$id_list)) {
147+
continue;
148+
}
113149
echo "Processing $interpro_id".PHP_EOL;
114150

115151
$name = $o->name;

0 commit comments

Comments
 (0)