Skip to content

Commit

Permalink
Updated for ChEMBL 09
Browse files Browse the repository at this point in the history
  • Loading branch information
egonw committed Mar 17, 2011
1 parent e79dbd1 commit 3fa2dfd
Show file tree
Hide file tree
Showing 6 changed files with 188 additions and 49 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
vars.php

*~
22 changes: 11 additions & 11 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,30 @@ The data is copyrighted by them, and licensed CC-BY-SA:
as explained on:

http://www.ebi.ac.uk/chembldb/
ftp://ftp.ebi.ac.uk/pub/databases/chembl/releases/chembl_06/LICENSE
ftp://ftp.ebi.ac.uk/pub/databases/chembl/releases/chembl_09/LICENSE

These scripts were tested against version 06 of ChEMBL, as downloaded from:

ftp://ftp.ebi.ac.uk/pub/databases/chembl/releases/chembl_06/
ftp://ftp.ebi.ac.uk/pub/databases/chembl/releases/chembl_00/

# Requirements

ChEMBL 06.
ChEMBL 09.

# Installation

The scripts expect a script only readble by the server software called vars.php, with content like:

<?php
<?php

$db = 'chembl_06';
$user = 'user';
$pwd = 'secret';
$db = 'chembl_09';
$user = 'user';
$pwd = 'secret';

// use the next line to limit the output
// $limit = ' LIMIT 5';
$limit = '';
// use the next line to limit the output
// $limit = ' LIMIT 5';
$limit = '';

?>
?>

to access the MySQL database with the ChEMBL content.
10 changes: 6 additions & 4 deletions activities.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,19 @@
echo "act:a" . $row['activity_id'] . " a :Activity ;\n";
echo " :extractedFrom res:r" . $row['doc_id'] . " ;\n";
echo " :onAssay ass:a" . $row['assay_id'] . " ;\n";
$chebi = mysql_query("SELECT DISTINCT * FROM compounds WHERE molregno = \"" . $row['molregno'] . "\"");
$chebi = mysql_query("SELECT DISTINCT * FROM molecule_dictionary WHERE molregno = \"" . $row['molregno'] . "\"");
if ($chebiRow = mysql_fetch_assoc($chebi)) {
echo " :forMolecule mol:m" . $chebiRow['chebi_id'] . " ;\n";
}
if ($row['relation']) {
if ($row['relation'])
echo " :relation \"" . $row['relation'] . "\" ;\n";
}
echo " :standardValue \"" . $row['standard_value'] . "\" ;\n";
echo " :standardUnits \"" . $row['standard_units'] . "\" ;\n";
echo " :type \"" . $row['standard_type'] . "\" .\n";
if ($row['standard_value']) {
echo " :standardValue \"" . $row['standard_value'] . "\"^^xsd:float ;\n";
echo " :standardUnits \"" . $row['standard_units'] . "\" ;\n";
echo " :type \"" . $row['standard_type'] . "\" .\n";
}
flush();
}

Expand Down
112 changes: 112 additions & 0 deletions chembl.owl
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .

@prefix bibo: <http://purl.org/ontology/bibo/> .

@prefix : <http://pele.farmbio.uu.se/chembl/onto/#> .

:Drug owl:equivalentClass :Compound ;
a owl:Class .

:SmallMolecule rdfs:subClassOf :Drug .
:Protein rdfs:subClassOf :Drug .
:Cell rdfs:subClassOf :Drug .
:Oligosaccharide rdfs:subClassOf :Drug .
:Oligonucleotide rdfs:subClassOf :Drug .
:Antibody rdfs:subClassOf :Drug .

:Activity a owl:Class .
:Assay a owl:Class .
:Target a owl:Class .

:extractedFrom a owl:ObjectProperty ;
rdfs:domain :Activity ;
rdfs:range bibo:Document .

:onAssay a owl:ObjectProperty ;
rdfs:domain :Activity ;
rdfs:range :Assay .

:forMolecule a owl:ObjectPropery ;
rdfs:domain :Activity ;
rdfs:range :Drug .

:relation a owl:DatatypeProperty ;
rdfs:domain :Activity .

:standardValue a owl:DatatypeProperty ;
rdfs:domain :Activity .

:standardUnits a owl:DatatypeProperty ;
rdfs:domain :Activity .

:type a owl:DatatypeProperty ;
rdfs:domain :Activity .

:hasDescription a owl:DatatypeProperty ;
rdfs:domain :Assay .

:extractedFrom a owl:ObjectProperty ;
rdfs:domain :Assay ;
rdfs:range bibo:Document .

:organism a owl:DatatypeProperty ;
rdfs:domain :Assay .

:hasTarget a owl:ObjectProperty ;
rdfs:domain :Assay ;
rdfs:range :Target .

:hasConfScore a owl:DatatypeProperty ;
rdfs:domain :Assay .

:hasAssayType a owl:ObjectProperty ;
rdfs:domain :Assay .

:hasTargetType a owl:ObjectProperty ;
rdfs:domain :Target .

:organism a owl:DatatypeProperty ;
rdfs:domain :Target .

:hasDescription a owl:DatatypeProperty ;
rdfs:domain :Target .

:hasKeyword a owl:DatatypeProperty ;
rdfs:domain :Target .

:sequence a owl:DatatypeProperty ;
rdfs:domain :Target .

:hasTaxonomy a owl:ObjectProperty ;
rdfs:domain :Target ;
rdfs:range <http://bio2rdf.org/uniprot_resource:Taxon> .

:classL1 a owl:DatatypeProperty ;
rdfs:domain :Target ;
rdfs:label "Level 1 classification".

:classL2 a owl:DatatypeProperty ;
rdfs:domain :Target ;
rdfs:label "Level 2 classification".

:classL3 a owl:DatatypeProperty ;
rdfs:domain :Target ;
rdfs:label "Level 3 classification".

:classL4 a owl:DatatypeProperty ;
rdfs:domain :Target ;
rdfs:label "Level 4 classification".

:classL5 a owl:DatatypeProperty ;
rdfs:domain :Target ;
rdfs:label "Level 5 classification".

:classL6 a owl:DatatypeProperty ;
rdfs:domain :Target ;
rdfs:label "Level 6 classification".

:classL7 a owl:DatatypeProperty ;
rdfs:domain :Target ;
rdfs:label "Level 7 classification".
89 changes: 57 additions & 32 deletions compounds.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,46 +45,71 @@
# echo "</rdf:Description>\n";
#}

$allIDs = mysql_query("SELECT * FROM compounds, compound_properties WHERE compounds.molregno = compound_properties.molregno" . $limit);
$allIDs = mysql_query("SELECT * FROM compound_records, compound_properties WHERE compound_records.molregno = compound_properties.molregno" . $limit);

$num = mysql_numrows($allIDs);

while ($row = mysql_fetch_assoc($allIDs)) {
echo "mol:m" . $row['chebi_id'] . " a :Compound ;\n";
#if ($row['inchi']) {
if (false)
echo " = <http://rdf.openmolecules.net/?" . $row['inchi'] . "> ;\n";
echo " chem:inchi \"" . $row['inchi'] . "\" ;\n";
}
#if ($row['inchi_key'])
# echo " chem:inchikey \"" . $row['inchi_key'] . "\" ;\n";
if ($row['canonical_smiles'])
echo " chem:smiles \"" . $row['canonical_smiles'] . "\" ;\n";

#foreach ($descs as $value => $type) {
#if ($row[$row[$value]]) {
$chebi = mysql_query("SELECT DISTINCT * FROM molecule_dictionary WHERE molregno = \"" . $row['molregno'] . "\"");
if ($chebiRow = mysql_fetch_assoc($chebi)) {
echo "mol:m" . $chebiRow['chebi_id'] . " a ";
if ($chebiRow['molecule_type']) {
if ($chebiRow['molecule_type'] = "Small molecule") {
echo ":SmallMolecule ;\n";
} else if ($chebiRow['molecule_type'] = "Protein") {
echo ":Protein ;\n";
} else if ($chebiRow['molecule_type'] = "Cell") {
echo ":Cell ;\n";
} else if ($chebiRow['molecule_type'] = "Oligosaccharide") {
echo ":Oligosaccharide ;\n";
} else if ($chebiRow['molecule_type'] = "Oligonucleotide") {
echo ":Oligonucleotide ;\n";
} else if ($chebiRow['molecule_type'] = "Antibody") {
echo ":Antibody ;\n";
} else {
echo ":Drug ;\n";
}
} else {
echo ":Drug ;\n";
}
#if ($row['inchi']) {
if (false) {
echo " <bodo:hasDescriptorValue>\n";
echo " <bodo:DescriptorValue>\n";
echo " <bodo:hasPart>\n";
echo " <bodo:DescriptorValuePoint>\n";
echo " <bodo:hasValue rdf:datatype=\"http://www.w3.org/2001/XMLSchema#" .
$type . "\">" . $row[$value] . "</bodo:hasValue>\n";
echo " <bodo:valuePointFor rdf:resource=\"" . $ns . "descriptorId=" . md5($value) . "\" />\n";
echo " </bodo:DescriptorValuePoint>\n";
echo " </bodo:hasPart>\n";
echo " </bodo:DescriptorValue>\n";
echo " </bodo:hasDescriptorValue>\n";
echo " = <http://rdf.openmolecules.net/?" . $row['inchi'] . "> ;\n";
echo " chem:inchi \"" . $row['inchi'] . "\" ;\n";
}
#if ($row['inchi_key'])
# echo " chem:inchikey \"" . $row['inchi_key'] . "\" ;\n";
$structs = mysql_query("SELECT DISTINCT * FROM compound_structures WHERE molregno = " . $row['molregno']);
while ($struct = mysql_fetch_assoc($structs)) {
if ($struct['canonical_smiles'])
echo " chem:smiles \"" . $struct['canonical_smiles'] . "\" ;\n";
}
#}

$names = mysql_query("SELECT DISTINCT * FROM compound_synonyms WHERE molregno = " . $row['molregno']);
while ($name = mysql_fetch_assoc($names)) {
if ($name['synonyms'])
echo " dc:title \"" . str_replace("\"", "\\\"", $name['synonyms']) . "\" ;\n";
}
#foreach ($descs as $value => $type) {
#if ($row[$row[$value]]) {
if (false) {
echo " <bodo:hasDescriptorValue>\n";
echo " <bodo:DescriptorValue>\n";
echo " <bodo:hasPart>\n";
echo " <bodo:DescriptorValuePoint>\n";
echo " <bodo:hasValue rdf:datatype=\"http://www.w3.org/2001/XMLSchema#" .
$type . "\">" . $row[$value] . "</bodo:hasValue>\n";
echo " <bodo:valuePointFor rdf:resource=\"" . $ns . "descriptorId=" . md5($value) . "\" />\n";
echo " </bodo:DescriptorValuePoint>\n";
echo " </bodo:hasPart>\n";
echo " </bodo:DescriptorValue>\n";
echo " </bodo:hasDescriptorValue>\n";
}
#}

$names = mysql_query("SELECT DISTINCT * FROM molecule_synonyms WHERE molregno = " . $row['molregno']);
while ($name = mysql_fetch_assoc($names)) {
if ($name['synonyms'])
echo " dc:title \"" . str_replace("\"", "\\\"", $name['synonyms']) . "\" ;\n";
}

echo " = <http://bio2rdf.org/chebi:" . $row['chebi_id'] . "> .\n";
echo " = <http://bio2rdf.org/chebi:" . $chebiRow['chebi_id'] . "> .\n";
}
}

?>
2 changes: 1 addition & 1 deletion docs.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
@prefix res: <http://rdf.farmbio.uu.se/chembl/resource/> .
@prefix mol: <http://rdf.farmbio.uu.se/chembl/molecule/> .
@prefix ass: <http://rdf.farmbio.uu.se/chembl/assay/> .
@prefix jrn: <http://rdf.farmbio.uu.se/chembl/assay/> .
@prefix jrn: <http://rdf.farmbio.uu.se/chembl/journal/> .

<?php

Expand Down

0 comments on commit 3fa2dfd

Please sign in to comment.