Skip to content

Commit

Permalink
DS model for Chemspider+ChEMBL queries.
Browse files Browse the repository at this point in the history
  • Loading branch information
olas committed Apr 18, 2012
1 parent 97aad1d commit a7a115c
Show file tree
Hide file tree
Showing 9 changed files with 414 additions and 0 deletions.
7 changes: 7 additions & 0 deletions plugins/net.bioclipse.ds.chemspider/.classpath
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
28 changes: 28 additions & 0 deletions plugins/net.bioclipse.ds.chemspider/.project
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>net.bioclipse.ds.chemspider</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
23 changes: 23 additions & 0 deletions plugins/net.bioclipse.ds.chemspider/META-INF/MANIFEST.MF
@@ -0,0 +1,23 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Chemspider DS
Bundle-SymbolicName: net.bioclipse.ds.chemspider;singleton:=true
Bundle-Version: 0.2.0
Bundle-Vendor: bioclipse.net
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.help,
net.bioclipse.ds,
net.bioclipse.cdk.ui.sdfeditor,
net.bioclipse.cdk.business,
net.bioclipse.core,
net.bioclipse.ds.common,
net.bioclipse.ds.ui,
org.openscience.cdk.interfaces,
org.openscience.cdk.standard,
org.openscience.cdk.io,
org.openscience.cdk.nonotify,
net.bioclipse.chemspider;bundle-version="2.5.0",
net.bioclipse.rdf;bundle-version="2.5.0"
Import-Package: org.apache.log4j
6 changes: 6 additions & 0 deletions plugins/net.bioclipse.ds.chemspider/build.properties
@@ -0,0 +1,6 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
plugin.xml,\
icons/
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 26 additions & 0 deletions plugins/net.bioclipse.ds.chemspider/plugin.xml
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
point="net.bioclipse.decisionsupport">

<endpoint
id="net.bioclipse.ds.chemspider"
description="Chemspider lookup"
icon="icons/cs-icon.png"
name="Chemspider+ChEMBL">
</endpoint>

<test
id="chemspider.nearest"
name="Chemspider nearest neighbour"
endpoint="net.bioclipse.ds.chemspider"
class="net.bioclipse.ds.chemspider.SimilaritySearchModel"
consensus="net.bioclipse.ds.consensus.majority.emptyinconclusive">

<parameter name="distance.tanimoto" value="0.8" />

</test>
</extension>

</plugin>
@@ -0,0 +1,71 @@
package net.bioclipse.ds.chemspider;

public class ChemblInteraction {

String title;
String value;
String unit;
String targetType;
String interactionType;
String relation;
String description;

public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public String getUnit() {
return unit;
}
public void setUnit(String unit) {
this.unit = unit;
}
public String getTargetType() {
return targetType;
}
public void setTargetType(String targetType) {
this.targetType = targetType;
}
public String getInteractionType() {
return interactionType;
}
public void setInteractionType(String interactionType) {
this.interactionType = interactionType;
}
public String getRelation() {
return relation;
}
public void setRelation(String relation) {
this.relation = relation;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}

public ChemblInteraction(String value, String unit, String interactionType) {
super();
this.value = value;
this.unit = unit;
this.interactionType = interactionType;
}
@Override
public String toString() {
return "ChemblInteraction [title=" + title + ", value=" + value
+ ", unit=" + unit + ", targetType=" + targetType
+ ", interactionType=" + interactionType + ", relation="
+ relation + ", description=" + description + "]";
}


}
@@ -0,0 +1,98 @@
package net.bioclipse.ds.chemspider;

import java.util.ArrayList;
import java.util.List;

import net.bioclipse.core.business.BioclipseException;
import net.bioclipse.core.domain.IStringMatrix;
import net.bioclipse.rdf.Activator;
import net.bioclipse.rdf.business.IRDFManager;

/**
* Look up interactions in ChEMBL-rdf for a given Chemspider ID
*
* @author Ola Spjuth
*
*/
public class ChemblLookup {

public static List<ChemblInteraction> lookupCSID(Integer csid) throws BioclipseException{

IRDFManager rdf = Activator.getDefault().getJavaManager();
String endpoint = "http://rdf.farmbio.uu.se/chembl/sparql";

//10368587 is one example

String query =
"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 dc: <http://purl.org/dc/elements/1.1/>"+
"PREFIX foaf: <http://xmlns.com/foaf/0.1/>"+
"PREFIX chembl: <http://rdf.farmbio.uu.se/chembl/onto/#>"+
"PREFIX bo: <http://www.blueobelisk.org/chemistryblogs/>"+
"PREFIX bibo: <http://purl.org/ontology/bibo/>"+
"PREFIX cito: <http://purl.org/spar/cito/>"+
"PREFIX cheminf: <http://semanticscience.org/resource/>"+
"PREFIX pro: <http://purl.obolibrary.org/obo/>"+
"PREFIX skos: <http://www.w3.org/2004/02/skos/core#>"+

"SELECT ?val ?units ?targetType ?title ?interactionType ?relation ?description ?assay WHERE {"+
"?csid <http://semanticscience.org/resource/SIO_000300> " + csid + " ."+
"?chembl cheminf:CHEMINF_000200 ?csid ."+
"?mol owl:equivalentClass ?chembl ."+
"?act chembl:forMolecule ?mol ."+
"?act chembl:standardValue ?val ."+
"FILTER (?val < 100000)"+
"?act chembl:standardUnits ?units ."+
"?act chembl:onAssay ?assay ."+
"?act chembl:type ?interactionType ."+
"?assay chembl:hasTarget ?target ."+
"?assay chembl:hasDescription ?description ."+
"?target dc:title ?title ."+
"OPTIONAL { ?target chembl:classL1 ?targetType . }"+
"OPTIONAL { ?act chembl:relation ?relation . }"+
"}";

IStringMatrix res = rdf.sparqlRemote(endpoint, query);

// System.out.println(res);

if (res.getColumnCount()<=0)
return null;

System.out.println("Got " + res.getRowCount() + " hits for CSID=" + csid);

List<ChemblInteraction> interactions = new ArrayList<ChemblInteraction>();
for (int i=0; i < res.getRowCount(); i++){
String value = res.getColumn("val").get(i);
String unit = res.getColumn("units").get(i);
String inttype = res.getColumn("interactionType").get(i);
String targetType = res.getColumn("targetType").get(i);
String title = res.getColumn("title").get(i);
String interactionType = res.getColumn("interactionType").get(i);
String relation = res.getColumn("relation").get(i);
String description = res.getColumn("description").get(i);
String assay = res.getColumn("assay").get(i);

value=value.substring(0,value.indexOf("^^"));
if (null==title || title.length()<=0)
title=assay.substring(assay.lastIndexOf("/")+1);

ChemblInteraction interaction = new ChemblInteraction(value, unit, inttype);

interaction.setTitle(title);
interaction.setRelation(relation);
interaction.setTargetType(targetType);
interaction.setInteractionType(interactionType);
interaction.setDescription(description);

interactions.add(interaction);
// System.out.println(interaction);

}

return interactions;
}

}

0 comments on commit a7a115c

Please sign in to comment.