annotate simsearch.xml @ 0:52e5c0f2907f draft

Uploaded
author bgruening
date Thu, 15 Aug 2013 03:36:37 -0400
parents
children 0892f7ced10c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
1 <tool id="ctb_simsearch" name="Similarity Search" version="0.1.1">
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
2 <description>of fingerprint data sets</description>
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
3 <requirements>
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
4 <requirement type="package" version="1.1p1">chemfp</requirement>
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
5 <requirement type="package" version="2.3.2">openbabel</requirement>
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
6 </requirements>
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
7 <command>
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
8 #if $method_opts.method_opts_selector == "chemfp":
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
9 simsearch
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
10 #if int($method_opts.knn) == 0:
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
11 #set $k = 'all'
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
12 ## count is only available if k nearest neighbor search is disabled
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
13 $method_opts.counts
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
14 #else:
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
15 #set $k = int($method_opts.knn)
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
16 #end if
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
17
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
18 -k $k
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
19
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
20 --threshold $method_opts.threshold
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
21 --query-format fps
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
22 --target-format fps
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
23 -o "${outfile}"
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
24
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
25 ## build and search an in-memory data structure (faster for multiple queries)
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
26 --memory
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
27
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
28 #if $method_opts.query_opts.query_opts_selector == "normal":
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
29 -q "${method_opts.query_opts.query}"
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
30 #else:
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
31 --NxN
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
32 #end if
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
33
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
34 "${method_opts.query_opts.targets}"
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
35 #else:
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
36 ## OpenBabel needs the original molecule file (molecule.'fileformat') next to the fastsearch index (molecule.fs). We use a composite datatype to accomplish that.
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
37 ## Furthermore OpenBabel is really picky with file extensions. We need to specify every datatype. I did not find a solution to specify the query-filetype.
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
38 ## A workaround is to create a symlink with a proper file-extension.
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
39 #import tempfile
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
40 #set $temp_file = tempfile.NamedTemporaryFile()
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
41 #set $temp_link = "%s.%s" % ($temp_file.name, $method_opts.query.ext)
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
42 $temp_file.close()
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
43 ln -s $method_opts.query $temp_link;
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
44 obabel -i fs "${os.path.join($method_opts.fastsearch.extra_files_path,'molecule.fs')}" -S "${temp_link}" -at${method_opts.threshold} -O "${outfile}" -osmi -aa 2>&#38;1;
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
45 rm $temp_link
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
46 #end if
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
47 </command>
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
48 <inputs>
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
49
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
50 <conditional name="method_opts">
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
51 <param name="method_opts_selector" type="select" label="Subject database/sequences">
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
52 <option value="chemfp">Chemfp fingerprint file</option>
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
53 <option value="obabel">OpenBabel Fastsearch Index</option>
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
54 </param>
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
55 <when value="chemfp">
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
56 <conditional name="query_opts">
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
57 <param name="query_opts_selector" type="select" label="Query Mode">
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
58 <option value="normal">Query molecules are stores in a separate file</option>
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
59 <option value="nxn">Target molecules are also queries (NxN)</option>
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
60 </param>
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
61 <when value="normal">
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
62 <param name='query' type='data' format="fps" label='Query molecules'/>
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
63 <param name='targets' type='data' format="fps" label='Target molecules'/>
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
64 </when>
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
65 <when value="nxn">
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
66 <param name='targets' type='data' format="fps" label='Target moleculs'/>
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
67 </when>
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
68 </conditional>
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
69 <param name='knn' type='integer' value='0' label='select the k nearest neighbors' help='0 means all neighbors'>
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
70 <validator type="in_range" min="0" />
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
71 </param>
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
72 <param name='threshold' type='float' value='0.7' label='threshold' />
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
73 <param name="counts" type="boolean" truevalue="-c" falsevalue="" checked="false" label="report counts (-c)" help="Is ignored if k nearest neighbor search is enabled" />
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
74 </when>
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
75 <when value="obabel">
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
76 <param name="query" type='data' format="smi,mol,sdf,inchi" label="query"/>
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
77 <param name="fastsearch" type='data' format="obfs" label="OpenBabel Fastsearch Index"/>
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
78 <param name="threshold" type='float' label="threshold" value='0.7'/>
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
79 </when>
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
80 </conditional>
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
81
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
82 </inputs>
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
83 <outputs>
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
84 <data name="outfile" format="tabular" />
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
85 </outputs>
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
86 <tests>
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
87 <test>
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
88 <param name="targets" ftype="fps" value="targets.fps"/>
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
89 <param name="query" ftype="fps" value="q.fps"/>
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
90 <param name="k" value='4'/>
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
91 <param name="th" value='0.7'/>
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
92 <output name="outfile" ftype="tabular" file="simsearch_on_tragets_and_q.tabular"/>
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
93 </test>
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
94 </tests>
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
95 <help>
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
96
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
97
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
98 .. class:: infomark
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
99
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
100 **What this tool does**
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
101
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
102 Similarity searches using a variety of different fingerprints using either the chemfp_ FPS type or the Open Babel FastSearch_ index.
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
103
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
104 .. _chemfp: http://chemfp.com/
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
105 .. _FastSearch: http://openbabel.org/wiki/FastSearch
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
106
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
107 -----
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
108
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
109 .. class:: infomark
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
110
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
111 **Cite**
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
112
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
113 | The chemfp_ project
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
114 |
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
115 | N M O'Boyle, M Banck, C A James, C Morley, T Vandermeersch and G R Hutchison - `Open Babel: An open chemical toolbox`_
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
116
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
117 .. _`Open Babel: An open chemical toolbox`: http://www.jcheminf.com/content/3/1/33
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
118
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
119
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
120 </help>
52e5c0f2907f Uploaded
bgruening
parents:
diff changeset
121 </tool>