-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathstubb.patch
503 lines (455 loc) · 19.6 KB
/
stubb.patch
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
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
diff -ruw stubb_2.1/Makefile stubb_for_REforge/Makefile
--- stubb_2.1/Makefile 2003-11-18 17:18:51.000000000 +0100
+++ stubb_for_REforge/Makefile 2018-03-07 17:38:56.814312917 +0100
@@ -1,10 +1,10 @@
-all: ss ms
+all: ss #ms
ss: Makefile.ss
make -f Makefile.ss
-ms: Makefile.ms
- make -f Makefile.ms
+#ms: Makefile.ms
+# make -f Makefile.ms
clean:
rm -f *~ *.o core
diff -ruw stubb_2.1/Makefile.ms stubb_for_REforge/Makefile.ms
--- stubb_2.1/Makefile.ms 2003-11-18 17:18:51.000000000 +0100
+++ stubb_for_REforge/Makefile.ms 2018-03-07 16:45:11.115205169 +0100
@@ -1,7 +1,7 @@
COMPILER = g++
BIN = bin/
LIBS = -lm
-CCFLAGS = -O3 -D_MARKOV -DMARKOV_ORDER=2 -DCONTEXT_SIZE=5 -D_OPTIMIZE_MOTIFORIENTATION -D_OPTIMIZE_PROTECTED_ACCESS -D_OPTIMIZE_CAREFULCSP -D_OPTIMIZE_WMINDEX -D_MULTIPLE_SEQUENCES -D_MEMORY_HACK #-D_WTMX_BIAS
+CCFLAGS = -O3 -D_MARKOV -DMARKOV_ORDER=2 -DCONTEXT_SIZE=5 -D_OPTIMIZE_MOTIFORIENTATION -D_OPTIMIZE_PROTECTED_ACCESS -D_OPTIMIZE_CAREFULCSP -D_OPTIMIZE_WMINDEX -D_MULTIPLE_SEQUENCES -D_MEMORY_HACK -fpermissive #-D_WTMX_BIAS
STUBBMSCCFLAGS = -D_OPTIMIZE_CACHESEQUENCEPROBABILITIES -D_FIXED_WIDTH #-D_PRUNE_MOTIFS
all: clean stubbms stubbms_modifyalignments
diff -ruw stubb_2.1/Makefile.ss stubb_for_REforge/Makefile.ss
--- stubb_2.1/Makefile.ss 2003-11-18 17:18:51.000000000 +0100
+++ stubb_for_REforge/Makefile.ss 2018-03-07 17:37:51.377700197 +0100
@@ -3,26 +3,26 @@
BIN = bin/
LIBS = -L${NEWMATDIR} -lm -lnewmat
GSLINC = -I${NEWMATDIR}
-CCFLAGS = -O3 -D_MARKOV -DMARKOV_ORDER=2 -DCONTEXT_SIZE=5 -D_OPTIMIZE_MOTIFORIENTATION -D_OPTIMIZE_PROTECTED_ACCESS -D_OPTIMIZE_CAREFULCSP -D_OPTIMIZE_WMINDEX -D_EXIST_SMALL_SEQUENCES -D_CYCLIC_WINDOWS #-D_WTMX_BIAS
+CCFLAGS = -O3 -D_MARKOV -DMARKOV_ORDER=0 -DCONTEXT_SIZE=5 -D_OPTIMIZE_MOTIFORIENTATION -D_OPTIMIZE_PROTECTED_ACCESS -D_OPTIMIZE_CAREFULCSP -D_OPTIMIZE_WMINDEX -D_EXIST_SMALL_SEQUENCES -D_CYCLIC_WINDOWS -fpermissive # -D_WTMX_BIAS
STUBBCCFLAGS = -D_OPTIMIZE_CACHESEQUENCEPROBABILITIES #-D_PRUNE_MOTIFS
STUBBH01CCFLAGS = -D_OPTIMIZE_CACHESEQUENCEPROBABILITIES
-all: clean stubb stubbh01 stubbh01f stubb_fitprobs stubb_fixedprobs
+all: clean stubb stubb_fitprobs stubb_fixedprobs # stubbh01 stubbh01f
stubb: Makefile ${NEWMATDIR}/libnewmat.a stubb.cpp util.o parameters.o parameters_h0.o parameters_h1.o parameters_h01.o sequence.o windowiterator.o wtmx.o fastafile.o
- ${COMPILER} ${CCFLAGS} ${STUBBCCFLAGS} -o ${BIN}/stubb stubb.cpp util.o parameters.o parameters_h0.o parameters_h1.o parameters_h01.o sequence.o windowiterator.o wtmx.o fastafile.o ${LIBS}
+ ${COMPILER} ${CCFLAGS} ${STUBBCCFLAGS} -o ${BIN}/stubb_noPseudoCount stubb.cpp util.o parameters.o parameters_h0.o parameters_h1.o parameters_h01.o sequence.o windowiterator.o wtmx.o fastafile.o ${LIBS}
-stubbh01: Makefile stubbh01.cpp util.o parameters.o parameters_h0.o parameters_h1.o parameters_h01.o sequence.o windowiterator.o wtmx.o fastafile.o
- ${COMPILER} ${CCFLAGS} ${STUBBH01CCFLAGS} -o ${BIN}/stubbh01 stubbh01.cpp util.o parameters.o parameters_h0.o parameters_h1.o parameters_h01.o sequence.o windowiterator.o wtmx.o fastafile.o ${LIBS}
+# stubbh01: Makefile stubbh01.cpp util.o parameters.o parameters_h0.o parameters_h1.o parameters_h01.o sequence.o windowiterator.o wtmx.o fastafile.o
+# ${COMPILER} ${CCFLAGS} ${STUBBH01CCFLAGS} -o ${BIN}/stubbh01 stubbh01.cpp util.o parameters.o parameters_h0.o parameters_h1.o parameters_h01.o sequence.o windowiterator.o wtmx.o fastafile.o ${LIBS}
-stubbh01f: Makefile stubbh01f.cpp util.o parameters.o parameters_h0.o parameters_h1.o parameters_h01.o sequence.o windowiterator.o wtmx.o fastafile.o
- ${COMPILER} ${CCFLAGS} ${STUBBH01CCFLAGS} -o ${BIN}/stubbh01f stubbh01f.cpp util.o parameters.o parameters_h0.o parameters_h1.o parameters_h01.o sequence.o windowiterator.o wtmx.o fastafile.o ${LIBS}
+#stubbh01f: Makefile stubbh01f.cpp util.o parameters.o parameters_h0.o parameters_h1.o parameters_h01.o sequence.o windowiterator.o wtmx.o fastafile.o
+# ${COMPILER} ${CCFLAGS} ${STUBBH01CCFLAGS} -o ${BIN}/stubbh01f stubbh01f.cpp util.o parameters.o parameters_h0.o parameters_h1.o parameters_h01.o sequence.o windowiterator.o wtmx.o fastafile.o ${LIBS}
stubb_fitprobs: Makefile ${NEWMATDIR}/libnewmat.a stubb_fitprobs.cpp util.o parameters.o parameters_h0.o parameters_h1.o parameters_h01.o sequence.o windowiterator.o wtmx.o fastafile.o
- ${COMPILER} ${CCFLAGS} ${STUBBCCFLAGS} -o ${BIN}/stubb_fitprobs stubb_fitprobs.cpp util.o parameters.o parameters_h0.o parameters_h1.o parameters_h01.o sequence.o windowiterator.o wtmx.o fastafile.o ${LIBS}
+ ${COMPILER} ${CCFLAGS} ${STUBBCCFLAGS} -o ${BIN}/stubb_fitprobs_noPseudoCount stubb_fitprobs.cpp util.o parameters.o parameters_h0.o parameters_h1.o parameters_h01.o sequence.o windowiterator.o wtmx.o fastafile.o ${LIBS}
stubb_fixedprobs: Makefile ${NEWMATDIR}/libnewmat.a stubb_fixedprobs.cpp util.o parameters.o parameters_h0.o parameters_h1.o parameters_h01.o sequence.o windowiterator.o wtmx.o fastafile.o
- ${COMPILER} ${CCFLAGS} ${STUBBCCFLAGS} -o ${BIN}/stubb_fixedprobs stubb_fixedprobs.cpp util.o parameters.o parameters_h0.o parameters_h1.o parameters_h01.o sequence.o windowiterator.o wtmx.o fastafile.o ${LIBS}
+ ${COMPILER} ${CCFLAGS} ${STUBBCCFLAGS} -o ${BIN}/stubb_fixedprobs_noPseudoCount stubb_fixedprobs.cpp util.o parameters.o parameters_h0.o parameters_h1.o parameters_h01.o sequence.o windowiterator.o wtmx.o fastafile.o ${LIBS}
util.o: Makefile util.cpp util.h parameters.h typedefs.h parameters.o
${COMPILER} ${CCFLAGS} -c util.cpp
diff -ruw stubb_2.1/parameters.h stubb_for_REforge/parameters.h
--- stubb_2.1/parameters.h 2003-11-18 17:18:51.000000000 +0100
+++ stubb_for_REforge/parameters.h 2018-03-07 16:45:11.129204871 +0100
@@ -42,7 +42,7 @@
#define BKG_FORWARD_ONLY 1
#define DEFAULT_BOTH_ORIENTATIONS true
-#define ALMOSTONE 0.9
+#define ALMOSTONE 0.99
#define MOTIF_COUNT_THRESHOLD 1.0
#define DEFAULT_MOTIF_OCCURRENCE_THRESHOLD 0.1
#define DEFAULT_FEN_THRESHOLD 10
@@ -69,6 +69,7 @@
bool _is_initialized;
DTYPE _free_energy;
+ DTYPE _free_energy_background;
DTYPE _free_energy_differential;// Fb - F
DTYPE _free_energy_perlength;
int _num_iterations;
@@ -185,7 +186,7 @@
int _max_window_length; // used for an optimization, set in Initialize()
Window *_currentWindow; // as above, used for an optimization
- static const float THRESHOLD = 1e-4; // used to terminate training
+ static const float THRESHOLD = 1e-2; // used to terminate training
static const float RELENT_THRESHOLD = 0.00001; // used to decide upon perturbing parameters
static const int CHECK_ITERATION_THRESHOLD = 20;
static const int MAX_TRAINING_ITERATIONS = 100;
diff -ruw stubb_2.1/parameters_h0.cpp stubb_for_REforge/parameters_h0.cpp
--- stubb_2.1/parameters_h0.cpp 2003-11-18 17:18:51.000000000 +0100
+++ stubb_for_REforge/parameters_h0.cpp 2018-03-07 16:45:10.307222346 +0100
@@ -27,6 +27,7 @@
#include <math.h>
#include <stdexcept>
#include "util.h"
+#include <iostream>
void Parameters_H0::Train(bool differential)
{
@@ -74,6 +75,7 @@
#endif
_free_energy_perlength = _free_energy_differential / float(numTotal);
+ _free_energy_background = freeEnergyBackground;
_is_trained = true;
}
@@ -112,6 +114,7 @@
#endif
_free_energy_perlength = _free_energy_differential / float(numTotal);
+ _free_energy_background = freeEnergyBackground;
_is_trained = true;
}
@@ -607,19 +610,21 @@
char seqname[1024]; (*_windows)[0]->Seq()->Name(seqname);
fprintf(fp,"%.4f\t%.4f\t%d\t%d\t%s\n",_free_energy_differential,_free_energy_perlength,totalLen,_num_iterations,seqname);
#else
- fprintf(fp,"%.4f\t%.4f\t%d\t%d\n",_free_energy_differential,_free_energy_perlength,totalLen,_num_iterations);
+ // fprintf(fp,"%.4f\t%.4f\t%d\t%d\n",_free_energy_differential,_free_energy_perlength,totalLen,_num_iterations);
+ fprintf(fp,"%.4f\t%.4f\tBG:%.4f\tFG:%.4f\t%d\t%d\n",_free_energy_differential,_free_energy_perlength,_free_energy_background,_free_energy,totalLen,_num_iterations);
#endif
return;
}
else {
- for (int wi=0; wi<_windows->size(); wi++)
- (*_windows)[wi]->Print(verbose);
- fprintf(fp,"Score = %.4f\tTotalLen = %d\tIterations = %d\n",_free_energy_differential,totalLen,_num_iterations);
+ // for (int wi=0; wi<_windows->size(); wi++)
+ // (*_windows)[wi]->Print(verbose);
+ // fprintf(fp,"Score = %.4f\tTotalLen = %d\tIterations = %d\n",_free_energy_differential,totalLen,_num_iterations);
+ fprintf(fp,"Score = %.4f\tTotalLen = %d\tIterations = %d\tBG:%.4f\tFG:%.4f\n",_free_energy_differential,totalLen,_num_iterations, _free_energy_background, _free_energy);
int i;
- _bkgwm->Print();
+ // _bkgwm->Print();
fprintf(fp,"Transition probabilities (p_i):\n"); // print the _pi values
for (i=0; i<_numWM; i++) {
fprintf(fp,"%g ",_pi[i]);
diff -ruw stubb_2.1/stubb.cpp stubb_for_REforge/stubb.cpp
--- stubb_2.1/stubb.cpp 2003-11-18 17:18:51.000000000 +0100
+++ stubb_for_REforge/stubb.cpp 2018-03-07 16:45:10.902209697 +0100
@@ -26,6 +26,7 @@
#include <stdio.h>
#include <assert.h>
#include <math.h>
+#include <iostream>
#include "util.h"
#include "sequence.h"
@@ -40,16 +41,31 @@
main(int argc, char **argv)
{
if (argc < 5) {
- printf("usage: %s <sequencefile> <wtmxfile> <windowsize> <shiftsize> [-od <output_dir>] [-b <background file>] [-ft <energy thresold for printing>] [-ot <motif occurrence threshold for printing]\n",argv[0]);
+ printf("usage: %s <sequencefile> <wtmxfile> <windowsize> <shiftsize> [-od <output_dir>] [-b <background file>] [-ft <energy thresold for printing>] [-ot <motif occurrence threshold for printing] [-brief] [-seq]\n",argv[0]);
exit(1);
}
globalid = 0;
global_background = NULL;
+ // Read in the optional arguments
+ int argbase = 5;
+ struct Options *opt = ReadOptionalArguments(argbase, argc, argv);
+
// Read in the sequence(s)
- char *fastafile = argv[1];
+ int numSeqs;
FastaFile sequences;
+ Sequence **seqs;
+ Sequence *_sequences[1];
+ char *fastafile = argv[1];
+ if (opt->seq) {
+ _sequences[0] = new Sequence(argv[1],strlen(argv[1]), "Sequence");
+ seqs = _sequences;
+ numSeqs = 1;
+ } else {
+ char *fastafile = argv[1];
sequences.ReadFasta(fastafile);
+ numSeqs = sequences.Size();
+ }
// Read in the weight matrices
char *wmcfile = argv[2];
@@ -60,10 +76,6 @@
int windowsize = atoi(argv[3]);
int shiftsize = atoi(argv[4]);
- // Read in the optional arguments
- int argbase = 5;
- struct Options *opt = ReadOptionalArguments(argbase, argc, argv);
-
if (opt->bkg_file != NULL) {
Sequence *bkg_seq = new Sequence(opt->bkg_file);
Window *bkg_window = new Window(bkg_seq,0,bkg_seq->Length()-1);
@@ -73,15 +85,31 @@
}
// Prepare for various printing
- FILE *prof = OpenProfile(fastafile, opt->output_dir);
- FILE *dict = OpenDictionary(fastafile, opt->output_dir);
- FILE *ener = OpenOutput (fastafile, opt->output_dir);
+ FILE *prof;
+ FILE *dict;
+ FILE *ener;
+ FILE *prob;
+ if (!opt->brief) {
+ prof = OpenProfile(fastafile, opt->output_dir);
+ dict = OpenDictionary(fastafile, opt->output_dir);
+ ener = OpenOutput (fastafile, opt->output_dir);
+ prob = OpenProbabilities (fastafile, opt->output_dir);
PrintParameters(fastafile,wmcfile,windowsize, shiftsize, opt);
+ }
+
+ for (int seqnum=0; seqnum < numSeqs; seqnum++) {
+ Sequence *seq;
+ if (opt->seq) {
+ seq = seqs[seqnum];
+ } else {
+ seq = sequences[seqnum];
+ }
- for (int seqnum=0; seqnum < sequences.Size(); seqnum++) {
- Sequence *seq = sequences[seqnum];
int seq_len = seq->Length();
- if (seq_len < 200) continue;
+ if (seq_len < 30) {
+ if (opt->brief) fprintf(stdout,"%d\t0\n",seqnum);
+ continue;
+ }
// Declare that the matrices in wmc are not going to be modified, and cache the probabilities
#ifdef _OPTIMIZE_CACHESEQUENCEPROBABILITIES
@@ -89,6 +117,9 @@
#endif
// now start iterating through the windows
+ float maxllr = -1;
+ DTYPE *max_pi = new DTYPE[numWM+1];
+
WindowIterator wi(seq);
bool did_begin = false;
#ifdef _EXIST_SMALL_SEQUENCES
@@ -148,18 +179,36 @@
PruneMotifsAndTrain(totalLen,windowsize,wl,&wmc,param0,&wmc_prune,param0_prune);
// either param0_prune returns null, or param0 is deleted
if (param0_prune) {
+ if (!opt->brief) {
param0_prune->Print(ener);
if (param0_prune->Free_Energy_Differential() > opt->fen_threshold)
param0_prune->PrintProfile(prof,dict,opt->motif_occurrence_threshold);
+ } else {
+ if (param0_prune->Free_Energy_Differential() > maxllr) {
+ maxllr = param0_prune->Free_Energy_Differential();
+ for (int wmindex = 0; wmindex < numWM+1; wmindex++) {
+ max_pi[wmindex] = param0->GetParameter(wmindex);
+ }
+ }
+ }
delete param0_prune;
}
else {
+ if (!opt->brief) {
param0->Print(ener);
+ param0->PrintProbabilities(prob);
if (param0->Free_Energy_Differential() > opt->fen_threshold)
param0->PrintProfile(prof,dict,opt->motif_occurrence_threshold);
+ } else {
+ if (param0->Free_Energy_Differential() > maxllr) {
+ maxllr = param0->Free_Energy_Differential();
+ for (int wmindex = 0; wmindex < numWM+1; wmindex++) {
+ max_pi[wmindex] = param0->GetParameter(wmindex);
+ }
+ }
+ }
delete param0;
}
-
// clean up
for (int windex=0; windex<wl->size(); windex++) {
Window *win = (*wl)[windex];
@@ -168,14 +217,26 @@
delete wl;
}
+ if (opt->brief) {
+ fprintf(stdout,"%d\t%.5f",seqnum,maxllr);
+ for (int wmindex = 0; wmindex < numWM+1; wmindex++) {
+ fprintf(stdout, "\t%f", max_pi[wmindex]);
+ }
+ fprintf(stdout, "\n");
+
+ }
+
#ifdef _OPTIMIZE_CACHESEQUENCEPROBABILITIES
Parameters::DeleteCacheSubsequenceProbabilities(seq);
#endif
}
+ if (!opt->brief) {
fclose(ener);
fclose(dict);
fclose(prof);
+ fclose(prob);
+ }
delete opt;
}
diff -ruw stubb_2.1/stubb_fixedprobs.cpp stubb_for_REforge/stubb_fixedprobs.cpp
--- stubb_2.1/stubb_fixedprobs.cpp 2003-11-18 17:18:51.000000000 +0100
+++ stubb_for_REforge/stubb_fixedprobs.cpp 2018-03-07 16:45:10.301222474 +0100
@@ -27,6 +27,7 @@
#include <assert.h>
#include <math.h>
+
#include "util.h"
#include "sequence.h"
#include "parameters.h"
@@ -40,16 +41,31 @@
main(int argc, char **argv)
{
if (argc < 6) {
- printf("usage: %s <sequencefile> <wtmxfile> <windowsize> <shiftsize> <fitprobs_file> [-od <output_dir>] [-b <background file>] [-ft <energy thresold for printing>] [-ot <motif occurrence threshold for printing]\n",argv[0]);
+ printf("usage: %s <sequencefile> <wtmxfile> <windowsize> <shiftsize> <fitprobs_file> [-od <output_dir>] [-b <background file>] [-ft <energy thresold for printing>] [-ot <motif occurrence threshold for printing] [-brief] [-seq]\n",argv[0]);
exit(1);
}
globalid = 0;
global_background = NULL;
+ // Read in the optional arguments
+ int argbase = 6;
+ struct Options *opt = ReadOptionalArguments(argbase, argc, argv);
+
// Read in the sequence(s)
- char *fastafile = argv[1];
+ int numSeqs;
FastaFile sequences;
+ Sequence **seqs;
+ Sequence *_sequences[1];
+ char *fastafile = argv[1];
+ if (opt->seq) {
+ _sequences[0] = new Sequence(argv[1],strlen(argv[1]), "Sequence");
+ seqs = _sequences;
+ numSeqs = 1;
+ } else {
+ char *fastafile = argv[1];
sequences.ReadFasta(fastafile);
+ numSeqs = sequences.Size();
+ }
// Read in the weight matrices
char *wmcfile = argv[2];
@@ -68,9 +84,6 @@
exit(1);
}
}
- // Read in the optional arguments
- int argbase = 6;
- struct Options *opt = ReadOptionalArguments(argbase, argc, argv);
if (opt->bkg_file != NULL) {
Sequence *bkg_seq = new Sequence(opt->bkg_file);
@@ -81,15 +94,29 @@
}
// Prepare for various printing
- FILE *prof = OpenProfile(fastafile, opt->output_dir);
- FILE *dict = OpenDictionary(fastafile, opt->output_dir);
- FILE *ener = OpenOutput (fastafile, opt->output_dir);
+ FILE *prof;
+ FILE *dict;
+ FILE *ener;
+ if (!opt->brief) {
+ prof = OpenProfile(fastafile, opt->output_dir);
+ dict = OpenDictionary(fastafile, opt->output_dir);
+ ener = OpenOutput (fastafile, opt->output_dir);
PrintParameters(fastafile,wmcfile,windowsize, shiftsize, opt);
+ }
+
+ for (int seqnum=0; seqnum < numSeqs; seqnum++) {
+ Sequence *seq;
+ if (opt->seq) {
+ seq = seqs[seqnum];
+ } else {
+ seq = sequences[seqnum];
+ }
- for (int seqnum=0; seqnum < sequences.Size(); seqnum++) {
- Sequence *seq = sequences[seqnum];
int seq_len = seq->Length();
- if (seq_len < 200) continue;
+ if (seq_len < 30) {
+ if (opt->brief) fprintf(stdout,"%d\t0\n",seqnum);
+ continue;
+ }
// Declare that the matrices in wmc are not going to be modified, and cache the probabilities
#ifdef _OPTIMIZE_CACHESEQUENCEPROBABILITIES
@@ -97,6 +124,7 @@
#endif
// now start iterating through the windows
+ float maxllr = -1;
WindowIterator wi(seq);
bool did_begin = false;
#ifdef _EXIST_SMALL_SEQUENCES
@@ -149,10 +177,15 @@
param0->Initialize(wl,&wmc,bkgIndex);
param0->SetParameters(fitprobs);
param0->TrainWithFixedParameters();
-
- param0->Print(ener);
+ if (!opt->brief) {
+ param0->Print(ener, false);
if (param0->Free_Energy_Differential() > opt->fen_threshold)
param0->PrintProfile(prof,dict,opt->motif_occurrence_threshold);
+ } else {
+ if (param0->Free_Energy_Differential() > maxllr) {
+ maxllr = param0->Free_Energy_Differential();
+ }
+ }
delete param0;
// clean up
@@ -163,14 +196,20 @@
delete wl;
}
+ if (opt->brief) {
+ fprintf(stdout,"%d\t%.5f\n",seqnum,maxllr);
+ }
+
#ifdef _OPTIMIZE_CACHESEQUENCEPROBABILITIES
Parameters::DeleteCacheSubsequenceProbabilities(seq);
#endif
}
+ if (!opt->brief) {
fclose(ener);
fclose(dict);
fclose(prof);
+ }
delete opt;
}
diff -ruw stubb_2.1/util.cpp stubb_for_REforge/util.cpp
--- stubb_2.1/util.cpp 2003-11-18 17:18:51.000000000 +0100
+++ stubb_for_REforge/util.cpp 2018-03-07 16:45:10.316222155 +0100
@@ -282,6 +282,17 @@
argbase++;
continue;
}
+ if (!strcmp(argv[argbase],"-brief")) {
+ opt->brief = true;
+ argbase++;
+ continue;
+ }
+ if (!strcmp(argv[argbase],"-seq")) {
+ opt->seq = true;
+ opt->brief = true;
+ argbase++;
+ continue;
+ }
if (strstr(argv[argbase],"-b")) {
argbase++;
if (argbase >= argc) {
diff -ruw stubb_2.1/util.h stubb_for_REforge/util.h
--- stubb_2.1/util.h 2003-11-18 17:18:51.000000000 +0100
+++ stubb_for_REforge/util.h 2018-03-07 16:45:10.898209782 +0100
@@ -40,6 +40,8 @@
int *corr_list; int corr_list_size;
float fen_threshold;
float motif_occurrence_threshold;
+ bool brief;
+ bool seq;
Options() { output_dir = NULL; bkg_file = NULL; phylogeny_file = NULL; anchors_file = NULL; corr_file = NULL; fen_threshold = DEFAULT_FEN_THRESHOLD; motif_occurrence_threshold = DEFAULT_MOTIF_OCCURRENCE_THRESHOLD; corr_list = NULL; corr_list_size = 0; }
~Options() { if (corr_list != NULL) delete [] corr_list; }
diff -ruw stubb_2.1/wtmx.h stubb_for_REforge/wtmx.h
--- stubb_2.1/wtmx.h 2003-11-18 17:18:51.000000000 +0100
+++ stubb_for_REforge/wtmx.h 2018-03-07 16:45:10.904209654 +0100
@@ -31,7 +31,7 @@
#include <stdlib.h>
#include <string.h>
-#define PSEUDO_COUNT 0.5
+#define PSEUDO_COUNT 0.0
extern int globalid;
// The Weight matrix class