1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
|
---
layout: post
title: "Development: Vanilla Version"
description: ""
category: development
tags: [Lazar, Fminer, 4store, BBRC, LAST-PM, Tutorials]
---
{% include JB/setup %}
[Install development](http://opentox.github.com/setup/2012/08/09/install-opentox-development-environment/) version, using `bash`. Make sure ot-tools are available (insert `ot` and press `<TAB>`).
Source from `$HOME`:
# configure
otconfig
otstart all
lh="http://localhost"
# util
function get_result {
task=$1
while [ 1 ]; do
result=`curl -H "accept:text/uri-list" $task 2>/dev/null`
[ $result == $task ] && sleep 1 || break
done
echo $result
}
Load dataset.
# load ds
cd
task=`curl -X POST \
-F "file=@opentox-ruby/opentox-test/test/data/hamster_carcinogenicity.csv;type=text/csv" \
$lh:8083/dataset`
ds=`get_result "$task"`
echo "hamster: $ds"
<br>
<br>
<hr>
<br>
Calculate benzene PC descriptors, constrained by `lib`:
curl \
--data-urlencode "pc_type=geometrical" \
-X POST http://localhost:8082/compound/InChI=1S/C6H6/c1-2-4-6-5-3-1/h1-6H/pc
Constrained by `lib` and `pc_type`:
curl \
--data-urlencode "lib=joelib" \
--data-urlencode "pc_type=geometrical" \
-X POST http://localhost:8082/compound/InChI=1S/C6H6/c1-2-4-6-5-3-1/h1-6H/pc
As RDF/XML:
curl -H "accept:application/rdf+xml" \
--data-urlencode "pc_type=geometrical" \
-X POST http://localhost:8082/compound/InChI=1S/C6H6/c1-2-4-6-5-3-1/h1-6H/pc
Calculate dataset PC descriptors, constrained by `lib`:
task=`curl \
--data-urlencode "pc_type=geometrical" \
-X POST $ds/pc`
pc_fds=`get_result "$task"`
echo "pc feature ds: $pc_fds"
<br>
<br>
<hr>
<br>
Mine subgraphs.
# bbrc feature ds
task=`curl -X POST --data-urlencode "dataset_uri=$ds" $lh:8081/algorithm/fminer/bbrc`
bbrc_fds=`get_result "$task"`
echo "bbrc feature ds: $bbrc_fds"
# last-pm feature ds
task=`curl -X POST --data-urlencode "dataset_uri=$ds" $lh:8081/algorithm/fminer/last`
last_fds=`get_result "$task"`
echo "last-pm feature ds: $last_fds"
Make Lazar models with substructural descriptors.
# create lazar m w/ bbrc
task=`curl -X POST --data-urlencode "dataset_uri=$ds" $lh:8081/algorithm/lazar`
lazar_m_bbrc=`get_result "$task"`
echo "Hamster model with bbrc: $lazar_m_bbrc"
# create lazar m w/ last-pm
task=`curl -X POST \
--data-urlencode "dataset_uri=$ds" \
--data-urlencode "feature_generation_uri=$lh:8081/algorithm/fminer/last" \
$lh:8081/algorithm/lazar`
lazar_m_last=`get_result "$task"`
echo "Hamster model with last-pm: $lazar_m_last"
Make predictions with BBRC (LAST-PM would also work).
# make benzene prediction w lazar m w/ bbrc
task=`curl -X POST \
--data-urlencode "compound_uri=$lh:8082/compound/InChI=1S/C6H6/c1-2-4-6-5-3-1/h1-6H" \
$lazar_m_bbrc`
lazar_p_bbrc=`get_result "$task"`
echo "Benzene prediction with bbrc model: $lazar_p_bbrc"
# make a database prediction
task=`curl -X POST \
--data-urlencode "compound_uri=$lh:8082/compound/InChI=1S/C12H12N2O3/c1-2-12(8-6-4-3-5-7-8)9(15)13-11(17)14-10(12)16/h3-7H,2H2,1H3,(H2,13,14,15,16,17)" \
$lazar_m_bbrc`
lazar_p_bbrc=`get_result "$task"`
echo "Benzene prediction with bbrc model: $lazar_p_bbrc"
The result dataset does not yet contain verbose information (neighbors etc).
The example below demonstrates how much time each step approximately consumes during prediction. Call is:
curl -X POST --data-urlencode "compound_uri=$lh:8082/compound/InChI=1S/C6H6/c1-2-4-6-5-3-1/h1-6H" $lazar_m_bbrc
i.e. predict benzene for hamster carcinogenicity.
10:23:34 :: Inited p dataset :: /lazar.rb:135
10:23:35 :: Loaded t dataset :: /lazar.rb:139
10:23:44 :: Loaded f dataset :: /lazar.rb:143
10:23:44 :: Calced q fps :: /lazar.rb:149
10:23:44 :: Custom model :: /lazar.rb:20
10:23:45 :: Filled m data :: /lazar.rb:163
10:23:45 :: F: 11x54; R: 54 :: /transform.rb:402
10:23:45 :: Sims: 11, Acts: 11 :: /transform.rb:403
10:23:45 :: Transformed m :: /lazar.rb:166
10:23:45 :: Weighted Majority Vote :: /algorithm.rb:30
10:23:45 :: Prediction is: '2'. :: /algorithm.rb:56
10:23:45 :: Confidence is: '0.25281 :: /algorithm.rb:58
10:23:45 :: Predicted q :: /lazar.rb:174
Time total: 11s, Time Dataset loading: 10s
|