Skip to content

Commit

Permalink
Use CHEMINF; synonyms as rdfs:label; n-triples for all
Browse files Browse the repository at this point in the history
  • Loading branch information
egonw committed Oct 23, 2011
1 parent fe9e8f5 commit 6c77e8c
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions compounds.php
Expand Up @@ -37,8 +37,10 @@
while ($row = mysql_fetch_assoc($allIDs)) {
$chebi = mysql_query("SELECT DISTINCT * FROM molecule_dictionary WHERE molregno = \"" . $row['molregno'] . "\"");
if ($chebiRow = mysql_fetch_assoc($chebi)) {
$molecule = $MOL . "m" . $chebiRow['chebi_id'];
$molecule = $MOL . "m" . $chebiRow['molregno'];
if ($chebiRow['molecule_type']) {
echo triple( $molecule, $RDFS . "subClassOf", $CHEMINF . "CHEMINF_000000"); # chemical entity
if (false) {
if ($chebiRow['molecule_type'] = "Small molecule") {
echo triple( $molecule, $RDF . "type", $ONTO . "SmallMolecule" );
} else if ($chebiRow['molecule_type'] = "Protein") {
Expand All @@ -54,6 +56,7 @@
} else {
echo triple( $molecule, $RDF . "type", $ONTO . "Drug" );
}
}
} else {
echo triple( $molecule, $RDF . "type", $ONTO . "Drug" );
}
Expand All @@ -64,14 +67,19 @@
$smiles = str_replace("\\", "\\\\", $smiles);
$smiles = str_replace("\n", "", $smiles);
echo dataTriple( $molecule, $CHEM . "smiles", $smiles );
#echo " cheminf:CHEMINF_000200 [ a cheminf:CHEMINF_000018 ; cheminf:SIO_000300 \"$smiles\" ] ;\n";
$molsmiles = $molecule . "/smiles";
echo triple($molecule, $CHEMINF . "CHEMINF_000200", $molsmiles);
echo triple($molsmiles, $RDF . "type", $CHEMINF . "CHEMINF_000018");
echo dataTriple($molsmiles, $CHEMINF . "SIO_000300", $smiles);
}
#if ($struct['standard_inchi']) {
if (false) {
echo " chem:inchi \"" . $struct['standard_inchi'] . "\" ;\n";
echo " cheminf:CHEMINF_000200 [ a cheminf:CHEMINF_000113 ; cheminf:SIO_000300 \"" . $struct['standard_inchi'] . "\" ] ;\n";
if ($struct['standard_inchi']) {
echo dataTriple($molecule, $CHEM . "inchi", $struct['standard_inchi']);
$molsmiles = $molecule . "/inchi";
echo triple($molecule, $CHEMINF . "CHEMINF_000200", $molsmiles);
echo triple($molsmiles, $RDF . "type", $CHEMINF . "CHEMINF_000113");
echo dataTriple($molsmiles, $CHEMINF . "SIO_000300", $struct['standard_inchi']);
if (strlen($struct['standard_inchi']) < 1500) {
echo " owl:sameAs <http://rdf.openmolecules.net/?" . $struct['standard_inchi'] . "> ;\n";
echo triple($molecule, $OWL . "equivalentClass", "http://rdf.openmolecules.net/?" . $struct['standard_inchi']);
}
}
if ($struct['standard_inchi_key'])
Expand All @@ -98,10 +106,10 @@
$names = mysql_query("SELECT DISTINCT * FROM molecule_synonyms WHERE molregno = " . $row['molregno']);
while ($name = mysql_fetch_assoc($names)) {
if ($name['synonyms'])
echo dataTriple( $molecule, $DC . "title", str_replace("\"", "\\\"", $name['synonyms']) );
echo dataTriple( $molecule, $RDFS . "label", str_replace("\"", "\\\"", $name['synonyms']) );
}

echo triple( $molecule, $OWL . "sameAs", "http://bio2rdf.org/chebi:" . $chebiRow['chebi_id'] );
echo triple( $molecule, $OWL . "equivalentClass", "http://bio2rdf.org/chebi:" . $chebiRow['chebi_id'] );
}
}

Expand Down

0 comments on commit 6c77e8c

Please sign in to comment.