-
Notifications
You must be signed in to change notification settings - Fork 0
/
api.html
342 lines (320 loc) · 17.9 KB
/
api.html
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>API reference — CoCoTools 0.0.1 documentation</title>
<link rel="stylesheet" href="_static/sphinxdoc.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '',
VERSION: '0.0.1',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<link rel="top" title="CoCoTools 0.0.1 documentation" href="index.html" />
<link rel="up" title="CoCoTools’s documentation" href="documentation.html" />
<link rel="prev" title="CoCoTools Objects" href="objects.html" />
</head>
<body>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="objects.html" title="CoCoTools Objects"
accesskey="P">previous</a> |</li>
<li><a href="index.html">CoCoTools 0.0.1 documentation</a> »</li>
<li><a href="documentation.html" accesskey="U">CoCoTools’s documentation</a> »</li>
</ul>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<h3><a href="index.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">API reference</a><ul>
<li><a class="reference internal" href="#query-related-functions">Query-related functions</a></li>
<li><a class="reference internal" href="#pre-processing">Pre-Processing</a></li>
<li><a class="reference internal" href="#coordinate-free-registration">Coordinate-free registration</a></li>
<li><a class="reference internal" href="#post-processing">Post-processing</a></li>
<li><a class="reference internal" href="#main-classes">Main classes</a></li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="objects.html"
title="previous chapter">CoCoTools Objects</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/api.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
<h3>Quick search</h3>
<form class="search" action="search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
<p class="searchtip" style="font-size: 90%">
Enter search terms or a module, class or function name.
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="section" id="api-reference">
<h1>API reference<a class="headerlink" href="#api-reference" title="Permalink to this headline">¶</a></h1>
<p>The following is the public API (Application Programming Interface) for
CoCoTools. Any module, class or function not listed here should be considered
a private implementation detailed and is subject to change without notice in
future releases.</p>
<span class="target" id="module-cocotools"></span><div class="section" id="query-related-functions">
<h2>Query-related functions<a class="headerlink" href="#query-related-functions" title="Permalink to this headline">¶</a></h2>
<dl class="function">
<dt id="cocotools.multi_map_ebunch">
<tt class="descclassname">cocotools.</tt><tt class="descname">multi_map_ebunch</tt><big>(</big><em>search_type</em>, <em>subset=False</em><big>)</big><a class="headerlink" href="#cocotools.multi_map_ebunch" title="Permalink to this definition">¶</a></dt>
<dd><p>Construct and return ebunch from data for several BrainMaps.</p>
<p>Also return the BrainMaps for which queries failed.</p>
<dl class="docutils">
<dt>search_type <span class="classifier-delimiter">:</span> <span class="classifier">string</span></dt>
<dd>‘Mapping’ or ‘Connectivity’</dd>
<dt>subset <span class="classifier-delimiter">:</span> <span class="classifier">sequence or string (optional)</span></dt>
<dd>Subset of BrainMaps to query. Default is to query all BrainMaps in
CoCoMac. If a string is supplied, it must be the name of a text
file with one BrainMap per line.</dd>
</dl>
<dl class="docutils">
<dt>big_ebunch <span class="classifier-delimiter">:</span> <span class="classifier">list of tuples</span></dt>
<dd>Each tuple specifies a source and target node and edge attributes.</dd>
<dt>failures <span class="classifier-delimiter">:</span> <span class="classifier">list of strings</span></dt>
<dd>These are the BrainMaps for which no data were acquired.</dd>
</dl>
<p>Querying a BrainMap for which there is only Mapping data using the
Connectivity search type would result in its being a failure.
Failures can also result from CoCoMac server errors.</p>
<p>The term ebunch, borrowed from NetworkX, refers to a sequence of
graph theory edges.</p>
<p>Integrated primary projections are returned for Connectivity queries,
and primary relations are returned for Mapping queries.</p>
</dd></dl>
<dl class="function">
<dt id="cocotools.query_maps_by_area">
<tt class="descclassname">cocotools.</tt><tt class="descname">query_maps_by_area</tt><big>(</big><em>search_type</em>, <em>subset=False</em><big>)</big><a class="headerlink" href="#cocotools.query_maps_by_area" title="Permalink to this definition">¶</a></dt>
<dd><p>Construct and return ebunch from data for several BrainMaps.</p>
<p>Also return the BrainMaps for which queries failed.</p>
<dl class="docutils">
<dt>search_type <span class="classifier-delimiter">:</span> <span class="classifier">string</span></dt>
<dd>‘Mapping’ or ‘Connectivity’</dd>
<dt>subset <span class="classifier-delimiter">:</span> <span class="classifier">sequence or string (optional)</span></dt>
<dd>Subset of BrainMaps to query. Default is to query all BrainMaps in
CoCoMac. If a string is supplied, it must be the name of a text
file with one BrainMap per line.</dd>
</dl>
<dl class="docutils">
<dt>big_ebunch <span class="classifier-delimiter">:</span> <span class="classifier">list of tuples</span></dt>
<dd>Each tuple specifies a source and target node and edge attributes.</dd>
<dt>failures <span class="classifier-delimiter">:</span> <span class="classifier">list of strings</span></dt>
<dd>These are the BrainMaps for which no data were acquired.</dd>
</dl>
<p>Querying a BrainMap for which there is only Mapping data using the
Connectivity search type would result in its being a failure.
Failures can also result from CoCoMac server errors.</p>
<p>The term ebunch, borrowed from NetworkX, refers to a sequence of
graph theory edges.</p>
<p>Integrated primary projections are returned for Connectivity queries,
and primary relations are returned for Mapping queries.</p>
</dd></dl>
</div>
<div class="section" id="pre-processing">
<h2>Pre-Processing<a class="headerlink" href="#pre-processing" title="Permalink to this headline">¶</a></h2>
<dl class="method">
<dt id="cocotools.MapGraph.clean_data">
<tt class="descclassname">MapGraph.</tt><tt class="descname">clean_data</tt><big>(</big><big>)</big><a class="headerlink" href="#cocotools.MapGraph.clean_data" title="Permalink to this definition">¶</a></dt>
<dd><p>Remove errors and add missing data.</p>
<p>See comments for more information.</p>
</dd></dl>
<dl class="method">
<dt id="cocotools.MapGraph.keep_only_one_level_of_resolution">
<tt class="descclassname">MapGraph.</tt><tt class="descname">keep_only_one_level_of_resolution</tt><big>(</big><em>cong</em>, <em>target_map</em><big>)</big><a class="headerlink" href="#cocotools.MapGraph.keep_only_one_level_of_resolution" title="Permalink to this definition">¶</a></dt>
<dd><p>Determine each map’s hierarchy and keep only one level.</p>
<dl class="docutils">
<dt>cong <span class="classifier-delimiter">:</span> <span class="classifier">ConGraph instance</span></dt>
<dd>Associated Connectivity data.</dd>
<dt>target_map <span class="classifier-delimiter">:</span> <span class="classifier">string</span></dt>
<dd>Name of BrainMap to which translation will be performed.</dd>
</dl>
<dl class="docutils">
<dt>cong <span class="classifier-delimiter">:</span> <span class="classifier">ConGraph instance</span></dt>
<dd>Updated Connectivity data.</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="cocotools.MapGraph.deduce_edges">
<tt class="descclassname">MapGraph.</tt><tt class="descname">deduce_edges</tt><big>(</big><big>)</big><a class="headerlink" href="#cocotools.MapGraph.deduce_edges" title="Permalink to this definition">¶</a></dt>
<dd><p>Deduce new edges based on those in the graph and add them.</p>
<p>Intra-map edges are disallowed. It is assumed that all regions
in the graph from the same BrainMap are disjoint (i.e., at the same
level of resolution).</p>
</dd></dl>
</div>
<div class="section" id="coordinate-free-registration">
<h2>Coordinate-free registration<a class="headerlink" href="#coordinate-free-registration" title="Permalink to this headline">¶</a></h2>
<dl class="method">
<dt id="cocotools.EndGraph.add_translated_edges">
<tt class="descclassname">EndGraph.</tt><tt class="descname">add_translated_edges</tt><big>(</big><em>mapp</em>, <em>conn</em>, <em>desired_map</em>, <em>method</em><big>)</big><a class="headerlink" href="#cocotools.EndGraph.add_translated_edges" title="Permalink to this definition">¶</a></dt>
<dd><p>Translate edges in conn to nomenclature of desired_bmap.</p>
<p>Add all desired_map nodes in mapp to this graph.</p>
<dl class="docutils">
<dt>mapp <span class="classifier-delimiter">:</span> <span class="classifier">MapGraph</span></dt>
<dd>Graph of spatial relationships between BrainSites from various
BrainMaps.</dd>
<dt>conn <span class="classifier-delimiter">:</span> <span class="classifier">ConGraph</span></dt>
<dd>Graph of anatomical connections between BrainSites.</dd>
<dt>desired_map <span class="classifier-delimiter">:</span> <span class="classifier">string</span></dt>
<dd>Name of BrainMap to which translation will be performed.</dd>
<dt>method <span class="classifier-delimiter">:</span> <span class="classifier">string</span></dt>
<dd>AT method to be used: ‘original’ (that of Stephan & Kotter)
or ‘modified’</dd>
</dl>
</dd></dl>
</div>
<div class="section" id="post-processing">
<h2>Post-processing<a class="headerlink" href="#post-processing" title="Permalink to this headline">¶</a></h2>
<dl class="function">
<dt id="cocotools.strip_absent_and_unknown_edges">
<tt class="descclassname">cocotools.</tt><tt class="descname">strip_absent_and_unknown_edges</tt><big>(</big><em>end</em><big>)</big><a class="headerlink" href="#cocotools.strip_absent_and_unknown_edges" title="Permalink to this definition">¶</a></dt>
<dd><p>Return graph with known-absent edges removed.</p>
<p>Do not modify the graph passed as input; return a new graph.</p>
<dl class="docutils">
<dt>end <span class="classifier-delimiter">:</span> <span class="classifier">EndGraph</span></dt>
<dd>EndGraph after translated edges have been added.</dd>
</dl>
<dl class="docutils">
<dt>g <span class="classifier-delimiter">:</span> <span class="classifier">NetworkX DiGraph</span></dt>
<dd>Graph with those edges in EndGraph known to be present. Edge
attributes are not transferred to this graph.</dd>
</dl>
</dd></dl>
</div>
<div class="section" id="main-classes">
<h2>Main classes<a class="headerlink" href="#main-classes" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="cocotools.MapGraph">
<em class="property">class </em><tt class="descclassname">cocotools.</tt><tt class="descname">MapGraph</tt><a class="headerlink" href="#cocotools.MapGraph" title="Permalink to this definition">¶</a></dt>
<dd><p>Subclass of the NetworkX DiGraph designed to hold CoCoMac Mapping data.</p>
<p>Each node must be specified in CoCoMac format as a string:
‘BrainMap-BrainSite’. Nodes not in this format are rejected. Node
attributes are not allowed.</p>
<p>Edges have the following attributes (but only RC and PDC should be
supplied by the user):</p>
<p>(1) RC (relation code). Allowable values are ‘I’ (identical to),
‘S’ (smaller than), ‘L’ (larger than), or ‘O’ (overlaps with). These
values complete the sentence, The source node is _____ the target node.</p>
<p>(2) TP (transformation path). This is a list of regions representing
the chain of relationships (the path within the graph) that mediates
the relationship between the source and the target. When the
relationship between the source and the target has been pulled directly
from the literature, TP is an empty list. When source’s relationship
to target is known because of source’s relationship to region X and
region X’s relationship to target, TP is [‘X’]. The list grows with
the number of intervening nodes. Of note, the TP for the edge from
target to source must be the reverse of the TP for the edge from
source to target.</p>
<p>(3) PDC (precision description code). An integer (from zero to 18,
with zero being the best) corresponding to an index in the PDC
hierarchy (cocotools.query.PDC_HIER), which was developed by the
CoCoMac curators. Entries in the hierarchy represent levels of
precision with which a statement in the original literature can be
made. When the edge is absent from the literature and has been
deduced based on other edges (i.e., when the TP length is greater
than zero), the PDC corresponds to the worst PDC of the edges
represented by TP.</p>
<p>Accurate deduction of new spatial relationships among regions and
accurate translation of connectivity data between maps demand that each
map be represented at just one level of resolution. This implies that
when a suite of spatially related regions from the same map is
identified, one or more regions must be excluded from the MapGraph
until all remaining are disjoint.</p>
<p>When keep_only_one_level_of_resolution is called, all but one level of
resolution is removed from the graph (and cong). The level with the
most anatomical connections (i.e., edges in cong) is chosen; in the
event of a tie, the finest level of resolution is chosen for all maps
but the target map, for which the coarsest level of resolution is
chosen.</p>
<p>Redundant nodes within a map are merged into a single node in this
graph and in the associated ConGraph. A name for the node is chosen
from the list of redundant ones arbitrarily.</p>
<p>New spatial relationships are deduced using an enhanced version of
Objective Relational Transformation (ORT) with the deduce_edges method.
The strategy used in MapGraph for handling intra-map spatial
relationships described above ensures that levels of resolution will
not be mixed within maps when deduce_edges is called. This allows
deduce_edges to assume all regions within a map are disjoint, which
enables, after all possible deductions have been made, automatic
identification and removal of relationships that cannot be true due to
their implication (in combination with other known relationships) of
spatial overlap between regions in the same map.</p>
</dd></dl>
<img alt="_images/MapGraph_inher.png" src="_images/MapGraph_inher.png" />
<dl class="class">
<dt id="cocotools.ConGraph">
<em class="property">class </em><tt class="descclassname">cocotools.</tt><tt class="descname">ConGraph</tt><big>(</big><em>data=None</em>, <em>**attr</em><big>)</big><a class="headerlink" href="#cocotools.ConGraph" title="Permalink to this definition">¶</a></dt>
<dd><p>Subclass of the NetworkX DiGraph designed to hold Connectivity data.</p>
<p>The DiGraph methods add_edge and add_edges_from have been overridden,
to enforce that edges have valid attributes with the highest likelihood
of correctness referring to their extension codes (ECs), precision
description codes (PDCs), and degree.</p>
</dd></dl>
<img alt="_images/ConGraph_inher.png" src="_images/ConGraph_inher.png" />
<dl class="class">
<dt id="cocotools.EndGraph">
<em class="property">class </em><tt class="descclassname">cocotools.</tt><tt class="descname">EndGraph</tt><big>(</big><em>data=None</em>, <em>**attr</em><big>)</big><a class="headerlink" href="#cocotools.EndGraph" title="Permalink to this definition">¶</a></dt>
<dd><p>Subclass of the NetworkX DiGraph designed to hold post-ORT data.</p>
</dd></dl>
<img alt="_images/EndGraph_inher.png" src="_images/EndGraph_inher.png" />
</div>
</div>
</div>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="objects.html" title="CoCoTools Objects"
>previous</a> |</li>
<li><a href="index.html">CoCoTools 0.0.1 documentation</a> »</li>
<li><a href="documentation.html" >CoCoTools’s documentation</a> »</li>
</ul>
</div>
<div class="footer">
© Copyright 2011, Daniel Bliss, Rob Blumenfeld and Fernando Perez.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
</div>
</body>
</html>