On this blog you are able to follow my degree project(master thesis in Bioinformatics) which have the title Pharmaceutical knowledge retrieval through reasoning of ChEMBL RDF.
My supervisor is Egon Willighagen, http://chem-bla-ics.blogspot.com/.

Topics

Java (4) SPARQL (6) Substructure mining (5)
Visar inlägg med etikett Substructure mining. Visa alla inlägg
Visar inlägg med etikett Substructure mining. Visa alla inlägg

måndag 14 juni 2010

A small but wonderful add-on

Look at the following scenarios:

(a)

> var camk = chembl.MossGetProtFamilyCompAct("camk", "IC50")

> chembl.MoSSViewHistogram(camk)


> var camkBounds = chembl.MossSetActivityBound(camk, 1,1000000)

> camkBounds.getRowCount()

2565

>chembl.MossSaveFormat("/ChEMBL-MoSS/Rapport/CAMKIC501", camk)


(b)

> var camk=chembl.MossGetProtFamilyCompActBounds("CAMK","IC50",1, 1000000)

> camk.getRowCount()

2565

> chembl.MossSaveFormat("/ChEMBL-MoSS/Rapport/CAMKIC502", camk)



(a)+(b) Scripts taken from the context of retrieving molecules for molecular substructure mining. (a) Collects compounds that bind to proteins from the family CAMK with the activity IC50. The activities for the compounds are looked at in a histogram and the bound is later set to involve molecules within activities between 1-1000,000. Lastly saved out to a file that supports MoSS input file.

(b)Lets say you been working with this set a couple of times and know exactly your parameters then the script in (b) would reduce unnecessary steps in retrieving molecules by simply adding the upper and lower value to the query directly. At last saving into an input file of MoSS.


Small step but wonderful when you run scripts all day!


måndag 7 juni 2010

The ChEMLB-MoSS interaction in Bioclipse

There are two ways of accessing the chEMBL- MoSS feature in Bioclipse, javascript and by wizard. I will present both ways here!

In both situation I work with an example of accessing molecules for the Kinase protein family Tyrosin Kinase also known as TK. I want to look at the compounds that bind to any protein in this family with the activity Ki. Also, to specify in what activity span my molecules should be in.

Starting of with the wizard, this is what it looks like when it is first open.

Only one box is accessible and that is the one for protein families. When a family is selected a SPARQL query run towards the endpoint and returns the available activities for that family. By simply selecting a preferred activity an other SPARQL query will update the table with compounds (with a limitation of 50, the button add all(which is done in the picture) will of course add them all=).
Now I would like to only collect the active compounds hence I first look at the graph displaying the activities.
When I know in what activity span I would like to work with I update the table with help from the lower and upper boxes and simply press update table. When I now press finish a file that supports MoSS will be produced.

Javascript
Performing almost the same task now provides the following javascript.

> var tkki = chembl.MossGetProtFamilyCompAct("tk","ki",50)
> tkki.getRowCount()
50
Here I collect 50 compounds from the TK family with the activity of KI.

> var tkki = chembl.MossGetProtFamilyCompAct("tk","ki")
> tkki.getRowCount()
976
Here I perform the same thing as above without a limit leaving to returning 976 compounds, the same number that was returned when "add all" was pushed in the wizard.

> var tkkiActBound = chembl.MossSetActivityBound(tkki, 1,15000)
> tkkiActBound.getRowCount()
850
> tkkiActBound
[["actval","smiles"],
["160","Cc1nc(N)sc1c2ccnc(Nc3cccc(c3)[N+](=O)[O-])n2"],
["700","CCOc1nc(cc(N)c1Cl)C(=O)NCc2ccc(cc2)S(=O)(=O)C"],
["10000","CS(=O)(=O)Nc1cc2OCCCCCOc3nc(NC(=O)Nc2cc1Cl)cnc3C#N"],
["10000","OCCCOc1cc2OCCCCCOc3nc(NC(=O)Nc2cc1Cl)cnc3C#N"],
["10000","OCCCc1cc2OCCCCCOc3nc(NC(=O)Nc2cc1Cl)cnc3C#N"],
["19.4","Cc1cc(cc2nnc(Nc3ccc(OCCN4CCCC4)cc3)nc12)c5c(Cl)cccc5Cl"],
["950","COc1cc2ncc(C#N)c(N[C@@H]3C[C@H]3c4ccccc4)c2cc1OC"],
["10000","N#Cc1cnc2ccc(cc2c1N[C@@H]3C[C@H]3c4ccccc4)c5ccc(CN6CCOCC6)cc5"],
["10000","N#Cc1cnc2ccc(cc2c1N[C@@H]3C[C@H]3c4ccccc4)c5cccc(CN6CCOCC6)c5"],
…

With the specification of an activity span between 1 and 15000 nm the number of compounds are reduced to 850(as in the wizard). If I write the name of the variable a string matrix will display all the information. But in order to work with MoSS it has to be saved in a certain way. That's why we save the matrix to a file just as we did when we pressed finish in the wizard.

> chembl.saveMossFormat("/chembl/Script/tkki",tkkiActBound)


Taken from the produced file(s)(they are exactly the same).

1,0,Cc1nc(N)sc1c2ccnc(Nc3cccc(c3)[N+](=O)[O-])n2
2,0,CCOc1nc(cc(N)c1Cl)C(=O)NCc2ccc(cc2)S(=O)(=O)C
3,0,CS(=O)(=O)Nc1cc2OCCCCCOc3nc(NC(=O)Nc2cc1Cl)cnc3C#N
4,0,OCCCOc1cc2OCCCCCOc3nc(NC(=O)Nc2cc1Cl)cnc3C#N
…
…
…
848,0,Clc1cc2NC(=O)Nc3cnc(C#N)c(OCCCCOc2cc1NCc4cncs4)n3
849,0,OC[C@@H](NC(=O)c1cc(c[nH]1)c2[nH]ncc2c3cccc(Cl)c3)c4ccc(F)c(Cl)c4
850,0,FC(F)(F)c1cccc(c1)c2nnc3ccc(NC4CCNCC4)nn23

With this shown I will
soon let you know what MoSS can do with the saved data!

måndag 17 maj 2010

A moss-chembl application

After a month of traveling I'm now back to devote my time to what's left of my project which would be about 8-9 weeks. My work is progressing and much of my time I'm working with human-computer-interaction but also advancing the SPARQL queries and test for accuracy.

MoSS as I probably mentioned a couple of times before is a molecular substructure mining software produced by Christian Borgelt, http://www.borgelt.net/moss.html. I implemented that application for Bioclipse in 2008, http://wiki.bioclipse.net/index.php?title=MoSS_in_Bioclipse, and I'm now making use of my own application.

As my chEMBL work is coming along I'm at the moment working on a specific working flow, "from chEMBL to MoSS". With the functionality of SPARQL I am now via java methods accessing compounds from various Kinase protein familes. A method could look like something like this

public IStringMatrix MossProtFamilyCompounds(String fam, String actType)
throws BioclipseException{

String sparql =
"PREFIX chembl: " +
"PREFIX bo: "+

"SELECT DISTINCT ?smiles where{ " + " ?target a chembl:Target;" +
" chembl:classL5 ?fam. " +
" ?assay chembl:hasTarget ?target . " +
" ?activity chembl:onAssay ?assay ;" +
" chembl:type ?actType ; " +
" chembl:forMo
lecule ?mol ."+
" ?mol bo:smiles ?smiles. " +
" FILTER regex(?fam, " + "\"^" + fam + "$\"" + ", \"i\")."+
" FILTER regex(?
actType, " + "\"^" + actType + "$\"" + ", \"i\")."+
" }";
IStringMatrix matrix = rdf.sparqlRemote("http://rdf.farmbio.uu.se/chembl/sparql",sparql);

return matrix;
}

Inside this java method there is a SPARQL query which is a string named sparql. It is possible to run a query like this due to the rdf project done by Egon. I use that feature when I call rdf.sparqlRemote, what that command basically do is accessing the SPARQL endpoint(URL) with my query which is made into a String. So for this to work an internet connection must exist.
I will try to find something that can check if such a connection exist or not to improve the use of the application(no connection -> no search).

The compounds are saved into a file supported by MoSS. This makes it possible for MoSS to run on the compounds drawn from the chEMBL database. Also a java script environment is available.

































The pictures shows(top) the moss-chembl wizard and (bottom) the moss wizard.

The moss-chembl applications is dynamic which means that you can search for wanted compounds and look at them directly. This ease the work a lot! Also to be mentioned is that the compounds are at the moment only compounds that bind to a protein in a Kinase Family.

When a preferred data set is chosen moss will read in the data and now you are able to perform a substructure mining on them!

Next problem to manage Visualization...

fredag 19 februari 2010

moss + manager = true

My goal this week was to have integrated moss into a Bioclipse manager.
Well I'm almost there.=0)

So this is what I have done the later part of the week. I also managed to run some SPARQL queries and got some problems to figure out there, main focus next week.

Most parts of Moss now work, although there are some settings that involves combining masks that are not quite finished yet. I actually think that I've spend most my hours on this and still not done...grr

Since Moss have over 30 different parameters I found it important to have a method that shows them. But just now I realized that this is what man moss is for. Well its the same text so no worries there.
Taken from the method though it will look something like this:
> moss.parameterDescription()
Examplea moss.createParamteters("aromatic", "always"),
moss.createParamteters("minEmbed", 6)

aromatic: ("aromatic", "never"/"upgrade"/"downgrade") |"String"
canonic: ("canonicequiv", false/true) |boolean
canonicEquiv: ("canonic", true/false) |boolean
carbonChainLength: ("carbonChainLength", true/false) |boolean
class: not for use
closed: ("closed", true/false) |boolean
exNode: ("exNode", "Atom") |"String"
exSeed: ("exSeed", "Atom") |"String"
extPrune: ("extPrune", "none"/"full"/"partial"/) |"String"
ignoreAtomTypes: ("ignoreAtomTypes", "never"/"always"/"in rings") |"String"
ignoreBond: ("ignoreBond", "never"/"always"/"in rings") |"String"
kekule: ("kekule", true/false) |boolean
limits: not for use
matchAromaticityAtoms: ("matchChargeOfAtoms", "never"/"always"/"in rings")
|"String"
matchChargeOfAtoms: ("matchAromaticityAtoms", "match"/"no match") |"String"
matom: not for use
maxEmbMemory: ("maxEmbMemory", value) |integer
maxEmbed: ("maxEmbed",value) |integer
maxRing: ("maxRing", value) |integer
maximalSupport: ("maximalSupport", value) |double
mbond: not for use
minEmbed: ("minEmbed", value) |integer
minRing: ("maxRing", value) |integer
minimalSupport: ("minimalSupport", value) |double
mode: not for use
mrgat: not for use
mrgbd: not for use
ringExtension: ("ringExtension", "none"/"full"/"merge"/"filter") |"String"
seed: ("seed", "Atom") |"String"
split: ("split", true/false) |boolean
threshold: ("threshold", value) |double
unembedSibling: ("unembedSibling", false/true) |boolean


Will immediately start working on the manager.

I figure that it would be nice to have one method that sets the parameters, in this case createParameters(). The first input specifies what you want to set and the second argument provides the value. The arguments is handled by the following method,
public String createParameters(String propertyName, Object value) throws Exception{

if(value.getClass().equals(Double.class)){
value= ((Double) value).intValue();
int values = (Integer) value;
mossbean.setParameters(mossbean, propertyName, values);
}else{
mossbean.setParameters(mossbean, propertyName, value);
}
return value +" is set to " +propertyName;
}

When trying out moss myself I got irritated that I forgot the values of my parameters hence the method parameterValues() was created. It returns the current values of all parameters:
> moss.parameterValues()
aromatic:
canonic: true
canonicEquiv: false
carbonChainLength:
class: class net.bioclipse.moss.business.backbone.MossBean
closed: true
exNode: H
exSeed:
extPrune:
ignoreAtomTypes:
ignoreBond:
kekule:
limits: 0.0
matchAromaticityAtoms:
matchChargeOfAtoms:
maxEmbMemory: 0
maxEmbed: 0
maxRing: 0
maximalSupport: 0.02
minEmbed: 0
minRing: 0
minimalSupport: 0.1
ringExtension: none
seed:
split: false
threshold: 0.5
unembedSibling: false


I will also create a method that restores the values to default since it is valuable to the end-user.
I can't figure out though how to return an arraylist in a smooth way. I returned it as a String, this is how I've done it
public String parameterValues() throws Exception{
ArrayList name = mossbean.getPropertyNames(mossbean);
String info="";
String names;
for(int i=0; i names = name.get(i);
info= info + names +": " + mossbean.getProperty(mossbean, names) + " \n";
}
return info;


If you know something better, please tell!

Mostly polishing left when it comes to Moss but (perhaps) bigger mask combination parts to, it depends on the outcome of my Moss tests(which I will do when it's not Friday afternoon and I have a sharp mind).

Next week main focus is to develop SPARQL queries again!

fredag 12 februari 2010

Approching substructure mining

With a simple query like the one below random compounds from kinases from the Tk family is collected. I would like to filter the standard value to be under a certain value but I have some problem with doing that in Bioclipse, via SPARQL endpoint I've managed to create this filter. Will work on it.

var allsmiles = " \
PREFIX onto: \
PREFIX blueobelisk: \
\
SELECT DISTINCT ?smiles \
WHERE { \
?target a onto:Target . \
?target onto:classL5 \"Tk\" . \
?target onto:classL6 ?L6 . \
?assay onto:hasTarget ?target . \
?activity onto:onAssay ?assay . \
?activity onto:standardValue ?st . \
?activity onto:forMolecule ?mol . \
?mol blueobelisk:smiles ?smiles . \
}LIMIT 20 \
";
var all = rdf.sparqlRemote("http://rdf.farmbio.uu.se/chembl/sparql", allsmiles)
var all now contains a list of molecules that I is saved in a file via the net.bioclipse.moss.business plug-in.

moss.saveMoss(String fileName, List all)
Will create a file that support moss(id, threshold value, description), not complete
0,0,Cc1nc(N)sc1c2ccnc(Nc3cccc(c3)[N+](=O)[O-])n2
1,0,COc1cc(Nc2c(cnc3cc(OCCC4CCN(C)CC4)c(OC)cc23)C#N)c(Cl)cc1Cl
2,0,CCOc1cc(Nc2c(cnc3cc(OCC4CCN(C)CC4)c(OC)cc23)C#N)c(Cl)cc1Cl
3,0,COc1ccc(C)c(Nc2c(cnc3cc(OCC4CCN(C)CC4)c(OC)cc23)C#N)c1
4,0,COc1ccc(Cl)c(Nc2c(cnc3cc(OCC4CCN(C)CC4)c(OC)cc23)C#N)c1
5,0,COc1cc2c(Nc3ccc(C)cc3C)c(cnc2cc1OCC4CCN(C)CC4)C#N
6,0,COc1cc(Nc2c(cnc3cc(OCC4CCN(C)CC4)c(OC)cc23)C#N)c(C)cc1C


This file now have to be initialized, add parameters for the run and when done simply run.

> moss.saveMoss("/Moss/Test/collected", all)
> moss.init("/Moss/Test/collected")
done
>moss.setLimits(10,2)
> moss.run("/Moss/Test/collectedOut", "/Moss/Test/collectedOutId")


Only two basic parameter settings work at the moment, this is something to be added as soon as possible. It will take time though since lots of parameters are set by combining flags which I remember to be a crucial thing to do.

To read about how MoSS works, how to understand the output files etc look at Christian Borgelt homepage, http://www.borgelt.net/doc/moss/moss.html.
Output file(not complete):
id,description,nodes,edges,s_abs,s_rel,c_abs,c_rel
1,n1:c2:c(:c(-N-c3:c(-Cl):c:c(-Cl):c(-O-C):c:3):c(-C#N):c:1):c:c(-O-C):c(-O-C-C1-C-C-N(-C-C-1)-C):c:2,34,37,2,10.0,0,0.0
2,n1:c2:c(:c(-N-c3:c(-Cl):c:c:c(-O-C):c:3):c(-C#N):c:1):c:c(-O-C):c(-O-C-C1-C-C-N(-C-C-1)-C):c:2,33,36,3,15.0,0,0.0
3,n1:c2:c(:c(-N-c3:c(-Cl):c:c(-Cl):c(-O-C):c:3):c(-C#N):c:1):c:c(-O-C):c(-O-C-C(-C-C)-C):c:2,31,33,3,15.0,0,0.0
4,n1:c2:c(:c(-N-c3:c(-Cl):c:c:c(-O-C):c:3):c(-C#N):c:1):c:c(-O-C):c(-O-C-C(-C-C)-C):c:2,30,32,4,20.0,0,0.0


Output file Id(not complete)
id:list
1:2,10
2:2,4,10
3:2,9,10
4:2,4,9,10
5:2,7,10
6:2,4,7,10


Want to be able to visualize the result in tables later on, perhaps together with the input and other information collected via SPARQL.