Debian Codegraph @

hmmer/profmark/00README.md

raw symbols SCIP
1 # profmark: benchmark protocol used in HMMER testing
2
3
4 ## 1. create-profmark: creating a new benchmark dataset
5
6 A central idea to how we make a benchmark is to split a known sequence
7 family into a training set and a test set, not just randomly, but such
8 that the test sequences are dissimilar to the training sequences
9 [Petti & Eddy, 2022]. We want to test the ability of a remote
10 homology search procedure to detect distant outliers.
11
12 Another central idea is that our positives are full length sequences,
13 with homologous domains embedded in nonhomologous flanking sequence.
14 We want to test the ability of profile search software to use local
15 and glocal alignment to identify, parse, and align individual domains
16 of full-length protein sequences that are typically composed of more
17 than one domain. Global alignment to isolated domains is not an
18 adequate test.
19
20 Another central idea that our negative nonhomologous (sub)sequences
21 are always synthetic, not real. This makes sure that a sequence is
22 truly nonhomologous, not some as-yet undiscovered homolog that must
23 not be counted as a "false positive" if a new approach detects it.
24
25 The `create-profmark` program embodies our procedure for splitting
26 input multiple sequence alignments of homologous domains (such as Pfam
27 alignments) into training/set sets, synthesizing positive homologous
28 sequences by embedding one or two test domains in synthetic
29 nonhomologous flanking sequence, and synthesizing negative
30 nonhomologous sequences, and
31
32
33 ### Running create-profmark
34
35 **Usage:** `./create-profmark <benchmark_prefix> <Stockholm MSA file> <FASTA sequence database>`
36 **Example:** `./create-profmark pmark Pfam-A.seed uniprot-sprot.fa`
37
38 The `<Stockholm MSA file>` and `<FASTA sequence database>` are inputs.
39 The MSA file is the source of one or more sequence domain alignments
40 that we'll split into training and test sets. Typically, this would be
41 a Pfam seed or full alignment database. The `<FASTA sequence
42 database>` is used as the source of random protein subsequences that
43 we randomize to create synthetic nonhomologous subsequences.
44
45 Five output files are created, using the `<benchmark_prefix>` to
46 construct filenames. (The format of these files is described in a
47 later section of these notes.)
48
49 | file | description |
50 |-------|--------------|
51 | `<benchmark_prefix>.train.msa` | MSA queries; Stockholm format |
52 | `<benchmark_prefix>.test.fa` | synthetic positive and negative sequence targets; FASTA format |
53 | `<benchmark_prefix>.tbl` | table summarizing the benchmark |
54 | `<benchmark_prefix>.pos` | table summarizing synthetic positive test set |
55 | `<benchmark_prefix>.neg` | table summarizing synthetic negative test set |
56
57 Briefly: each input alignment in the `<Stockholm MSA file>` is split
58 into a query alignment and a nonredundant set of test domains by two
59 single-linkage clustering steps, such that no test domain has > 25%
60 identity to any query sequence and no test domain is > 50% identical
61 to any other test domain. Full-length positive test sequences are
62 constructed by embedding two test domains in a larger sequence, with
63 nonhomologous segments generated by selecting a random segment of the
64 `<FASTA sequence database>` and shuffling it. Full-length negative
65 test sequences are constructed in the same patchwork way except that
66 all five segments are nonhomologous shuffled sequence. Test sequences
67 are deliberately created in this patchwork to simulate some of the
68 inhomogeneity of real sequences.
69
70 Alternatively, instead of creating full-length positive and negative
71 test sequences in FASTA format in the .test.fa file, `create_profmark` can
72 also be used to split input MSAs into training and test MSAs. Since no
73 nonhomologous sequence source is needed, the `<FASTA sequence database>`
74 argument isn't used.
75
76 **Usage:** `./create-profmark --onlysplit <benchmark_prefix> <Stockholm MSA file>`
77 **Example:** `./create-profmark --onlysplit pmark Pfam-A.seed`
78
79 With `--onlysplit`, three output files are created:
80
81 | file | description |
82 |-------|--------------|
83 | `<benchmark_prefix>.tbl` | table summarizing the benchmark |
84 | `<benchmark_prefix>.train.msa` | MSA queries, Stockholm format |
85 | `<benchmark_prefix>.test.msa` | MSA test sequences, Stockholm format |
86
87
88 ### Detailed stepwise explanation of the procedure
89
90 In more detail, including options that change the default benchmark
91 construction protocol, the procedure is as follows:
92
93
94 * for each MSA in `<Stockholm MSA file>`:
95
96 - **Filter out sequence "fragments".**
97
98 Fragments are aligned seqs with aspan/alen < fragthresh, where aspan
99 is the number of alignment columns spanned from the leftmost to rightmost residue.
100 Default fragthresh is 0.5; it can be changed with `--fragthresh <x>`.
101 Setting `--fragthresh 0` means no seqs will be defined as fragments.
102
103
104 - **Attempt to split the MSA into a training set S, and a dissimilar test set T.**
105
106 A successful split is such that:
107 * no test sequence in T has $> t_1$ fractional pairwise identity to any
108 training sequence in S.
109 * no pair of test sequences has $> t_2$ fractional pairwise identity
110 * optionally, no pair of training sequences has $> t_3$ fractional pairwise id
111 * training and test set sizes |S| and |T| satisfy specified minima.
112
113 Fractional identity is calculated by `esl_dst_XPairId()` as
114 nid/MIN(rlen1,rlen2), where nid is number of identical aligned
115 residues, and rlen1, rlen2 are the total unaligned length of each
116 sequence. Alignments involving any IUPAC degenerate residues
117 must be identical to count toward nid.
118
119 create-profmark supports four different splitting algorithms.
120 The default is `--cobalt`, the Cobalt algorithm of [Petti & Eddy,
121 2022], a graph theoretic independent set algorithm. Blue
122 (`--blue`) is a more powerful version of Cobalt that can find
123 successful splits somewhat more frequently, at the expense of
124 much more compute time. Previous versions of create-profmark used
125 single-linkage clustering, which is still available as the
126 `--clust` option.
127
128 A fourth algorithm, Random (`--random`), is a bad algorithm that
129 would usually only be used as a baseline for comparing different
130 splitting algorithms. Random creates a random training/test set
131 split, and this will typically fail to satisfy the criterion of
132 having no linked train/test set pair. However, with `--random -1
133 1.0`, you can create random train/test set splits without regard
134 for sequence identity. This is the usual way that machine
135 learning people would jackknife their data. By default, 0.75
136 (75%) of the sequences are put in the training set and the rest
137 in the test set; this fraction can be set with the `--rp <x>`
138 option.
139
140 - **For each split attempt on the input MSA:**
141
142 1. **Split the MSA using the chosen algorithm into two sets, S and T.**
143
144 As above: such that no sequence in S (the candidate
145 training set) has $> t_1$ fractional identity to any
146 sequence in T (the candidate test set). Default $t_1$ is
147 0.25; this can be changed with the `-1 <x>` option.
148
149 With Cobalt and Blue, the larger of the two sets after a
150 split is designated as the training set S, so $|S| \geq |T|$.
151 For Random, the default `--rp` of 0.75 also makes $|S| \geq |T|$.
152 For Cluster, which splits the MSA into
153 single-linkage clusters, the largest cluster is designated
154 as the training set $S$ and all other sequences go into $T$;
155 as a result, it is possible for $|T| > |S|$ with Cluster.
156
157 2. **Prune redundant test sequences from T.**
158
159 After this step, no pair of test sequences has $> t_2$ fractional
160 identity. Default $t_2 = 0.5$ (50%); controlled by `-2 <x>`
161 option.
162
163 This is done by applying essentially the same chosen
164 splitting algorithm, except that when the Random algorithm
165 is used for step 1, "monoCobalt" is used for step 2. (When
166 we're using Random, it's only the initial split that we're
167 interested in doing badly. Pruning steps are still
168 done well.)
169
170 3. **Optionally, prune redundant training sequences from S.**
171
172 The same pruning may be done to the training set sequences
173 by setting a third threshold $t_3$ with the `-3 <x>`
174 option. By default, this third threshold is set to
175 1.0, which means that no pruning is done (because no
176 fractional pairwise identity can be > 1.0).
177
178 Choosing the training set alignment to be the larger split, and
179 defaulting to not pruning it further, is intended to keep the
180 training set alignment as close to the original input MSA as
181 possible, in order to benchmark "realistic" input alignment
182 search queries.
183
184 4. **Optionally, ensure a minimum number of training and test sequences.**
185
186 The `--mintrain <n>` and `--mintest <n>` options
187 set these minima. If they aren't satisfied, the split
188 attempt is deemed unsuccessful. Default is 2 for test set
189 size, because the default is to embed 2 homologous domains
190 per synthetic positive sequence. Default is 1 for
191 training set size.
192
193 - **Optionally, repeat attempts to achieve a successful split.**
194
195 Blue, Cobalt, and Random are randomized algorithms. They can
196 fail in some runs and succeed in others. Running multiple
197 attempts increases the odds of a successful split. One split
198 attempt consists of steps 1-4 above. The `--firstof <n>` option
199 runs up to a maximum of <n> split attempts and stops when one
200 succeeds. The `--bestof <n>` option performs `n` splits and if
201 more than one succeeds, it returns the one that maximizes
202 `|S|*|T|` (i.e. the geometric mean of the number of sequences in the two
203 sets). The Cluster algorithm is deterministic, so these options
204 are not available nor sensible with `--clust`.
205
206 - **Optionally, downsample either S or T to maximum sizes.**
207
208 The `--maxtrain <n>` and `--maxtest <n>` options are off by default,
209 but can be used to set maximum sizes for |S| and |T|. A set
210 is randomly downsampled to n if it exceeds the limit.
211
212 - **Randomly permute the order of both sets.**
213
214 This allows single-sequence-query tests to start on a random but
215 reproducible single query sequence, simply by taking the first
216 seq in the alignment. Other than this (row) permutation, the
217 training set is preserved in its original alignment.
218
219 At this point, the split is judged to either be a success or a
220 failure. A line of tabular data summarizing the split is written
221 to `<benchmark_prefix>.tbl`, whether successful or not.
222
223 - **In the `--onlysplit` version, end here: output and move on to next MSA.**
224
225 If the split was successful, and `--speedtest` isn't on, the
226 training and test set alignments are written to
227 `<benchmark_prefix>.train.msa` and `<benchmark_prefix>.test.msa`.
228 Remaining steps below are skipped.
229
230 We use the `--speedtest` option to benchmark time performance of
231 the splitting algorithms themselves, as in the [Petti & Eddy,
232 2022] paper. This option skips some computationally expensive
233 characterization of the input MSAs (the average pid and average
234 connectivity calculations reported in the .tbl output), and when
235 `--onlysplit` is on, `--speedtest` also skips writing these big
236 alignment outputs and only writes the .tbl output file.
237
238 - **Otherwise, write the training set alignment to
239 `<benchmark_prefix>.train.msa`, and continue.**
240
241 - **Synthesize full-length positive test sequences.**
242
243 The test set T is now considered to be a set of individual test
244 domains. We construct positive test sequences by embedding these
245 domains in nonhomologous sequence constructed from sequences in
246 the `<FASTA sequence database>` as follows:
247
248 1. Choose two test domains (by default; `--single` option makes it one)
249
250 2. Sample a sequence length from a lognormal distribution fitted
251 to UniProt sequence lengths, sufficiently long to contain the
252 test domains.
253
254 The default lognormal parameters ($\mu = 5.6$, $\sigma = 0.75$) were fitted to 195.7M sequence lengths in UniProt
255 (October 2020 release). This skewed and long-tailed
256 distribution has a mean of 360, median 270, mode 150, and
257 standard deviation of 300. They can be changed with
258 the `--smu <x>` and `--ssigma <x>` options.
259
260 3. Embed the domain(s) at random positions in that sequence length.
261
262 4. Construct the flanking regions of the test sequence with
263 nonhomologous sequence segments. There are several ways to
264 construct "nonhomologous" sequence segments, all of which
265 (except `--iid`) start with selecting a random subsequence of
266 appropriate length from the `FASTA sequence database`:
267
268 - shuffle the selected subsequence. (default; `--mono`)
269 - shuffle preserving diresidue composition. (`--di`)
270 - synthesize with same monoresidue comp (`--markov0`)
271 - synthesize with same diresidue comp (`--markov1`)
272 - reverse C-to-N direction (`--reverse`)
273 - synthesize iid sequence (`--iid`)
274
275 The random subsequence of length W is selected by first
276 sampling a random sequence from the `FASTA sequence
277 database` of length L, and then sampling a random
278 subsequence from it of length W. If W>L, then the sequence
279 is concatenated c times to length cL >= W first.
280
281 5. The embedded-domain positive test sequences are written in FASTA format
282 to the `<benchmark_prefix>.test.fa` file. Details of how they were
283 constructed (where all the sequence segments came from) are
284 written to the `<benchmark_prefix>.pos` file.
285
286 * **Synthesize N negative test sequences.**
287
288 Default is to synthesize 200000 (200K) of them,
289 controlled by the `-N <n>` option.
290
291 The procedure for synthesizing negatives is essentially the same
292 as for positives, except the embedded domain(s) are nonhomologous
293 too:
294
295 1. Sample lengths D1 and D2 (or just D1, with `--single`) from
296 a lognormal distribution.
297
298 The default parameters of the lognormal are $\mu = 4.8$,
299 $\sigma = 0.69$. They were fitted to the lengths of 1.2M
300 domain sequences in 19632 Pfam 35.0 seed alignments. The
301 distribution has a mean of 150, median 120, and mode 75.
302
303 2. Sample a sequence length from a lognormal distribution
304 for UniProt sequence lengths, as above, sufficient to
305 contain D1+D2.
306
307 3. Embed the D1 and D2 nonhomologous segments at random
308 positions in that overall length. This defines three
309 flanking nonhomologous segments of lengths L1, L2, L3.
310
311 4. Synthesize the five nonhomologous sequences as above.
312
313 The test sequences are appended in FASTA format to the
314 `<benchmark_prefix>.test.fa` file. Details of how they were constructed
315 (where all the sequence segments came from) are written to the
316 `<benchmark_prefix>.neg` file.
317
318
319 ## 2. Format of the output files (.train.msa, .test.fa, .tbl, .pos, .neg)
320
321 The `<basepfx>.train.msa` file is a Stockholm file containing all the query
322 alignments in the training set. The name of each alignment is
323 unchanged from the original.
324
325 The `<basepfx>.test.fa` file is a FASTA file containing the positive and
326 negative test sequences in the test set.
327
328
329 (With the `--onlysplit` option, the training set is in `<basepfx>.train.msa` and the test set
330 is in `<basepfx>.test.msa`, both as Stockholm files.)
331
332
333
334 ### Format of .tbl output file
335
336 The .tbl file is used by pmark-master.pl as a list of MSA queries in
337 the benchmark. Each line has 11 whitespace-delimited fields:
338
339 ```
340 <msa_name> <nseq> <alen> <nfrag> <avg_pid> <avg_conn> <ntries> <success> <nS> <nT> <npos>
341 ```
342
343 For example:
344
345 ```
346 1-cysPrx_C 40 55 0 29% 55% 1 ok 11 7 3
347 120_Rick_ant 2 240 0 78% 100% 0 FAIL 0 0 0
348 12TM_1 7 504 0 18% 10% 1 ok 5 2 1
349 14-3-3 149 301 0 45% 92% 1 FAIL 0 0 0
350 17kDa_Anti_2 6 122 0 34% 60% 1 FAIL 0 0 0
351 2-Hacid_dh 78 363 0 20% 16% 1 ok 53 17 8
352 ```
353
354 In more detail, these 11 fields are:
355
356 | field | description |
357 |---------------------|-------------------------------------|
358 | `msa_name` | name of the MSA, in the Stockholm msafile |
359 | `nseq` | number of sequences in the original MSA |
360 | `alen` | number of aligned columns in the original MSA |
361 | `nfrag` | number of fragments removed from MSA |
362 | `avg_pid` | average pairwise identity in msa (after fragments removed) |
363 | `avg_conn` | average pairwise connectivity (at $> t_1$ threshold) |
364 | `ntries` | number of split attempts. Can be 0, if there aren't enough seqs to satisfy min_train and min_test minima |
365 | `success` | "ok" or "FAIL"; whether the split succeeded. Success requires no pairwise link between S,T, and satisfying minimum sizes of S,T |
366 | `nS` | number of seqs in training set S, if split succeeded; else 0 |
367 | `nT` | number of seqs in test set T, if split succeeded; else 0 |
368 | `npos` | number of synthetic positive seqs created from test domains |
369
370
371 The "ok" vs. "FAIL" flag has a subtly different meaning in default
372 vs. `--onlysplit` modes. With `--onlysplit`, "ok" means that the split
373 succeeded. Without `--onlysplit`, "ok" means that the split succeeded
374 and we successfully generated positive test sequences for this family
375 (and the query training MSA, of course). If you want to filter the
376 .tbl file for MSAs that are usable in a benchmark, rather than just
377 seeing the status of all MSAs we _tried_ to use, you can filter on
378 field 8 being "ok". That's what the pmark_master.py script does.
379
380
381 ### Format of .pos output file
382
383 The .pos file is a log of where all the segments in the positive test
384 sequences came from. Each line has 22 whitespace-delimited fields (16,
385 with `--single`):
386
387 ```
388 <seqname> <length> <L1> <D1> <L2> <D2> <L3> [<source> <len> <from> <to> <concat?>]...
389 ```
390
391 These fields are:
392
393 | field | description |
394 |-------------------|--------------|
395 | `seqname` | name of the test sequence (see below). `<msaname>/<seqi>/<d1i>-<d1j>/<d2i>-<d2j>`; for example `4HB_MCP_1/109/10-194/211-390`. |
396 | `length` | length of test sequence in residues |
397 | `L1` | length of first nonhomologous segment |
398 | `D1` | length of first homologous test domain |
399 | `L2` | length of 2nd nonhomologous segment |
400 | `D2` | length of second homologous test domain (or 0, with `--single`) |
401 | `L3` | length of 3rd nonhomologous segment (or 0) |
402 | `source` | name of source sequence for each segment; in the FASTA seq database for nonhomologous segments, and in the original MSA for homologous |
403 | `len` | length of source sequence |
404 | `from` | start coord in the source (1-based) |
405 | `to` | end coordinate in the source |
406 | `concat?` | "." or "c", indicates whether source had to be concatenated to make sufficient length |
407
408 A source/len/from/to/concat quintet is repeated for each segment in
409 the synthetic sequence; 5 segments for the default of two embedded
410 homologous domains, 3 segments with `--single`.
411
412 The sequence length is equal to L1+D1+L2+D2+L3.
413
414 Positive synthetic sequences have names formatted as
415 `<msaname>/<seqi>/<d1i>-<d1j>/<d2i>-<d2j>`, for example
416 `4HB_MCP_1/109/10-194/211-390`. The `<seqi>` counts from 1 to the
417 total number of positive seqs. The first homologous domain is embedded
418 at positions `<d1i>-<d1j>` in the synthetic sequence (counting from
419 1), and the second domain is at `<d2i>-<d2j>`. (With `--single` only a
420 single domain is embedded, so the name is just
421 `<msaname>/<seqi>/<d1i>-<d1j`.) Thus names are guaranteed to be unique
422 (because of the `<seqi>`, and a benchmark script can tell just from
423 the name of the positive sequence what query is supposed to recognize
424 this sequence, and where.
425
426 The `concat?` flag (`.` for no, `c` for concatenation) is for a
427 frequent edge case, where the length W of a nonhomologous segment is
428 longer than the length of the source sequence that was sampled for making it. In
429 this case, the source is concatenated to length c*len >= W before
430 taking and randomizing a random segment of the desired length W. When
431 concatenation is used, the `from` coord might be greater than the `to`
432 coord, and `len` is not simply equal to `to-from+1`. The sampled
433 segment is `from..len` + zero or more copies of `1..len` + `1..to`.
434
435 For the homologous segments, we currently only embed full-length
436 domains. Thus `from` is always 1 and `to` is always `rlen`. In the
437 future we might embed fragments for testing local alignment detection.
438 A `concat` field is present but only for symmetry with the
439 nonhomologous domains; it is always `.` and I can't imagine a case
440 where we'd concatenate homologous segments.
441
442
443 ### Format of the .neg output file
444
445 The .neg file is a log of where all the segments in the negative test
446 sequences came from. It has essentially the same format as the .pos
447 file, except that negative sequences are all named `decoy<i>`
448 (example: `decoy2012`), where `<i>` counts from 1 to the total number
449 of negatives. Thus it is easy to separate positives from negatives in
450 a list of hits, by grepping for/against `^decoy`. Our benchmark
451 scripts rely on this naming convention to identify negative test
452 sequences.
453
454
455 ## 3. Finding summary statistics of a benchmark dataset
456
457 | statistic | command |
458 |-------------------------|---------------------------|
459 | Number of query alignments: | `wc -l <benchmark_prefix>.tbl` |
460 | Number of positives: | `wc -l <benchmark_prefix>.pos` |
461 | Number of negatives: | `wc -l <benchmark_prefix>.neg` |
462 | Test sequence length dist: | `esl-seqstat <benchmark_prefix>.test.fa` |
463 | # of training seqs: | `avg -f6 <benchmark_prefix>.tbl` |
464 | # of test seqs: | `avg -f8 <benchmark_prefix>.tbl` |
465
466
467 ================================================================
468 = 5. pmark-master.pl: running a pmark benchmark, in parallel using SGE qsub
469 ================================================================
470
471 Usage: ./pmark-master.pl <top_builddir> <top_srcdir> <resultdir> <nproc> <benchmark_prefix> <benchmark script>
472 Example: ./pmark-master.pl ~/releases/hmmer-release/build-icc ~/releases/hmmer-release h3-results 100 pmark ./x-hmmsearch
473
474 pmark-master.pl is a wrapper that coarse-grain parallelizes a
475 benchmark run for our SGE queue.
476
477 This would typically be run in a notebook directory, which would have
478 symlinks to the pmark-master.pl script and the driver x-* scripts, and
479 also would have the <benchmark_prefix>.{tbl,msa,fa,pos,neg} files
480 either present or symlinked.
481
482 For each benchmark you run that day, you'd have a different
483 <resultdir>; for example, you might run a "h3" and "h2"
484 benchmark. The <resultdir> name should be short because it is used to
485 construct other names, including the SGE job name.
486
487 The pmark-master.pl creates the <resultdir>, splits the
488 <benchmark_prefix>.tbl file into <nproc> separate tbl files called
489 <resultdir>/tbl.<i>, and issues "qsub" commands to run the <benchmark
490 script> on each of these subtables.
491
492 The jobs in SGE are named <resultdir>.<i>.
493
494 The <benchmark script> is passed 7 arguments:
495 <top_builddir> <top_srcdir> <resultdir> <subtbl> <benchmark_prefix.train.msa> <benchmark_prefix.test.fa> <outfile>
496 where <subtbl> is <resultdir>/tbl.<i> (the list of queries this
497 parallelized instance of the benchmark driver is supposed to process),
498 and <outfile> is a file named <resultdir>/tbl<i>.out.
499
500 When all the driver script instances are done, there will be <nproc>
501 output files named <resultdir>/tbl<i>.out. These files can be analysed
502 and turned into ROC graphs using rocplot and/or rocplot.pl.
503
504 ================================================================
505 = 6. x-<benchmark>: benchmark driver scripts
506 ================================================================
507
508 A driver script gets the 7 arguments as described above:
509
510 <top_builddir> : path to top-level build directory of the
511 program(s) to be tested, where executables
512 can be found. When testing non-HMMER
513 programs, this is the installation directory
514 where those executables are found.
515
516 <top_srcdir> : path to top-level src directory of the HMMER
517 program(s) to be tested, where data and
518 scripts may be found. When testing non-HMMER
519 programs, this is nonetheless still a HMMER
520 top-level src directory, where parser scripts
521 and data may be found. (For example, BLAST
522 output parsers: our demotic perl modules.)
523
524 <resultdir> : name of the directory that temp files can
525 be placed in, unique to the instantiation
526 of pmark-master.pl that called us, so long
527 as we use names that don't clash with the
528 other <nproc>-1 instances of driver scripts;
529 for example, we can safely create tmp files
530 that start with <queryname>.
531
532 <subtbl> : name of the tbl.<i> file in <resultsdir> that
533 lists the query alignments this instantiation
534 of the driver is supposed to work on.
535
536 <benchmark_prefix.train.msa> : the benchmark's MSA file; query alignments named
537 in <subtbl> will be esl-alifetch'ed from here.
538
539 <benchmark_prefix.test.fa> : the benchmark's positive and negative sequences;
540 this will be used as the target database for
541 searches the driver runs.
542
543 As a special case (i.e. hack), iterative
544 search benchmarks may look for related
545 files, such as <benchmark_prefix.test.fa.iter>, a
546 sequence database to iterate on first before
547 running on <benchmark_prefix.test.fa>.
548
549 <outfile> : a whitespace-delimited tabular output file,
550 one line per target sequence, described below.
551
552 Using <top_builddir> and <top_srcdir> allows us to easily construct
553 regression tests of different HMMER versions and/or configurations.
554
555 Why the BEGIN {} clause: you'll see a BEGIN {} clause wrapping cmdline
556 argument parsing on many of the x- scripts. That's a trick that goes
557 with "use lib ${top_srcdir}/easel/demotic", where we need the demotic
558 library included, but we don't know where it is until we get
559 ${top_srcdir} from the cmdline, so we defer the 'use lib'.
560
561 Error handling: why don't these scripts call die() on errors? That's
562 deliberate. If a step fails, the script prints an error message and
563 skips to the next query, without cleaning up any tmp files from the
564 failed query. Thus we continue collecting data from as much of the
565 .tbl file of queries as possible, while saving tmp files that we'll
566 need for debugging later. If you have the x- script fail w/ a fatal
567 error, it will stop in the middle of a tbl file, which unnecessarily
568 compromises the completeness of a benchmark (say, if one piddly query
569 out of 10000 fails, there's no reason to bring down the whole
570 benchmark).
571
572
573 ================================================================
574 = 7. format of benchmark results output files
575 ================================================================
576
577 The <nproc> output in files <resultdir>/tbl<i>.out have four fields:
578 <E-value> <bit score> <target> <query>
579 for example:
580 6e-41 144.1 UCH/6548/39-342/368-893 UCH
581 1.5e-34 123.1 UCH/6546/168-490/816-1424 UCH
582 0.17 14.4 zf-UBP/6823/3-74/209-283 UCH
583 1.4 11.4 decoy31607 UCH
584
585 These can be concatenated and sorted by E-value:
586 cat *.out | sort -g
587
588 Analysis scripts can easily tell the difference between a true,
589 false, and "ignored" comparison:
590
591 - if the target is named "decoy", it's a negative (nonhomologous)
592 comparison.
593
594 - if the name of the query matches the first part of the name of the
595 target, it's a true (homologous) comparison.
596
597 - if the name of the query doesn't match the first part of the
598 target name, we will ignore the comparison. This is a match
599 between a positive sequence and a query that doesn't correspond to
600 the positive test domains; it might be a false hit, but it also
601 might be that the two alignments (the query and the one that
602 generated the test sequence) are homologous.
603
604 Thus it's easy to keep track (even during a run) of the top-scoring
605 false positive:
606 cat *.out | sort -g | grep decoy | head
607
608 and using the rocplot.pl script, it's easy to see get a glimpse of
609 how the ROC plot is turning out:
610
611 cat *.out | sort -g | ../rocplot.pl | head
612
613
614 ================================================================
615 = 8. rocplot: displaying results as ROC graphs
616 ================================================================
617
618 rocplot is compiled from ANSI C source rocplot.c; see Makefile.in for build.
619
620 Usage: ./rocplot <benchmark_prefix> <sorted .out data>
621 Example: cat *.out | sort -g | ../rocplot pmark - > results.xy
622
623 The output is an XMGRACE xydydy file, plotting fractional coverage of
624 the positives (on the Y-axis; range 0..1) versus errors per query (on
625 the X-axis; ranging from 1/(# of models) to 10.0 by default; see --min
626 and --max options). For each point, a 95% confidence interval is
627 denoted by the dydy points, as determined by "Bayesian" bootstrap
628 resampling of the query alignments.
629
630 Output from rocplot over a set of different benchmarks are usually
631 concatenated into one XMGRACE input .dat file, and worked up into
632 a display following a procedure akin to:
633
634
635 cat bench1/*.out | sort -g | ./rocplot pmark - > bench1.dat
636 cat bench2/*.out | sort -g | ./rocplot pmark - > bench2.dat
637
638 cat bench1.dat > todays.dat
639 cat bench2.dat >> todays.dat
640
641 \cp todays.dat todays.agr
642 xmgrace -settype xydydy -param ~/src/hmmer/profmark/pmark.param todays.agr
643
644 then manually making the lines pretty colors as in
645 All: symbols circle 56 opaque white fill no riser
646 set 0 bench1 orange
647 set 1 bench2 black
648
649 and saving (as .agr) and exporting (as .eps):
650 Figure: todays.{dat,agr,eps}
651
652