| 1 |
<HTML> |
| 2 |
|
| 3 |
<HEAD> |
| 4 |
<TITLE>ACEDB User Group Newsletter - June 2003</TITLE> |
| 5 |
|
| 6 |
<LINK rel=stylesheet type="text/css" |
| 7 |
href="../newsletter.css" |
| 8 |
title="Style sheet for Acedb newsletters"> |
| 9 |
|
| 10 |
</HEAD> |
| 11 |
|
| 12 |
|
| 13 |
<BODY> |
| 14 |
|
| 15 |
<HR> |
| 16 |
<HR> |
| 17 |
|
| 18 |
<!-- Don't change this name unless you change mkindex.pl. --> |
| 19 |
<a name="Top"></a> |
| 20 |
|
| 21 |
<H1>ACEDB User Group Newsletter - June 2003</H1> |
| 22 |
|
| 23 |
|
| 24 |
<!-- ******************************************************************** --> |
| 25 |
<P>If you want to have this newsletter mailed to you <B>or</B> you want to |
| 26 |
make comments/suggestions about the format/content then |
| 27 |
send an email to <A HREF="mailto:[email protected]">[email protected]</A>. |
| 28 |
|
| 29 |
|
| 30 |
<!-- ******************************************************************** --> |
| 31 |
<P><hr width="62%" align=left> |
| 32 |
<P>The June release includes the first extension to the Query language for some |
| 33 |
time, a new programmer's interface in |
| 34 |
C, Ace-C, reminiscent of AcePerl, but such that the same subroutines can |
| 35 |
be used in distant clients, as stand alone executables or embedded in |
| 36 |
tace/xace, |
| 37 |
an enhancement to the xace/xremote interface, tips for models file |
| 38 |
editting, bug fixes for gene making and acediff and a speed fix for the |
| 39 |
server. |
| 40 |
|
| 41 |
|
| 42 |
<!-- ******************************************************************** --> |
| 43 |
<P><hr width="62%" align=left> |
| 44 |
<a name="General_News"></a><H2>General News</H2> |
| 45 |
|
| 46 |
<P>Jean Thierry-Mieg |
| 47 |
<A HREF="mailto:[email protected]">[email protected]</A> reports: |
| 48 |
|
| 49 |
<P>Very good news: Jean [email protected] and Richard [email protected] |
| 50 |
have decided that they will from now on try to contribute regularly to |
| 51 |
this newsletter, and encourage developers to use it as a forum to |
| 52 |
discuss planned or desirable enhancements of Acedb. |
| 53 |
|
| 54 |
<P>Very sad news: Mark Sienkiewicz, after one year of excellent work on |
| 55 |
acedb at NCBI, has left. In this short time, in collaboration with Jean, |
| 56 |
he has made several lasting contributions to acedb. He wrote the support |
| 57 |
for arbitrary genetic code, recursively hooked to the closest parent |
| 58 |
sequence. This code is compatible with the NCBI recognized set of |
| 59 |
genetic codes, and is therefore usable, modulo a simple declaration, for |
| 60 |
all organisms and organelles. It is currently used in WormBase to |
| 61 |
translate the mitochondrial genes. Mark then worked on tricky kernel |
| 62 |
issues, affecting the very large acedb database that Jean uses at NCBI |
| 63 |
to support the annotation of the complete human genome (4 million |
| 64 |
sequences, 16 million objects). He fixed in particular a rare disk |
| 65 |
runaway and accelerated the client/server TCP protocol. But his most |
| 66 |
important realization is his contribution to the design and |
| 67 |
implementation of the new Ace-C programmer's interface described below. |
| 68 |
"He went over to the dark side, but let us hope for the return of the Jedi". |
| 69 |
|
| 70 |
|
| 71 |
<!-- ******************************************************************** --> |
| 72 |
<P><hr width="62%" align=left> |
| 73 |
<a name="New_Features"></a><H2>New Features</H2> |
| 74 |
|
| 75 |
|
| 76 |
<a name="query"></a><H3>Expanding Keysets in the ACEDB query language</H3> |
| 77 |
|
| 78 |
<P>(<I>This article is courtesy of Dan Lawson |
| 79 |
<A HREF="mailto:[email protected]">[email protected]</A> (who originally requested this |
| 80 |
new feature) and Jean Thierry-Mieg |
| 81 |
<A HREF="mailto:[email protected]">[email protected]</A> (who coded the new feature))</I> |
| 82 |
|
| 83 |
<P>ACEDB handles sets of objects called Keysets (you have all seen the xace |
| 84 |
window termed 'Main KeySet' or the tace line '// 13 Active Objects'). We |
| 85 |
use Keysets all the time during an ACEDB session, as transient lists of |
| 86 |
objects of interest, and it is possible to save them for later |
| 87 |
retrieval/use, using the 'save as' button in the 'Select/Modif' menu of |
| 88 |
the keyset window. They then belong to the "Keyset" class and can be |
| 89 |
retrieved in xace from the main window, or using the query: find keyset |
| 90 |
toto. |
| 91 |
|
| 92 |
<P>The problem was to get the objects contained in the keyset. In graphic |
| 93 |
mode (xace), you click on the Keyset object and it expands in a new |
| 94 |
keyset window, which you can query, intersect, dump etc. In text mode |
| 95 |
(tace), you could only so far get inside the keyset using the tace |
| 96 |
command 'follow'. However, a major limitation of the tace behaviour was |
| 97 |
that this command was not part of the query language, so it could not be |
| 98 |
used in complex queries or from the WormBase interface. |
| 99 |
|
| 100 |
<P>The new operator, 'expand', fixes this problem in the way you expect. |
| 101 |
Let us consider a biological example. In each release of WormBase, there |
| 102 |
is a canned keyset called CDS_with_RNAi. You can now say, from the |
| 103 |
command line: |
| 104 |
|
| 105 |
<P><pre><code>acedb> query find Keyset CDS_with_RNAi; expand; where From_laboratory = HX; |
| 106 |
|
| 107 |
// Found 8425 objects |
| 108 |
// 8425 Active Objects |
| 109 |
acedb> |
| 110 |
</code></pre> |
| 111 |
|
| 112 |
This is especially useful when you use the <A HREF="http://www.wormbase.org/">WormBase</A> |
| 113 |
single line |
| 114 |
<A HREF="http://www.wormbase.org/db/searches/query">query search box</A>: |
| 115 |
|
| 116 |
<P><pre><code>find Keyset CDS_with_RNAi; expand; From_laboratory = HX; |
| 117 |
</code></pre> |
| 118 |
|
| 119 |
<P>(Note that you do not need to specify the leading "query" keyword when using the |
| 120 |
Wormbase query dialog.) |
| 121 |
|
| 122 |
<P>This query returns those members of the CDS_with_RNAi keyset which were |
| 123 |
predicted by the Sanger Institute. |
| 124 |
|
| 125 |
<P>In addition, since the expand operator is now part of the standard acedb |
| 126 |
query language, it can be used in more complex queries as follows: |
| 127 |
|
| 128 |
<P><pre>Expand: query language operator. |
| 129 |
Expand takes no parameter. |
| 130 |
It opens the keysets present in the active set and returns as the new |
| 131 |
active set the union of all the objects that they contain. |
| 132 |
|
| 133 |
examples: (at the tace prompt) |
| 134 |
|
| 135 |
<code>acedb> query find author; expand</code> |
| 136 |
returns an empty set, because authors are not keysets, but plain objects |
| 137 |
|
| 138 |
<code>acedb> query find keyset CDS_with_RNAi; expand</code> |
| 139 |
returns as the active keyset all objects contained in CDS_with_RNAi |
| 140 |
|
| 141 |
<code>acedb> query find keyset C* ; expand ; IS > b10 AND IS <= b100</code> |
| 142 |
returns all members of all keysets called C*; then filters those on |
| 143 |
their names. Recall that, in acedb, b8 < b10 < b20 < b22a < b100. |
| 144 |
So you will get objects from b11* to b100, possibly including b22a. |
| 145 |
|
| 146 |
<code>acedb> query find keyset ; COUNT { expand } > 12 ; expand</code> |
| 147 |
returns a keyset of all keysets containing at least 12 objects, then |
| 148 |
expands just those |
| 149 |
</pre> |
| 150 |
|
| 151 |
|
| 152 |
|
| 153 |
|
| 154 |
<a name="windowid"></a><H3>Getting the xace main window id for use with xremote</H3> |
| 155 |
|
| 156 |
<P>To interact with a running xace program via xremote you need to know the |
| 157 |
window id of the xace main window. This is now provided along with other useful |
| 158 |
information in the "readlock" file for the running xace process. |
| 159 |
|
| 160 |
<P>Readlock files are held in the database subdirectory "<db>/database/readlocks" |
| 161 |
and have a file name of the format: |
| 162 |
|
| 163 |
<P><pre> <code><session>.<host>.<pid></code> |
| 164 |
|
| 165 |
e.g. <code>5.grifbo.457076</code> |
| 166 |
</pre> |
| 167 |
|
| 168 |
<P>Typical contents of a readlock are: |
| 169 |
|
| 170 |
<P><pre><code>Readlock file to prevent destruction of sessions still in use by other processes |
| 171 |
Created: 2003-07-02_13:45:46 |
| 172 |
User: edgrif |
| 173 |
Program: xace |
| 174 |
Version: ACEDB 4_9t |
| 175 |
Linkdate: compiled on: Jul 1 2003 14:00:08 |
| 176 |
WindowID: 0x6c00028 |
| 177 |
</code></pre> |
| 178 |
|
| 179 |
<P>Note the window id as the final entry. |
| 180 |
|
| 181 |
|
| 182 |
|
| 183 |
|
| 184 |
<a name="ace-c"></a><H3>Ace-C: a new C interface to acedb</H3> |
| 185 |
|
| 186 |
<P>(<I>This article is courtesy of Jean Thierry-Mieg |
| 187 |
<A HREF="mailto:[email protected]">[email protected]</A>)</I> |
| 188 |
|
| 189 |
<P>Mark Sienkiewicz and Jean Thierry-Mieg designed a new C interface to |
| 190 |
acedb. It is analog to AcePerl, but programmed as a C library. |
| 191 |
Like Janus, it has a double face. The same Ace-C code can run as a |
| 192 |
subroutine in tace, or as a distant client talking to the acedb server. |
| 193 |
|
| 194 |
<P>This is in fact the seventh interface developed for acedb, but we hope |
| 195 |
that, together with AcePerl, Ace-C will last. The problem at stake is to |
| 196 |
use acedb to support a Web site. We first had the Moulon server of the |
| 197 |
enigmatic Guy Decoux which was a clever hack rather than a programmer's |
| 198 |
interface. Then we had the -p style of Doug Bigwood et al. which |
| 199 |
exported full fledged Perl objects, but was hard to use. Then Lincoln |
| 200 |
and Jean developed the -j style to support first Jade, a Java universal |
| 201 |
interface to acedb, which died as a victim of the Java war, then |
| 202 |
AcePerl, the clear success we are all familiar with. In the meantime, |
| 203 |
another java interface, javace, was developed, but it is not universal |
| 204 |
and exports only a particular acedb schema into a particular biojava |
| 205 |
schema. There were also two C interfaces, one called acelib, which was |
| 206 |
designed collectively at the Cornell acedb meeting but was incomplete |
| 207 |
and clumsy, and a second one designed at NCBI, which was too complex and |
| 208 |
never released. By the way, we would like to remove acelib, so if anyone |
| 209 |
is using it, which I doubt, please let us know, we can help port the |
| 210 |
code to the new Ace-C. |
| 211 |
|
| 212 |
<P>Why so many attempts ? Well, clearly it is a hard problem, but each time |
| 213 |
we benefit from the previous tries. Why not just use AcePerl ? Because |
| 214 |
AcePerl modules can only be used as distant slow clients, and cannot be |
| 215 |
embedded as fast subroutines to develop new tools inside acedb. In fact |
| 216 |
AcePerl would benefit from being rewritten above the new Ace-C, which is |
| 217 |
better optimized than the current AcePerl communication layer and which |
| 218 |
offers new functionalities. |
| 219 |
|
| 220 |
<P>The real nice thing is that the Ace-C programmer's interface is defined |
| 221 |
in a single include file, wac/ac.h, and you may choose to link your |
| 222 |
program either with the client Ace-C lib, called libaccl.a or with the |
| 223 |
standalone Ace-C lib called libacs.a. |
| 224 |
|
| 225 |
<P>In the client case, data are exchanged with the server using the new |
| 226 |
'show -C' mode, born from ideas discussed years ago with Richard and |
| 227 |
Doug Bigwood. |
| 228 |
In the standalone case, the Ace-C function calls are just wrappers for |
| 229 |
standard acedb kernel calls, which means that Ace-C runs with a |
| 230 |
negligible overhead, and can run standalone or as a subroutine imbedded |
| 231 |
in tace/xace. |
| 232 |
The interface is powerful, streamlined, unambiguous and well defined, |
| 233 |
and should be easy to learn and use. |
| 234 |
|
| 235 |
|
| 236 |
<P>Example (extracted from in wacext/makefile.acc): |
| 237 |
|
| 238 |
<P><pre><code>kscount: kscount.o $(LINK_ACC) |
| 239 |
$(LINKER) -o $@ kscount.o $(LINK_ACC) $(LIBS) |
| 240 |
|
| 241 |
skscount: kscount.o $(LINK_ACS) |
| 242 |
$(LINKER) -o $@ kscount.o $(LINK_ACS) $(LIBS) |
| 243 |
|
| 244 |
kscount s:host:12345:anonymous # runs as a client |
| 245 |
skscount $ACEDB # runs standalone |
| 246 |
</code></pre> |
| 247 |
|
| 248 |
<P>Ace-C is now used in production underneath the NCBI AceView website |
| 249 |
http://www.humangenes.org |
| 250 |
All the source code has been put in the CVS, the library is well |
| 251 |
documented in wac/ac.h, although there is no user manual, and there is a |
| 252 |
built in regression suite. However, the rarely used functions may still |
| 253 |
need some tuning and we would appreciate feedback. |
| 254 |
|
| 255 |
<P>If you are interested, please use the acedb daily build and mail |
| 256 |
<A HREF="mailto:[email protected]">[email protected]</A>)</I> |
| 257 |
|
| 258 |
|
| 259 |
<a name="Named_Keysets"></a><H3>Named Keysets</H3> |
| 260 |
|
| 261 |
<P>(<I>This article is courtesy of Jean Thierry-Mieg |
| 262 |
<A HREF="mailto:[email protected]">[email protected]</A>)</I> |
| 263 |
|
| 264 |
<P>As part of the support for Ace-C, we introduced 3 new commands to the |
| 265 |
acedb command language, available from tace and aceclient. |
| 266 |
|
| 267 |
<P><pre><code>kstore name : store active keyset in internal tmp space as name |
| 268 |
kget name : copy named set as active keyset |
| 269 |
kclear name : clear named set |
| 270 |
</code></pre> |
| 271 |
|
| 272 |
<P>The name space and all the named keyset are per client and released |
| 273 |
when the client quits. |
| 274 |
|
| 275 |
<P>Example: Build a Wen diagram |
| 276 |
|
| 277 |
<P><pre><code> query ......... // a very slow query |
| 278 |
kstore L1 |
| 279 |
query ......... // a very slow query |
| 280 |
kstore L2 |
| 281 |
.... |
| 282 |
kget L1 |
| 283 |
spush |
| 284 |
kget L2 |
| 285 |
sand |
| 286 |
spop |
| 287 |
count // counts the objects in the intersect |
| 288 |
</code></pre> |
| 289 |
|
| 290 |
<P>I remember that Lincoln had for years been asking for this functionality. |
| 291 |
|
| 292 |
|
| 293 |
<!-- ******************************************************************** --> |
| 294 |
<P><hr width="62%" align=left> |
| 295 |
<a name="Articles"></a><H2>Articles</H2> |
| 296 |
|
| 297 |
|
| 298 |
|
| 299 |
<a name="models_file"></a><H3>Editting wspec/models.wrm</H3> |
| 300 |
|
| 301 |
<P>A couple of times recently users have sent emails with questions about the |
| 302 |
models file and how it should be edited. Here are tips/guidelines/rules. |
| 303 |
|
| 304 |
<P>The spatial layout of the models.wrm file is crucial as it describes the structure |
| 305 |
of objects in the database. Here is a crude example: |
| 306 |
|
| 307 |
<P><pre><code> Class in models.wrm Object in database |
| 308 |
|
| 309 |
?Name First_name Text Ed---->First_name--->"Edward" |
| 310 |
Surname Text | |
| 311 |
V |
| 312 |
Surname---->"Griffiths" |
| 313 |
</code></pre> |
| 314 |
|
| 315 |
<P>If you misaligned the class definition as below acedb would complain and refuse to |
| 316 |
parse the models file: |
| 317 |
|
| 318 |
<P><pre><code>?Name First_name Text |
| 319 |
Surname Text |
| 320 |
</code></pre> |
| 321 |
|
| 322 |
<P>This is fine in a way because you would quickly find out about the error and nothing |
| 323 |
will be corrupted. Mistakes |
| 324 |
can however be less obvious if you have a deeply nested object and you have used Tabs to |
| 325 |
space out your class. The accidental deletion of a Tab can change the whole branching |
| 326 |
structure of your class: |
| 327 |
|
| 328 |
<P><pre>Original class: |
| 329 |
|
| 330 |
<code>?Map No_cache // Don't cache segs for this map. |
| 331 |
Display Non_graphic // Prevents a graphic display! |
| 332 |
Title UNIQUE ?Text |
| 333 |
Flipped // Then coordinates go upwards |
| 334 |
Unit UNIQUE Text |
| 335 |
// e.g. kb, centiMorgan, MegaParsec |
| 336 |
Centre UNIQUE Float UNIQUE Float |
| 337 |
// default centre, width - else 0, 10 |
| 338 |
Extent UNIQUE Float UNIQUE Float |
| 339 |
// min, max - else min, max gene/locus |
| 340 |
Default_view UNIQUE ?View |
| 341 |
Minimal_view UNIQUE ?View // use this when >1 map displayed |
| 342 |
View ?View // Columns to display |
| 343 |
Inherits From_map UNIQUE ?Map // To locally edit |
| 344 |
Author Text // login name of who created it</code> |
| 345 |
|
| 346 |
Class after accidental deletion of Tab preceding "Centre": |
| 347 |
|
| 348 |
<code>?Map No_cache // Don't cache segs for this map. |
| 349 |
Display Non_graphic // Prevents a graphic display! |
| 350 |
Title UNIQUE ?Text |
| 351 |
Flipped // Then coordinates go upwards |
| 352 |
Unit UNIQUE Text |
| 353 |
// e.g. kb, centiMorgan, MegaParsec |
| 354 |
Centre UNIQUE Float UNIQUE Float |
| 355 |
// default centre, width - else 0, 10 |
| 356 |
Extent UNIQUE Float UNIQUE Float |
| 357 |
// min, max - else min, max gene/locus |
| 358 |
Default_view UNIQUE ?View |
| 359 |
Minimal_view UNIQUE ?View // use this when >1 map displayed |
| 360 |
View ?View // Columns to display |
| 361 |
Inherits From_map UNIQUE ?Map // To locally edit |
| 362 |
Author Text // login name of who created it</code> |
| 363 |
</pre> |
| 364 |
|
| 365 |
<P>This one character deletion changes the branching structure of the object completely |
| 366 |
legally to something quite different from the original. There are now three main branches |
| 367 |
in the object defined by the "Display", "Centre" and "Inherits" tags where there used |
| 368 |
to be two. While usage of both spaces and Tabs is completely legal, using Tabs is |
| 369 |
not a good idea ! |
| 370 |
|
| 371 |
|
| 372 |
<P>If inadvertantly you read this wrong model file and start using it |
| 373 |
<ul> |
| 374 |
<li>You can still see your old data, because acedb uses the schema as |
| 375 |
it was when the data was loaded. |
| 376 |
<li>You can parse old ace files, because the list of tags did not |
| 377 |
change, just their organization. But now data under "Centre" go to the |
| 378 |
new place. |
| 379 |
<li>Queries concerning "Centre" and any tag below only retrieve newly |
| 380 |
entered data, because the old objects do not contain those tags in the |
| 381 |
current position |
| 382 |
</ul> |
| 383 |
|
| 384 |
<P>To fix the mess, please use tace: |
| 385 |
|
| 386 |
<P><pre><code>tace $ACEDB << EOF |
| 387 |
query find map centre // gets just the 'new' centre |
| 388 |
show -a -f toto.ace centre // exports just that tag |
| 389 |
edit -D centre // removes the tag in the 'new' objects |
| 390 |
read-models // read back the correct models |
| 391 |
parse toto.ace // recover your data in the right place |
| 392 |
save |
| 393 |
quit |
| 394 |
EOF</code></pre> |
| 395 |
|
| 396 |
|
| 397 |
<P>Here are some tips that will help you to avoid having trouble editting the models.wrm |
| 398 |
file: |
| 399 |
|
| 400 |
<ul> |
| 401 |
<li>Only use a plain text editor, i.e. one that does not format or add any control |
| 402 |
characters to the file, e.g. "vi", "emacs" or some similar editor in Unix and |
| 403 |
"Notepad" in Windows. In particular note that if you are working on a Windows machine |
| 404 |
your editor will probably add DOS style "end of line" characters to the |
| 405 |
end of each line. This is fine if you only use the models file from a windows |
| 406 |
machine but you should be aware that this will make that models file unparseable |
| 407 |
from a Unix machine. |
| 408 |
<li>Use a constant width font to view the file so you can be sure your tags are correctly lined up. |
| 409 |
<li>Always use spaces instead of Tabs, that way it will be more obvious if you |
| 410 |
accidentally delete something. Chances are that you will produce an illegal |
| 411 |
models file and acedb will report the error. |
| 412 |
</ul> |
| 413 |
|
| 414 |
|
| 415 |
|
| 416 |
|
| 417 |
<!-- ******************************************************************** --> |
| 418 |
<P><hr width="62%" align=left> |
| 419 |
<a name="Bugs_Fixed"></a><H2>Bugs Fixed</H2> |
| 420 |
|
| 421 |
|
| 422 |
<a name="parent_bug"></a><H3>Gene curation bug in FMap</H3> |
| 423 |
|
| 424 |
<P>A number of users have reported the error |
| 425 |
"Failed to update parent sequence object: <name of object>" when trying to |
| 426 |
make temporary genes from within the gene finding package for the FMap. |
| 427 |
This has now been fixed and was a fault in the code that tried to find a |
| 428 |
parent for the temporary gene. |
| 429 |
|
| 430 |
|
| 431 |
<a name="blixem"></a><H3>Blixem not displaying homologies that extend to end of sequence</H3> |
| 432 |
|
| 433 |
<P>A trivial (as in the coding, not in the debugging sense !) off-by-one error in coordinate |
| 434 |
calculations in blixem calling code resulted in the loss of |
| 435 |
all homologies which extend right to the end of the displayed sequence. |
| 436 |
|
| 437 |
|
| 438 |
<a name="acediff"></a><H3>acediff bugs</H3> |
| 439 |
|
| 440 |
<P>acediff was erroneously interpretting "//" in a text field as the start of an |
| 441 |
acedb style comment and hence getting the text field wrong. This is now fixed, |
| 442 |
backslash escapes in comment delimiters are now honoured: |
| 443 |
|
| 444 |
<P><pre><code>// this is a comment |
| 445 |
/\/ this is not (now) a comment |
| 446 |
</code></pre> |
| 447 |
|
| 448 |
<P>acediff had a problem processing files where the same tag was repeated due to clumsy |
| 449 |
pre-processing and generated spurious -D lines in the output, this is now fixed. |
| 450 |
|
| 451 |
|
| 452 |
<a name="print_window"></a><H3>Printer list in print window</H3> |
| 453 |
|
| 454 |
<P>The printer list in the print window used to contain blank lines if the |
| 455 |
system file /etc/printcap contained incomplete entries. This is now fixed. |
| 456 |
|
| 457 |
|
| 458 |
<a name="make"></a><H3>makefile shenanigans</H3> |
| 459 |
|
| 460 |
<P>Replaced "test" with "/usr/bin/test" since the test builtin in some |
| 461 |
versions of the shell doesn't understand "-L" -- step forward Solaris! |
| 462 |
|
| 463 |
|
| 464 |
|
| 465 |
<!-- ******************************************************************** --> |
| 466 |
<P><hr width="62%" align=left> |
| 467 |
<a name="Developers_Corner"></a><H2>Developers Corner</H2> |
| 468 |
|
| 469 |
<a name="performance"></a><H3>Performance and acedb</H3> |
| 470 |
|
| 471 |
<P>(<I>This article is courtesy of Jean Thierry-Mieg |
| 472 |
<A HREF="mailto:[email protected]">[email protected]</A>)</I> |
| 473 |
|
| 474 |
<P>This could be interesting to all programmers. I recently fixed heavy |
| 475 |
performance problems just by editing my makefile: |
| 476 |
|
| 477 |
<ol> |
| 478 |
<li>I had an apparent memory leak in the acedb server underneath my |
| 479 |
web-site, affecting Solaris on sparc or on Intel. The leak went away |
| 480 |
when I removed from my makefile the pragma <b>-l malloc</b> |
| 481 |
<li>On Linux, I considerably accelerated parsing files by removing a pragma |
| 482 |
<b>-l pthread</b>, |
| 483 |
although I was actually not using threads, acedb is NOT thread save, the |
| 484 |
library was listed in my configuration files, because of other programs, |
| 485 |
and this turned the getc(), used by the acedb parser to scan input |
| 486 |
files, from a macro into a very slow function. |
| 487 |
It is possible that this library is linked implicitly in many C++ |
| 488 |
implementations, slowing down many of your programs, beware! |
| 489 |
<li>Several months ago, qsort on Solaris was bugged, retrieving a |
| 490 |
negative record at a very low but non zero probability, and inducing |
| 491 |
very soon after that a flat crash. I fixed that by replacing in |
| 492 |
arraySort the call to qsort by an actually faster call to msort, a |
| 493 |
function that I added in freesubs. |
| 494 |
Conclusion: If you have any trouble with performance, do not forget to |
| 495 |
suspect the standard Unix functions, such as qsort, and standard |
| 496 |
libraries, such as lmalloc and lpthread. Also remember that I am always |
| 497 |
interested in hearing about performance problems ([email protected]). |
| 498 |
</ol> |
| 499 |
|
| 500 |
|
| 501 |
<a name="cattext"></a><H3>About catText catBinary</H3> |
| 502 |
|
| 503 |
<P>(<I>This article is courtesy of Jean Thierry-Mieg |
| 504 |
<A HREF="mailto:[email protected]">[email protected]</A>)</I> |
| 505 |
|
| 506 |
<P>Let us re-explain what happened last month. |
| 507 |
Since its introduction, catBinary was bugged, it was appending an extra |
| 508 |
zero at the end of the buffer. This was apparent only if you were |
| 509 |
calling catBinary() twice on the same stack, because you then had this |
| 510 |
extra zero in between the two pages. Nobody ever complained, may be |
| 511 |
nobody ever tried. This bug was fixed by Mark Sienkiewicz around May 25. |
| 512 |
|
| 513 |
<P>While fixing the bug, catText was inadvertently modified. This killed |
| 514 |
the query language, was detected by Aquila the same night, and fixed the |
| 515 |
following day. So, just to clarify: |
| 516 |
|
| 517 |
<ul> |
| 518 |
<li>The automatic Aquila test correctly reported the error, merci Detlef. |
| 519 |
<li>catText was not modified, except for a few hours, and only on the |
| 520 |
development version, during which acedb was brain dead (all queries |
| 521 |
failed). So nobody should worry about catText. |
| 522 |
<li>However, catBinary was purposely modified. This affects, in the |
| 523 |
public distribution, binary buffers exported by aceserver. If by chance |
| 524 |
you had a work-around the bug in your client code, you should be aware |
| 525 |
of this change and modify your clients to cope with the now correct data |
| 526 |
exported by the acedb server. |
| 527 |
</ul> |
| 528 |
|
| 529 |
|
| 530 |
|
| 531 |
<a name="server"></a><H3>Server speed up</H3> |
| 532 |
|
| 533 |
<P>(<I>Thanks to Mark Sienkiewicz (formerly of NCBI) for spotting this one.</I>) |
| 534 |
|
| 535 |
<P>Requests/replies can be greatly speeded up for the server by setting the TCP_NODELAY |
| 536 |
flag for the socket. This prevents TCP from waiting for an acknowledgement for each packet |
| 537 |
before it sends the next one. This is particularly relevant for small requests on slow |
| 538 |
networks (the effect is hardly noticeable on a local high speed network): |
| 539 |
|
| 540 |
|
| 541 |
<P>Jean Thierry-Mieg |
| 542 |
<A HREF="mailto:[email protected]">[email protected]</A> reports: |
| 543 |
|
| 544 |
<P>Mark Sienkiewicz greatly speeded up the server by setting the |
| 545 |
TCP_NODELAY flag for the socket. This prevents TCP from waiting for an |
| 546 |
acknowledgement for each packet before it sends the next one. The |
| 547 |
improvement is particularly important for small requests on slow |
| 548 |
networks, as when one uses AcePerl over the network across the Atlantic |
| 549 |
ocean. The way Mark found the bug is interesting. Because it seemed too |
| 550 |
hard to retrofit the ace.4_9 TCP protocol (let us call it the |
| 551 |
s-protocol) in the ace.4_7 code still used in production at NCBI, he |
| 552 |
wrote, in the context of Ace-C, a new simple minded TCP protocol (let us |
| 553 |
call it the a-protocol). Later the Ace-C client was adapted to talk to |
| 554 |
the ace.4_9 saceserver, and it became immediately apparent that the |
| 555 |
s-protocol was way slower than the a-protocol, even on the NCBI |
| 556 |
intranet. After some testing, it all boiled down to raising a single |
| 557 |
flag, and speeds were equalized. |
| 558 |
|
| 559 |
|
| 560 |
<a name="optimisations"></a><H3>Optimisations</H3> |
| 561 |
|
| 562 |
<P>(<I>This article is courtesy of Jean Thierry-Mieg |
| 563 |
<A HREF="mailto:[email protected]">[email protected]</A>)</I> |
| 564 |
|
| 565 |
<P>With data size ever increasing, it becomes necessary to optimize the |
| 566 |
code once more. To this end, i revamped the acedb CHRONO and started |
| 567 |
pushing fixes in the CVS. |
| 568 |
|
| 569 |
<ol> |
| 570 |
<li>A glitch in the hashing function used by the dict library was fixed. |
| 571 |
This does not affect the acedb main classes, which have their own direct |
| 572 |
hashing. The improvement is visible only if you use a dict with over |
| 573 |
100,000 entries. |
| 574 |
<li>I modified disk/cache handling with a tremendous effect on very large |
| 575 |
databases. To parse the 16 million objects of the whole human genome |
| 576 |
annotation database on an alpha, time went down from 24 to 12 hours. |
| 577 |
<li>The problem of disk runaways has been found by Mark Sienkiewicz but needs to be |
| 578 |
incorporated into the development code. |
| 579 |
<li>File scanning optimization is under way, and will be put in the CVS |
| 580 |
shortly. |
| 581 |
<li>Several types of query now use the internal indexing more efficiently. |
| 582 |
</ol> |
| 583 |
|
| 584 |
|
| 585 |
<a name="Chrono"></a><H3>Chrono</H3> |
| 586 |
|
| 587 |
<P>(<I>This article is courtesy of Jean Thierry-Mieg |
| 588 |
<A HREF="mailto:[email protected]">[email protected]</A>)</I> |
| 589 |
|
| 590 |
<P>Chrono is back and working. It is a very versatile way of profiling |
| 591 |
acedb. It is programmed as macros, and does not affect the compiled code |
| 592 |
when turned off. |
| 593 |
|
| 594 |
<pre>Usage: |
| 595 |
<code>#define CHRONO /* if undef, all chrono calls disappear */ |
| 596 |
#include "chrono.h" /* must come after the define CHRONO */ |
| 597 |
... |
| 598 |
f () |
| 599 |
{ |
| 600 |
chrono ("f") ; /* or any message you like */ |
| 601 |
......... /* do something */ |
| 602 |
chronoReturn () ; /* carefully chronoReturn along each path*/ |
| 603 |
/* |
| 604 |
beware of goto's and early return statements */ |
| 605 |
} |
| 606 |
... |
| 607 |
main() |
| 608 |
{ |
| 609 |
chronoStart () ; |
| 610 |
chronoStop() ; |
| 611 |
chronoReport () ; |
| 612 |
}</code> |
| 613 |
</pre> |
| 614 |
|
| 615 |
<P>The nice thing is that you can chrono a whole function or just a few |
| 616 |
lines of code. Nested chrono calls are allowed. |
| 617 |
|
| 618 |
<P>To start and stop a chrono session, there are four methods |
| 619 |
|
| 620 |
<ul> |
| 621 |
<li>call chronoStart/Stop/Report in main() |
| 622 |
<li>define CHRONO at the top of session.c to chrono the whole acedb session. |
| 623 |
<li>activate chrono from the tace prompt (to be folded in CVS very soon) |
| 624 |
Chrono {start | stop | show} affects all chrono-aware routines |
| 625 |
<li>activate and visualize chrono from xace->admin->chrono |
| 626 |
This option is available in xace up to 4_7, but seems lost in 4_9. |
| 627 |
</ul> |
| 628 |
|
| 629 |
|
| 630 |
<P>Example comparing acein and freecard on the same dataset: |
| 631 |
|
| 632 |
<pre><code>// Total time : 4.42 s system, 66.43 user level = 0 |
| 633 |
// # of calls System % User % |
| 634 |
// Chrono 0 0.00 s 0 % 0.00 s 0 % |
| 635 |
//test_acein 1 0.65 s 14 % 14.50 s 21 % |
| 636 |
//test_freecard 1 0.92 s 20 % 13.93 s 20 % |
| 637 |
</code></pre> |
| 638 |
|
| 639 |
|
| 640 |
|
| 641 |
<!-- ******************************************************************** --> |
| 642 |
<P><hr width="62%" align=left> |
| 643 |
<a name="Monthly_Build"><H2>June monthly build now available.</H2> |
| 644 |
|
| 645 |
<P>You can pick up the monthly builds from: |
| 646 |
<dl> |
| 647 |
<dt><b>Sanger users</b> |
| 648 |
<dd>~acedb/RELEASE.DEVELOPMENT |
| 649 |
<dt><b>External users</b> |
| 650 |
<dd><A href="http://www.acedb.org/Software/Downloads/monthly.shtml"> |
| 651 |
http://www.acedb.org/Software/Downloads/monthly.shtml</A> |
| 652 |
</dl> |
| 653 |
|
| 654 |
<!-- ******************************************************************** --> |
| 655 |
<P><hr width="62%" align=left> |
| 656 |
<a name="User_Group"><H2>Next User Group Meeting - D319, 3.00pm, Thursday, 10th July 2003</H2> |
| 657 |
|
| 658 |
<!-- ******************************************************************** --> |
| 659 |
<HR> |
| 660 |
<HR> |
| 661 |
|
| 662 |
<ADDRESS><A href="mailto:[email protected]">Ed Griffiths <[email protected]></A></ADDRESS> |
| 663 |
<!-- hhmts start --> |
| 664 |
Last modified: Tue Jul 8 10:46:24 BST 2003 |
| 665 |
<!-- hhmts end --> |
| 666 |
|
| 667 |
</BODY> |
| 668 |
</HTML> |