| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
#include <esl_config.h> |
| 8 |
#include <p7_config.h> |
| 9 |
#include "config.h" |
| 10 |
|
| 11 |
#include <stdio.h> |
| 12 |
#include <stdlib.h> |
| 13 |
#include <string.h> |
| 14 |
|
| 15 |
#include "easel.h" |
| 16 |
#include "esl_alphabet.h" |
| 17 |
#include "esl_dmatrix.h" |
| 18 |
#include "esl_getopts.h" |
| 19 |
#include "esl_scorematrix.h" |
| 20 |
#include "esl_sq.h" |
| 21 |
#include "esl_sqio.h" |
| 22 |
#include "esl_ssi.h" |
| 23 |
#include "esl_stopwatch.h" |
| 24 |
#include "esl_vectorops.h" |
| 25 |
|
| 26 |
#ifdef HAVE_MPI |
| 27 |
#include "mpi.h" |
| 28 |
#include "esl_mpi.h" |
| 29 |
#endif |
| 30 |
|
| 31 |
#ifdef HMMER_THREADS |
| 32 |
#include <unistd.h> |
| 33 |
#include "esl_threads.h" |
| 34 |
#include "esl_workqueue.h" |
| 35 |
#endif |
| 36 |
|
| 37 |
#include "hmmer.h" |
| 38 |
|
| 39 |
#include "infernal.h" |
| 40 |
|
| 41 |
typedef struct { |
| 42 |
#ifdef HMMER_THREADS |
| 43 |
ESL_WORK_QUEUE *queue; |
| 44 |
#endif |
| 45 |
CM_PIPELINE *pli; |
| 46 |
CM_TOPHITS *th; |
| 47 |
CM_t *cm; |
| 48 |
P7_BG *bg; |
| 49 |
P7_OPROFILE *om; |
| 50 |
P7_PROFILE *gm; |
| 51 |
P7_PROFILE *Rgm; |
| 52 |
P7_PROFILE *Lgm; |
| 53 |
P7_PROFILE *Tgm; |
| 54 |
P7_SCOREDATA *msvdata; |
| 55 |
float *p7_evparam; |
| 56 |
float smxsize; |
| 57 |
} WORKER_INFO; |
| 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 |
#if defined (HMMER_THREADS) && defined (HAVE_MPI) |
| 94 |
#define CPUOPTS "--mpi" |
| 95 |
#define MPIOPTS "--cpu" |
| 96 |
#else |
| 97 |
#define CPUOPTS NULL |
| 98 |
#define MPIOPTS NULL |
| 99 |
#endif |
| 100 |
|
| 101 |
static ESL_OPTIONS options[] = { |
| 102 |
|
| 103 |
{ "-h", eslARG_NONE, FALSE, NULL, NULL, NULL, NULL, NULL, "show brief help on version and usage", 1 }, |
| 104 |
{ "-g", eslARG_NONE, FALSE, NULL, NULL, NULL, NULL, "--hmmonly", "configure CM for glocal alignment [default: local]", 1 }, |
| 105 |
{ "-Z", eslARG_REAL, FALSE, NULL, "x>0", NULL, NULL, NULL, "set search space size in *Mb* to <x> for E-value calculations", 1 }, |
| 106 |
{ "--devhelp", eslARG_NONE, NULL, NULL, NULL, NULL, NULL, NULL, "show list of otherwise hidden developer/expert options", 1 }, |
| 107 |
|
| 108 |
|
| 109 |
{ "-o", eslARG_OUTFILE, NULL, NULL, NULL, NULL, NULL, NULL, "direct output to file <f>, not stdout", 2 }, |
| 110 |
{ "-A", eslARG_OUTFILE, NULL, NULL, NULL, NULL, NULL, NULL, "save multiple alignment of all significant hits to file <s>", 2 }, |
| 111 |
{ "--tblout", eslARG_OUTFILE, NULL, NULL, NULL, NULL, NULL, NULL, "save parseable table of hits to file <s>", 2 }, |
| 112 |
{ "--fmt", eslARG_INT, NULL, NULL, "1<=n<=3",NULL,"--tblout",NULL, "set hit table format to <n>", 2 }, |
| 113 |
{ "--acc", eslARG_NONE, FALSE, NULL, NULL, NULL, NULL, NULL, "prefer accessions over names in output", 2 }, |
| 114 |
{ "--noali", eslARG_NONE, FALSE, NULL, NULL, NULL, NULL, NULL, "don't output alignments, so output is smaller", 2 }, |
| 115 |
{ "--notextw", eslARG_NONE, NULL, NULL, NULL, NULL, NULL, "--textw", "unlimit ASCII text output line width", 2 }, |
| 116 |
{ "--textw", eslARG_INT, "120", NULL, "n>=120",NULL, NULL, "--notextw", "set max width of ASCII text output lines", 2 }, |
| 117 |
{ "--verbose", eslARG_NONE, FALSE, NULL, NULL, NULL, NULL, NULL, "report extra information; mainly useful for debugging", 2 }, |
| 118 |
{ "--nomiss", eslARG_NONE, FALSE, NULL, NULL, NULL, "-A", NULL, "with -A, do not mark truncated hits with missing (~) chars", 2 }, |
| 119 |
|
| 120 |
|
| 121 |
{ "-E", eslARG_REAL, "10.0", NULL, "x>0", NULL, NULL, NULL, "report sequences <= this E-value threshold in output", 3 }, |
| 122 |
{ "-T", eslARG_REAL, FALSE, NULL, NULL, NULL, NULL, NULL, "report sequences >= this score threshold in output", 3 }, |
| 123 |
|
| 124 |
|
| 125 |
{ "--incE", eslARG_REAL, "0.01", NULL, "x>0", NULL, NULL, NULL, "consider sequences <= this E-value threshold as significant", 4 }, |
| 126 |
{ "--incT", eslARG_REAL, FALSE, NULL, NULL, NULL, NULL, NULL, "consider sequences >= this score threshold as significant", 4 }, |
| 127 |
|
| 128 |
|
| 129 |
{ "--cut_ga", eslARG_NONE, FALSE, NULL, NULL, NULL, NULL, NULL, "use CM's GA gathering cutoffs as reporting thresholds", 5 }, |
| 130 |
{ "--cut_nc", eslARG_NONE, FALSE, NULL, NULL, NULL, NULL, NULL, "use CM's NC noise cutoffs as reporting thresholds", 5 }, |
| 131 |
{ "--cut_tc", eslARG_NONE, FALSE, NULL, NULL, NULL, NULL, NULL, "use CM's TC trusted cutoffs as reporting thresholds", 5 }, |
| 132 |
|
| 133 |
|
| 134 |
{ "--max", eslARG_NONE, FALSE, NULL, NULL, NULL, NULL, NULL, "turn all heuristic filters off (slow)", 6 }, |
| 135 |
{ "--nohmm", eslARG_NONE, FALSE, NULL, NULL, NULL, NULL, NULL, "skip all HMM filter stages, use only CM (slow)", 6 }, |
| 136 |
{ "--mid", eslARG_NONE, FALSE, NULL, NULL, NULL, NULL, NULL, "skip first two HMM filter stages (SSV & Vit)", 6 }, |
| 137 |
{ "--default", eslARG_NONE,"default",NULL, NULL, NULL, NULL, NULL, "default: run search space size-dependent pipeline", 6 }, |
| 138 |
{ "--rfam", eslARG_NONE, FALSE, NULL, NULL, NULL, NULL, NULL, "set heuristic filters at Rfam-level (fast)", 6 }, |
| 139 |
{ "--hmmonly", eslARG_NONE, FALSE, NULL, NULL, NULL, NULL, NULL, "use HMM only, don't use a CM at all", 6 }, |
| 140 |
{ "--FZ", eslARG_REAL, NULL, NULL, NULL, NULL, NULL, NULL, "set filters to defaults used for a search space of size <x> Mb", 6 }, |
| 141 |
{ "--Fmid", eslARG_REAL, "0.02", NULL, NULL, NULL,"--mid", NULL, "with --mid, set P-value threshold for HMM stages to <x>", 6 }, |
| 142 |
|
| 143 |
|
| 144 |
{ "--notrunc", eslARG_NONE, FALSE, NULL, NULL, NULL, NULL, NULL, "do not allow truncated hits at sequence termini", 7 }, |
| 145 |
{ "--anytrunc", eslARG_NONE, FALSE, NULL, NULL, NULL, NULL, NULL, "allow full+truncated hits at terminii and anywhere within seqs", 7 }, |
| 146 |
{ "--nonull3", eslARG_NONE, FALSE, NULL, NULL, NULL, NULL, NULL, "turn off the NULL3 post hoc additional null model", 7 }, |
| 147 |
{ "--mxsize", eslARG_REAL, NULL, NULL, "x>0.1", NULL, NULL, NULL, "set max allowed alnment mx size to <x> Mb [df: autodetermined]", 7 }, |
| 148 |
{ "--smxsize", eslARG_REAL, "128.", NULL, "x>0.1", NULL, NULL, NULL, "set max allowed size of search DP matrices to <x> Mb", 7 }, |
| 149 |
{ "--cyk", eslARG_NONE, FALSE, NULL, NULL, NULL, NULL, NULL, "use scanning CM CYK algorithm, not Inside in final stage", 7 }, |
| 150 |
{ "--acyk", eslARG_NONE, FALSE, NULL, NULL, NULL, NULL, NULL, "align hits with CYK, not optimal accuracy", 7 }, |
| 151 |
{ "--wcx", eslARG_REAL, FALSE, NULL, "x>=1.25",NULL, NULL,"--nohmm,--qdb,--fqdb", "set W (expected max hit len) as <x> * cm->clen (model len)", 7 }, |
| 152 |
{ "--toponly", eslARG_NONE, FALSE, NULL, NULL, NULL, NULL, NULL, "only search the top strand", 7 }, |
| 153 |
{ "--bottomonly", eslARG_NONE, FALSE, NULL, NULL, NULL, NULL, NULL, "only search the bottom strand", 7 }, |
| 154 |
{ "--tformat", eslARG_STRING, NULL, NULL, NULL, NULL, NULL, NULL, "assert target <seqdb> is in format <s>: no autodetection", 7 }, |
| 155 |
{ "--glist", eslARG_INFILE, NULL, NULL, NULL, NULL, NULL, NULL, "BOGUS OPTION, NEVER ALLOWED", 999 }, |
| 156 |
{ "--clanin", eslARG_INFILE, NULL, NULL, NULL, NULL, NULL, NULL, "BOGUS OPTION, NEVER ALLOWED", 999 }, |
| 157 |
{ "--oclan", eslARG_NONE, FALSE, NULL, NULL, NULL, NULL, NULL, "BOGUS OPTION, NEVER ALLOWED", 999 }, |
| 158 |
{ "--oskip", eslARG_NONE, FALSE, NULL, NULL, NULL, NULL, NULL, "BOGUS OPTION, NEVER ALLOWED", 999 }, |
| 159 |
#ifdef HMMER_THREADS |
| 160 |
{ "--cpu", eslARG_INT, CMNCPU,"INFERNAL_NCPU","n>=0",NULL, NULL, CPUOPTS, "number of parallel CPU workers to use for multithreads", 7 }, |
| 161 |
#endif |
| 162 |
#ifdef HAVE_MPI |
| 163 |
{ "--stall", eslARG_NONE, FALSE, NULL, NULL, NULL,"--mpi", NULL, "arrest after start: for debugging MPI under gdb", 7 }, |
| 164 |
{ "--mpi", eslARG_NONE, FALSE, NULL, NULL, NULL, NULL, MPIOPTS, "run as an MPI parallel program", 7 }, |
| 165 |
#endif |
| 166 |
|
| 167 |
|
| 168 |
|
| 169 |
|
| 170 |
{ "--noF1", eslARG_NONE, FALSE, NULL, NULL, NULL, NULL, "--doF1b", "skip the HMM SSV filter stage", 101 }, |
| 171 |
{ "--noF2", eslARG_NONE, FALSE, NULL, NULL, NULL,"--noF2b", NULL, "skip the HMM Viterbi filter stage", 101 }, |
| 172 |
{ "--noF3", eslARG_NONE, FALSE, NULL, NULL, NULL,"--noF3b", NULL, "skip the HMM Forward filter stage", 101 }, |
| 173 |
{ "--noF4", eslARG_NONE, FALSE, NULL, NULL, NULL,"--noF4b", NULL, "skip the HMM glocal Forward filter stage", 101 }, |
| 174 |
{ "--noF6", eslARG_NONE, FALSE, NULL, NULL, NULL, NULL, NULL, "skip the CM CYK filter stage", 101 }, |
| 175 |
{ "--doF1b", eslARG_NONE, FALSE, NULL, NULL, NULL, NULL, NULL, "turn on the HMM SSV composition bias filter", 101 }, |
| 176 |
{ "--noF2b", eslARG_NONE, FALSE, NULL, NULL, NULL, NULL, NULL, "turn off the HMM Vit composition bias filter", 101 }, |
| 177 |
{ "--noF3b", eslARG_NONE, FALSE, NULL, NULL, NULL, NULL, NULL, "turn off the HMM Fwd composition bias filter", 101 }, |
| 178 |
{ "--noF4b", eslARG_NONE, FALSE, NULL, NULL, NULL, NULL, NULL, "turn off the HMM glocal Fwd composition bias filter", 101 }, |
| 179 |
{ "--doF5b", eslARG_NONE, FALSE, NULL, NULL, NULL, NULL, NULL, "turn on the HMM per-envelope composition bias filter", 101 }, |
| 180 |
{ "--F1", eslARG_REAL, FALSE, NULL, "x>0", NULL, NULL, "--noF1", "Stage 1 (SSV) threshold: promote hits w/ P <= <x>", 101 }, |
| 181 |
{ "--F1b", eslARG_REAL, FALSE, NULL, "x>0", NULL,"--doF1b", NULL, "Stage 1 (MSV) bias threshold: promote hits w/ P <= <x>", 101 }, |
| 182 |
{ "--F2", eslARG_REAL, FALSE, NULL, "x>0", NULL, NULL, "--noF2", "Stage 2 (Vit) threshold: promote hits w/ P <= <x>", 101 }, |
| 183 |
{ "--F2b", eslARG_REAL, FALSE, NULL, "x>0", NULL, NULL, "--noF2b", "Stage 2 (Vit) bias threshold: promote hits w/ P <= <x>", 101 }, |
| 184 |
{ "--F3", eslARG_REAL, FALSE, NULL, "x>0", NULL, NULL, "--noF3", "Stage 3 (Fwd) threshold: promote hits w/ P <= <x>", 101 }, |
| 185 |
{ "--F3b", eslARG_REAL, FALSE, NULL, "x>0", NULL, NULL, "--noF3b", "Stage 3 (Fwd) bias threshold: promote hits w/ P <= <x>", 101 }, |
| 186 |
{ "--F4", eslARG_REAL, FALSE, NULL, "x>0", NULL, NULL, "--noF4", "Stage 4 (gFwd) glocal threshold: promote hits w/ P <= <x>", 101 }, |
| 187 |
{ "--F4b", eslARG_REAL, FALSE, NULL, "x>0", NULL, NULL, "--noF4b", "Stage 4 (gFwd) glocal bias thr: promote hits w/ P <= <x>", 101 }, |
| 188 |
{ "--F5", eslARG_REAL, FALSE, NULL, "x>0", NULL, NULL, NULL, "Stage 5 (env defn) threshold: promote hits w/ P <= <x>", 101 }, |
| 189 |
{ "--F5b", eslARG_REAL, FALSE, NULL, "x>0", NULL,"--doF5b", NULL, "Stage 5 (env defn) bias thr: promote hits w/ P <= <x>", 101 }, |
| 190 |
{ "--F6", eslARG_REAL, FALSE, NULL, "x>0", NULL, NULL, "--noF6", "Stage 6 (CYK) threshold: promote hits w/ P <= <x>", 101 }, |
| 191 |
|
| 192 |
|
| 193 |
{ "--hmmmax", eslARG_NONE, FALSE, NULL, NULL, NULL, NULL, NULL, "in HMM-only mode, turn off all filters", 102 }, |
| 194 |
{ "--hmmF1", eslARG_REAL, "0.02", NULL, "x>0", NULL, NULL, "--nohmmonly", "in HMM-only mode, set stage 1 (SSV) P value threshold to <x>", 102 }, |
| 195 |
{ "--hmmF2", eslARG_REAL, "1e-3", NULL, "x>0", NULL, NULL, "--nohmmonly", "in HMM-only mode, set stage 2 (Vit) P value threshold to <x>", 102 }, |
| 196 |
{ "--hmmF3", eslARG_REAL, "1e-5", NULL, "x>0", NULL, NULL, "--nohmmonly", "in HMM-only mode, set stage 3 (Fwd) P value threshold to <x>", 102 }, |
| 197 |
{ "--hmmnobias", eslARG_NONE, FALSE, NULL, NULL, NULL, NULL, "--nohmmonly", "in HMM-only mode, turn off the bias composition filter", 102 }, |
| 198 |
{ "--hmmnonull2", eslARG_NONE, FALSE, NULL, NULL, NULL, NULL, "--nohmmonly", "in HMM-only mode, turn off the null2 score correction", 102 }, |
| 199 |
{ "--nohmmonly", eslARG_NONE, FALSE, NULL, NULL, NULL, NULL, "--hmmmax", "never run HMM-only mode, not even for models with 0 basepairs",102 }, |
| 200 |
|
| 201 |
|
| 202 |
{ "--rt1", eslARG_REAL, "0.25", NULL, NULL, NULL, NULL, "--nohmm,--max", "set domain/envelope definition rt1 parameter as <x>", 103 }, |
| 203 |
{ "--rt2", eslARG_REAL, "0.10", NULL, NULL, NULL, NULL, "--nohmm,--max", "set domain/envelope definition rt2 parameter as <x>", 103 }, |
| 204 |
{ "--rt3", eslARG_REAL, "0.20", NULL, NULL, NULL, NULL, "--nohmm,--max", "set domain/envelope definition rt3 parameter as <x>", 103 }, |
| 205 |
{ "--ns", eslARG_INT, "200", NULL, NULL, NULL, NULL, "--nohmm,--max", "set number of domain/envelope tracebacks to <n>", 103 }, |
| 206 |
|
| 207 |
|
| 208 |
{ "--ftau", eslARG_REAL, "1e-4", NULL, "1E-18<x<1", NULL, NULL, "--fqdb", "set HMM band tail loss prob for CYK filter to <x>", 104 }, |
| 209 |
{ "--fsums", eslARG_NONE, FALSE, NULL, NULL, NULL, NULL, "--fqdb", "w/--fhbanded use posterior sums (widens bands)", 104 }, |
| 210 |
{ "--fqdb", eslARG_NONE, FALSE, NULL, NULL, NULL, NULL, NULL, "use QDBs in CYK filter round, not HMM bands", 104 }, |
| 211 |
{ "--fbeta", eslARG_REAL, "1e-7", NULL, "1E-18<x<1", NULL, NULL, NULL, "set tail loss prob for CYK filter QDB calculation to <x>", 104 }, |
| 212 |
{ "--fnonbanded", eslARG_NONE, FALSE, NULL, NULL, NULL, NULL, NULL, "do not use any bands for CYK filter round", 104 }, |
| 213 |
{ "--nocykenv", eslARG_NONE, FALSE, NULL, NULL, NULL, NULL, "--max", "do not redefine envelopes after stage 6 based on CYK hits", 104 }, |
| 214 |
{ "--cykenvx", eslARG_INT, "10", NULL, "n>=1", NULL, NULL, "--max", "CYK envelope redefinition threshold multiplier, <n> * F6", 104 }, |
| 215 |
|
| 216 |
|
| 217 |
{ "--tau", eslARG_REAL, "5e-6", NULL, "1E-18<x<1", NULL, NULL,"--qdb", "set HMM band tail loss prob for final round to <x>", 105 }, |
| 218 |
{ "--sums", eslARG_NONE, FALSE, NULL, NULL, NULL, NULL,"--qdb", "w/--hbanded use posterior sums (widens bands)", 105 }, |
| 219 |
{ "--qdb", eslARG_NONE, FALSE, NULL, NULL, NULL, NULL, NULL, "use QDBs (instead of HMM bands) in final Inside round", 105 }, |
| 220 |
{ "--beta", eslARG_REAL,"1e-15", NULL, "1E-18<x<1", NULL, NULL, NULL, "set tail loss prob for final Inside QDB calculation to <x>", 105 }, |
| 221 |
{ "--nonbanded", eslARG_NONE, FALSE, NULL, NULL, NULL, NULL, NULL, "do not use QDBs or HMM bands in final Inside round of CM search", 105 }, |
| 222 |
|
| 223 |
{ "--trmF3", eslARG_NONE, FALSE, NULL, NULL, NULL,"--noali,--hmmonly", NULL, "terminate after Stage 3 Fwd and output surviving windows", 106 }, |
| 224 |
|
| 225 |
|
| 226 |
{ "--timeF1", eslARG_NONE, FALSE, NULL, NULL, NULL, NULL, NULL, "abort after Stage 1 SSV; for timing expts", 107 }, |
| 227 |
{ "--timeF2", eslARG_NONE, FALSE, NULL, NULL, NULL, NULL, NULL, "abort after Stage 2 Vit; for timing expts", 107 }, |
| 228 |
{ "--timeF3", eslARG_NONE, FALSE, NULL, NULL, NULL, NULL, NULL, "abort after Stage 3 Fwd; for timing expts", 107 }, |
| 229 |
{ "--timeF4", eslARG_NONE, FALSE, NULL, NULL, NULL, NULL, NULL, "abort after Stage 4 glocal Fwd; for timing expts", 107 }, |
| 230 |
{ "--timeF5", eslARG_NONE, FALSE, NULL, NULL, NULL, NULL, NULL, "abort after Stage 5 envelope def; for timing expts", 107 }, |
| 231 |
{ "--timeF6", eslARG_NONE, FALSE, NULL, NULL, NULL, NULL, NULL, "abort after Stage 6 CYK; for timing expts", 107 }, |
| 232 |
|
| 233 |
|
| 234 |
{ "--nogreedy", eslARG_NONE, FALSE, NULL, NULL, NULL, NULL, NULL, "do not resolve hits with greedy algorithm, use optimal one", 108 }, |
| 235 |
{ "--cp9noel", eslARG_NONE, FALSE, NULL, NULL, NULL, NULL, "-g", "turn off local ends in cp9 HMMs", 108 }, |
| 236 |
{ "--cp9gloc", eslARG_NONE, FALSE, NULL, NULL, NULL, NULL, "-g,--cp9noel", "configure cp9 HMM in glocal mode", 108 }, |
| 237 |
{ "--null2", eslARG_NONE, FALSE, NULL, NULL, NULL, NULL, NULL, "turn on null 2 biased composition HMM score corrections", 108 }, |
| 238 |
{ "--maxtau", eslARG_REAL, "0.05", NULL,"0<x<0.5",NULL, NULL, NULL, "set max tau <x> when tightening HMM bands", 108 }, |
| 239 |
{ "--seed", eslARG_INT, "181", NULL, "n>=0", NULL, NULL, NULL, "set RNG seed to <n> (if 0: one-time arbitrary seed)", 108 }, |
| 240 |
{ "--block", eslARG_INT, NULL, NULL, "n>0", NULL, NULL, NULL, "BOGUS OPTION, NEVER ALLOWED", 999 }, |
| 241 |
{ "--onepass", eslARG_NONE, FALSE, NULL, NULL, NULL, NULL,"--nohmm,--qdb,--fqdb", "use CM only for best scoring HMM pass for full seq envelopes", 108 }, |
| 242 |
{ "--olonepass", eslARG_NONE, FALSE, NULL, NULL, NULL, NULL, NULL, "use CM only f. best sc'ing HMM pass f. overlapping envelopes", 108 }, |
| 243 |
{ "--noiter", eslARG_NONE, FALSE, NULL, NULL, NULL, NULL,"--nohmm,--qdb,--fqdb", "do not iteratively tighten bands when necessary", 108 }, |
| 244 |
{ "--inttrunc", eslARG_NONE, FALSE, NULL, NULL, NULL, NULL, NULL, "allow full and truncated hits anywhere within sequences", 108 }, |
| 245 |
{ "--onlytrunc", eslARG_NONE, FALSE, NULL, NULL, NULL, NULL, NULL, "allow only truncated hits, anywhere within sequences", 108 }, |
| 246 |
{ "--5trunc", eslARG_NONE, FALSE, NULL, NULL, NULL, NULL, NULL, "allow truncated hits only at 5' ends of sequences", 108 }, |
| 247 |
{ "--3trunc", eslARG_NONE, FALSE, NULL, NULL, NULL, NULL, NULL, "allow truncated hits only at 3' ends of sequences", 108 }, |
| 248 |
#ifdef HAVE_MPI |
| 249 |
|
| 250 |
{ "--sidx", eslARG_INT, NULL, NULL, "n>0", NULL,"--mpi", NULL, "start searching at sequence index <n> in target db SSI index" , 108 }, |
| 251 |
{ "--eidx", eslARG_INT, NULL, NULL, "n>0", NULL,"--mpi", NULL, "stop searching at sequence index <n> in target db SSI index", 108 }, |
| 252 |
#endif |
| 253 |
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, |
| 254 |
}; |
| 255 |
|
| 256 |
|
| 257 |
|
| 258 |
|
| 259 |
|
| 260 |
|
| 261 |
struct cfg_s { |
| 262 |
char *dbfile; |
| 263 |
char *cmfile; |
| 264 |
int64_t Z; |
| 265 |
enum cm_zsetby_e Z_setby; |
| 266 |
int do_mpi; |
| 267 |
int nproc; |
| 268 |
int my_rank; |
| 269 |
}; |
| 270 |
|
| 271 |
static char usage[] = "[options] <cmfile> <seqdb>"; |
| 272 |
static char banner[] = "search CM(s) against a sequence database"; |
| 273 |
|
| 274 |
static int serial_master(ESL_GETOPTS *go, struct cfg_s *cfg); |
| 275 |
static int serial_loop (WORKER_INFO *info, ESL_SQFILE *dbfp, int64_t *srcL); |
| 276 |
|
| 277 |
#ifdef HMMER_THREADS |
| 278 |
#define BLOCK_SIZE 1000 |
| 279 |
static int thread_loop(WORKER_INFO *info, ESL_THREADS *obj, ESL_WORK_QUEUE *queue, ESL_SQFILE *dbfp, int64_t *srcL); |
| 280 |
static void pipeline_thread(void *arg); |
| 281 |
#endif |
| 282 |
|
| 283 |
#ifdef HAVE_MPI |
| 284 |
static int mpi_master (ESL_GETOPTS *go, struct cfg_s *cfg); |
| 285 |
static int mpi_worker (ESL_GETOPTS *go, struct cfg_s *cfg); |
| 286 |
#endif |
| 287 |
|
| 288 |
static void process_commandline(int argc, char **argv, ESL_GETOPTS **ret_go, char **ret_cmfile, char **ret_seqfile); |
| 289 |
static int output_header(FILE *ofp, const ESL_GETOPTS *go, char *cmfile, char *seqfile, int ncpus); |
| 290 |
|
| 291 |
|
| 292 |
static int open_dbfile(ESL_GETOPTS *go, struct cfg_s *cfg, char *errbuf, ESL_SQFILE **ret_dbfp); |
| 293 |
static int dbsize_and_seq_lengths(ESL_GETOPTS *go, struct cfg_s *cfg, ESL_SQFILE **dbfp_ptr, char *errbuf, int64_t **ret_srcL, int64_t *ret_nseqs); |
| 294 |
static WORKER_INFO *create_info(const ESL_GETOPTS *go); |
| 295 |
static int clone_info(ESL_GETOPTS *go, WORKER_INFO *src_info, WORKER_INFO *dest_infoA, int dest_infocnt, char *errbuf); |
| 296 |
static void free_info(WORKER_INFO *info); |
| 297 |
static int configure_cm(WORKER_INFO *info); |
| 298 |
static int setup_hmm_filter(ESL_GETOPTS *go, WORKER_INFO *info); |
| 299 |
|
| 300 |
#ifdef HAVE_MPI |
| 301 |
|
| 302 |
#define MAX_BLOCK_SIZE (512*1024) |
| 303 |
typedef struct mpi_block_s { |
| 304 |
|
| 305 |
|
| 306 |
|
| 307 |
|
| 308 |
|
| 309 |
|
| 310 |
|
| 311 |
|
| 312 |
|
| 313 |
|
| 314 |
|
| 315 |
|
| 316 |
|
| 317 |
|
| 318 |
|
| 319 |
|
| 320 |
|
| 321 |
|
| 322 |
|
| 323 |
|
| 324 |
|
| 325 |
|
| 326 |
int64_t first_idx; |
| 327 |
int64_t final_idx; |
| 328 |
int64_t first_from; |
| 329 |
int64_t final_to; |
| 330 |
int64_t blockL; |
| 331 |
int complete; |
| 332 |
} MPI_BLOCK; |
| 333 |
|
| 334 |
typedef struct mpi_block_list_s { |
| 335 |
MPI_BLOCK **blocks; |
| 336 |
int N; |
| 337 |
int nalloc; |
| 338 |
} MPI_BLOCK_LIST; |
| 339 |
|
| 340 |
|
| 341 |
#define INFERNAL_ERROR_TAG 1 |
| 342 |
#define INFERNAL_BLOCK_TAG 2 |
| 343 |
#define INFERNAL_PIPELINE_TAG 3 |
| 344 |
#define INFERNAL_TOPHITS_TAG 4 |
| 345 |
#define INFERNAL_TERMINATING_TAG 5 |
| 346 |
#define INFERNAL_READY_TAG 6 |
| 347 |
|
| 348 |
static void mpi_failure(char *format, ...); |
| 349 |
static int mpi_open_dbfile_ssi(ESL_GETOPTS *go, struct cfg_s *cfg, ESL_SQFILE *dbfp, char *errbuf); |
| 350 |
static int mpi_dbsize_using_ssi(ESL_GETOPTS *go, struct cfg_s *cfg, ESL_SQFILE *dbfp, char *errbuf); |
| 351 |
static int mpi_add_blocks(ESL_SQFILE *dbfp, ESL_SQ *sq, int64_t ncontext, char *errbuf, int64_t final_pkey_idx, |
| 352 |
MPI_BLOCK_LIST *block_list, int64_t *ret_new_idx, int64_t *ret_noverlap, int64_t *ret_nseq); |
| 353 |
static int mpi_inspect_next_sequence_using_ssi(ESL_SQFILE *dbfp, ESL_SQ *sq, int64_t ncontext, int64_t pkey_idx, char *errbuf, |
| 354 |
MPI_BLOCK_LIST *block_list, int64_t *ret_noverlap); |
| 355 |
|
| 356 |
static MPI_BLOCK *create_mpi_block(); |
| 357 |
static MPI_BLOCK_LIST *create_mpi_block_list(); |
| 358 |
static void free_mpi_block_list(MPI_BLOCK_LIST *list); |
| 359 |
#if eslDEBUGLEVEL >= 1 |
| 360 |
|
| 361 |
static void dump_mpi_block(FILE *fp, MPI_BLOCK *block); |
| 362 |
static void dump_mpi_block_list(FILE *fp, MPI_BLOCK_LIST *list); |
| 363 |
#endif |
| 364 |
|
| 365 |
static int mpi_block_send(MPI_BLOCK *block, int dest, int tag, MPI_Comm comm, char **buf, int *nalloc); |
| 366 |
static int mpi_block_recv(int source, int tag, MPI_Comm comm, char **buf, int *nalloc, MPI_BLOCK **ret_block); |
| 367 |
static int mpi_block_pack_size(MPI_BLOCK *block, MPI_Comm comm, int *ret_n); |
| 368 |
static int mpi_block_pack(MPI_BLOCK *block, char *buf, int n, int *pos, MPI_Comm comm); |
| 369 |
static int mpi_block_unpack(char *buf, int n, int *pos, MPI_Comm comm, MPI_BLOCK **ret_block); |
| 370 |
#endif |
| 371 |
|
| 372 |
int |
| 373 |
main(int argc, char **argv) |
| 374 |
{ |
| 375 |
|
| 376 |
int status = eslOK; |
| 377 |
|
| 378 |
ESL_GETOPTS *go = NULL; |
| 379 |
struct cfg_s cfg; |
| 380 |
|
| 381 |
|
| 382 |
impl_Init(); |
| 383 |
|
| 384 |
|
| 385 |
|
| 386 |
cfg.cmfile = NULL; |
| 387 |
cfg.dbfile = NULL; |
| 388 |
|
| 389 |
cfg.do_mpi = FALSE; |
| 390 |
cfg.nproc = 0; |
| 391 |
cfg.my_rank = 0; |
| 392 |
|
| 393 |
|
| 394 |
init_ilogsum(); |
| 395 |
FLogsumInit(); |
| 396 |
p7_FLogsumInit(); |
| 397 |
process_commandline(argc, argv, &go, &cfg.cmfile, &cfg.dbfile); |
| 398 |
|
| 399 |
|
| 400 |
|
| 401 |
|
| 402 |
#ifdef HAVE_MPI |
| 403 |
|
| 404 |
#if eslDEBUGLEVEL >= 1 |
| 405 |
pid_t pid; |
| 406 |
pid = getpid(); |
| 407 |
printf("#DEBUG: The process id is %d\n", pid); |
| 408 |
fflush(stdout); |
| 409 |
#endif |
| 410 |
|
| 411 |
|
| 412 |
|
| 413 |
|
| 414 |
|
| 415 |
if (esl_opt_GetBoolean(go, "--stall")) pause(); |
| 416 |
|
| 417 |
if (esl_opt_GetBoolean(go, "--mpi")) |
| 418 |
{ |
| 419 |
cfg.do_mpi = TRUE; |
| 420 |
MPI_Init(&argc, &argv); |
| 421 |
MPI_Comm_rank(MPI_COMM_WORLD, &(cfg.my_rank)); |
| 422 |
MPI_Comm_size(MPI_COMM_WORLD, &(cfg.nproc)); |
| 423 |
|
| 424 |
if(cfg.nproc == 1) cm_Fail("MPI mode, but only 1 processor running... (did you execute mpirun?)"); |
| 425 |
|
| 426 |
if (cfg.my_rank > 0) status = mpi_worker(go, &cfg); |
| 427 |
else status = mpi_master(go, &cfg); |
| 428 |
|
| 429 |
MPI_Finalize(); |
| 430 |
} |
| 431 |
else |
| 432 |
#endif |
| 433 |
{ |
| 434 |
status = serial_master(go, &cfg); |
| 435 |
} |
| 436 |
|
| 437 |
esl_getopts_Destroy(go); |
| 438 |
|
| 439 |
return status; |
| 440 |
} |
| 441 |
|
| 442 |
|
| 443 |
|
| 444 |
|
| 445 |
|
| 446 |
|
| 447 |
|
| 448 |
|
| 449 |
static int |
| 450 |
serial_master(ESL_GETOPTS *go, struct cfg_s *cfg) |
| 451 |
{ |
| 452 |
FILE *ofp = stdout; |
| 453 |
FILE *afp = NULL; |
| 454 |
FILE *tblfp = NULL; |
| 455 |
CM_FILE *cmfp; |
| 456 |
CM_t *cm = NULL; |
| 457 |
ESL_SQFILE *dbfp = NULL; |
| 458 |
ESL_ALPHABET *abc = NULL; |
| 459 |
ESL_STOPWATCH *w = NULL; |
| 460 |
ESL_STOPWATCH *mw = NULL; |
| 461 |
int textw = 0; |
| 462 |
int64_t cm_idx = 0; |
| 463 |
int status = eslOK; |
| 464 |
int qhstatus = eslOK; |
| 465 |
int sstatus = eslOK; |
| 466 |
int i; |
| 467 |
|
| 468 |
int ncpus = 0; |
| 469 |
|
| 470 |
WORKER_INFO *tinfo; |
| 471 |
WORKER_INFO *info = NULL; |
| 472 |
int infocnt = 0; |
| 473 |
|
| 474 |
int64_t *srcL = NULL; |
| 475 |
int64_t nseqs_expected = 0; |
| 476 |
double eZ; |
| 477 |
int nbps; |
| 478 |
|
| 479 |
#ifdef HMMER_THREADS |
| 480 |
ESL_SQ_BLOCK *block = NULL; |
| 481 |
ESL_THREADS *threadObj= NULL; |
| 482 |
ESL_WORK_QUEUE *queue = NULL; |
| 483 |
#endif |
| 484 |
char errbuf[eslERRBUFSIZE]; |
| 485 |
|
| 486 |
w = esl_stopwatch_Create(); |
| 487 |
mw = esl_stopwatch_Create(); |
| 488 |
esl_stopwatch_Start(mw); |
| 489 |
|
| 490 |
if (esl_opt_GetBoolean(go, "--notextw")) textw = 0; |
| 491 |
else textw = esl_opt_GetInteger(go, "--textw"); |
| 492 |
|
| 493 |
|
| 494 |
if((status = open_dbfile(go, cfg, errbuf, &dbfp)) != eslOK) esl_fatal(errbuf); |
| 495 |
|
| 496 |
|
| 497 |
if((status = cm_file_Open(cfg->cmfile, NULL, FALSE, &(cmfp), errbuf)) != eslOK) cm_Fail(errbuf); |
| 498 |
|
| 499 |
|
| 500 |
if (esl_opt_IsOn(go, "-o")) { if ((ofp = fopen(esl_opt_GetString(go, "-o"), "w")) == NULL) cm_Fail("Failed to open output file %s for writing\n", esl_opt_GetString(go, "-o")); } |
| 501 |
if (esl_opt_IsOn(go, "-A")) { if ((afp = fopen(esl_opt_GetString(go, "-A"), "w")) == NULL) cm_Fail("Failed to open alignment file %s for writing\n", esl_opt_GetString(go, "-A")); } |
| 502 |
if (esl_opt_IsOn(go, "--tblout")) { if ((tblfp = fopen(esl_opt_GetString(go, "--tblout"), "w")) == NULL) cm_Fail("Failed to open tabular output file %s for writing\n", esl_opt_GetString(go, "--tblout")); } |
| 503 |
|
| 504 |
#ifdef HMMER_THREADS |
| 505 |
|
| 506 |
ncpus = ESL_MIN(esl_opt_GetInteger(go, "--cpu"), esl_threads_GetCPUCount()); |
| 507 |
if (ncpus > 0) { |
| 508 |
threadObj = esl_threads_Create(&pipeline_thread); |
| 509 |
queue = esl_workqueue_Create(ncpus * 2); |
| 510 |
} |
| 511 |
#endif |
| 512 |
|
| 513 |
infocnt = (ncpus == 0) ? 1 : ncpus; |
| 514 |
ESL_ALLOC(info, sizeof(WORKER_INFO) * infocnt); |
| 515 |
|
| 516 |
|
| 517 |
qhstatus = cm_file_Read(cmfp, TRUE, &abc, &cm); |
| 518 |
|
| 519 |
if (qhstatus == eslOK) { |
| 520 |
|
| 521 |
output_header(ofp, go, cfg->cmfile, cfg->dbfile, ncpus); |
| 522 |
dbfp->abc = abc; |
| 523 |
|
| 524 |
|
| 525 |
|
| 526 |
|
| 527 |
|
| 528 |
|
| 529 |
|
| 530 |
|
| 531 |
|
| 532 |
|
| 533 |
|
| 534 |
if ((! esl_sqfile_IsRewindable(dbfp)) && dbfp->data.ascii.do_gzip == FALSE) { |
| 535 |
cm_Fail("Target sequence file %s isn't rewindable, cmsearch needs to be able to rewind it", cfg->dbfile); |
| 536 |
} |
| 537 |
if((status = dbsize_and_seq_lengths(go, cfg, &dbfp, errbuf, &srcL, &nseqs_expected)) != eslOK) { |
| 538 |
cm_Fail("Parse failed (sequence file %s):\n%s\n", dbfp->filename, esl_sqfile_GetErrorBuf(dbfp)); |
| 539 |
} |
| 540 |
if(esl_opt_IsUsed(go, "-Z")) { |
| 541 |
cfg->Z = (int64_t) (esl_opt_GetReal(go, "-Z") * 1000000.); |
| 542 |
cfg->Z_setby = CM_ZSETBY_OPTION; |
| 543 |
} |
| 544 |
|
| 545 |
for (i = 0; i < infocnt; ++i) { |
| 546 |
info[i].pli = NULL; |
| 547 |
info[i].th = NULL; |
| 548 |
info[i].cm = NULL; |
| 549 |
info[i].om = NULL; |
| 550 |
info[i].bg = NULL; |
| 551 |
ESL_ALLOC(info[i].p7_evparam, sizeof(float) * CM_p7_NEVPARAM); |
| 552 |
#ifdef HMMER_THREADS |
| 553 |
info[i].queue = queue; |
| 554 |
#endif |
| 555 |
} |
| 556 |
|
| 557 |
#ifdef HMMER_THREADS |
| 558 |
for (i = 0; i < ncpus * 2; ++i) { |
| 559 |
block = esl_sq_CreateDigitalBlock(BLOCK_SIZE, abc); |
| 560 |
if (block == NULL) esl_fatal("Failed to allocate sequence block"); |
| 561 |
|
| 562 |
status = esl_workqueue_Init(queue, block); |
| 563 |
if (status != eslOK) esl_fatal("Failed to add block to work queue"); |
| 564 |
} |
| 565 |
#endif |
| 566 |
} |
| 567 |
|
| 568 |
|
| 569 |
while (qhstatus == eslOK) { |
| 570 |
cm_idx++; |
| 571 |
esl_stopwatch_Start(w); |
| 572 |
|
| 573 |
|
| 574 |
tinfo = create_info(go); |
| 575 |
tinfo->cm = cm; |
| 576 |
|
| 577 |
|
| 578 |
if(! (tinfo->cm->flags & CMH_FP7)) cm_Fail("no filter HMM was read for CM: %s\n", tinfo->cm->name); |
| 579 |
|
| 580 |
|
| 581 |
|
| 582 |
|
| 583 |
|
| 584 |
|
| 585 |
|
| 586 |
|
| 587 |
nbps = CMCountNodetype(tinfo->cm, MATP_nd); |
| 588 |
if(( esl_opt_GetBoolean(go, "--nohmmonly")) || |
| 589 |
( esl_opt_GetBoolean(go, "-g")) || |
| 590 |
((! esl_opt_GetBoolean(go, "--hmmonly")) && (nbps > 0))) { |
| 591 |
|
| 592 |
if(! (tinfo->cm->flags & CMH_EXPTAIL_STATS)) cm_Fail("no E-value parameters were read for CM: %s.\nYou may need to run cmcalibrate.", tinfo->cm->name); |
| 593 |
} |
| 594 |
|
| 595 |
|
| 596 |
if (cm_idx > 1) { |
| 597 |
if (! esl_sqfile_IsRewindable(dbfp)) |
| 598 |
esl_fatal("Target sequence file %s isn't rewindable; can't search it with multiple queries", cfg->dbfile); |
| 599 |
esl_sqfile_Position(dbfp, 0); |
| 600 |
} |
| 601 |
|
| 602 |
fprintf(ofp, "Query: %s [CLEN=%d]\n", tinfo->cm->name, tinfo->cm->clen); |
| 603 |
if (tinfo->cm->acc) fprintf(ofp, "Accession: %s\n", tinfo->cm->acc); |
| 604 |
if (tinfo->cm->desc) fprintf(ofp, "Description: %s\n", tinfo->cm->desc); |
| 605 |
|
| 606 |
|
| 607 |
|
| 608 |
|
| 609 |
|
| 610 |
tinfo->pli = cm_pipeline_Create(go, abc, tinfo->cm->clen, 100, cfg->Z, cfg->Z_setby, CM_SEARCH_SEQS); |
| 611 |
if((status = configure_cm(tinfo)) != eslOK) cm_Fail(tinfo->pli->errbuf); |
| 612 |
if((status = setup_hmm_filter(go, tinfo)) != eslOK) cm_Fail(tinfo->pli->errbuf); |
| 613 |
|
| 614 |
if((status = clone_info(go, tinfo, info, infocnt, errbuf)) != eslOK) cm_Fail(errbuf); |
| 615 |
|
| 616 |
|
| 617 |
for (i = 0; i < infocnt; ++i) { |
| 618 |
info[i].th = cm_tophits_Create(); |
| 619 |
info[i].pli = cm_pipeline_Create(go, abc, tinfo->cm->clen, 100, cfg->Z, cfg->Z_setby, CM_SEARCH_SEQS); |
| 620 |
if((status = cm_pli_NewModel(info[i].pli, CM_NEWMODEL_CM, info[i].cm, info[i].cm->clen, info[i].cm->W, nbps, |
| 621 |
info[i].om, info[i].bg, info[i].p7_evparam, info[i].om->max_length, cm_idx-1, |
| 622 |
-1, NULL)) != eslOK) { |
| 623 |
cm_Fail(info[i].pli->errbuf); |
| 624 |
} |
| 625 |
|
| 626 |
#ifdef HMMER_THREADS |
| 627 |
if (ncpus > 0) esl_threads_AddThread(threadObj, &info[i]); |
| 628 |
#endif |
| 629 |
} |
| 630 |
|
| 631 |
#ifdef HMMER_THREADS |
| 632 |
if (ncpus > 0) sstatus = thread_loop(info, threadObj, queue, dbfp, srcL); |
| 633 |
else sstatus = serial_loop(info, dbfp, srcL); |
| 634 |
#else |
| 635 |
sstatus = serial_loop(info, dbfp, srcL); |
| 636 |
#endif |
| 637 |
switch(sstatus) { |
| 638 |
case eslEFORMAT: |
| 639 |
esl_fatal("Parse failed (sequence file %s):\n%s\n", |
| 640 |
dbfp->filename, esl_sqfile_GetErrorBuf(dbfp)); |
| 641 |
break; |
| 642 |
case eslEOF: |
| 643 |
|
| 644 |
break; |
| 645 |
default: |
| 646 |
esl_fatal("Unexpected error %d reading sequence file %s", sstatus, dbfp->filename); |
| 647 |
} |
| 648 |
|
| 649 |
|
| 650 |
for (i = 0; i < infocnt; ++i) { |
| 651 |
if(info[i].pli->do_hmmonly_cur) eZ = info[i].pli->Z / (float) info[i].om->max_length; |
| 652 |
else eZ = info[i].cm->expA[info[i].pli->final_cm_exp_mode]->cur_eff_dbsize; |
| 653 |
cm_tophits_ComputeEvalues(info[i].th, eZ, 0); |
| 654 |
} |
| 655 |
|
| 656 |
|
| 657 |
for (i = 1; i < infocnt; ++i) { |
| 658 |
cm_tophits_Merge(info[0].th, info[i].th); |
| 659 |
cm_pipeline_Merge(info[0].pli, info[i].pli); |
| 660 |
free_info(&info[i]); |
| 661 |
} |
| 662 |
|
| 663 |
|
| 664 |
cm_tophits_SortForOverlapRemoval(info[0].th); |
| 665 |
if((status = cm_tophits_RemoveOrMarkOverlaps(info[0].th, FALSE, errbuf)) != eslOK) cm_Fail(errbuf); |
| 666 |
|
| 667 |
|
| 668 |
if(info[0].pli->do_trm_F3) cm_tophits_SortByPosition(info[0].th); |
| 669 |
else cm_tophits_SortByEvalue(info[0].th); |
| 670 |
|
| 671 |
|
| 672 |
cm_tophits_Threshold(info[0].th, info[0].pli); |
| 673 |
|
| 674 |
|
| 675 |
for (i = 0; i < info->th->N; i++) { |
| 676 |
if ((info[0].th->hit[i]->flags & CM_HIT_IS_REPORTED) || (info[0].th->hit[i]->flags & CM_HIT_IS_INCLUDED)) { |
| 677 |
info[0].pli->acct[info[0].th->hit[i]->pass_idx].n_output++; |
| 678 |
info[0].pli->acct[info[0].th->hit[i]->pass_idx].pos_output += llabs(info[0].th->hit[i]->stop - info[0].th->hit[i]->start) + 1; |
| 679 |
} |
| 680 |
} |
| 681 |
|
| 682 |
|
| 683 |
if(info[0].pli->do_trm_F3) { |
| 684 |
cm_tophits_F3Targets(ofp, info[0].th, info[0].pli); |
| 685 |
} |
| 686 |
else { |
| 687 |
cm_tophits_Targets(ofp, info[0].th, info[0].pli, textw); |
| 688 |
} |
| 689 |
fprintf(ofp, "\n\n"); |
| 690 |
|
| 691 |
if(info[0].pli->show_alignments) { |
| 692 |
if((status = cm_tophits_HitAlignments(ofp, info[0].th, info[0].pli, textw)) != eslOK) cm_Fail("Out of memory"); |
| 693 |
fprintf(ofp, "\n\n"); |
| 694 |
if(info[0].pli->be_verbose) { |
| 695 |
cm_tophits_HitAlignmentStatistics(ofp, info[0].th, |
| 696 |
(info[0].pli->cm_align_opts & CM_ALIGN_HBANDED), |
| 697 |
(info[0].pli->cm_align_opts & CM_ALIGN_CYK), |
| 698 |
info[0].pli->final_tau); |
| 699 |
fprintf(ofp, "\n\n"); |
| 700 |
} |
| 701 |
} |
| 702 |
|
| 703 |
if (tblfp != NULL) { |
| 704 |
if(info[0].pli->do_trm_F3) { |
| 705 |
cm_tophits_F3TabularTargets1(tblfp, info[0].th, info[0].pli, (cm_idx == 1)); |
| 706 |
} |
| 707 |
else { |
| 708 |
if((! esl_opt_IsUsed(go, "--fmt")) || (esl_opt_GetInteger(go, "--fmt") == 1)) { |
| 709 |
cm_tophits_TabularTargets1 (tblfp, info[0].cm->name, info[0].cm->acc, info[0].th, info[0].pli, (cm_idx == 1)); |
| 710 |
} |
| 711 |
else if(esl_opt_GetInteger(go, "--fmt") == 3) { |
| 712 |
cm_tophits_TabularTargets3 (tblfp, info[0].cm->name, info[0].cm->acc, info[0].th, info[0].pli, (cm_idx == 1)); |
| 713 |
} |
| 714 |
|
| 715 |
|
| 716 |
} |
| 717 |
fflush(tblfp); |
| 718 |
} |
| 719 |
esl_stopwatch_Stop(w); |
| 720 |
cm_pli_Statistics(ofp, info[0].pli, w); |
| 721 |
|
| 722 |
|
| 723 |
if (afp) { |
| 724 |
ESL_MSA *msa = NULL; |
| 725 |
if((status = cm_tophits_Alignment(info[0].cm, info[0].th, errbuf, (! esl_opt_GetBoolean(go, "--nomiss")), &msa)) == eslOK) { |
| 726 |
if(msa != NULL) { |
| 727 |
if (textw > 0) esl_msafile_Write(afp, msa, eslMSAFILE_STOCKHOLM); |
| 728 |
else esl_msafile_Write(afp, msa, eslMSAFILE_PFAM); |
| 729 |
fprintf(ofp, "# Alignment of %d hits satisfying inclusion thresholds saved to: %s\n", msa->nseq, esl_opt_GetString(go, "-A")); |
| 730 |
} |
| 731 |
else { |
| 732 |
fprintf(ofp, "# No hits satisfy inclusion thresholds; no alignment saved\n"); |
| 733 |
} |
| 734 |
esl_msa_Destroy(msa); |
| 735 |
} |
| 736 |
else { |
| 737 |
cm_Fail(errbuf); |
| 738 |
} |
| 739 |
} |
| 740 |
fprintf(ofp, "//\n"); |
| 741 |
|
| 742 |
free_info(tinfo); |
| 743 |
free(tinfo); |
| 744 |
free_info(&(info[0])); |
| 745 |
|
| 746 |
qhstatus = cm_file_Read(cmfp, TRUE, &abc, &cm); |
| 747 |
} |
| 748 |
|
| 749 |
switch(qhstatus) { |
| 750 |
case eslEFORMAT: cm_Fail("bad file format in CM file %s\n%s", cfg->cmfile, cmfp->errbuf); break; |
| 751 |
case eslEOF: break; |
| 752 |
default: cm_Fail("Unexpected error (%d) in reading CMs from %s\n%s", qhstatus, cfg->cmfile, cmfp->errbuf); |
| 753 |
} |
| 754 |
|
| 755 |
#ifdef HMMER_THREADS |
| 756 |
if (ncpus > 0) { |
| 757 |
esl_workqueue_Reset(queue); |
| 758 |
while (esl_workqueue_Remove(queue, (void **) &block) == eslOK) { |
| 759 |
esl_sq_DestroyBlock(block); |
| 760 |
} |
| 761 |
esl_workqueue_Destroy(queue); |
| 762 |
esl_threads_Destroy(threadObj); |
| 763 |
} |
| 764 |
#endif |
| 765 |
|
| 766 |
|
| 767 |
|
| 768 |
if (tblfp) cm_tophits_TabularTail(tblfp, "cmsearch", CM_SEARCH_SEQS, cfg->cmfile, cfg->dbfile, go); |
| 769 |
fprintf(ofp, "[ok]\n"); |
| 770 |
|
| 771 |
esl_stopwatch_Stop(mw); |
| 772 |
if(esl_opt_GetBoolean(go, "--verbose")) esl_stopwatch_Display(stdout, mw, "# Total CPU time:"); |
| 773 |
|
| 774 |
free(info); |
| 775 |
if(srcL != NULL) free(srcL); |
| 776 |
|
| 777 |
cm_file_Close(cmfp); |
| 778 |
esl_sqfile_Close(dbfp); |
| 779 |
esl_alphabet_Destroy(abc); |
| 780 |
if(w != NULL) esl_stopwatch_Destroy(w); |
| 781 |
if(mw != NULL) esl_stopwatch_Destroy(mw); |
| 782 |
|
| 783 |
if (ofp != stdout) fclose(ofp); |
| 784 |
if (afp) fclose(afp); |
| 785 |
if (tblfp) fclose(tblfp); |
| 786 |
|
| 787 |
return eslOK; |
| 788 |
|
| 789 |
ERROR: |
| 790 |
return eslFAIL; |
| 791 |
} |
| 792 |
|
| 793 |
|
| 794 |
|
| 795 |
|
| 796 |
|
| 797 |
|
| 798 |
|
| 799 |
|
| 800 |
|
| 801 |
static int |
| 802 |
serial_loop(WORKER_INFO *info, ESL_SQFILE *dbfp, int64_t *srcL) |
| 803 |
{ |
| 804 |
int status; |
| 805 |
int wstatus; |
| 806 |
int prv_pli_ntophits; |
| 807 |
int64_t seq_idx = 0; |
| 808 |
ESL_SQ *dbsq = esl_sq_CreateDigital(info->cm->abc); |
| 809 |
|
| 810 |
wstatus = esl_sqio_ReadWindow(dbfp, info->pli->maxW, CM_MAX_RESIDUE_COUNT, dbsq); |
| 811 |
seq_idx++; |
| 812 |
|
| 813 |
while(wstatus == eslEOD) { |
| 814 |
info->pli->nseqs++; |
| 815 |
esl_sq_Reuse(dbsq); |
| 816 |
wstatus = esl_sqio_ReadWindow(dbfp, info->pli->maxW, CM_MAX_RESIDUE_COUNT, dbsq); |
| 817 |
seq_idx++; |
| 818 |
} |
| 819 |
|
| 820 |
|
| 821 |
while (wstatus == eslOK ) { |
| 822 |
|
| 823 |
if(dbsq->start == 1) dbsq->L = srcL[seq_idx-1]; |
| 824 |
|
| 825 |
cm_pli_NewSeq(info->pli, dbsq, seq_idx-1); |
| 826 |
|
| 827 |
if (info->pli->do_top) { |
| 828 |
prv_pli_ntophits = info->th->N; |
| 829 |
if((status = cm_Pipeline(info->pli, info->cm->offset, info->om, info->bg, info->p7_evparam, info->msvdata, dbsq, info->th, FALSE, |
| 830 |
NULL, &(info->gm), &(info->Rgm), &(info->Lgm), &(info->Tgm), &(info->cm))) != eslOK) cm_Fail("cm_pipeline() failed unexpected with status code %d\n%s\n", status, info->pli->errbuf); |
| 831 |
cm_pipeline_Reuse(info->pli); |
| 832 |
|
| 833 |
|
| 834 |
if(dbsq->C > 0) cm_pli_AdjustNresForOverlaps(info->pli, dbsq->C, FALSE); |
| 835 |
|
| 836 |
|
| 837 |
cm_tophits_UpdateHitPositions(info->th, prv_pli_ntophits, dbsq->start, FALSE); |
| 838 |
} |
| 839 |
|
| 840 |
|
| 841 |
if (info->pli->do_bot && dbsq->abc->complement != NULL) { |
| 842 |
prv_pli_ntophits = info->th->N; |
| 843 |
esl_sq_ReverseComplement(dbsq); |
| 844 |
if((status = cm_Pipeline(info->pli, info->cm->offset, info->om, info->bg, info->p7_evparam, info->msvdata, dbsq, info->th, TRUE, |
| 845 |
NULL, &(info->gm), &(info->Rgm), &(info->Lgm), &(info->Tgm), &(info->cm))) != eslOK) cm_Fail("cm_pipeline() failed unexpected with status code %d\n%s\n", status, info->pli->errbuf); |
| 846 |
cm_pipeline_Reuse(info->pli); |
| 847 |
|
| 848 |
|
| 849 |
if(dbsq->C > 0) cm_pli_AdjustNresForOverlaps(info->pli, dbsq->C, TRUE); |
| 850 |
|
| 851 |
|
| 852 |
cm_tophits_UpdateHitPositions(info->th, prv_pli_ntophits, dbsq->start, TRUE); |
| 853 |
|
| 854 |
|
| 855 |
|
| 856 |
|
| 857 |
|
| 858 |
|
| 859 |
|
| 860 |
esl_sq_ReverseComplement(dbsq); |
| 861 |
} |
| 862 |
|
| 863 |
wstatus = esl_sqio_ReadWindow(dbfp, info->pli->maxW, CM_MAX_RESIDUE_COUNT, dbsq); |
| 864 |
|
| 865 |
while (wstatus == eslEOD) { |
| 866 |
|
| 867 |
|
| 868 |
|
| 869 |
info->pli->nseqs++; |
| 870 |
esl_sq_Reuse(dbsq); |
| 871 |
wstatus = esl_sqio_ReadWindow(dbfp, info->pli->maxW, CM_MAX_RESIDUE_COUNT, dbsq); |
| 872 |
seq_idx++; |
| 873 |
} |
| 874 |
} |
| 875 |
|
| 876 |
esl_sq_Destroy(dbsq); |
| 877 |
|
| 878 |
return wstatus; |
| 879 |
} |
| 880 |
|
| 881 |
#ifdef HMMER_THREADS |
| 882 |
static int |
| 883 |
thread_loop(WORKER_INFO *info, ESL_THREADS *obj, ESL_WORK_QUEUE *queue, ESL_SQFILE *dbfp, int64_t *srcL) |
| 884 |
{ |
| 885 |
int status = eslOK; |
| 886 |
int sstatus = eslOK; |
| 887 |
int eofCount = 0; |
| 888 |
int i; |
| 889 |
ESL_SQ *tmpsq = esl_sq_CreateDigital(info->cm->abc); |
| 890 |
ESL_SQ_BLOCK *block; |
| 891 |
void *newBlock; |
| 892 |
int prv_block_complete = TRUE; |
| 893 |
|
| 894 |
esl_workqueue_Reset(queue); |
| 895 |
esl_threads_WaitForStart(obj); |
| 896 |
|
| 897 |
status = esl_workqueue_ReaderUpdate(queue, NULL, &newBlock); |
| 898 |
if (status != eslOK) esl_fatal("Work queue reader failed"); |
| 899 |
((ESL_SQ_BLOCK *)newBlock)->complete = TRUE; |
| 900 |
|
| 901 |
|
| 902 |
while (sstatus == eslOK ) { |
| 903 |
block = (ESL_SQ_BLOCK *) newBlock; |
| 904 |
|
| 905 |
|
| 906 |
for (i=0; i < block->count; i++) esl_sq_Reuse(block->list + i); |
| 907 |
|
| 908 |
if (! prv_block_complete) { |
| 909 |
esl_sq_Copy(tmpsq, block->list); |
| 910 |
block->complete = FALSE; |
| 911 |
block->list->C = info->pli->maxW; |
| 912 |
|
| 913 |
|
| 914 |
} |
| 915 |
|
| 916 |
sstatus = esl_sqio_ReadBlock(dbfp, block, CM_MAX_RESIDUE_COUNT, -1, TRUE, TRUE); |
| 917 |
|
| 918 |
if (sstatus == eslOK) { |
| 919 |
if(! block->complete) { |
| 920 |
|
| 921 |
|
| 922 |
|
| 923 |
esl_sq_Copy(block->list + (block->count - 1) , tmpsq); |
| 924 |
} |
| 925 |
block->first_seqidx = info->pli->nseqs; |
| 926 |
info->pli->nseqs += (block->complete) ? block->count : block->count-1; |
| 927 |
|
| 928 |
|
| 929 |
for(i = 0; i < block->count; i++) { |
| 930 |
block->list[i].L = srcL[block->first_seqidx + i]; |
| 931 |
} |
| 932 |
} |
| 933 |
|
| 934 |
if (sstatus == eslEOF) { |
| 935 |
if (eofCount < esl_threads_GetWorkerCount(obj)) sstatus = eslOK; |
| 936 |
++eofCount; |
| 937 |
} |
| 938 |
if (! block->complete ) { |
| 939 |
|
| 940 |
|
| 941 |
|
| 942 |
|
| 943 |
|
| 944 |
|
| 945 |
|
| 946 |
|
| 947 |
esl_sq_Copy(block->list + (block->count - 1) , tmpsq); |
| 948 |
} |
| 949 |
|
| 950 |
|
| 951 |
|
| 952 |
|
| 953 |
|
| 954 |
|
| 955 |
prv_block_complete = block->complete; |
| 956 |
|
| 957 |
if (sstatus == eslOK) { |
| 958 |
status = esl_workqueue_ReaderUpdate(queue, block, &newBlock); |
| 959 |
if (status != eslOK) esl_fatal("Work queue reader failed"); |
| 960 |
} |
| 961 |
|
| 962 |
|
| 963 |
((ESL_SQ_BLOCK *)newBlock)->complete = prv_block_complete; |
| 964 |
if (! prv_block_complete) { |
| 965 |
|
| 966 |
|
| 967 |
|
| 968 |
|
| 969 |
esl_sq_Copy(tmpsq, ((ESL_SQ_BLOCK *)newBlock)->list); |
| 970 |
((ESL_SQ_BLOCK *)newBlock)->list->C = info->pli->maxW; |
| 971 |
} |
| 972 |
} |
| 973 |
|
| 974 |
status = esl_workqueue_ReaderUpdate(queue, block, NULL); |
| 975 |
if (status != eslOK) esl_fatal("Work queue reader failed"); |
| 976 |
|
| 977 |
if (sstatus == eslEOF) { |
| 978 |
|
| 979 |
esl_threads_WaitForFinish(obj); |
| 980 |
esl_workqueue_Complete(queue); |
| 981 |
} |
| 982 |
|
| 983 |
if(tmpsq != NULL) esl_sq_Destroy(tmpsq); |
| 984 |
|
| 985 |
return sstatus; |
| 986 |
} |
| 987 |
|
| 988 |
|
| 989 |
|
| 990 |
|
| 991 |
|
| 992 |
|
| 993 |
|
| 994 |
|
| 995 |
static void |
| 996 |
pipeline_thread(void *arg) |
| 997 |
{ |
| 998 |
int i; |
| 999 |
int status; |
| 1000 |
int workeridx; |
| 1001 |
WORKER_INFO *info; |
| 1002 |
ESL_THREADS *obj; |
| 1003 |
|
| 1004 |
ESL_SQ_BLOCK *block = NULL; |
| 1005 |
void *newBlock; |
| 1006 |
int prv_pli_ntophits; |
| 1007 |
|
| 1008 |
#ifdef HAVE_FLUSH_ZERO_MODE |
| 1009 |
|
| 1010 |
|
| 1011 |
|
| 1012 |
|
| 1013 |
|
| 1014 |
|
| 1015 |
_MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_ON); |
| 1016 |
#endif |
| 1017 |
|
| 1018 |
obj = (ESL_THREADS *) arg; |
| 1019 |
esl_threads_Started(obj, &workeridx); |
| 1020 |
|
| 1021 |
info = (WORKER_INFO *) esl_threads_GetData(obj, workeridx); |
| 1022 |
|
| 1023 |
status = esl_workqueue_WorkerUpdate(info->queue, NULL, &newBlock); |
| 1024 |
if (status != eslOK) esl_fatal("Work queue worker failed"); |
| 1025 |
|
| 1026 |
|
| 1027 |
block = (ESL_SQ_BLOCK *) newBlock; |
| 1028 |
while (block->count > 0) { |
| 1029 |
|
| 1030 |
for (i = 0; i < block->count; ++i) { |
| 1031 |
ESL_SQ *dbsq = block->list + i; |
| 1032 |
|
| 1033 |
cm_pli_NewSeq(info->pli, dbsq, block->first_seqidx + i); |
| 1034 |
|
| 1035 |
if (info->pli->do_top) { |
| 1036 |
prv_pli_ntophits = info->th->N; |
| 1037 |
if((status = cm_Pipeline(info->pli, info->cm->offset, info->om, info->bg, info->p7_evparam, info->msvdata, dbsq, info->th, FALSE, |
| 1038 |
NULL, &(info->gm), &(info->Rgm), &(info->Lgm), &(info->Tgm), &(info->cm))) != eslOK) cm_Fail("cm_pipeline() failed unexpected with status code %d\n%s\n", status, info->pli->errbuf); |
| 1039 |
cm_pipeline_Reuse(info->pli); |
| 1040 |
|
| 1041 |
|
| 1042 |
if(dbsq->C > 0) cm_pli_AdjustNresForOverlaps(info->pli, dbsq->C, FALSE); |
| 1043 |
|
| 1044 |
|
| 1045 |
cm_tophits_UpdateHitPositions(info->th, prv_pli_ntophits, dbsq->start, FALSE); |
| 1046 |
} |
| 1047 |
|
| 1048 |
|
| 1049 |
if (info->pli->do_bot && dbsq->abc->complement != NULL) { |
| 1050 |
prv_pli_ntophits = info->th->N; |
| 1051 |
esl_sq_ReverseComplement(dbsq); |
| 1052 |
if((status = cm_Pipeline(info->pli, info->cm->offset, info->om, info->bg, info->p7_evparam, info->msvdata, dbsq, info->th, TRUE, |
| 1053 |
NULL, &(info->gm), &(info->Rgm), &(info->Lgm), &(info->Tgm), &(info->cm))) != eslOK) cm_Fail("cm_pipeline() failed unexpected with status code %d\n%s\n", status, info->pli->errbuf); |
| 1054 |
cm_pipeline_Reuse(info->pli); |
| 1055 |
|
| 1056 |
|
| 1057 |
if(dbsq->C > 0) cm_pli_AdjustNresForOverlaps(info->pli, dbsq->C, TRUE); |
| 1058 |
|
| 1059 |
|
| 1060 |
cm_tophits_UpdateHitPositions(info->th, prv_pli_ntophits, dbsq->start, TRUE); |
| 1061 |
|
| 1062 |
|
| 1063 |
|
| 1064 |
|
| 1065 |
|
| 1066 |
|
| 1067 |
esl_sq_ReverseComplement(dbsq); |
| 1068 |
} |
| 1069 |
} |
| 1070 |
|
| 1071 |
status = esl_workqueue_WorkerUpdate(info->queue, block, &newBlock); |
| 1072 |
if (status != eslOK) esl_fatal("Work queue worker failed"); |
| 1073 |
|
| 1074 |
block = (ESL_SQ_BLOCK *) newBlock; |
| 1075 |
} |
| 1076 |
|
| 1077 |
status = esl_workqueue_WorkerUpdate(info->queue, block, NULL); |
| 1078 |
if (status != eslOK) esl_fatal("Work queue worker failed"); |
| 1079 |
|
| 1080 |
esl_threads_Finished(obj, workeridx); |
| 1081 |
return; |
| 1082 |
} |
| 1083 |
#endif |
| 1084 |
|
| 1085 |
#if HAVE_MPI |
| 1086 |
|
| 1087 |
|
| 1088 |
|
| 1089 |
|
| 1090 |
|
| 1091 |
|
| 1092 |
|
| 1093 |
|
| 1094 |
|
| 1095 |
|
| 1096 |
|
| 1097 |
|
| 1098 |
|
| 1099 |
|
| 1100 |
|
| 1101 |
|
| 1102 |
|
| 1103 |
|
| 1104 |
static int |
| 1105 |
mpi_master(ESL_GETOPTS *go, struct cfg_s *cfg) |
| 1106 |
{ |
| 1107 |
FILE *ofp = stdout; |
| 1108 |
FILE *afp = NULL; |
| 1109 |
FILE *tblfp = NULL; |
| 1110 |
|
| 1111 |
CM_FILE *cmfp; |
| 1112 |
ESL_SQFILE *dbfp = NULL; |
| 1113 |
ESL_SQ *dbsq = NULL; |
| 1114 |
ESL_ALPHABET *abc = NULL; |
| 1115 |
ESL_STOPWATCH *w = NULL; |
| 1116 |
ESL_STOPWATCH *mw = NULL; |
| 1117 |
int textw = 0; |
| 1118 |
int64_t cm_idx = 0; |
| 1119 |
int status = eslOK; |
| 1120 |
int hstatus = eslOK; |
| 1121 |
int sstatus = eslOK; |
| 1122 |
int dest; |
| 1123 |
|
| 1124 |
WORKER_INFO *info = NULL; |
| 1125 |
|
| 1126 |
int i; |
| 1127 |
|
| 1128 |
char *mpi_buf = NULL; |
| 1129 |
int mpi_size = 0; |
| 1130 |
MPI_BLOCK_LIST *block_list = NULL; |
| 1131 |
|
| 1132 |
int size; |
| 1133 |
MPI_Status mpistatus; |
| 1134 |
char errbuf[eslERRBUFSIZE]; |
| 1135 |
int64_t pkey_idx; |
| 1136 |
int64_t final_pkey_idx; |
| 1137 |
MPI_BLOCK *cur_block = NULL; |
| 1138 |
int64_t nseq = 0; |
| 1139 |
int64_t tot_nseq = 0; |
| 1140 |
int64_t noverlap = 0; |
| 1141 |
int64_t tot_noverlap = 0; |
| 1142 |
int nbps; |
| 1143 |
|
| 1144 |
w = esl_stopwatch_Create(); |
| 1145 |
mw = esl_stopwatch_Create(); |
| 1146 |
esl_stopwatch_Start(mw); |
| 1147 |
|
| 1148 |
if (esl_opt_GetBoolean(go, "--notextw")) textw = 0; |
| 1149 |
else textw = esl_opt_GetInteger(go, "--textw"); |
| 1150 |
|
| 1151 |
|
| 1152 |
if((status = open_dbfile (go, cfg, errbuf, &dbfp)) != eslOK) mpi_failure(errbuf); |
| 1153 |
|
| 1154 |
|
| 1155 |
if((status = cm_file_Open(cfg->cmfile, NULL, FALSE, &(cmfp), errbuf)) != eslOK) mpi_failure(errbuf); |
| 1156 |
|
| 1157 |
|
| 1158 |
if (esl_opt_IsOn(go, "-o") && (ofp = fopen(esl_opt_GetString(go, "-o"), "w")) == NULL) |
| 1159 |
mpi_failure("Failed to open output file %s for writing\n", esl_opt_GetString(go, "-o")); |
| 1160 |
|
| 1161 |
if (esl_opt_IsOn(go, "-A")) { |
| 1162 |
if ((afp = fopen(esl_opt_GetString(go, "-A"), "w")) == NULL) |
| 1163 |
mpi_failure("Failed to open alignment file %s for writing\n", esl_opt_GetString(go, "-A")); |
| 1164 |
} |
| 1165 |
|
| 1166 |
if (esl_opt_IsOn(go, "--tblout") && (tblfp = fopen(esl_opt_GetString(go, "--tblout"), "w")) == NULL) |
| 1167 |
mpi_failure("Failed to open tabular per-seq output file %s for writing\n", esl_opt_GetString(go, "--tblout")); |
| 1168 |
|
| 1169 |
|
| 1170 |
if((info = create_info(go)) == NULL) mpi_failure("Out of memory"); |
| 1171 |
|
| 1172 |
|
| 1173 |
hstatus = cm_file_Read(cmfp, TRUE, &abc, &(info->cm)); |
| 1174 |
|
| 1175 |
|
| 1176 |
if (hstatus == eslOK) { |
| 1177 |
|
| 1178 |
|
| 1179 |
|
| 1180 |
|
| 1181 |
|
| 1182 |
|
| 1183 |
|
| 1184 |
|
| 1185 |
if((status = mpi_open_dbfile_ssi(go, cfg, dbfp, errbuf)) != eslOK) mpi_failure(errbuf); |
| 1186 |
if(esl_opt_IsUsed(go, "-Z")) { |
| 1187 |
cfg->Z = (int64_t) (esl_opt_GetReal(go, "-Z") * 1000000.); |
| 1188 |
cfg->Z_setby = CM_ZSETBY_OPTION; |
| 1189 |
} |
| 1190 |
else { |
| 1191 |
esl_stopwatch_Start(w); |
| 1192 |
if((status = mpi_dbsize_using_ssi(go, cfg, dbfp, errbuf)) != eslOK) mpi_failure(errbuf); |
| 1193 |
esl_stopwatch_Stop(w); |
| 1194 |
if(esl_opt_GetBoolean(go, "--verbose")) esl_stopwatch_Display(ofp, w, "# MPI Determining Z CPU time: "); |
| 1195 |
} |
| 1196 |
|
| 1197 |
MPI_Bcast(&(cfg->Z), 1, MPI_LONG_LONG_INT, 0, MPI_COMM_WORLD); |
| 1198 |
|
| 1199 |
|
| 1200 |
|
| 1201 |
output_header(ofp, go, cfg->cmfile, cfg->dbfile, cfg->nproc); |
| 1202 |
dbsq = esl_sq_CreateDigital(abc); |
| 1203 |
} |
| 1204 |
|
| 1205 |
|
| 1206 |
while (hstatus == eslOK) { |
| 1207 |
cm_idx++; |
| 1208 |
esl_stopwatch_Start(w); |
| 1209 |
|
| 1210 |
|
| 1211 |
if(! (info->cm->flags & CMH_FP7)) mpi_failure("no filter HMM was read for CM: %s\n", info->cm->name); |
| 1212 |
|
| 1213 |
|
| 1214 |
|
| 1215 |
|
| 1216 |
|
| 1217 |
|
| 1218 |
|
| 1219 |
|
| 1220 |
nbps = CMCountNodetype(info->cm, MATP_nd); |
| 1221 |
if(( esl_opt_GetBoolean(go, "--nohmmonly")) || |
| 1222 |
( esl_opt_GetBoolean(go, "-g")) || |
| 1223 |
((! esl_opt_GetBoolean(go, "--hmmonly")) && (nbps > 0))) { |
| 1224 |
|
| 1225 |
if(! (info->cm->flags & CMH_EXPTAIL_STATS)) mpi_failure("no E-value parameters were read for CM: %s\n", info->cm->name); |
| 1226 |
} |
| 1227 |
|
| 1228 |
fprintf(ofp, "Query: %s [CLEN=%d]\n", info->cm->name, info->cm->clen); |
| 1229 |
if (info->cm->acc) fprintf(ofp, "Accession: %s\n", info->cm->acc); |
| 1230 |
if (info->cm->desc) fprintf(ofp, "Description: %s\n", info->cm->desc); |
| 1231 |
|
| 1232 |
|
| 1233 |
info->th = cm_tophits_Create(); |
| 1234 |
info->pli = cm_pipeline_Create(go, abc, info->cm->clen, 100, cfg->Z, cfg->Z_setby, CM_SEARCH_SEQS); |
| 1235 |
|
| 1236 |
|
| 1237 |
if((status = configure_cm(info)) != eslOK) mpi_failure(info->pli->errbuf); |
| 1238 |
if((status = setup_hmm_filter(go, info)) != eslOK) mpi_failure(info->pli->errbuf); |
| 1239 |
if((status = cm_pli_NewModel(info->pli, CM_NEWMODEL_CM, info->cm, info->cm->clen, info->cm->W, nbps, |
| 1240 |
info->om, info->bg, info->p7_evparam, info->om->max_length, cm_idx-1, |
| 1241 |
-1, NULL)) != eslOK) { |
| 1242 |
mpi_failure(info->pli->errbuf); |
| 1243 |
} |
| 1244 |
|
| 1245 |
|
| 1246 |
block_list = create_mpi_block_list(); |
| 1247 |
block_list->blocks[0] = create_mpi_block(); |
| 1248 |
block_list->N = 1; |
| 1249 |
|
| 1250 |
|
| 1251 |
pkey_idx = 0; |
| 1252 |
final_pkey_idx = dbfp->data.ascii.ssi->nprimary - 1; |
| 1253 |
sstatus = eslOK; |
| 1254 |
tot_noverlap = noverlap = 0; |
| 1255 |
tot_nseq = nseq = 0; |
| 1256 |
#ifdef HAVE_MPI |
| 1257 |
|
| 1258 |
if(esl_opt_IsUsed(go, "--sidx")) { |
| 1259 |
pkey_idx = esl_opt_GetInteger(go, "--sidx") - 1; |
| 1260 |
if(pkey_idx >= dbfp->data.ascii.ssi->nprimary) { |
| 1261 |
mpi_failure("--sidx %d is invalid because only %d sequences exist in the target db", pkey_idx+1, dbfp->data.ascii.ssi->nprimary); |
| 1262 |
} |
| 1263 |
} |
| 1264 |
if(esl_opt_IsUsed(go, "--eidx")) { |
| 1265 |
final_pkey_idx = esl_opt_GetInteger(go, "--eidx") - 1; |
| 1266 |
if(final_pkey_idx >= dbfp->data.ascii.ssi->nprimary) { |
| 1267 |
mpi_failure("--eidx %d is invalid because only %d sequences exist in the target db", final_pkey_idx+1, dbfp->data.ascii.ssi->nprimary); |
| 1268 |
} |
| 1269 |
if(final_pkey_idx < pkey_idx) { |
| 1270 |
mpi_failure("with --sidx <n1> --eidx <n2>, <n2> must be >= <n1>"); |
| 1271 |
} |
| 1272 |
} |
| 1273 |
|
| 1274 |
#endif |
| 1275 |
|
| 1276 |
while((pkey_idx <= final_pkey_idx) && |
| 1277 |
((sstatus = mpi_add_blocks(dbfp, dbsq, info->pli->maxW, errbuf, final_pkey_idx, block_list, &pkey_idx, &noverlap, &nseq)) == eslOK)) |
| 1278 |
{ |
| 1279 |
tot_noverlap += noverlap; |
| 1280 |
tot_nseq += nseq; |
| 1281 |
|
| 1282 |
cur_block = block_list->blocks[0]; |
| 1283 |
|
| 1284 |
while(cur_block != NULL && cur_block->complete) { |
| 1285 |
|
| 1286 |
if (MPI_Probe(MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &mpistatus) != 0) |
| 1287 |
mpi_failure("MPI error %d receiving message from %d\n", mpistatus.MPI_SOURCE); |
| 1288 |
|
| 1289 |
MPI_Get_count(&mpistatus, MPI_PACKED, &size); |
| 1290 |
if (mpi_buf == NULL || size > mpi_size) { |
| 1291 |
void *tmp; |
| 1292 |
ESL_RALLOC(mpi_buf, tmp, sizeof(char) * size); |
| 1293 |
mpi_size = size; |
| 1294 |
} |
| 1295 |
|
| 1296 |
dest = mpistatus.MPI_SOURCE; |
| 1297 |
MPI_Recv(mpi_buf, size, MPI_PACKED, dest, mpistatus.MPI_TAG, MPI_COMM_WORLD, &mpistatus); |
| 1298 |
|
| 1299 |
if (mpistatus.MPI_TAG == INFERNAL_ERROR_TAG) |
| 1300 |
mpi_failure("MPI client %d raised error:\n%s\n", dest, mpi_buf); |
| 1301 |
if (mpistatus.MPI_TAG != INFERNAL_READY_TAG) |
| 1302 |
mpi_failure("Unexpected tag %d from %d\n", mpistatus.MPI_TAG, dest); |
| 1303 |
|
| 1304 |
mpi_block_send(cur_block, dest, INFERNAL_BLOCK_TAG, MPI_COMM_WORLD, &mpi_buf, &mpi_size); |
| 1305 |
|
| 1306 |
|
| 1307 |
|
| 1308 |
free(cur_block); |
| 1309 |
for(i = 0; i < (block_list->N-1); i++) { |
| 1310 |
block_list->blocks[i] = block_list->blocks[i+1]; |
| 1311 |
} |
| 1312 |
block_list->blocks[(block_list->N-1)] = NULL; |
| 1313 |
block_list->N--; |
| 1314 |
cur_block = block_list->blocks[0]; |
| 1315 |
} |
| 1316 |
} |
| 1317 |
if(sstatus != eslOK) mpi_failure(errbuf); |
| 1318 |
|
| 1319 |
|
| 1320 |
cur_block = create_mpi_block(); |
| 1321 |
cur_block->complete = TRUE; |
| 1322 |
|
| 1323 |
|
| 1324 |
for (i = 1; i < cfg->nproc; ++i) { |
| 1325 |
if (MPI_Probe(MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &mpistatus) != 0) |
| 1326 |
mpi_failure("MPI error %d receiving message from %d\n", mpistatus.MPI_SOURCE); |
| 1327 |
|
| 1328 |
MPI_Get_count(&mpistatus, MPI_PACKED, &size); |
| 1329 |
if (mpi_buf == NULL || size > mpi_size) { |
| 1330 |
void *tmp; |
| 1331 |
ESL_RALLOC(mpi_buf, tmp, sizeof(char) * size); |
| 1332 |
mpi_size = size; |
| 1333 |
} |
| 1334 |
|
| 1335 |
dest = mpistatus.MPI_SOURCE; |
| 1336 |
MPI_Recv(mpi_buf, size, MPI_PACKED, dest, mpistatus.MPI_TAG, MPI_COMM_WORLD, &mpistatus); |
| 1337 |
|
| 1338 |
if (mpistatus.MPI_TAG == INFERNAL_ERROR_TAG) |
| 1339 |
mpi_failure("MPI client %d raised error:\n%s\n", dest, mpi_buf); |
| 1340 |
if (mpistatus.MPI_TAG != INFERNAL_READY_TAG) |
| 1341 |
mpi_failure("Unexpected tag %d from %d\n", mpistatus.MPI_TAG, dest); |
| 1342 |
} |
| 1343 |
|
| 1344 |
|
| 1345 |
for (dest = 1; dest < cfg->nproc; ++dest) { |
| 1346 |
CM_PIPELINE *mpi_pli = NULL; |
| 1347 |
CM_TOPHITS *mpi_th = NULL; |
| 1348 |
|
| 1349 |
|
| 1350 |
mpi_block_send(cur_block, dest, INFERNAL_BLOCK_TAG, MPI_COMM_WORLD, &mpi_buf, &mpi_size); |
| 1351 |
|
| 1352 |
|
| 1353 |
if ((status = cm_tophits_MPIRecv(dest, INFERNAL_TOPHITS_TAG, MPI_COMM_WORLD, &mpi_buf, &mpi_size, &mpi_th)) != eslOK) |
| 1354 |
mpi_failure("Unexpected error %d receiving tophits from %d", status, dest); |
| 1355 |
|
| 1356 |
if ((status = cm_pipeline_MPIRecv(dest, INFERNAL_PIPELINE_TAG, MPI_COMM_WORLD, &mpi_buf, &mpi_size, go, &mpi_pli)) != eslOK) |
| 1357 |
mpi_failure("Unexpected error %d receiving pipeline from %d", status, dest); |
| 1358 |
|
| 1359 |
|
| 1360 |
cm_tophits_Merge(info->th, mpi_th); |
| 1361 |
cm_pipeline_Merge(info->pli, mpi_pli); |
| 1362 |
|
| 1363 |
cm_pipeline_Destroy(mpi_pli, NULL); |
| 1364 |
cm_tophits_Destroy(mpi_th); |
| 1365 |
} |
| 1366 |
free(cur_block); cur_block = NULL; |
| 1367 |
|
| 1368 |
|
| 1369 |
info->pli->nseqs = tot_nseq; |
| 1370 |
if(info->pli->do_top && tot_noverlap > 0) cm_pli_AdjustNresForOverlaps(info->pli, tot_noverlap, FALSE); |
| 1371 |
if(info->pli->do_bot && tot_noverlap > 0) cm_pli_AdjustNresForOverlaps(info->pli, tot_noverlap, TRUE); |
| 1372 |
|
| 1373 |
|
| 1374 |
cm_tophits_SortForOverlapRemoval(info->th); |
| 1375 |
if((status = cm_tophits_RemoveOrMarkOverlaps(info->th, FALSE, errbuf)) != eslOK) mpi_failure(errbuf); |
| 1376 |
|
| 1377 |
|
| 1378 |
if(info->pli->do_trm_F3) cm_tophits_SortByPosition(info->th); |
| 1379 |
else cm_tophits_SortByEvalue(info[0].th); |
| 1380 |
|
| 1381 |
|
| 1382 |
cm_tophits_Threshold(info[0].th, info[0].pli); |
| 1383 |
|
| 1384 |
|
| 1385 |
for (i = 0; i < info->th->N; i++) { |
| 1386 |
if ((info->th->hit[i]->flags & CM_HIT_IS_REPORTED) || (info->th->hit[i]->flags & CM_HIT_IS_INCLUDED)) { |
| 1387 |
info->pli->acct[info->th->hit[i]->pass_idx].n_output++; |
| 1388 |
info->pli->acct[info->th->hit[i]->pass_idx].pos_output += llabs(info->th->hit[i]->stop - info->th->hit[i]->start) + 1; |
| 1389 |
} |
| 1390 |
} |
| 1391 |
|
| 1392 |
if(info->pli->do_trm_F3) { |
| 1393 |
cm_tophits_F3Targets(ofp, info->th, info->pli); |
| 1394 |
} |
| 1395 |
else { |
| 1396 |
cm_tophits_Targets(ofp, info->th, info->pli, textw); |
| 1397 |
} |
| 1398 |
fprintf(ofp, "\n\n"); |
| 1399 |
if(info->pli->show_alignments) { |
| 1400 |
if((status = cm_tophits_HitAlignments(ofp, info->th, info->pli, textw)) != eslOK) mpi_failure("Out of memory"); |
| 1401 |
fprintf(ofp, "\n\n"); |
| 1402 |
if(info->pli->be_verbose) { |
| 1403 |
cm_tophits_HitAlignmentStatistics(ofp, info->th, |
| 1404 |
(info->pli->cm_align_opts & CM_ALIGN_HBANDED), |
| 1405 |
(info->pli->cm_align_opts & CM_ALIGN_CYK), |
| 1406 |
info->pli->final_tau); |
| 1407 |
fprintf(ofp, "\n\n"); |
| 1408 |
} |
| 1409 |
} |
| 1410 |
if (tblfp != NULL) { |
| 1411 |
if(info->pli->do_trm_F3) { |
| 1412 |
cm_tophits_F3TabularTargets1(tblfp, info->th, info->pli, (cm_idx == 1)); |
| 1413 |
} |
| 1414 |
else { |
| 1415 |
if((! esl_opt_IsUsed(go, "--fmt")) || (esl_opt_GetInteger(go, "--fmt") == 1)) { |
| 1416 |
cm_tophits_TabularTargets1 (tblfp, info->cm->name, info->cm->acc, info->th, info->pli, (cm_idx == 1)); |
| 1417 |
} |
| 1418 |
else if(esl_opt_GetInteger(go, "--fmt") == 3) { |
| 1419 |
cm_tophits_TabularTargets3 (tblfp, info->cm->name, info->cm->acc, info->th, info->pli, (cm_idx == 1)); |
| 1420 |
} |
| 1421 |
|
| 1422 |
|
| 1423 |
} |
| 1424 |
fflush(tblfp); |
| 1425 |
} |
| 1426 |
esl_stopwatch_Stop(w); |
| 1427 |
cm_pli_Statistics(ofp, info->pli, w); |
| 1428 |
fflush(ofp); |
| 1429 |
|
| 1430 |
|
| 1431 |
if (afp) { |
| 1432 |
ESL_MSA *msa = NULL; |
| 1433 |
if((status = cm_tophits_Alignment(info->cm, info->th, errbuf, (! esl_opt_GetBoolean(go, "--nomiss")), &msa)) == eslOK) { |
| 1434 |
if(msa != NULL) { |
| 1435 |
if (textw > 0) esl_msafile_Write(afp, msa, eslMSAFILE_STOCKHOLM); |
| 1436 |
else esl_msafile_Write(afp, msa, eslMSAFILE_PFAM); |
| 1437 |
fprintf(ofp, "# Alignment of %d hits satisfying inclusion thresholds saved to: %s\n", msa->nseq, esl_opt_GetString(go, "-A")); |
| 1438 |
} |
| 1439 |
else { |
| 1440 |
fprintf(ofp, "# No hits satisfy inclusion thresholds; no alignment saved\n"); |
| 1441 |
} |
| 1442 |
esl_msa_Destroy(msa); |
| 1443 |
} |
| 1444 |
else { |
| 1445 |
mpi_failure(errbuf); |
| 1446 |
} |
| 1447 |
} |
| 1448 |
fprintf(ofp, "//\n"); |
| 1449 |
|
| 1450 |
free_info(info); |
| 1451 |
free(info); |
| 1452 |
free_mpi_block_list(block_list); |
| 1453 |
block_list = NULL; |
| 1454 |
|
| 1455 |
if((info = create_info(go)) == NULL) mpi_failure("Out of memory"); |
| 1456 |
|
| 1457 |
hstatus = cm_file_Read(cmfp, TRUE, &abc, &(info->cm)); |
| 1458 |
if(hstatus != eslOK) { free_info(info); free(info); } |
| 1459 |
} |
| 1460 |
|
| 1461 |
switch(hstatus) { |
| 1462 |
case eslEFORMAT: mpi_failure("bad file format in CM file %s\n%s", cfg->cmfile, cmfp->errbuf); break; |
| 1463 |
case eslEOF: break; |
| 1464 |
default: mpi_failure("Unexpected error (%d) in reading CMs from %s\n%s", hstatus, cfg->cmfile, cmfp->errbuf); |
| 1465 |
} |
| 1466 |
|
| 1467 |
|
| 1468 |
for (i = 1; i < cfg->nproc; ++i) |
| 1469 |
{ |
| 1470 |
if (MPI_Probe(MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &mpistatus) != 0) |
| 1471 |
mpi_failure("MPI error %d receiving message from %d\n", mpistatus.MPI_SOURCE); |
| 1472 |
|
| 1473 |
MPI_Get_count(&mpistatus, MPI_PACKED, &size); |
| 1474 |
if (mpi_buf == NULL || size > mpi_size) { |
| 1475 |
void *tmp; |
| 1476 |
ESL_RALLOC(mpi_buf, tmp, sizeof(char) * size); |
| 1477 |
mpi_size = size; |
| 1478 |
} |
| 1479 |
|
| 1480 |
dest = mpistatus.MPI_SOURCE; |
| 1481 |
MPI_Recv(mpi_buf, size, MPI_PACKED, dest, mpistatus.MPI_TAG, MPI_COMM_WORLD, &mpistatus); |
| 1482 |
|
| 1483 |
if (mpistatus.MPI_TAG == INFERNAL_ERROR_TAG) |
| 1484 |
mpi_failure("MPI client %d raised error:\n%s\n", dest, mpi_buf); |
| 1485 |
if (mpistatus.MPI_TAG != INFERNAL_TERMINATING_TAG) |
| 1486 |
mpi_failure("Unexpected tag %d from %d\n", mpistatus.MPI_TAG, dest); |
| 1487 |
} |
| 1488 |
|
| 1489 |
|
| 1490 |
|
| 1491 |
if (tblfp) cm_tophits_TabularTail(tblfp, "cmsearch", CM_SEARCH_SEQS, cfg->cmfile, cfg->dbfile, go); |
| 1492 |
fprintf(ofp, "[ok]\n"); |
| 1493 |
|
| 1494 |
esl_stopwatch_Stop(mw); |
| 1495 |
if(esl_opt_GetBoolean(go, "--verbose")) esl_stopwatch_Display(stdout, mw, "# Total CPU time:"); |
| 1496 |
|
| 1497 |
|
| 1498 |
|
| 1499 |
free(block_list); |
| 1500 |
if (mpi_buf != NULL) free(mpi_buf); |
| 1501 |
|
| 1502 |
cm_file_Close(cmfp); |
| 1503 |
esl_sqfile_Close(dbfp); |
| 1504 |
esl_alphabet_Destroy(abc); |
| 1505 |
esl_sq_Destroy(dbsq); |
| 1506 |
if(w != NULL) esl_stopwatch_Destroy(w); |
| 1507 |
if(mw != NULL) esl_stopwatch_Destroy(mw); |
| 1508 |
|
| 1509 |
if (ofp != stdout) fclose(ofp); |
| 1510 |
if (afp) fclose(afp); |
| 1511 |
if (tblfp) fclose(tblfp); |
| 1512 |
|
| 1513 |
return eslOK; |
| 1514 |
|
| 1515 |
ERROR: |
| 1516 |
return eslEMEM; |
| 1517 |
} |
| 1518 |
|
| 1519 |
|
| 1520 |
|
| 1521 |
|
| 1522 |
|
| 1523 |
|
| 1524 |
|
| 1525 |
|
| 1526 |
static int |
| 1527 |
mpi_worker(ESL_GETOPTS *go, struct cfg_s *cfg) |
| 1528 |
{ |
| 1529 |
ESL_ALPHABET *abc = NULL; |
| 1530 |
CM_FILE *cmfp; |
| 1531 |
ESL_SQFILE *dbfp = NULL; |
| 1532 |
ESL_STOPWATCH *w; |
| 1533 |
int status = eslOK; |
| 1534 |
int hstatus = eslOK; |
| 1535 |
int prv_pli_ntophits; |
| 1536 |
ESL_SQ *dbsq = NULL; |
| 1537 |
int64_t cm_idx = 0; |
| 1538 |
double eZ; |
| 1539 |
|
| 1540 |
WORKER_INFO *info = NULL; |
| 1541 |
|
| 1542 |
char *mpi_buf = NULL; |
| 1543 |
int mpi_size = 0; |
| 1544 |
|
| 1545 |
char errbuf[eslERRBUFSIZE]; |
| 1546 |
int64_t pkey_idx; |
| 1547 |
int64_t L; |
| 1548 |
int64_t seq_from, seq_to; |
| 1549 |
int64_t readL; |
| 1550 |
char *pkey; |
| 1551 |
|
| 1552 |
w = esl_stopwatch_Create(); |
| 1553 |
|
| 1554 |
|
| 1555 |
if((status = open_dbfile (go, cfg, errbuf, &dbfp)) != eslOK) mpi_failure(errbuf); |
| 1556 |
|
| 1557 |
|
| 1558 |
if((status = cm_file_Open(cfg->cmfile, NULL, FALSE, &(cmfp), errbuf)) != eslOK) mpi_failure(errbuf); |
| 1559 |
|
| 1560 |
|
| 1561 |
if((info = create_info(go)) == NULL) mpi_failure("Out of memory"); |
| 1562 |
|
| 1563 |
|
| 1564 |
hstatus = cm_file_Read(cmfp, TRUE, &abc, &(info->cm)); |
| 1565 |
|
| 1566 |
if (hstatus == eslOK) { |
| 1567 |
|
| 1568 |
|
| 1569 |
|
| 1570 |
|
| 1571 |
|
| 1572 |
if((status = mpi_open_dbfile_ssi(go, cfg, dbfp, errbuf)) != eslOK) mpi_failure(errbuf); |
| 1573 |
|
| 1574 |
MPI_Bcast(&(cfg->Z), 1, MPI_LONG_LONG_INT, 0, MPI_COMM_WORLD); |
| 1575 |
|
| 1576 |
|
| 1577 |
|
| 1578 |
|
| 1579 |
dbsq = esl_sq_CreateDigital(abc); |
| 1580 |
} |
| 1581 |
|
| 1582 |
|
| 1583 |
while (hstatus == eslOK) { |
| 1584 |
MPI_BLOCK *block; |
| 1585 |
|
| 1586 |
cm_idx++; |
| 1587 |
esl_stopwatch_Start(w); |
| 1588 |
|
| 1589 |
status = 0; |
| 1590 |
|
| 1591 |
MPI_Send(&status, 1, MPI_INT, 0, INFERNAL_READY_TAG, MPI_COMM_WORLD); |
| 1592 |
|
| 1593 |
|
| 1594 |
info->th = cm_tophits_Create(); |
| 1595 |
info->pli = cm_pipeline_Create(go, abc, info->cm->clen, 100, cfg->Z, cfg->Z_setby, CM_SEARCH_SEQS); |
| 1596 |
|
| 1597 |
|
| 1598 |
if((status = configure_cm(info)) != eslOK) mpi_failure(info->pli->errbuf); |
| 1599 |
if((status = setup_hmm_filter(go, info)) != eslOK) mpi_failure(info->pli->errbuf); |
| 1600 |
if((status = cm_pli_NewModel(info->pli, CM_NEWMODEL_CM, info->cm, info->cm->clen, info->cm->W, CMCountNodetype(info->cm, MATP_nd), |
| 1601 |
info->om, info->bg, info->p7_evparam, info->om->max_length, cm_idx-1, |
| 1602 |
-1, NULL)) != eslOK) { |
| 1603 |
mpi_failure(info->pli->errbuf); |
| 1604 |
} |
| 1605 |
|
| 1606 |
|
| 1607 |
if((status = mpi_block_recv(0, INFERNAL_BLOCK_TAG, MPI_COMM_WORLD, &mpi_buf, &mpi_size, &block)) != eslOK) mpi_failure("Failed to receive sequence block, error status code: %d\n", status); |
| 1608 |
|
| 1609 |
while(block->first_idx != -1) { |
| 1610 |
readL = 0; |
| 1611 |
pkey_idx = block->first_idx; |
| 1612 |
while(pkey_idx <= block->final_idx) |
| 1613 |
{ |
| 1614 |
|
| 1615 |
|
| 1616 |
if((status = esl_ssi_FindNumber(dbfp->data.ascii.ssi, pkey_idx, NULL, NULL, NULL, &L, &pkey)) != eslOK) { |
| 1617 |
if(status == eslENOTFOUND) mpi_failure("(worker) unable to find sequence %d in SSI index file", pkey_idx); |
| 1618 |
if(status == eslEFORMAT) mpi_failure("(worker) SSI index for database file is in incorrect format."); |
| 1619 |
if(status != eslOK) mpi_failure("(worker) problem with SSI index for database file."); |
| 1620 |
} |
| 1621 |
|
| 1622 |
|
| 1623 |
if((pkey_idx != block->first_idx) && (pkey_idx != block->final_idx)) { |
| 1624 |
|
| 1625 |
if((status = esl_sqio_Fetch(dbfp, pkey, dbsq)) != eslOK) mpi_failure("unable to fetch sequence %s\n", pkey); |
| 1626 |
seq_from = 1; |
| 1627 |
seq_to = L; |
| 1628 |
|
| 1629 |
} |
| 1630 |
else { |
| 1631 |
|
| 1632 |
seq_from = (pkey_idx == block->first_idx) ? block->first_from : 1; |
| 1633 |
seq_to = (pkey_idx == block->final_idx) ? block->final_to : L; |
| 1634 |
if((status = esl_sqio_FetchSubseq(dbfp, pkey, seq_from, seq_to, dbsq)) != eslOK) mpi_failure("unable to fetch subsequence %ld..%ld of %s\n", seq_from, seq_to, pkey); |
| 1635 |
|
| 1636 |
esl_sq_SetName(dbsq, dbsq->source); |
| 1637 |
|
| 1638 |
} |
| 1639 |
free(pkey); |
| 1640 |
|
| 1641 |
|
| 1642 |
cm_pli_NewSeq(info->pli, dbsq, pkey_idx); |
| 1643 |
readL += dbsq->n; |
| 1644 |
|
| 1645 |
|
| 1646 |
if (info->pli->do_top) { |
| 1647 |
prv_pli_ntophits = info->th->N; |
| 1648 |
if((status = cm_Pipeline(info->pli, info->cm->offset, info->om, info->bg, info->p7_evparam, info->msvdata, dbsq, info->th, FALSE, |
| 1649 |
NULL, &(info->gm), &(info->Rgm), &(info->Lgm), &(info->Tgm), &(info->cm))) != eslOK) |
| 1650 |
mpi_failure("cm_Pipeline() failed unexpected with status code %d\n%s\n", status, info->pli->errbuf); |
| 1651 |
cm_pipeline_Reuse(info->pli); |
| 1652 |
|
| 1653 |
|
| 1654 |
|
| 1655 |
if(seq_from != 1) cm_tophits_UpdateHitPositions(info->th, prv_pli_ntophits, seq_from, FALSE); |
| 1656 |
} |
| 1657 |
|
| 1658 |
|
| 1659 |
if(info->pli->do_bot && dbsq->abc->complement != NULL) { |
| 1660 |
esl_sq_ReverseComplement(dbsq); |
| 1661 |
prv_pli_ntophits = info->th->N; |
| 1662 |
if((status = cm_Pipeline(info->pli, info->cm->offset, info->om, info->bg, info->p7_evparam, info->msvdata, dbsq, info->th, TRUE, |
| 1663 |
NULL, &(info->gm), &(info->Rgm), &(info->Lgm), &(info->Tgm), &(info->cm))) != eslOK) |
| 1664 |
mpi_failure("cm_Pipeline() failed unexpected with status code %d\n%s\n", status, info->pli->errbuf); |
| 1665 |
cm_pipeline_Reuse(info->pli); |
| 1666 |
|
| 1667 |
|
| 1668 |
|
| 1669 |
|
| 1670 |
cm_tophits_UpdateHitPositions(info->th, prv_pli_ntophits, seq_to, TRUE); |
| 1671 |
} |
| 1672 |
esl_sq_Reuse(dbsq); |
| 1673 |
|
| 1674 |
pkey_idx++; |
| 1675 |
} |
| 1676 |
|
| 1677 |
if (block->blockL != readL) mpi_failure("Block length mismatch - expected %ld found %ld for block idx:%ld from:%ld\n", block->blockL, readL, block->first_idx, block->first_from); |
| 1678 |
|
| 1679 |
free(block); block = NULL; |
| 1680 |
|
| 1681 |
|
| 1682 |
status = 0; |
| 1683 |
MPI_Send(&status, 1, MPI_INT, 0, INFERNAL_READY_TAG, MPI_COMM_WORLD); |
| 1684 |
|
| 1685 |
|
| 1686 |
if((status = mpi_block_recv(0, INFERNAL_BLOCK_TAG, MPI_COMM_WORLD, &mpi_buf, &mpi_size, &block)) != eslOK) mpi_failure("Failed to receive sequence block, error status code: %d\n", status); |
| 1687 |
} |
| 1688 |
esl_stopwatch_Stop(w); |
| 1689 |
|
| 1690 |
free(block); block = NULL; |
| 1691 |
|
| 1692 |
|
| 1693 |
if(info->pli->do_hmmonly_cur) eZ = info->pli->Z / (float) info->om->max_length; |
| 1694 |
else eZ = info->cm->expA[info->pli->final_cm_exp_mode]->cur_eff_dbsize; |
| 1695 |
cm_tophits_ComputeEvalues(info->th, eZ, 0); |
| 1696 |
|
| 1697 |
cm_tophits_MPISend(info->th, 0, INFERNAL_TOPHITS_TAG, MPI_COMM_WORLD, &mpi_buf, &mpi_size); |
| 1698 |
cm_pipeline_MPISend(info->pli, 0, INFERNAL_PIPELINE_TAG, MPI_COMM_WORLD, &mpi_buf, &mpi_size); |
| 1699 |
|
| 1700 |
free_info(info); |
| 1701 |
free(info); |
| 1702 |
|
| 1703 |
if((info = create_info(go)) == NULL) mpi_failure("Out of memory"); |
| 1704 |
|
| 1705 |
hstatus = cm_file_Read(cmfp, TRUE, &abc, &(info->cm)); |
| 1706 |
if(hstatus != eslOK) { free_info(info); free(info); } |
| 1707 |
} |
| 1708 |
|
| 1709 |
switch(hstatus) { |
| 1710 |
case eslEFORMAT: mpi_failure("bad file format in CM file %s\n%s", cfg->cmfile, cmfp->errbuf); break; |
| 1711 |
case eslEOF: break; |
| 1712 |
default: mpi_failure("Unexpected error (%d) in reading CMs from %s\n%s", hstatus, cfg->cmfile, cmfp->errbuf); |
| 1713 |
} |
| 1714 |
|
| 1715 |
status = 0; |
| 1716 |
MPI_Send(&status, 1, MPI_INT, 0, INFERNAL_TERMINATING_TAG, MPI_COMM_WORLD); |
| 1717 |
|
| 1718 |
if (mpi_buf != NULL) free(mpi_buf); |
| 1719 |
|
| 1720 |
cm_file_Close(cmfp); |
| 1721 |
esl_sqfile_Close(dbfp); |
| 1722 |
|
| 1723 |
esl_sq_Destroy(dbsq); |
| 1724 |
|
| 1725 |
esl_alphabet_Destroy(abc); |
| 1726 |
esl_stopwatch_Destroy(w); |
| 1727 |
|
| 1728 |
return eslOK; |
| 1729 |
} |
| 1730 |
#endif |
| 1731 |
|
| 1732 |
|
| 1733 |
|
| 1734 |
|
| 1735 |
|
| 1736 |
|
| 1737 |
|
| 1738 |
static void |
| 1739 |
process_commandline(int argc, char **argv, ESL_GETOPTS **ret_go, char **ret_cmfile, char **ret_seqfile) |
| 1740 |
{ |
| 1741 |
ESL_GETOPTS *go = NULL; |
| 1742 |
char *devmsg = "*"; |
| 1743 |
int do_dev = FALSE; |
| 1744 |
|
| 1745 |
if ((go = esl_getopts_Create(options)) == NULL) cm_Fail("Internal failure creating options object"); |
| 1746 |
if (esl_opt_ProcessEnvironment(go) != eslOK) { printf("Failed to process environment: %s\n", go->errbuf); goto ERROR; } |
| 1747 |
if (esl_opt_ProcessCmdline(go, argc, argv) != eslOK) { printf("Failed to parse command line: %s\n", go->errbuf); goto ERROR; } |
| 1748 |
if (esl_opt_VerifyConfig(go) != eslOK) { printf("Failed to parse command line: %s\n", go->errbuf); goto ERROR; } |
| 1749 |
|
| 1750 |
|
| 1751 |
do_dev = esl_opt_GetBoolean(go, "--devhelp") ? TRUE : FALSE; |
| 1752 |
if (esl_opt_GetBoolean(go, "-h") || do_dev) { |
| 1753 |
cm_banner(stdout, argv[0], banner); |
| 1754 |
esl_usage(stdout, argv[0], usage); |
| 1755 |
|
| 1756 |
puts("\nBasic options:"); |
| 1757 |
esl_opt_DisplayHelp(stdout, go, 1, 2, 80); |
| 1758 |
|
| 1759 |
puts("\nOptions directing output:"); |
| 1760 |
esl_opt_DisplayHelp(stdout, go, 2, 2, 80); |
| 1761 |
|
| 1762 |
puts("\nOptions controlling reporting thresholds:"); |
| 1763 |
esl_opt_DisplayHelp(stdout, go, 3, 2, 80); |
| 1764 |
|
| 1765 |
puts("\nOptions controlling inclusion (significance) thresholds:"); |
| 1766 |
esl_opt_DisplayHelp(stdout, go, 4, 2, 80); |
| 1767 |
|
| 1768 |
puts("\nOptions controlling model-specific reporting thresholds:"); |
| 1769 |
esl_opt_DisplayHelp(stdout, go, 5, 2, 80); |
| 1770 |
|
| 1771 |
printf("\nOptions controlling acceleration heuristics%s:\n", do_dev ? "" : devmsg); |
| 1772 |
esl_opt_DisplayHelp(stdout, go, 6, 2, 100); |
| 1773 |
if(do_dev) { |
| 1774 |
puts("\nOptions for precise control of the CM filter pipeline:"); |
| 1775 |
esl_opt_DisplayHelp(stdout, go, 101, 2, 80); |
| 1776 |
puts("\nOptions controlling the HMM-only filter pipeline (run for models w/0 basepairs):"); |
| 1777 |
esl_opt_DisplayHelp(stdout, go, 102, 2, 80); |
| 1778 |
puts("\nOptions for precise control of HMM envelope definition:"); |
| 1779 |
esl_opt_DisplayHelp(stdout, go, 103, 2, 80); |
| 1780 |
puts("\nOptions for precise control of the CYK filter stage:"); |
| 1781 |
esl_opt_DisplayHelp(stdout, go, 104, 2, 80); |
| 1782 |
puts("\nOptions for precise control of the final stage:"); |
| 1783 |
esl_opt_DisplayHelp(stdout, go, 105, 2, 80); |
| 1784 |
puts("\nOptions for terminating after individual pipeline stages:"); |
| 1785 |
esl_opt_DisplayHelp(stdout, go, 106, 2, 80); |
| 1786 |
puts("\nOptions for timing pipeline stages:"); |
| 1787 |
esl_opt_DisplayHelp(stdout, go, 107, 2, 80); |
| 1788 |
} |
| 1789 |
|
| 1790 |
printf("\nOther options%s:\n", do_dev ? "" : devmsg); |
| 1791 |
esl_opt_DisplayHelp(stdout, go, 7, 2, 80); |
| 1792 |
if(do_dev) { |
| 1793 |
printf("\nOther expert options%s:\n", do_dev ? "" : devmsg); |
| 1794 |
esl_opt_DisplayHelp(stdout, go, 108, 2, 80); |
| 1795 |
} |
| 1796 |
else { |
| 1797 |
puts("\n*Use --devhelp to show additional expert options."); |
| 1798 |
} |
| 1799 |
exit(0); |
| 1800 |
} |
| 1801 |
|
| 1802 |
if (esl_opt_ArgNumber(go) != 2) { puts("Incorrect number of command line arguments."); goto ERROR; } |
| 1803 |
if ((*ret_cmfile = esl_opt_GetArg(go, 1)) == NULL) { puts("Failed to get <cmfile> argument on command line"); goto ERROR; } |
| 1804 |
if ((*ret_seqfile = esl_opt_GetArg(go, 2)) == NULL) { puts("Failed to get <seqdb> argument on command line"); goto ERROR; } |
| 1805 |
|
| 1806 |
if (strcmp(*ret_seqfile, "-") == 0) { puts("Can't read <seqdb> from stdout: don't use '-'"); goto ERROR; } |
| 1807 |
|
| 1808 |
|
| 1809 |
|
| 1810 |
|
| 1811 |
if (esl_opt_IsOn(go, "--glist")) { |
| 1812 |
puts("Failed to parse command line: --glist is an invalid cmsearch option (it only works with cmscan)"); |
| 1813 |
goto ERROR; |
| 1814 |
} |
| 1815 |
|
| 1816 |
|
| 1817 |
if (esl_opt_IsUsed(go, "--beta") && (! esl_opt_GetBoolean(go, "--qdb")) && |
| 1818 |
(! esl_opt_GetBoolean(go, "--nohmm")) && (! esl_opt_GetBoolean(go, "--max"))) { |
| 1819 |
puts("Failed to parse command line: --beta only makes sense in combination with --qdb, --nohmm or --max"); |
| 1820 |
goto ERROR; |
| 1821 |
} |
| 1822 |
|
| 1823 |
|
| 1824 |
if (esl_opt_IsUsed(go, "--fbeta") && (! esl_opt_GetBoolean(go, "--fqdb")) && (! esl_opt_GetBoolean(go, "--nohmm"))) { |
| 1825 |
puts("Failed to parse command line: --fbeta only makes sense in combination with --fqdb or --nohmm"); |
| 1826 |
goto ERROR; |
| 1827 |
} |
| 1828 |
|
| 1829 |
|
| 1830 |
|
| 1831 |
|
| 1832 |
|
| 1833 |
|
| 1834 |
|
| 1835 |
if ((esl_opt_GetBoolean(go, "--nohmm") && (! esl_opt_GetBoolean(go, "--fnonbanded")) && (! esl_opt_GetBoolean(go, "--nonbanded"))) || |
| 1836 |
(esl_opt_GetBoolean(go, "--qdb") && esl_opt_GetBoolean(go, "--fqdb"))) { |
| 1837 |
if(esl_opt_IsUsed(go, "--beta") && esl_opt_IsUsed(go, "--fbeta")) { |
| 1838 |
if((esl_opt_GetReal(go, "--beta") - esl_opt_GetReal(go, "--fbeta")) > 1E-20) { |
| 1839 |
puts("Failed to parse command line: with --nohmm --fbeta <x1> --beta <x2>, <x1> must be >= <x2>\n"); |
| 1840 |
goto ERROR; |
| 1841 |
} |
| 1842 |
} |
| 1843 |
else if(esl_opt_IsUsed(go, "--beta")) { |
| 1844 |
if((esl_opt_GetReal(go, "--beta") - esl_opt_GetReal(go, "--fbeta")) > 1E-20) { |
| 1845 |
printf("Failed to parse command line: with --nohmm --beta <x> (not in combination with --fbeta), <x> must be <= %g\n", esl_opt_GetReal(go, "--fbeta")); |
| 1846 |
goto ERROR; |
| 1847 |
} |
| 1848 |
} |
| 1849 |
else if(esl_opt_IsUsed(go, "--fbeta")) { |
| 1850 |
if((esl_opt_GetReal(go, "--beta") - esl_opt_GetReal(go, "--fbeta")) > 1E-20) { |
| 1851 |
printf("Failed to parse command line: with --nohmm --fbeta <x> (not in combination with --beta), <x> must be >= %g\n", esl_opt_GetReal(go, "--beta")); |
| 1852 |
goto ERROR; |
| 1853 |
} |
| 1854 |
} |
| 1855 |
} |
| 1856 |
|
| 1857 |
if((esl_opt_IsUsed(go, "--fmt")) && (esl_opt_GetInteger(go, "--fmt") == 3) && (esl_opt_IsUsed(go, "--trmF3"))) { |
| 1858 |
puts("--fmt 3 doesn't make sense in combination with --trmF3"); |
| 1859 |
goto ERROR; |
| 1860 |
} |
| 1861 |
if((esl_opt_IsUsed(go, "--fmt")) && (esl_opt_GetInteger(go, "--fmt") == 2)) { |
| 1862 |
puts("--fmt 2 only makes sense with cmscan, because cmsearch can't determine overlaps"); |
| 1863 |
goto ERROR; |
| 1864 |
} |
| 1865 |
|
| 1866 |
|
| 1867 |
|
| 1868 |
|
| 1869 |
|
| 1870 |
|
| 1871 |
|
| 1872 |
|
| 1873 |
if(esl_opt_IsUsed(go, "--max")) { |
| 1874 |
if(esl_opt_IsUsed(go, "--nohmm")) { puts("Failed to parse command line: Option --max is incompatible with option --nohmm"); goto ERROR; } |
| 1875 |
if(esl_opt_IsUsed(go, "--mid")) { puts("Failed to parse command line: Option --max is incompatible with option --mid"); goto ERROR; } |
| 1876 |
if(esl_opt_IsUsed(go, "--rfam")) { puts("Failed to parse command line: Option --max is incompatible with option --rfam"); goto ERROR; } |
| 1877 |
if(esl_opt_IsUsed(go, "--FZ")) { puts("Failed to parse command line: Option --max is incompatible with option --FZ"); goto ERROR; } |
| 1878 |
if(esl_opt_IsUsed(go, "--noF1")) { puts("Failed to parse command line: Option --max is incompatible with option --noF1"); goto ERROR; } |
| 1879 |
if(esl_opt_IsUsed(go, "--noF2")) { puts("Failed to parse command line: Option --max is incompatible with option --noF2"); goto ERROR; } |
| 1880 |
if(esl_opt_IsUsed(go, "--noF3")) { puts("Failed to parse command line: Option --max is incompatible with option --noF3"); goto ERROR; } |
| 1881 |
if(esl_opt_IsUsed(go, "--noF4")) { puts("Failed to parse command line: Option --max is incompatible with option --noF4"); goto ERROR; } |
| 1882 |
if(esl_opt_IsUsed(go, "--noF6")) { puts("Failed to parse command line: Option --max is incompatible with option --noF6"); goto ERROR; } |
| 1883 |
if(esl_opt_IsUsed(go, "--doF1b")) { puts("Failed to parse command line: Option --max is incompatible with option --doF1b"); goto ERROR; } |
| 1884 |
if(esl_opt_IsUsed(go, "--noF2b")) { puts("Failed to parse command line: Option --max is incompatible with option --noF2b"); goto ERROR; } |
| 1885 |
if(esl_opt_IsUsed(go, "--noF3b")) { puts("Failed to parse command line: Option --max is incompatible with option --noF3b"); goto ERROR; } |
| 1886 |
if(esl_opt_IsUsed(go, "--noF4b")) { puts("Failed to parse command line: Option --max is incompatible with option --noF4b"); goto ERROR; } |
| 1887 |
if(esl_opt_IsUsed(go, "--doF5b")) { puts("Failed to parse command line: Option --max is incompatible with option --doF5b"); goto ERROR; } |
| 1888 |
if(esl_opt_IsUsed(go, "--F1")) { puts("Failed to parse command line: Option --max is incompatible with option --F1"); goto ERROR; } |
| 1889 |
if(esl_opt_IsUsed(go, "--F1b")) { puts("Failed to parse command line: Option --max is incompatible with option --F1b"); goto ERROR; } |
| 1890 |
if(esl_opt_IsUsed(go, "--F2")) { puts("Failed to parse command line: Option --max is incompatible with option --F2"); goto ERROR; } |
| 1891 |
if(esl_opt_IsUsed(go, "--F2b")) { puts("Failed to parse command line: Option --max is incompatible with option --F2b"); goto ERROR; } |
| 1892 |
if(esl_opt_IsUsed(go, "--F3")) { puts("Failed to parse command line: Option --max is incompatible with option --F3"); goto ERROR; } |
| 1893 |
if(esl_opt_IsUsed(go, "--F3b")) { puts("Failed to parse command line: Option --max is incompatible with option --F3b"); goto ERROR; } |
| 1894 |
if(esl_opt_IsUsed(go, "--F4")) { puts("Failed to parse command line: Option --max is incompatible with option --F4"); goto ERROR; } |
| 1895 |
if(esl_opt_IsUsed(go, "--F4b")) { puts("Failed to parse command line: Option --max is incompatible with option --F4b"); goto ERROR; } |
| 1896 |
if(esl_opt_IsUsed(go, "--F5")) { puts("Failed to parse command line: Option --max is incompatible with option --F5"); goto ERROR; } |
| 1897 |
if(esl_opt_IsUsed(go, "--F6")) { puts("Failed to parse command line: Option --max is incompatible with option --F6"); goto ERROR; } |
| 1898 |
if(esl_opt_IsUsed(go, "--ftau")) { puts("Failed to parse command line: Option --max is incompatible with option --ftau"); goto ERROR; } |
| 1899 |
if(esl_opt_IsUsed(go, "--fsums")) { puts("Failed to parse command line: Option --max is incompatible with option --fsums"); goto ERROR; } |
| 1900 |
if(esl_opt_IsUsed(go, "--fqdb")) { puts("Failed to parse command line: Option --max is incompatible with option --fqdb"); goto ERROR; } |
| 1901 |
if(esl_opt_IsUsed(go, "--fbeta")) { puts("Failed to parse command line: Option --max is incompatible with option --fbeta"); goto ERROR; } |
| 1902 |
if(esl_opt_IsUsed(go, "--fnonbanded")) { puts("Failed to parse command line: Option --max is incompatible with option --fnonbanded"); goto ERROR; } |
| 1903 |
if(esl_opt_IsUsed(go, "--nocykenv")) { puts("Failed to parse command line: Option --max is incompatible with option --nocykenv"); goto ERROR; } |
| 1904 |
if(esl_opt_IsUsed(go, "--cykenvx")) { puts("Failed to parse command line: Option --max is incompatible with option --cykenvx"); goto ERROR; } |
| 1905 |
if(esl_opt_IsUsed(go, "--tau")) { puts("Failed to parse command line: Option --max is incompatible with option --tau"); goto ERROR; } |
| 1906 |
if(esl_opt_IsUsed(go, "--sums")) { puts("Failed to parse command line: Option --max is incompatible with option --sums"); goto ERROR; } |
| 1907 |
if(esl_opt_IsUsed(go, "--nonbanded")) { puts("Failed to parse command line: Option --max is incompatible with option --nonbanded"); goto ERROR; } |
| 1908 |
if(esl_opt_IsUsed(go, "--rt1")) { puts("Failed to parse command line: Option --max is incompatible with option --rt1"); goto ERROR; } |
| 1909 |
if(esl_opt_IsUsed(go, "--rt2")) { puts("Failed to parse command line: Option --max is incompatible with option --rt2"); goto ERROR; } |
| 1910 |
if(esl_opt_IsUsed(go, "--rt3")) { puts("Failed to parse command line: Option --max is incompatible with option --rt3"); goto ERROR; } |
| 1911 |
if(esl_opt_IsUsed(go, "--ns")) { puts("Failed to parse command line: Option --max is incompatible with option --ns"); goto ERROR; } |
| 1912 |
if(esl_opt_IsUsed(go, "--maxtau")) { puts("Failed to parse command line: Option --max is incompatible with option --maxtau"); goto ERROR; } |
| 1913 |
if(esl_opt_IsUsed(go, "--anytrunc")) { puts("Failed to parse command line: Option --max is incompatible with option --anytrunc"); goto ERROR; } |
| 1914 |
if(esl_opt_IsUsed(go, "--inttrunc")) { puts("Failed to parse command line: Option --max is incompatible with option --inttrunc"); goto ERROR; } |
| 1915 |
if(esl_opt_IsUsed(go, "--onlytrunc")) { puts("Failed to parse command line: Option --max is incompatible with option --onlytrunc"); goto ERROR; } |
| 1916 |
if(esl_opt_IsUsed(go, "--5trunc")) { puts("Failed to parse command line: Option --max is incompatible with option --5trunc"); goto ERROR; } |
| 1917 |
if(esl_opt_IsUsed(go, "--3trunc")) { puts("Failed to parse command line: Option --max is incompatible with option --3trunc"); goto ERROR; } |
| 1918 |
if(esl_opt_IsUsed(go, "--onepass")) { puts("Failed to parse command line: Option --max is incompatible with option --onepass"); goto ERROR; } |
| 1919 |
if(esl_opt_IsUsed(go, "--olonepass")) { puts("Failed to parse command line: Option --max is incompatible with option --olonepass"); goto ERROR; } |
| 1920 |
if(esl_opt_IsUsed(go, "--noiter")) { puts("Failed to parse command line: Option --max is incompatible with option --noiter"); goto ERROR; } |
| 1921 |
} |
| 1922 |
if(esl_opt_IsUsed(go, "--nohmm")) { |
| 1923 |
if(esl_opt_IsUsed(go, "--max")) { puts("Failed to parse command line: Option --nohmm is incompatible with option --max"); goto ERROR; } |
| 1924 |
if(esl_opt_IsUsed(go, "--mid")) { puts("Failed to parse command line: Option --nohmm is incompatible with option --mid"); goto ERROR; } |
| 1925 |
if(esl_opt_IsUsed(go, "--rfam")) { puts("Failed to parse command line: Option --nohmm is incompatible with option --rfam"); goto ERROR; } |
| 1926 |
if(esl_opt_IsUsed(go, "--FZ")) { puts("Failed to parse command line: Option --nohmm is incompatible with option --FZ"); goto ERROR; } |
| 1927 |
if(esl_opt_IsUsed(go, "--noF1")) { puts("Failed to parse command line: Option --nohmm is incompatible with option --noF1"); goto ERROR; } |
| 1928 |
if(esl_opt_IsUsed(go, "--noF2")) { puts("Failed to parse command line: Option --nohmm is incompatible with option --noF2"); goto ERROR; } |
| 1929 |
if(esl_opt_IsUsed(go, "--noF3")) { puts("Failed to parse command line: Option --nohmm is incompatible with option --noF3"); goto ERROR; } |
| 1930 |
if(esl_opt_IsUsed(go, "--noF4")) { puts("Failed to parse command line: Option --nohmm is incompatible with option --noF4"); goto ERROR; } |
| 1931 |
if(esl_opt_IsUsed(go, "--doF1b")) { puts("Failed to parse command line: Option --nohmm is incompatible with option --doF1b"); goto ERROR; } |
| 1932 |
if(esl_opt_IsUsed(go, "--noF2b")) { puts("Failed to parse command line: Option --nohmm is incompatible with option --noF2b"); goto ERROR; } |
| 1933 |
if(esl_opt_IsUsed(go, "--noF3b")) { puts("Failed to parse command line: Option --nohmm is incompatible with option --noF3b"); goto ERROR; } |
| 1934 |
if(esl_opt_IsUsed(go, "--noF4b")) { puts("Failed to parse command line: Option --nohmm is incompatible with option --noF4b"); goto ERROR; } |
| 1935 |
if(esl_opt_IsUsed(go, "--doF5b")) { puts("Failed to parse command line: Option --nohmm is incompatible with option --doF5b"); goto ERROR; } |
| 1936 |
if(esl_opt_IsUsed(go, "--F1")) { puts("Failed to parse command line: Option --nohmm is incompatible with option --F1"); goto ERROR; } |
| 1937 |
if(esl_opt_IsUsed(go, "--F1b")) { puts("Failed to parse command line: Option --nohmm is incompatible with option --F1b"); goto ERROR; } |
| 1938 |
if(esl_opt_IsUsed(go, "--F2")) { puts("Failed to parse command line: Option --nohmm is incompatible with option --F2"); goto ERROR; } |
| 1939 |
if(esl_opt_IsUsed(go, "--F2b")) { puts("Failed to parse command line: Option --nohmm is incompatible with option --F2b"); goto ERROR; } |
| 1940 |
if(esl_opt_IsUsed(go, "--F3")) { puts("Failed to parse command line: Option --nohmm is incompatible with option --F3"); goto ERROR; } |
| 1941 |
if(esl_opt_IsUsed(go, "--F3b")) { puts("Failed to parse command line: Option --nohmm is incompatible with option --F3b"); goto ERROR; } |
| 1942 |
if(esl_opt_IsUsed(go, "--F4")) { puts("Failed to parse command line: Option --nohmm is incompatible with option --F4"); goto ERROR; } |
| 1943 |
if(esl_opt_IsUsed(go, "--F4b")) { puts("Failed to parse command line: Option --nohmm is incompatible with option --F4b"); goto ERROR; } |
| 1944 |
if(esl_opt_IsUsed(go, "--F5")) { puts("Failed to parse command line: Option --nohmm is incompatible with option --F5"); goto ERROR; } |
| 1945 |
if(esl_opt_IsUsed(go, "--ftau")) { puts("Failed to parse command line: Option --nohmm is incompatible with option --ftau"); goto ERROR; } |
| 1946 |
if(esl_opt_IsUsed(go, "--fsums")) { puts("Failed to parse command line: Option --nohmm is incompatible with option --fsums"); goto ERROR; } |
| 1947 |
if(esl_opt_IsUsed(go, "--tau")) { puts("Failed to parse command line: Option --nohmm is incompatible with option --tau"); goto ERROR; } |
| 1948 |
if(esl_opt_IsUsed(go, "--sums")) { puts("Failed to parse command line: Option --nohmm is incompatible with option --sums"); goto ERROR; } |
| 1949 |
if(esl_opt_IsUsed(go, "--rt1")) { puts("Failed to parse command line: Option --nohmm is incompatible with option --rt1"); goto ERROR; } |
| 1950 |
if(esl_opt_IsUsed(go, "--rt2")) { puts("Failed to parse command line: Option --nohmm is incompatible with option --rt2"); goto ERROR; } |
| 1951 |
if(esl_opt_IsUsed(go, "--rt3")) { puts("Failed to parse command line: Option --nohmm is incompatible with option --rt3"); goto ERROR; } |
| 1952 |
if(esl_opt_IsUsed(go, "--ns")) { puts("Failed to parse command line: Option --nohmm is incompatible with option --ns"); goto ERROR; } |
| 1953 |
if(esl_opt_IsUsed(go, "--maxtau")) { puts("Failed to parse command line: Option --nohmm is incompatible with option --maxtau"); goto ERROR; } |
| 1954 |
if(esl_opt_IsUsed(go, "--anytrunc")) { puts("Failed to parse command line: Option --nohmm is incompatible with option --anytrunc"); goto ERROR; } |
| 1955 |
if(esl_opt_IsUsed(go, "--inttrunc")) { puts("Failed to parse command line: Option --nohmm is incompatible with option --inttrunc"); goto ERROR; } |
| 1956 |
if(esl_opt_IsUsed(go, "--onlytrunc")) { puts("Failed to parse command line: Option --nohmm is incompatible with option --onlytrunc"); goto ERROR; } |
| 1957 |
if(esl_opt_IsUsed(go, "--5trunc")) { puts("Failed to parse command line: Option --nohmm is incompatible with option --5trunc"); goto ERROR; } |
| 1958 |
if(esl_opt_IsUsed(go, "--3trunc")) { puts("Failed to parse command line: Option --nohmm is incompatible with option --3trunc"); goto ERROR; } |
| 1959 |
if(esl_opt_IsUsed(go, "--onepass")) { puts("Failed to parse command line: Option --nohmm is incompatible with option --onepass"); goto ERROR; } |
| 1960 |
if(esl_opt_IsUsed(go, "--olonepass")) { puts("Failed to parse command line: Option --nohmm is incompatible with option --olonepass"); goto ERROR; } |
| 1961 |
if(esl_opt_IsUsed(go, "--noiter")) { puts("Failed to parse command line: Option --nohmm is incompatible with option --noiter"); goto ERROR; } |
| 1962 |
} |
| 1963 |
if(esl_opt_IsUsed(go, "--mid")) { |
| 1964 |
if(esl_opt_IsUsed(go, "--max")) { puts("Failed to parse command line: Option --mid is incompatible with option --max"); goto ERROR; } |
| 1965 |
if(esl_opt_IsUsed(go, "--nohmm")) { puts("Failed to parse command line: Option --mid is incompatible with option --nohmm"); goto ERROR; } |
| 1966 |
if(esl_opt_IsUsed(go, "--rfam")) { puts("Failed to parse command line: Option --mid is incompatible with option --rfam"); goto ERROR; } |
| 1967 |
if(esl_opt_IsUsed(go, "--FZ")) { puts("Failed to parse command line: Option --mid is incompatible with option --FZ"); goto ERROR; } |
| 1968 |
if(esl_opt_IsUsed(go, "--noF1")) { puts("Failed to parse command line: Option --mid is incompatible with option --noF1"); goto ERROR; } |
| 1969 |
if(esl_opt_IsUsed(go, "--noF2")) { puts("Failed to parse command line: Option --mid is incompatible with option --noF2"); goto ERROR; } |
| 1970 |
if(esl_opt_IsUsed(go, "--noF3")) { puts("Failed to parse command line: Option --mid is incompatible with option --noF3"); goto ERROR; } |
| 1971 |
if(esl_opt_IsUsed(go, "--doF1b")) { puts("Failed to parse command line: Option --mid is incompatible with option --doF1b"); goto ERROR; } |
| 1972 |
if(esl_opt_IsUsed(go, "--noF2b")) { puts("Failed to parse command line: Option --mid is incompatible with option --noF2b"); goto ERROR; } |
| 1973 |
if(esl_opt_IsUsed(go, "--F1")) { puts("Failed to parse command line: Option --mid is incompatible with option --F1"); goto ERROR; } |
| 1974 |
if(esl_opt_IsUsed(go, "--F1b")) { puts("Failed to parse command line: Option --mid is incompatible with option --F1b"); goto ERROR; } |
| 1975 |
if(esl_opt_IsUsed(go, "--F2")) { puts("Failed to parse command line: Option --mid is incompatible with option --F2"); goto ERROR; } |
| 1976 |
if(esl_opt_IsUsed(go, "--F2b")) { puts("Failed to parse command line: Option --mid is incompatible with option --F2b"); goto ERROR; } |
| 1977 |
} |
| 1978 |
if(esl_opt_IsUsed(go, "--default")) { |
| 1979 |
if(esl_opt_IsUsed(go, "--max")) { puts("Failed to parse command line: Option --default is incompatible with option --max"); goto ERROR; } |
| 1980 |
if(esl_opt_IsUsed(go, "--nohmm")) { puts("Failed to parse command line: Option --default is incompatible with option --nohmm"); goto ERROR; } |
| 1981 |
if(esl_opt_IsUsed(go, "--rfam")) { puts("Failed to parse command line: Option --default is incompatible with option --rfam"); goto ERROR; } |
| 1982 |
if(esl_opt_IsUsed(go, "--FZ")) { puts("Failed to parse command line: Option --default is incompatible with option --FZ"); goto ERROR; } |
| 1983 |
} |
| 1984 |
if(esl_opt_IsUsed(go, "--rfam")) { |
| 1985 |
if(esl_opt_IsUsed(go, "--max")) { puts("Failed to parse command line: Option --rfam is incompatible with option --max"); goto ERROR; } |
| 1986 |
if(esl_opt_IsUsed(go, "--nohmm")) { puts("Failed to parse command line: Option --rfam is incompatible with option --nohmm"); goto ERROR; } |
| 1987 |
if(esl_opt_IsUsed(go, "--default")) { puts("Failed to parse command line: Option --rfam is incompatible with option --default"); goto ERROR; } |
| 1988 |
if(esl_opt_IsUsed(go, "--FZ")) { puts("Failed to parse command line: Option --rfam is incompatible with option --FZ"); goto ERROR; } |
| 1989 |
} |
| 1990 |
if(esl_opt_IsUsed(go, "--FZ")) { |
| 1991 |
if(esl_opt_IsUsed(go, "--max")) { puts("Failed to parse command line: Option --FZ is incompatible with option --max"); goto ERROR; } |
| 1992 |
if(esl_opt_IsUsed(go, "--nohmm")) { puts("Failed to parse command line: Option --FZ is incompatible with option --nohmm"); goto ERROR; } |
| 1993 |
if(esl_opt_IsUsed(go, "--default")) { puts("Failed to parse command line: Option --FZ is incompatible with option --default"); goto ERROR; } |
| 1994 |
if(esl_opt_IsUsed(go, "--rfam")) { puts("Failed to parse command line: Option --FZ is incompatible with option --rfam"); goto ERROR; } |
| 1995 |
} |
| 1996 |
if(esl_opt_IsUsed(go, "--hmmonly")) { |
| 1997 |
if(esl_opt_IsUsed(go, "--max")) { puts("Failed to parse command line: Option --hmmonly is incompatible with option --max"); goto ERROR; } |
| 1998 |
if(esl_opt_IsUsed(go, "--nohmm")) { puts("Failed to parse command line: Option --hmmonly is incompatible with option --nohmm"); goto ERROR; } |
| 1999 |
if(esl_opt_IsUsed(go, "--mid")) { puts("Failed to parse command line: Option --hmmonly is incompatible with option --mid"); goto ERROR; } |
| 2000 |
if(esl_opt_IsUsed(go, "--rfam")) { puts("Failed to parse command line: Option --hmmonly is incompatible with option --rfam"); goto ERROR; } |
| 2001 |
if(esl_opt_IsUsed(go, "--FZ")) { puts("Failed to parse command line: Option --hmmonly is incompatible with option --FZ"); goto ERROR; } |
| 2002 |
if(esl_opt_IsUsed(go, "--noF1")) { puts("Failed to parse command line: Option --hmmonly is incompatible with option --noF1"); goto ERROR; } |
| 2003 |
if(esl_opt_IsUsed(go, "--noF2")) { puts("Failed to parse command line: Option --hmmonly is incompatible with option --noF2"); goto ERROR; } |
| 2004 |
if(esl_opt_IsUsed(go, "--noF3")) { puts("Failed to parse command line: Option --hmmonly is incompatible with option --noF3"); goto ERROR; } |
| 2005 |
if(esl_opt_IsUsed(go, "--noF4")) { puts("Failed to parse command line: Option --hmmonly is incompatible with option --noF4"); goto ERROR; } |
| 2006 |
if(esl_opt_IsUsed(go, "--noF6")) { puts("Failed to parse command line: Option --hmmonly is incompatible with option --noF6"); goto ERROR; } |
| 2007 |
if(esl_opt_IsUsed(go, "--doF1b")) { puts("Failed to parse command line: Option --hmmonly is incompatible with option --doF1b"); goto ERROR; } |
| 2008 |
if(esl_opt_IsUsed(go, "--noF2b")) { puts("Failed to parse command line: Option --hmmonly is incompatible with option --noF2b"); goto ERROR; } |
| 2009 |
if(esl_opt_IsUsed(go, "--noF3b")) { puts("Failed to parse command line: Option --hmmonly is incompatible with option --noF3b"); goto ERROR; } |
| 2010 |
if(esl_opt_IsUsed(go, "--noF4b")) { puts("Failed to parse command line: Option --hmmonly is incompatible with option --noF4b"); goto ERROR; } |
| 2011 |
if(esl_opt_IsUsed(go, "--doF5b")) { puts("Failed to parse command line: Option --hmmonly is incompatible with option --doF5b"); goto ERROR; } |
| 2012 |
if(esl_opt_IsUsed(go, "--F1")) { puts("Failed to parse command line: Option --hmmonly is incompatible with option --F1"); goto ERROR; } |
| 2013 |
if(esl_opt_IsUsed(go, "--F1b")) { puts("Failed to parse command line: Option --hmmonly is incompatible with option --F1b"); goto ERROR; } |
| 2014 |
if(esl_opt_IsUsed(go, "--F2")) { puts("Failed to parse command line: Option --hmmonly is incompatible with option --F2"); goto ERROR; } |
| 2015 |
if(esl_opt_IsUsed(go, "--F2b")) { puts("Failed to parse command line: Option --hmmonly is incompatible with option --F2b"); goto ERROR; } |
| 2016 |
if(esl_opt_IsUsed(go, "--F3")) { puts("Failed to parse command line: Option --hmmonly is incompatible with option --F3"); goto ERROR; } |
| 2017 |
if(esl_opt_IsUsed(go, "--F3b")) { puts("Failed to parse command line: Option --hmmonly is incompatible with option --F3b"); goto ERROR; } |
| 2018 |
if(esl_opt_IsUsed(go, "--F4")) { puts("Failed to parse command line: Option --hmmonly is incompatible with option --F4"); goto ERROR; } |
| 2019 |
if(esl_opt_IsUsed(go, "--F4b")) { puts("Failed to parse command line: Option --hmmonly is incompatible with option --F4b"); goto ERROR; } |
| 2020 |
if(esl_opt_IsUsed(go, "--F5")) { puts("Failed to parse command line: Option --hmmonly is incompatible with option --F5"); goto ERROR; } |
| 2021 |
if(esl_opt_IsUsed(go, "--F6")) { puts("Failed to parse command line: Option --hmmonly is incompatible with option --F6"); goto ERROR; } |
| 2022 |
if(esl_opt_IsUsed(go, "--ftau")) { puts("Failed to parse command line: Option --hmmonly is incompatible with option --ftau"); goto ERROR; } |
| 2023 |
if(esl_opt_IsUsed(go, "--fsums")) { puts("Failed to parse command line: Option --hmmonly is incompatible with option --fsums"); goto ERROR; } |
| 2024 |
if(esl_opt_IsUsed(go, "--fqdb")) { puts("Failed to parse command line: Option --hmmonly is incompatible with option --fqdb"); goto ERROR; } |
| 2025 |
if(esl_opt_IsUsed(go, "--fbeta")) { puts("Failed to parse command line: Option --hmmonly is incompatible with option --fbeta"); goto ERROR; } |
| 2026 |
if(esl_opt_IsUsed(go, "--fnonbanded")) { puts("Failed to parse command line: Option --hmmonly is incompatible with option --fnonbanded"); goto ERROR; } |
| 2027 |
if(esl_opt_IsUsed(go, "--nocykenv")) { puts("Failed to parse command line: Option --hmmonly is incompatible with option --nocykenv"); goto ERROR; } |
| 2028 |
if(esl_opt_IsUsed(go, "--cykenvx")) { puts("Failed to parse command line: Option --hmmonly is incompatible with option --cykenvx"); goto ERROR; } |
| 2029 |
if(esl_opt_IsUsed(go, "--tau")) { puts("Failed to parse command line: Option --hmmonly is incompatible with option --tau"); goto ERROR; } |
| 2030 |
if(esl_opt_IsUsed(go, "--sums")) { puts("Failed to parse command line: Option --hmmonly is incompatible with option --sums"); goto ERROR; } |
| 2031 |
if(esl_opt_IsUsed(go, "--qdb")) { puts("Failed to parse command line: Option --hmmonly is incompatible with option --qdb"); goto ERROR; } |
| 2032 |
if(esl_opt_IsUsed(go, "--beta")) { puts("Failed to parse command line: Option --hmmonly is incompatible with option --beta"); goto ERROR; } |
| 2033 |
if(esl_opt_IsUsed(go, "--nonbanded")) { puts("Failed to parse command line: Option --hmmonly is incompatible with option --nonbanded"); goto ERROR; } |
| 2034 |
if(esl_opt_IsUsed(go, "--maxtau")) { puts("Failed to parse command line: Option --hmmonly is incompatible with option --maxtau"); goto ERROR; } |
| 2035 |
if(esl_opt_IsUsed(go, "--anytrunc")) { puts("Failed to parse command line: Option --hmmonly is incompatible with option --anytrunc"); goto ERROR; } |
| 2036 |
if(esl_opt_IsUsed(go, "--inttrunc")) { puts("Failed to parse command line: Option --hmmonly is incompatible with option --inttrunc"); goto ERROR; } |
| 2037 |
if(esl_opt_IsUsed(go, "--onlytrunc")) { puts("Failed to parse command line: Option --hmmonly is incompatible with option --onlytrunc"); goto ERROR; } |
| 2038 |
if(esl_opt_IsUsed(go, "--5trunc")) { puts("Failed to parse command line: Option --hmmonly is incompatible with option --5trunc"); goto ERROR; } |
| 2039 |
if(esl_opt_IsUsed(go, "--3trunc")) { puts("Failed to parse command line: Option --hmmonly is incompatible with option --3trunc"); goto ERROR; } |
| 2040 |
if(esl_opt_IsUsed(go, "--onepass")) { puts("Failed to parse command line: Option --hmmonly is incompatible with option --onepass"); goto ERROR; } |
| 2041 |
if(esl_opt_IsUsed(go, "--olonepass")) { puts("Failed to parse command line: Option --hmmonly is incompatible with option --olonepass"); goto ERROR; } |
| 2042 |
if(esl_opt_IsUsed(go, "--noiter")) { puts("Failed to parse command line: Option --hmmonly is incompatible with option --noiter"); goto ERROR; } |
| 2043 |
if(esl_opt_IsUsed(go, "--mxsize")) { puts("Failed to parse command line: Option --hmmonly is incompatible with option --mxsize"); goto ERROR; } |
| 2044 |
if(esl_opt_IsUsed(go, "--smxsize")) { puts("Failed to parse command line: Option --hmmonly is incompatible with option --smxsize"); goto ERROR; } |
| 2045 |
if(esl_opt_IsUsed(go, "--nonull3")) { puts("Failed to parse command line: Option --hmmonly is incompatible with option --nonull3"); goto ERROR; } |
| 2046 |
if(esl_opt_IsUsed(go, "--nohmmonly")) { puts("Failed to parse command line: Option --hmmonly is incompatible with option --nohmmonly"); goto ERROR; } |
| 2047 |
if(esl_opt_IsUsed(go, "--timeF4")) { puts("Failed to parse command line: Option --hmmonly is incompatible with option --timeF4"); goto ERROR; } |
| 2048 |
if(esl_opt_IsUsed(go, "--timeF5")) { puts("Failed to parse command line: Option --hmmonly is incompatible with option --timeF5"); goto ERROR; } |
| 2049 |
if(esl_opt_IsUsed(go, "--timeF6")) { puts("Failed to parse command line: Option --hmmonly is incompatible with option --timeF6"); goto ERROR; } |
| 2050 |
if(esl_opt_IsUsed(go, "--nogreedy")) { puts("Failed to parse command line: Option --hmmonly is incompatible with option --nogreedy"); goto ERROR; } |
| 2051 |
if(esl_opt_IsUsed(go, "--cp9noel")) { puts("Failed to parse command line: Option --hmmonly is incompatible with option --cp9noel"); goto ERROR; } |
| 2052 |
if(esl_opt_IsUsed(go, "--cp9gloc")) { puts("Failed to parse command line: Option --hmmonly is incompatible with option --cp9gloc"); goto ERROR; } |
| 2053 |
if(esl_opt_IsUsed(go, "--null2")) { puts("Failed to parse command line: Option --hmmonly is incompatible with option --null2"); goto ERROR; } |
| 2054 |
} |
| 2055 |
|
| 2056 |
|
| 2057 |
|
| 2058 |
|
| 2059 |
|
| 2060 |
if(esl_opt_IsUsed(go, "-E")) { |
| 2061 |
if((esl_opt_IsUsed(go, "-T")) || (esl_opt_IsUsed(go, "--cut_ga")) || (esl_opt_IsUsed(go, "--cut_nc")) || (esl_opt_IsUsed(go, "--cut_tc"))) { |
| 2062 |
puts("Failed to parse command line: Option -E is incompatible with -T,--cut_ga,--cut_nc,--cut_tc"); |
| 2063 |
goto ERROR; |
| 2064 |
} |
| 2065 |
} |
| 2066 |
if(esl_opt_IsUsed(go, "-T")) { |
| 2067 |
if((esl_opt_IsUsed(go, "-E")) || (esl_opt_IsUsed(go, "--cut_ga")) || (esl_opt_IsUsed(go, "--cut_nc")) || (esl_opt_IsUsed(go, "--cut_tc"))) { |
| 2068 |
puts("Failed to parse command line: Option -T is incompatible with -E,--cut_ga,--cut_nc,--cut_tc"); |
| 2069 |
goto ERROR; |
| 2070 |
} |
| 2071 |
} |
| 2072 |
if(esl_opt_IsUsed(go, "--incE")) { |
| 2073 |
if((esl_opt_IsUsed(go, "--incT")) || (esl_opt_IsUsed(go, "--cut_ga")) || (esl_opt_IsUsed(go, "--cut_nc")) || (esl_opt_IsUsed(go, "--cut_tc"))) { |
| 2074 |
puts("Failed to parse command line: Option --incE is incompatible with --incT,--cut_ga,--cut_nc,--cut_tc"); |
| 2075 |
goto ERROR; |
| 2076 |
} |
| 2077 |
} |
| 2078 |
if(esl_opt_IsUsed(go, "--incT")) { |
| 2079 |
if((esl_opt_IsUsed(go, "--incE")) || (esl_opt_IsUsed(go, "--cut_ga")) || (esl_opt_IsUsed(go, "--cut_nc")) || (esl_opt_IsUsed(go, "--cut_tc"))) { |
| 2080 |
puts("Failed to parse command line: Option --incT is incompatible with --incE,--cut_ga,--cut_nc,--cut_tc"); |
| 2081 |
goto ERROR; |
| 2082 |
} |
| 2083 |
} |
| 2084 |
if(esl_opt_IsUsed(go, "--cut_ga")) { |
| 2085 |
if((esl_opt_IsUsed(go, "-E")) || (esl_opt_IsUsed(go, "-T")) || (esl_opt_IsUsed(go, "--incE")) || (esl_opt_IsUsed(go, "--incT")) || (esl_opt_IsUsed(go, "--cut_nc")) || (esl_opt_IsUsed(go, "--cut_tc"))) { |
| 2086 |
puts("Failed to parse command line: Option --cut_ga is incompatible with -E,-T,--incE,--incT,--cut_nc,--cut_tc"); |
| 2087 |
goto ERROR; |
| 2088 |
} |
| 2089 |
} |
| 2090 |
if(esl_opt_IsUsed(go, "--cut_nc")) { |
| 2091 |
if((esl_opt_IsUsed(go, "-E")) || (esl_opt_IsUsed(go, "-T")) || (esl_opt_IsUsed(go, "--incE")) || (esl_opt_IsUsed(go, "--incT")) || (esl_opt_IsUsed(go, "--cut_ga")) || (esl_opt_IsUsed(go, "--cut_tc"))) { |
| 2092 |
puts("Failed to parse command line: Option --cut_nc is incompatible with -E,-T,--incE,--incT,--cut_ga,--cut_tc"); |
| 2093 |
goto ERROR; |
| 2094 |
} |
| 2095 |
} |
| 2096 |
if(esl_opt_IsUsed(go, "--cut_tc")) { |
| 2097 |
if((esl_opt_IsUsed(go, "-E")) || (esl_opt_IsUsed(go, "-T")) || (esl_opt_IsUsed(go, "--incE")) || (esl_opt_IsUsed(go, "--incT")) || (esl_opt_IsUsed(go, "--cut_ga")) || (esl_opt_IsUsed(go, "--cut_nc"))) { |
| 2098 |
puts("Failed to parse command line: Option --cut_tc is incompatible with -E,-T,--incE,--incT,--cut_ga,--cut_nc"); |
| 2099 |
goto ERROR; |
| 2100 |
} |
| 2101 |
} |
| 2102 |
|
| 2103 |
|
| 2104 |
|
| 2105 |
if(esl_opt_IsUsed(go, "--notrunc")) { |
| 2106 |
if((esl_opt_IsUsed(go, "--anytrunc")) || (esl_opt_IsUsed(go, "--inttrunc")) || (esl_opt_IsUsed(go, "--onlytrunc")) || (esl_opt_IsUsed(go, "--5trunc")) || (esl_opt_IsUsed(go, "--3trunc"))) { |
| 2107 |
puts("Failed to parse command line: Option --notrunc is incompatible with --anytrunc,--inttrunc,--onlytrunc,--5trunc,--3trunc"); |
| 2108 |
goto ERROR; |
| 2109 |
} |
| 2110 |
} |
| 2111 |
if(esl_opt_IsUsed(go, "--anytrunc")) { |
| 2112 |
if((esl_opt_IsUsed(go, "-g")) || (esl_opt_IsUsed(go, "--notrunc")) || (esl_opt_IsUsed(go, "--inttrunc")) || (esl_opt_IsUsed(go, "--onlytrunc")) || (esl_opt_IsUsed(go, "--5trunc")) || (esl_opt_IsUsed(go, "--3trunc"))) { |
| 2113 |
puts("Failed to parse command line: Option --anytrunc is incompatible with -g,--notrunc,--inttrunc,--onlytrunc,--5trunc,--3trunc"); |
| 2114 |
goto ERROR; |
| 2115 |
} |
| 2116 |
} |
| 2117 |
if(esl_opt_IsUsed(go, "-g")) { |
| 2118 |
if((esl_opt_IsUsed(go, "--anytrunc")) || (esl_opt_IsUsed(go, "--inttrunc")) || (esl_opt_IsUsed(go, "--onlytrunc")) || (esl_opt_IsUsed(go, "--5trunc")) || (esl_opt_IsUsed(go, "--3trunc"))) { |
| 2119 |
puts("Failed to parse command line: Option -g is incompatible with --anytrunc,--inttrunc,--onlytrunc,--5trunc,--3trunc"); |
| 2120 |
goto ERROR; |
| 2121 |
} |
| 2122 |
} |
| 2123 |
if(esl_opt_IsUsed(go, "--onlytrunc")) { |
| 2124 |
if((esl_opt_IsUsed(go, "-g")) || (esl_opt_IsUsed(go, "--anytrunc")) || (esl_opt_IsUsed(go, "--inttrunc")) || (esl_opt_IsUsed(go, "--notrunc")) || (esl_opt_IsUsed(go, "--5trunc")) || (esl_opt_IsUsed(go, "--3trunc"))) { |
| 2125 |
puts("Failed to parse command line: Option --onlytrunc is incompatible with -g,--anytrunc,--inttrunc,--notrunc,--5trunc,--3trunc"); |
| 2126 |
goto ERROR; |
| 2127 |
} |
| 2128 |
} |
| 2129 |
if(esl_opt_IsUsed(go, "--5trunc")) { |
| 2130 |
if((esl_opt_IsUsed(go, "-g")) || (esl_opt_IsUsed(go, "--anytrunc")) || (esl_opt_IsUsed(go, "--inttrunc")) || (esl_opt_IsUsed(go, "--notrunc")) || (esl_opt_IsUsed(go, "--onlytrunc")) || (esl_opt_IsUsed(go, "--3trunc"))) { |
| 2131 |
puts("Failed to parse command line: Option --5trunc is incompatible with -g,--anytrunc,--inttrunc,--notrunc,--onlytrunc,--3trunc"); |
| 2132 |
goto ERROR; |
| 2133 |
} |
| 2134 |
} |
| 2135 |
if(esl_opt_IsUsed(go, "--3trunc")) { |
| 2136 |
if((esl_opt_IsUsed(go, "-g")) || (esl_opt_IsUsed(go, "--anytrunc")) || (esl_opt_IsUsed(go, "--inttrunc")) || (esl_opt_IsUsed(go, "--notrunc")) || (esl_opt_IsUsed(go, "--onlytrunc")) || (esl_opt_IsUsed(go, "--5trunc"))) { |
| 2137 |
puts("Failed to parse command line: Option --5trunc is incompatible with -g,--anytrunc,--inttrunc,--notrunc,--onlytrunc,--5trunc"); |
| 2138 |
goto ERROR; |
| 2139 |
} |
| 2140 |
} |
| 2141 |
|
| 2142 |
|
| 2143 |
|
| 2144 |
if(esl_opt_IsUsed(go, "--timeF1")) { |
| 2145 |
if((esl_opt_IsUsed(go, "--timeF2")) || (esl_opt_IsUsed(go, "--timeF3")) || (esl_opt_IsUsed(go, "--timeF4")) || (esl_opt_IsUsed(go, "--timeF5")) || (esl_opt_IsUsed(go, "--timeF6"))) { |
| 2146 |
puts("Failed to parse command line: Option --timeF1 is incompatible with --timeF2,--timeF3,--timeF4,--timeF5,--timeF6"); |
| 2147 |
goto ERROR; |
| 2148 |
} |
| 2149 |
} |
| 2150 |
if(esl_opt_IsUsed(go, "--timeF2")) { |
| 2151 |
if((esl_opt_IsUsed(go, "--timeF1")) || (esl_opt_IsUsed(go, "--timeF3")) || (esl_opt_IsUsed(go, "--timeF4")) || (esl_opt_IsUsed(go, "--timeF5")) || (esl_opt_IsUsed(go, "--timeF6"))) { |
| 2152 |
puts("Failed to parse command line: Option --timeF2 is incompatible with --timeF1,--timeF3,--timeF4,--timeF5,--timeF6"); |
| 2153 |
goto ERROR; |
| 2154 |
} |
| 2155 |
} |
| 2156 |
if(esl_opt_IsUsed(go, "--timeF3")) { |
| 2157 |
if((esl_opt_IsUsed(go, "--timeF1")) || (esl_opt_IsUsed(go, "--timeF2")) || (esl_opt_IsUsed(go, "--timeF4")) || (esl_opt_IsUsed(go, "--timeF5")) || (esl_opt_IsUsed(go, "--timeF6"))) { |
| 2158 |
puts("Failed to parse command line: Option --timeF2 is incompatible with --timeF1,--timeF2,--timeF4,--timeF5,--timeF6"); |
| 2159 |
goto ERROR; |
| 2160 |
} |
| 2161 |
} |
| 2162 |
if(esl_opt_IsUsed(go, "--timeF4")) { |
| 2163 |
if((esl_opt_IsUsed(go, "--timeF1")) || (esl_opt_IsUsed(go, "--timeF2")) || (esl_opt_IsUsed(go, "--timeF3")) || (esl_opt_IsUsed(go, "--timeF5")) || (esl_opt_IsUsed(go, "--timeF6"))) { |
| 2164 |
puts("Failed to parse command line: Option --timeF4 is incompatible with --timeF1,--timeF2,--timeF3,--timeF5,--timeF6"); |
| 2165 |
goto ERROR; |
| 2166 |
} |
| 2167 |
} |
| 2168 |
if(esl_opt_IsUsed(go, "--timeF5")) { |
| 2169 |
if((esl_opt_IsUsed(go, "--timeF1")) || (esl_opt_IsUsed(go, "--timeF2")) || (esl_opt_IsUsed(go, "--timeF3")) || (esl_opt_IsUsed(go, "--timeF4")) || (esl_opt_IsUsed(go, "--timeF6"))) { |
| 2170 |
puts("Failed to parse command line: Option --timeF5 is incompatible with --timeF1,--timeF2,--timeF3,--timeF4,--timeF6"); |
| 2171 |
goto ERROR; |
| 2172 |
} |
| 2173 |
} |
| 2174 |
if(esl_opt_IsUsed(go, "--timeF6")) { |
| 2175 |
if((esl_opt_IsUsed(go, "--timeF1")) || (esl_opt_IsUsed(go, "--timeF2")) || (esl_opt_IsUsed(go, "--timeF3")) || (esl_opt_IsUsed(go, "--timeF4")) || (esl_opt_IsUsed(go, "--timeF5"))) { |
| 2176 |
puts("Failed to parse command line: Option --timeF6 is incompatible with --timeF1,--timeF2,--timeF3,--timeF4,--timeF5"); |
| 2177 |
goto ERROR; |
| 2178 |
} |
| 2179 |
} |
| 2180 |
if(esl_opt_IsUsed(go, "--trmF3")) { |
| 2181 |
if((esl_opt_IsUsed(go, "--timeF1")) || (esl_opt_IsUsed(go, "--timeF2")) || (esl_opt_IsUsed(go, "--timeF3")) || (esl_opt_IsUsed(go, "--timeF4")) || (esl_opt_IsUsed(go, "--timeF5")) || (esl_opt_IsUsed(go, "--timeF6"))) { |
| 2182 |
puts("Failed to parse command line: Option --trmF3 is incompatible with --timeF1,--timeF2,--timeF3,--timeF4,--timeF5,--timeF6"); |
| 2183 |
goto ERROR; |
| 2184 |
} |
| 2185 |
} |
| 2186 |
|
| 2187 |
|
| 2188 |
if(esl_opt_IsUsed(go, "--hmmmax")) { |
| 2189 |
if((esl_opt_IsUsed(go, "--hmmF1")) || (esl_opt_IsUsed(go, "--hmmF2")) || (esl_opt_IsUsed(go, "--hmmF3")) || (esl_opt_IsUsed(go, "--hmmnobias"))) { |
| 2190 |
puts("Failed to parse command line: Option --hmmmax is incompatible with --hmmF1,--hmmF2,--hmmF3,--hmmnobias"); |
| 2191 |
goto ERROR; |
| 2192 |
} |
| 2193 |
} |
| 2194 |
|
| 2195 |
|
| 2196 |
if(esl_opt_IsUsed(go, "--fnonbanded")) { |
| 2197 |
if((esl_opt_IsUsed(go, "--ftau")) || (esl_opt_IsUsed(go, "--fsums")) || (esl_opt_IsUsed(go, "--fqdb")) || (esl_opt_IsUsed(go, "--fbeta"))) { |
| 2198 |
puts("Failed to parse command line: Option --fnonbanded is incompatible with --ftau,--fsums,--fqdb,--fbeta"); |
| 2199 |
goto ERROR; |
| 2200 |
} |
| 2201 |
} |
| 2202 |
|
| 2203 |
|
| 2204 |
if(esl_opt_IsUsed(go, "--nonbanded")) { |
| 2205 |
if((esl_opt_IsUsed(go, "--tau")) || (esl_opt_IsUsed(go, "--sums")) || (esl_opt_IsUsed(go, "--qdb")) || (esl_opt_IsUsed(go, "--beta"))) { |
| 2206 |
puts("Failed to parse command line: Option --nonbanded is incompatible with --tau,--sums,--qdb,--beta"); |
| 2207 |
goto ERROR; |
| 2208 |
} |
| 2209 |
} |
| 2210 |
|
| 2211 |
|
| 2212 |
if(esl_opt_IsUsed(go, "--olonepass")) { |
| 2213 |
if((esl_opt_IsUsed(go, "--nohmm")) || (esl_opt_IsUsed(go, "--qdb")) || (esl_opt_IsUsed(go, "--fqdb")) || (esl_opt_IsUsed(go, "--onepass"))) { |
| 2214 |
puts("Failed to parse command line: Option --olonepass is incompatible with --nohmm,--qdb,--fqdb,--onepass"); |
| 2215 |
goto ERROR; |
| 2216 |
} |
| 2217 |
} |
| 2218 |
|
| 2219 |
|
| 2220 |
*ret_go = go; |
| 2221 |
return; |
| 2222 |
|
| 2223 |
ERROR: |
| 2224 |
esl_usage(stdout, argv[0], usage); |
| 2225 |
puts("\nwhere basic options are:"); |
| 2226 |
esl_opt_DisplayHelp(stdout, go, 1, 2, 80); |
| 2227 |
printf("\nTo see more help on available options, do %s -h\n\n", argv[0]); |
| 2228 |
exit(1); |
| 2229 |
} |
| 2230 |
|
| 2231 |
static int |
| 2232 |
output_header(FILE *ofp, const ESL_GETOPTS *go, char *cmfile, char *seqfile, int ncpus) |
| 2233 |
{ |
| 2234 |
cm_banner(ofp, go->argv[0], banner); |
| 2235 |
|
| 2236 |
fprintf(ofp, "# query CM file: %s\n", cmfile); |
| 2237 |
fprintf(ofp, "# target sequence database: %s\n", seqfile); |
| 2238 |
if (esl_opt_IsUsed(go, "-g")) fprintf(ofp, "# CM configuration: glocal\n"); |
| 2239 |
if (esl_opt_IsUsed(go, "-Z")) fprintf(ofp, "# database size is set to: %.1f Mb\n", esl_opt_GetReal(go, "-Z")); |
| 2240 |
if (esl_opt_IsUsed(go, "-o")) fprintf(ofp, "# output directed to file: %s\n", esl_opt_GetString(go, "-o")); |
| 2241 |
if (esl_opt_IsUsed(go, "-A")) fprintf(ofp, "# MSA of significant hits saved to file: %s\n", esl_opt_GetString(go, "-A")); |
| 2242 |
if (esl_opt_IsUsed(go, "--tblout")) fprintf(ofp, "# tabular output of hits: %s\n", esl_opt_GetString(go, "--tblout")); |
| 2243 |
if (esl_opt_IsUsed(go, "--acc")) fprintf(ofp, "# prefer accessions over names: yes\n"); |
| 2244 |
if (esl_opt_IsUsed(go, "--noali")) fprintf(ofp, "# show alignments in output: no\n"); |
| 2245 |
if (esl_opt_IsUsed(go, "--notextw")) fprintf(ofp, "# max ASCII text line length: unlimited\n"); |
| 2246 |
if (esl_opt_IsUsed(go, "--textw")) fprintf(ofp, "# max ASCII text line length: %d\n", esl_opt_GetInteger(go, "--textw")); |
| 2247 |
if (esl_opt_IsUsed(go, "--verbose")) fprintf(ofp, "# verbose output mode: on\n"); |
| 2248 |
if (esl_opt_IsUsed(go, "-E")) fprintf(ofp, "# sequence reporting threshold: E-value <= %g\n", esl_opt_GetReal(go, "-E")); |
| 2249 |
if (esl_opt_IsUsed(go, "-T")) fprintf(ofp, "# sequence reporting threshold: score >= %g\n", esl_opt_GetReal(go, "-T")); |
| 2250 |
if (esl_opt_IsUsed(go, "--incE")) fprintf(ofp, "# sequence inclusion threshold: E-value <= %g\n", esl_opt_GetReal(go, "--incE")); |
| 2251 |
if (esl_opt_IsUsed(go, "--incT")) fprintf(ofp, "# sequence inclusion threshold: score >= %g\n", esl_opt_GetReal(go, "--incT")); |
| 2252 |
if (esl_opt_IsUsed(go, "--cut_ga")) fprintf(ofp, "# model-specific thresholding: GA cutoffs\n"); |
| 2253 |
if (esl_opt_IsUsed(go, "--cut_nc")) fprintf(ofp, "# model-specific thresholding: NC cutoffs\n"); |
| 2254 |
if (esl_opt_IsUsed(go, "--cut_tc")) fprintf(ofp, "# model-specific thresholding: TC cutoffs\n"); |
| 2255 |
if (esl_opt_IsUsed(go, "--max")) fprintf(ofp, "# Max sensitivity mode: on [all heuristic filters off]\n"); |
| 2256 |
if (esl_opt_IsUsed(go, "--nohmm")) fprintf(ofp, "# CM-only mode: on [HMM filters off]\n"); |
| 2257 |
if (esl_opt_IsUsed(go, "--mid")) fprintf(ofp, "# HMM MSV and Viterbi filters: off\n"); |
| 2258 |
if (esl_opt_IsUsed(go, "--rfam")) fprintf(ofp, "# Rfam pipeline mode: on [strict filtering]\n"); |
| 2259 |
if (esl_opt_IsUsed(go, "--FZ")) fprintf(ofp, "# Filters set as if DB size in Mb is: %f\n", esl_opt_GetReal(go, "--FZ")); |
| 2260 |
if (esl_opt_IsUsed(go, "--Fmid")) fprintf(ofp, "# HMM Forward filter thresholds set to: %g\n", esl_opt_GetReal(go, "--Fmid")); |
| 2261 |
if (esl_opt_IsUsed(go, "--hmmonly")) fprintf(ofp, "# HMM-only mode (for all models): on [CM will not be used]\n"); |
| 2262 |
if (esl_opt_IsUsed(go, "--notrunc")) fprintf(ofp, "# truncated sequence detection: off\n"); |
| 2263 |
if (esl_opt_IsUsed(go, "--anytrunc")) fprintf(ofp, "# allowing truncated sequences anywhere: on\n"); |
| 2264 |
if (esl_opt_IsUsed(go, "--inttrunc")) fprintf(ofp, "# allowing internally truncated seqs: on\n"); |
| 2265 |
if (esl_opt_IsUsed(go, "--onlytrunc")) fprintf(ofp, "# only allowing truncated seqs anywhere: on\n"); |
| 2266 |
if (esl_opt_IsUsed(go, "--5trunc")) fprintf(ofp, "# allowing 5' truncated seqs only: on\n"); |
| 2267 |
if (esl_opt_IsUsed(go, "--3trunc")) fprintf(ofp, "# allowing 3' truncated seqs only: on\n"); |
| 2268 |
if (esl_opt_IsUsed(go, "--nonull3")) fprintf(ofp, "# null3 bias corrections: off\n"); |
| 2269 |
if (esl_opt_IsUsed(go, "--mxsize")) fprintf(ofp, "# maximum DP alignment matrix size: %.1f Mb\n", esl_opt_GetReal(go, "--mxsize")); |
| 2270 |
if (esl_opt_IsUsed(go, "--smxsize")) fprintf(ofp, "# maximum DP search matrix size: %.1f Mb\n", esl_opt_GetReal(go, "--smxsize")); |
| 2271 |
if (esl_opt_IsUsed(go, "--cyk")) fprintf(ofp, "# use CYK for final search stage on\n"); |
| 2272 |
if (esl_opt_IsUsed(go, "--acyk")) fprintf(ofp, "# use CYK to align hits: on\n"); |
| 2273 |
if (esl_opt_IsUsed(go, "--wcx")) fprintf(ofp, "# W set as <x> * cm->clen: <x>=%g\n", esl_opt_GetReal(go, "--wcx")); |
| 2274 |
if (esl_opt_IsUsed(go, "--onepass")) fprintf(ofp, "# using CM for best HMM pass only: on\n"); |
| 2275 |
if (esl_opt_IsUsed(go, "--olonepass")) fprintf(ofp, "# using CM for best HMM pass only (ol): on\n"); |
| 2276 |
if (esl_opt_IsUsed(go, "--noiter")) fprintf(ofp, "# iterative HMM band tightening: off\n"); |
| 2277 |
if (esl_opt_IsUsed(go, "--toponly")) fprintf(ofp, "# search top-strand only: on\n"); |
| 2278 |
if (esl_opt_IsUsed(go, "--bottomonly")) fprintf(ofp, "# search bottom-strand only: on\n"); |
| 2279 |
if (esl_opt_IsUsed(go, "--tformat")) fprintf(ofp, "# targ <seqdb> format asserted: %s\n", esl_opt_GetString(go, "--tformat")); |
| 2280 |
#ifdef HAVE_MPI |
| 2281 |
if (esl_opt_IsUsed(go, "--stall")) fprintf(ofp, "# MPI stall mode: on\n"); |
| 2282 |
#endif |
| 2283 |
|
| 2284 |
if (esl_opt_IsUsed(go, "--noF1")) fprintf(ofp, "# HMM MSV filter: off\n"); |
| 2285 |
if (esl_opt_IsUsed(go, "--noF2")) fprintf(ofp, "# HMM Vit filter: off\n"); |
| 2286 |
if (esl_opt_IsUsed(go, "--noF3")) fprintf(ofp, "# HMM Fwd filter: off\n"); |
| 2287 |
if (esl_opt_IsUsed(go, "--noF4")) fprintf(ofp, "# HMM glocal Fwd filter: off\n"); |
| 2288 |
if (esl_opt_IsUsed(go, "--noF6")) fprintf(ofp, "# CM CYK filter: off\n"); |
| 2289 |
if (esl_opt_IsUsed(go, "--doF1b")) fprintf(ofp, "# HMM MSV biased comp filter: on\n"); |
| 2290 |
if (esl_opt_IsUsed(go, "--noF2b")) fprintf(ofp, "# HMM Vit biased comp filter: off\n"); |
| 2291 |
if (esl_opt_IsUsed(go, "--noF3b")) fprintf(ofp, "# HMM Fwd biased comp filter: off\n"); |
| 2292 |
if (esl_opt_IsUsed(go, "--noF4b")) fprintf(ofp, "# HMM gFwd biased comp filter: off\n"); |
| 2293 |
if (esl_opt_IsUsed(go, "--doF5b")) fprintf(ofp, "# HMM per-envelope biased comp filter: on\n"); |
| 2294 |
if (esl_opt_IsUsed(go, "--F1")) fprintf(ofp, "# HMM MSV filter P threshold: <= %g\n", esl_opt_GetReal(go, "--F1")); |
| 2295 |
if (esl_opt_IsUsed(go, "--F1b")) fprintf(ofp, "# HMM MSV bias P threshold: <= %g\n", esl_opt_GetReal(go, "--F1b")); |
| 2296 |
if (esl_opt_IsUsed(go, "--F2")) fprintf(ofp, "# HMM Vit filter P threshold: <= %g\n", esl_opt_GetReal(go, "--F2")); |
| 2297 |
if (esl_opt_IsUsed(go, "--F2b")) fprintf(ofp, "# HMM Vit bias P threshold: <= %g\n", esl_opt_GetReal(go, "--F2b")); |
| 2298 |
if (esl_opt_IsUsed(go, "--F3")) fprintf(ofp, "# HMM Fwd filter P threshold: <= %g\n", esl_opt_GetReal(go, "--F3")); |
| 2299 |
if (esl_opt_IsUsed(go, "--F3b")) fprintf(ofp, "# HMM Fwd bias P threshold: <= %g\n", esl_opt_GetReal(go, "--F3b")); |
| 2300 |
if (esl_opt_IsUsed(go, "--F4")) fprintf(ofp, "# HMM glocal Fwd filter P threshold: <= %g\n", esl_opt_GetReal(go, "--F4")); |
| 2301 |
if (esl_opt_IsUsed(go, "--F4b")) fprintf(ofp, "# HMM glocal Fwd bias P threshold: <= %g\n", esl_opt_GetReal(go, "--F4b")); |
| 2302 |
if (esl_opt_IsUsed(go, "--F5")) fprintf(ofp, "# HMM env defn filter P threshold: <= %g\n", esl_opt_GetReal(go, "--F5")); |
| 2303 |
if (esl_opt_IsUsed(go, "--F5b")) fprintf(ofp, "# HMM env defn bias P threshold: <= %g\n", esl_opt_GetReal(go, "--F5b")); |
| 2304 |
if (esl_opt_IsUsed(go, "--F6")) fprintf(ofp, "# CM CYK filter P threshold: <= %g\n", esl_opt_GetReal(go, "--F6")); |
| 2305 |
|
| 2306 |
if (esl_opt_IsUsed(go, "--hmmmax")) fprintf(ofp, "# max sensitivity mode (HMM-only): on [all heuristic filters off]\n"); |
| 2307 |
if (esl_opt_IsUsed(go, "--hmmF1")) fprintf(ofp, "# HMM MSV filter P threshold (HMM-only) <= %g\n", esl_opt_GetReal(go, "--hmmF1")); |
| 2308 |
if (esl_opt_IsUsed(go, "--hmmF2")) fprintf(ofp, "# HMM Vit filter P threshold (HMM-only) <= %g\n", esl_opt_GetReal(go, "--hmmF2")); |
| 2309 |
if (esl_opt_IsUsed(go, "--hmmF3")) fprintf(ofp, "# HMM Fwd filter P threshold (HMM-only) <= %g\n", esl_opt_GetReal(go, "--hmmF3")); |
| 2310 |
if (esl_opt_IsUsed(go, "--hmmnobias")) fprintf(ofp, "# HMM MSV biased comp filter (HMM-only) off\n"); |
| 2311 |
if (esl_opt_IsUsed(go, "--hmmnonull2")) fprintf(ofp, "# null2 bias corrections (HMM-only): off\n"); |
| 2312 |
if (esl_opt_IsUsed(go, "--nohmmonly")) fprintf(ofp, "# HMM-only mode for 0 basepair models: no\n"); |
| 2313 |
|
| 2314 |
if (esl_opt_IsUsed(go, "--rt1")) fprintf(ofp, "# domain definition rt1 parameter %g\n", esl_opt_GetReal(go, "--rt1")); |
| 2315 |
if (esl_opt_IsUsed(go, "--rt2")) fprintf(ofp, "# domain definition rt2 parameter %g\n", esl_opt_GetReal(go, "--rt2")); |
| 2316 |
if (esl_opt_IsUsed(go, "--rt3")) fprintf(ofp, "# domain definition rt3 parameter %g\n", esl_opt_GetReal(go, "--rt3")); |
| 2317 |
if (esl_opt_IsUsed(go, "--ns")) fprintf(ofp, "# number of envelope tracebacks sampled %d\n", esl_opt_GetInteger(go, "--ns")); |
| 2318 |
|
| 2319 |
if (esl_opt_IsUsed(go, "--ftau")) fprintf(ofp, "# tau parameter for CYK filter stage: %g\n", esl_opt_GetReal(go, "--ftau")); |
| 2320 |
if (esl_opt_IsUsed(go, "--fsums")) fprintf(ofp, "# posterior sums (CYK filter stage): on\n"); |
| 2321 |
if (esl_opt_IsUsed(go, "--fqdb")) fprintf(ofp, "# QDBs (CYK filter stage) on\n"); |
| 2322 |
if (esl_opt_IsUsed(go, "--fbeta")) fprintf(ofp, "# beta parameter for CYK filter stage: %g\n", esl_opt_GetReal(go, "--fbeta")); |
| 2323 |
if (esl_opt_IsUsed(go, "--fnonbanded")) fprintf(ofp, "# no bands (CYK filter stage) on\n"); |
| 2324 |
if (esl_opt_IsUsed(go, "--nocykenv")) fprintf(ofp, "# CYK envelope redefinition: off\n"); |
| 2325 |
if (esl_opt_IsUsed(go, "--cykenvx")) fprintf(ofp, "# CYK envelope redefn P-val multiplier: %d\n", esl_opt_GetInteger(go, "--cykenvx")); |
| 2326 |
|
| 2327 |
if (esl_opt_IsUsed(go, "--tau")) fprintf(ofp, "# tau parameter for final stage: %g\n", esl_opt_GetReal(go, "--tau")); |
| 2328 |
if (esl_opt_IsUsed(go, "--sums")) fprintf(ofp, "# posterior sums (final stage): on\n"); |
| 2329 |
if (esl_opt_IsUsed(go, "--qdb")) fprintf(ofp, "# QDBs (final stage) on\n"); |
| 2330 |
if (esl_opt_IsUsed(go, "--beta")) fprintf(ofp, "# beta parameter for final stage: %g\n", esl_opt_GetReal(go, "--beta")); |
| 2331 |
if (esl_opt_IsUsed(go, "--nonbanded")) fprintf(ofp, "# no bands (final stage) on\n"); |
| 2332 |
|
| 2333 |
if (esl_opt_IsUsed(go, "--timeF1")) fprintf(ofp, "# abort after Stage 1 MSV (for timing) on\n"); |
| 2334 |
if (esl_opt_IsUsed(go, "--timeF2")) fprintf(ofp, "# abort after Stage 2 Vit (for timing) on\n"); |
| 2335 |
if (esl_opt_IsUsed(go, "--timeF3")) fprintf(ofp, "# abort after Stage 3 Fwd (for timing) on\n"); |
| 2336 |
if (esl_opt_IsUsed(go, "--timeF4")) fprintf(ofp, "# abort after Stage 4 gFwd (for timing) on\n"); |
| 2337 |
if (esl_opt_IsUsed(go, "--timeF5")) fprintf(ofp, "# abort after Stage 5 env defn (for timing) on\n"); |
| 2338 |
if (esl_opt_IsUsed(go, "--timeF6")) fprintf(ofp, "# abort after Stage 6 CYK (for timing) on\n"); |
| 2339 |
|
| 2340 |
if (esl_opt_IsUsed(go, "--trmF3")) fprintf(ofp, "# terminate after Stage 3 Fwd: on\n"); |
| 2341 |
|
| 2342 |
if (esl_opt_IsUsed(go, "--nogreedy")) fprintf(ofp, "# greedy CM hit resolution: off\n"); |
| 2343 |
if (esl_opt_IsUsed(go, "--cp9noel")) fprintf(ofp, "# CP9 HMM local ends: off\n"); |
| 2344 |
if (esl_opt_IsUsed(go, "--cp9gloc")) fprintf(ofp, "# CP9 HMM configuration: glocal\n"); |
| 2345 |
if (esl_opt_IsUsed(go, "--null2")) fprintf(ofp, "# null2 bias corrections: on\n"); |
| 2346 |
if (esl_opt_IsUsed(go, "--maxtau")) fprintf(ofp, "# max tau during band tightening: %g\n", esl_opt_GetReal(go, "--maxtau")); |
| 2347 |
if (esl_opt_IsUsed(go, "--seed")) { |
| 2348 |
if (esl_opt_GetInteger(go, "--seed") == 0) fprintf(ofp, "# random number seed: one-time arbitrary\n"); |
| 2349 |
else fprintf(ofp, "# random number seed set to: %d\n", esl_opt_GetInteger(go, "--seed")); |
| 2350 |
} |
| 2351 |
#ifdef HAVE_MPI |
| 2352 |
if (esl_opt_IsUsed(go, "--sidx")) fprintf(ofp, "# first target sequence to search: %d\n", esl_opt_GetInteger(go, "--sidx")); |
| 2353 |
if (esl_opt_IsUsed(go, "--eidx")) fprintf(ofp, "# final target sequence to search: %d\n", esl_opt_GetInteger(go, "--eidx")); |
| 2354 |
#endif |
| 2355 |
|
| 2356 |
|
| 2357 |
|
| 2358 |
|
| 2359 |
if(! (esl_opt_IsUsed(go, "--notrunc"))) { |
| 2360 |
if(esl_opt_IsUsed(go, "--max")) { fprintf(ofp, "# truncated hit detection: off [due to --max]\n"); } |
| 2361 |
if(esl_opt_IsUsed(go, "--nohmm")) { fprintf(ofp, "# truncated hit detection: off [due to --nohmm]\n"); } |
| 2362 |
} |
| 2363 |
|
| 2364 |
int output_ncpu = FALSE; |
| 2365 |
#ifdef HAVE_MPI |
| 2366 |
if (esl_opt_IsUsed(go, "--mpi")) { fprintf(ofp, "# MPI: on [%d processors]\n", ncpus); output_ncpu = TRUE; } |
| 2367 |
#endif |
| 2368 |
#ifdef HMMER_THREADS |
| 2369 |
if (! output_ncpu) { fprintf(ofp, "# number of worker threads: %d%s\n", ncpus, (esl_opt_IsUsed(go, "--cpu") ? " [--cpu]" : "")); output_ncpu = TRUE; } |
| 2370 |
#endif |
| 2371 |
if (! output_ncpu) { fprintf(ofp, "# number of worker threads: 0 [serial mode; threading unavailable]\n"); } |
| 2372 |
fprintf(ofp, "# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n\n"); |
| 2373 |
return eslOK; |
| 2374 |
} |
| 2375 |
|
| 2376 |
|
| 2377 |
|
| 2378 |
|
| 2379 |
|
| 2380 |
|
| 2381 |
|
| 2382 |
|
| 2383 |
|
| 2384 |
static int |
| 2385 |
open_dbfile(ESL_GETOPTS *go, struct cfg_s *cfg, char *errbuf, ESL_SQFILE **ret_dbfp) |
| 2386 |
{ |
| 2387 |
int status; |
| 2388 |
int dbfmt = eslSQFILE_UNKNOWN; |
| 2389 |
|
| 2390 |
if (esl_opt_IsOn(go, "--tformat")) { |
| 2391 |
dbfmt = esl_sqio_EncodeFormat(esl_opt_GetString(go, "--tformat")); |
| 2392 |
if (dbfmt == eslSQFILE_UNKNOWN) ESL_FAIL(eslEINVAL, errbuf, "%s is not a recognized sequence database file format\n", esl_opt_GetString(go, "--tformat")); |
| 2393 |
} |
| 2394 |
status = esl_sqfile_Open(cfg->dbfile, dbfmt, p7_SEQDBENV, ret_dbfp); |
| 2395 |
if (status == eslENOTFOUND) ESL_FAIL(status, errbuf, "Failed to open sequence file %s for reading\n", cfg->dbfile); |
| 2396 |
else if (status == eslEFORMAT) ESL_FAIL(status, errbuf, "Sequence file %s is empty or misformatted\n", cfg->dbfile); |
| 2397 |
else if (status == eslEINVAL) ESL_FAIL(status, errbuf, "Can't autodetect format of a stdin or .gz seqfile"); |
| 2398 |
else if (status != eslOK) ESL_FAIL(status, errbuf, "Unexpected error %d opening sequence file %s\n", status, cfg->dbfile); |
| 2399 |
|
| 2400 |
if (esl_sqio_IsAlignment((*ret_dbfp)->format)) { |
| 2401 |
|
| 2402 |
|
| 2403 |
|
| 2404 |
|
| 2405 |
cm_Fail("%s autodetected as an alignment file; unaligned sequence file, like FASTA, is required\n", cfg->dbfile); |
| 2406 |
} |
| 2407 |
|
| 2408 |
return eslOK; |
| 2409 |
} |
| 2410 |
|
| 2411 |
|
| 2412 |
|
| 2413 |
|
| 2414 |
|
| 2415 |
|
| 2416 |
|
| 2417 |
|
| 2418 |
|
| 2419 |
|
| 2420 |
|
| 2421 |
|
| 2422 |
|
| 2423 |
static int |
| 2424 |
dbsize_and_seq_lengths(ESL_GETOPTS *go, struct cfg_s *cfg, ESL_SQFILE **dbfp_ptr, char *errbuf, int64_t **ret_srcL, int64_t *ret_nseqs) |
| 2425 |
{ |
| 2426 |
int status; |
| 2427 |
ESL_SQ *sq = NULL; |
| 2428 |
int64_t nres = 0; |
| 2429 |
|
| 2430 |
int64_t *srcL = NULL; |
| 2431 |
int64_t nseqs = 0; |
| 2432 |
int64_t nalloc_srcL = 0; |
| 2433 |
int alloc_srcL = 10000; |
| 2434 |
int64_t i; |
| 2435 |
char *tmp_filename = NULL; |
| 2436 |
int tmp_fmt; |
| 2437 |
|
| 2438 |
|
| 2439 |
ESL_ALLOC(tmp_filename, sizeof(char) * (strlen((*dbfp_ptr)->filename) + 1)); |
| 2440 |
|
| 2441 |
sq = esl_sq_Create(); |
| 2442 |
while ((status = esl_sqio_ReadInfo(*dbfp_ptr, sq)) == eslOK) { |
| 2443 |
nres += sq->L; |
| 2444 |
if(nseqs == nalloc_srcL) { |
| 2445 |
nalloc_srcL += alloc_srcL; |
| 2446 |
ESL_REALLOC(srcL, sizeof(int64_t) * nalloc_srcL); |
| 2447 |
for(i = nalloc_srcL-alloc_srcL; i < nalloc_srcL; i++) srcL[i] = -1; |
| 2448 |
} |
| 2449 |
srcL[nseqs++] = sq->L; |
| 2450 |
esl_sq_Reuse(sq); |
| 2451 |
} |
| 2452 |
if(status != eslEOF) goto ERROR; |
| 2453 |
|
| 2454 |
|
| 2455 |
cfg->Z = nres; |
| 2456 |
if((! esl_opt_GetBoolean(go, "--toponly")) && |
| 2457 |
(! esl_opt_GetBoolean(go, "--bottomonly"))) { |
| 2458 |
cfg->Z *= 2; |
| 2459 |
} |
| 2460 |
cfg->Z_setby = CM_ZSETBY_FILEREAD; |
| 2461 |
|
| 2462 |
if((*dbfp_ptr)->data.ascii.do_gzip == TRUE) { |
| 2463 |
|
| 2464 |
|
| 2465 |
|
| 2466 |
|
| 2467 |
|
| 2468 |
|
| 2469 |
|
| 2470 |
strcpy(tmp_filename, (*dbfp_ptr)->filename); |
| 2471 |
tmp_fmt = (*dbfp_ptr)->format; |
| 2472 |
esl_sqfile_Close(*dbfp_ptr); |
| 2473 |
status = esl_sqfile_Open(tmp_filename, tmp_fmt, NULL, dbfp_ptr); |
| 2474 |
if (status == eslENOTFOUND) ESL_EXCEPTION(eslENOTFOUND, "failed to reopen alignment file"); |
| 2475 |
else if (status != eslOK) ESL_FAIL(status, errbuf, "unexpected error when reopening sequence file"); |
| 2476 |
} |
| 2477 |
else { |
| 2478 |
|
| 2479 |
esl_sqfile_Position((*dbfp_ptr), 0); |
| 2480 |
} |
| 2481 |
|
| 2482 |
if(tmp_filename != NULL) free(tmp_filename); |
| 2483 |
if(sq != NULL) esl_sq_Destroy(sq); |
| 2484 |
|
| 2485 |
*ret_srcL = srcL; |
| 2486 |
*ret_nseqs = nseqs; |
| 2487 |
|
| 2488 |
return eslOK; |
| 2489 |
|
| 2490 |
ERROR: |
| 2491 |
if((*dbfp_ptr)->data.ascii.do_gzip == TRUE) { |
| 2492 |
strcpy(tmp_filename, (*dbfp_ptr)->filename); |
| 2493 |
tmp_fmt = (*dbfp_ptr)->format; |
| 2494 |
esl_sqfile_Close((*dbfp_ptr)); |
| 2495 |
status = esl_sqfile_Open(tmp_filename, tmp_fmt, NULL, dbfp_ptr); |
| 2496 |
if (status == eslENOTFOUND) ESL_EXCEPTION(eslENOTFOUND, "failed to reopen alignment file"); |
| 2497 |
else if (status != eslOK) ESL_XFAIL(status, errbuf, "unexpected error when reopening sequence file"); |
| 2498 |
} |
| 2499 |
else { |
| 2500 |
|
| 2501 |
esl_sqfile_Position((*dbfp_ptr), 0); |
| 2502 |
} |
| 2503 |
if(tmp_filename != NULL) free(tmp_filename); |
| 2504 |
if(sq != NULL) esl_sq_Destroy(sq); |
| 2505 |
|
| 2506 |
*ret_srcL = NULL; |
| 2507 |
*ret_nseqs = 0; |
| 2508 |
return status; |
| 2509 |
} |
| 2510 |
|
| 2511 |
|
| 2512 |
|
| 2513 |
|
| 2514 |
|
| 2515 |
|
| 2516 |
|
| 2517 |
|
| 2518 |
WORKER_INFO * |
| 2519 |
create_info(const ESL_GETOPTS *go) |
| 2520 |
{ |
| 2521 |
int status; |
| 2522 |
WORKER_INFO *info = NULL; |
| 2523 |
|
| 2524 |
ESL_ALLOC(info, sizeof(WORKER_INFO)); |
| 2525 |
info->pli = NULL; |
| 2526 |
info->th = NULL; |
| 2527 |
info->cm = NULL; |
| 2528 |
info->gm = NULL; |
| 2529 |
info->Rgm = NULL; |
| 2530 |
info->Lgm = NULL; |
| 2531 |
info->Tgm = NULL; |
| 2532 |
info->om = NULL; |
| 2533 |
info->bg = NULL; |
| 2534 |
info->msvdata = NULL; |
| 2535 |
ESL_ALLOC(info->p7_evparam, sizeof(float) * CM_p7_NEVPARAM); |
| 2536 |
info->smxsize = esl_opt_GetReal(go, "--smxsize"); |
| 2537 |
return info; |
| 2538 |
|
| 2539 |
ERROR: |
| 2540 |
if(info != NULL) free(info); |
| 2541 |
return NULL; |
| 2542 |
} |
| 2543 |
|
| 2544 |
|
| 2545 |
|
| 2546 |
|
| 2547 |
|
| 2548 |
|
| 2549 |
|
| 2550 |
|
| 2551 |
|
| 2552 |
|
| 2553 |
|
| 2554 |
int |
| 2555 |
clone_info(ESL_GETOPTS *go, WORKER_INFO *src_info, WORKER_INFO *dest_infoA, int dest_infocnt, char *errbuf) |
| 2556 |
{ |
| 2557 |
int status; |
| 2558 |
int i; |
| 2559 |
|
| 2560 |
for (i = 0; i < dest_infocnt; ++i) { |
| 2561 |
if((status = cm_Clone(src_info->cm, errbuf, &(dest_infoA[i].cm))) != eslOK) return status; |
| 2562 |
if((dest_infoA[i].gm = p7_profile_Clone(src_info->gm)) == NULL) goto ERROR; |
| 2563 |
dest_infoA[i].Rgm = dest_infoA[i].Lgm = dest_infoA[i].Tgm = NULL; |
| 2564 |
if(src_info->Rgm != NULL) { if((dest_infoA[i].Rgm = p7_profile_Clone(src_info->Rgm)) == NULL) goto ERROR; } |
| 2565 |
if(src_info->Lgm != NULL) { if((dest_infoA[i].Lgm = p7_profile_Clone(src_info->Lgm)) == NULL) goto ERROR; } |
| 2566 |
if(src_info->Tgm != NULL) { if((dest_infoA[i].Tgm = p7_profile_Clone(src_info->Tgm)) == NULL) goto ERROR; } |
| 2567 |
if((dest_infoA[i].om = p7_oprofile_Clone(src_info->om)) == NULL) goto ERROR; |
| 2568 |
if((dest_infoA[i].bg = p7_bg_Create(src_info->bg->abc)) == NULL) goto ERROR; |
| 2569 |
if(dest_infoA[i].p7_evparam == NULL) ESL_ALLOC(dest_infoA[i].p7_evparam, sizeof(float) * CM_p7_NEVPARAM); |
| 2570 |
esl_vec_FCopy(src_info->cm->fp7_evparam, CM_p7_NEVPARAM, dest_infoA[i].p7_evparam); |
| 2571 |
dest_infoA[i].msvdata = p7_hmm_ScoreDataClone(src_info->msvdata, src_info->om->abc->Kp); |
| 2572 |
} |
| 2573 |
return eslOK; |
| 2574 |
|
| 2575 |
ERROR: |
| 2576 |
ESL_FAIL(status, errbuf, "clone_info(): out of memory"); |
| 2577 |
} |
| 2578 |
|
| 2579 |
|
| 2580 |
|
| 2581 |
|
| 2582 |
|
| 2583 |
|
| 2584 |
|
| 2585 |
|
| 2586 |
void |
| 2587 |
free_info(WORKER_INFO *info) |
| 2588 |
{ |
| 2589 |
if(info->pli != NULL) { cm_pipeline_Destroy(info->pli, info->cm); info->pli = NULL; } |
| 2590 |
if(info->th != NULL) { cm_tophits_Destroy(info->th); info->th = NULL; } |
| 2591 |
if(info->cm != NULL) { FreeCM(info->cm); info->cm = NULL; } |
| 2592 |
if(info->om != NULL) { p7_oprofile_Destroy(info->om); info->om = NULL; } |
| 2593 |
if(info->gm != NULL) { p7_profile_Destroy(info->gm); info->gm = NULL; } |
| 2594 |
if(info->Rgm != NULL) { p7_profile_Destroy(info->Rgm); info->Rgm = NULL; } |
| 2595 |
if(info->Lgm != NULL) { p7_profile_Destroy(info->Lgm); info->Lgm = NULL; } |
| 2596 |
if(info->Tgm != NULL) { p7_profile_Destroy(info->Tgm); info->Tgm = NULL; } |
| 2597 |
if(info->bg != NULL) { p7_bg_Destroy(info->bg); info->bg = NULL; } |
| 2598 |
if(info->p7_evparam != NULL) { free(info->p7_evparam); info->p7_evparam = NULL; } |
| 2599 |
if(info->msvdata != NULL) { p7_hmm_ScoreDataDestroy(info->msvdata); info->msvdata = NULL; } |
| 2600 |
|
| 2601 |
return; |
| 2602 |
} |
| 2603 |
|
| 2604 |
|
| 2605 |
|
| 2606 |
|
| 2607 |
|
| 2608 |
|
| 2609 |
|
| 2610 |
|
| 2611 |
|
| 2612 |
|
| 2613 |
|
| 2614 |
|
| 2615 |
|
| 2616 |
|
| 2617 |
|
| 2618 |
|
| 2619 |
int |
| 2620 |
configure_cm(WORKER_INFO *info) |
| 2621 |
{ |
| 2622 |
int status; |
| 2623 |
float reqMb = 0.; |
| 2624 |
int check_fcyk_beta; |
| 2625 |
int check_final_beta; |
| 2626 |
int W_from_cmdline; |
| 2627 |
|
| 2628 |
if(info->pli->cm_config_opts & CM_CONFIG_SCANMX) reqMb += cm_scan_mx_SizeNeeded(info->cm, TRUE, TRUE); |
| 2629 |
if(info->pli->cm_config_opts & CM_CONFIG_TRSCANMX) reqMb += cm_tr_scan_mx_SizeNeeded(info->cm, TRUE, TRUE); |
| 2630 |
if(reqMb > info->smxsize) { |
| 2631 |
ESL_FAIL(eslERANGE, info->pli->errbuf, "search will require %.2f Mb > %.2f Mb limit.\nIncrease limit with --smxsize, or don't use --max,--nohmm,--qdb,--fqdb.", reqMb, info->smxsize); |
| 2632 |
} |
| 2633 |
|
| 2634 |
|
| 2635 |
info->cm->config_opts = info->pli->cm_config_opts; |
| 2636 |
info->cm->align_opts = info->pli->cm_align_opts; |
| 2637 |
|
| 2638 |
|
| 2639 |
check_fcyk_beta = (info->pli->fcyk_cm_search_opts & CM_SEARCH_QDB) ? TRUE : FALSE; |
| 2640 |
check_final_beta = (info->pli->final_cm_search_opts & CM_SEARCH_QDB) ? TRUE : FALSE; |
| 2641 |
if((status = CheckCMQDBInfo(info->cm->qdbinfo, info->pli->fcyk_beta, check_fcyk_beta, info->pli->final_beta, check_final_beta)) != eslOK) { |
| 2642 |
info->cm->config_opts |= CM_CONFIG_QDB; |
| 2643 |
info->cm->qdbinfo->beta1 = info->pli->fcyk_beta; |
| 2644 |
info->cm->qdbinfo->beta2 = info->pli->final_beta; |
| 2645 |
} |
| 2646 |
|
| 2647 |
|
| 2648 |
W_from_cmdline = info->pli->do_wcx ? (int) (info->cm->clen * info->pli->wcx) : -1; |
| 2649 |
if((status = cm_Configure(info->cm, info->pli->errbuf, W_from_cmdline)) != eslOK) return status; |
| 2650 |
|
| 2651 |
return eslOK; |
| 2652 |
} |
| 2653 |
|
| 2654 |
|
| 2655 |
|
| 2656 |
|
| 2657 |
|
| 2658 |
|
| 2659 |
|
| 2660 |
|
| 2661 |
|
| 2662 |
|
| 2663 |
|
| 2664 |
|
| 2665 |
|
| 2666 |
|
| 2667 |
|
| 2668 |
|
| 2669 |
|
| 2670 |
int |
| 2671 |
setup_hmm_filter(ESL_GETOPTS *go, WORKER_INFO *info) |
| 2672 |
{ |
| 2673 |
int do_trunc_ends = (esl_opt_GetBoolean(go, "--notrunc") || esl_opt_GetBoolean(go, "--inttrunc")) ? FALSE : TRUE; |
| 2674 |
|
| 2675 |
|
| 2676 |
info->gm = p7_profile_Create (info->cm->fp7->M, info->cm->abc); |
| 2677 |
info->om = p7_oprofile_Create(info->cm->fp7->M, info->cm->abc); |
| 2678 |
info->bg = p7_bg_Create(info->cm->abc); |
| 2679 |
p7_ProfileConfig(info->cm->fp7, info->bg, info->gm, 100, p7_LOCAL); |
| 2680 |
p7_oprofile_Convert(info->gm, info->om); |
| 2681 |
|
| 2682 |
if(do_trunc_ends) { |
| 2683 |
info->Tgm = p7_profile_Clone(info->gm); |
| 2684 |
} |
| 2685 |
|
| 2686 |
p7_ProfileConfig(info->cm->fp7, info->bg, info->gm, 100, p7_GLOCAL); |
| 2687 |
|
| 2688 |
if(do_trunc_ends) { |
| 2689 |
|
| 2690 |
|
| 2691 |
info->Rgm = p7_profile_Clone(info->gm); |
| 2692 |
info->Lgm = p7_profile_Clone(info->gm); |
| 2693 |
|
| 2694 |
|
| 2695 |
p7_ProfileConfig5PrimeTrunc (info->Rgm, 100); |
| 2696 |
p7_ProfileConfig3PrimeTrunc (info->cm->fp7, info->Lgm, 100); |
| 2697 |
p7_ProfileConfig5PrimeAnd3PrimeTrunc(info->Tgm, 100); |
| 2698 |
} |
| 2699 |
else { |
| 2700 |
info->Rgm = NULL; |
| 2701 |
info->Lgm = NULL; |
| 2702 |
info->Tgm = NULL; |
| 2703 |
} |
| 2704 |
|
| 2705 |
|
| 2706 |
esl_vec_FCopy(info->cm->fp7_evparam, CM_p7_NEVPARAM, info->p7_evparam); |
| 2707 |
|
| 2708 |
|
| 2709 |
info->msvdata = p7_hmm_ScoreDataCreate(info->om, FALSE); |
| 2710 |
|
| 2711 |
return eslOK; |
| 2712 |
} |
| 2713 |
|
| 2714 |
#ifdef HAVE_MPI |
| 2715 |
|
| 2716 |
|
| 2717 |
|
| 2718 |
|
| 2719 |
|
| 2720 |
static void |
| 2721 |
mpi_failure(char *format, ...) |
| 2722 |
{ |
| 2723 |
va_list argp; |
| 2724 |
int status = eslFAIL; |
| 2725 |
int len; |
| 2726 |
int rank; |
| 2727 |
char str[512]; |
| 2728 |
|
| 2729 |
MPI_Comm_rank(MPI_COMM_WORLD, &rank); |
| 2730 |
|
| 2731 |
|
| 2732 |
va_start(argp, format); |
| 2733 |
len = vsnprintf(str, sizeof(str), format, argp); |
| 2734 |
va_end(argp); |
| 2735 |
|
| 2736 |
|
| 2737 |
str[sizeof(str)-1] = '\0'; |
| 2738 |
|
| 2739 |
|
| 2740 |
if (rank == 0) { |
| 2741 |
fprintf(stderr, "\nError: "); |
| 2742 |
fprintf(stderr, "%s", str); |
| 2743 |
fprintf(stderr, "\n"); |
| 2744 |
fflush(stderr); |
| 2745 |
|
| 2746 |
MPI_Abort(MPI_COMM_WORLD, status); |
| 2747 |
exit(1); |
| 2748 |
} |
| 2749 |
else { |
| 2750 |
MPI_Send(str, len, MPI_CHAR, 0, INFERNAL_ERROR_TAG, MPI_COMM_WORLD); |
| 2751 |
pause(); |
| 2752 |
} |
| 2753 |
} |
| 2754 |
|
| 2755 |
|
| 2756 |
|
| 2757 |
|
| 2758 |
|
| 2759 |
|
| 2760 |
|
| 2761 |
|
| 2762 |
static int |
| 2763 |
mpi_open_dbfile_ssi(ESL_GETOPTS *go, struct cfg_s *cfg, ESL_SQFILE *dbfp, char *errbuf) |
| 2764 |
{ |
| 2765 |
int status; |
| 2766 |
|
| 2767 |
if (dbfp->data.ascii.do_gzip) ESL_FAIL(eslEFORMAT, errbuf, "Reading gzipped sequence files is not supported with --mpi."); |
| 2768 |
if (dbfp->data.ascii.do_stdin) ESL_FAIL(eslEFORMAT, errbuf, "Reading sequence files from stdin is not supported with --mpi."); |
| 2769 |
status = esl_sqfile_OpenSSI(dbfp, NULL); |
| 2770 |
if (status == eslEFORMAT) ESL_FAIL(status, errbuf, "SSI index for database file is in incorrect format\n"); |
| 2771 |
else if (status == eslERANGE) ESL_FAIL(status, errbuf, "SSI index for database file is in 64-bit format and we can't read it\n"); |
| 2772 |
else if (status != eslOK) ESL_FAIL(status, errbuf, "Failed to open SSI index, use esl-sfetch to index the database file.\n"); |
| 2773 |
|
| 2774 |
return status; |
| 2775 |
} |
| 2776 |
|
| 2777 |
|
| 2778 |
|
| 2779 |
|
| 2780 |
|
| 2781 |
|
| 2782 |
|
| 2783 |
|
| 2784 |
|
| 2785 |
static int |
| 2786 |
mpi_dbsize_using_ssi(ESL_GETOPTS *go, struct cfg_s *cfg, ESL_SQFILE *dbfp, char *errbuf) |
| 2787 |
{ |
| 2788 |
int status; |
| 2789 |
int64_t L; |
| 2790 |
int i; |
| 2791 |
|
| 2792 |
if(dbfp->data.ascii.ssi == NULL) ESL_FAIL(eslEINVAL, errbuf, "SSI index failed to open"); |
| 2793 |
|
| 2794 |
|
| 2795 |
cfg->Z = 0; |
| 2796 |
for(i = 0; i < dbfp->data.ascii.ssi->nprimary; i++) { |
| 2797 |
status = esl_ssi_FindNumber(dbfp->data.ascii.ssi, i, NULL, NULL, NULL, &L, NULL); |
| 2798 |
if(status == eslENOTFOUND) ESL_FAIL(status, errbuf, "unable to find sequence %d in SSI index file, try re-indexing with esl-sfetch.", i); |
| 2799 |
if(status == eslEFORMAT) ESL_FAIL(status, errbuf, "SSI index for database file is in incorrect format."); |
| 2800 |
if(status != eslOK) ESL_FAIL(status, errbuf, "problem with SSI index for database file."); |
| 2801 |
cfg->Z += L; |
| 2802 |
} |
| 2803 |
if((! esl_opt_GetBoolean(go, "--toponly")) && |
| 2804 |
(! esl_opt_GetBoolean(go, "--bottomonly"))) { |
| 2805 |
cfg->Z *= 2; |
| 2806 |
} |
| 2807 |
cfg->Z_setby = CM_ZSETBY_SSIINFO; |
| 2808 |
|
| 2809 |
return eslOK; |
| 2810 |
} |
| 2811 |
|
| 2812 |
|
| 2813 |
|
| 2814 |
|
| 2815 |
|
| 2816 |
|
| 2817 |
|
| 2818 |
|
| 2819 |
|
| 2820 |
|
| 2821 |
|
| 2822 |
|
| 2823 |
|
| 2824 |
|
| 2825 |
|
| 2826 |
|
| 2827 |
|
| 2828 |
|
| 2829 |
|
| 2830 |
|
| 2831 |
|
| 2832 |
|
| 2833 |
|
| 2834 |
|
| 2835 |
|
| 2836 |
|
| 2837 |
|
| 2838 |
|
| 2839 |
|
| 2840 |
|
| 2841 |
|
| 2842 |
|
| 2843 |
|
| 2844 |
|
| 2845 |
|
| 2846 |
|
| 2847 |
int |
| 2848 |
mpi_add_blocks(ESL_SQFILE *dbfp, ESL_SQ *sq, int64_t ncontext, char *errbuf, int64_t final_pkey_idx, MPI_BLOCK_LIST *block_list, int64_t *ret_pkey_idx, int64_t *ret_noverlap, int64_t *ret_nseq) |
| 2849 |
{ |
| 2850 |
int status = eslOK; |
| 2851 |
int64_t pkey_idx; |
| 2852 |
int64_t noverlap = 0; |
| 2853 |
int64_t tot_noverlap = 0; |
| 2854 |
int64_t nseq = 0; |
| 2855 |
|
| 2856 |
|
| 2857 |
if(dbfp->data.ascii.ssi == NULL) ESL_FAIL(eslEINVAL, errbuf, "No SSI index available (it should've been opened earlier)"); |
| 2858 |
|
| 2859 |
if(block_list->N != 1 || block_list->blocks == NULL || block_list->blocks[0]->complete) { |
| 2860 |
ESL_FAIL(eslFAIL, errbuf, "contract violation in next_block, block_list does not contain exactly 1 incomplete block"); |
| 2861 |
} |
| 2862 |
|
| 2863 |
status = eslOK; |
| 2864 |
pkey_idx = *ret_pkey_idx; |
| 2865 |
|
| 2866 |
while((pkey_idx <= final_pkey_idx) && (! block_list->blocks[0]->complete)) { |
| 2867 |
status = mpi_inspect_next_sequence_using_ssi(dbfp, sq, ncontext, pkey_idx, errbuf, block_list, &noverlap); |
| 2868 |
nseq++; |
| 2869 |
if(block_list == NULL) ESL_FAIL(eslFAIL, errbuf, "error parsing database in add_blocks()"); |
| 2870 |
pkey_idx++; |
| 2871 |
tot_noverlap += noverlap; |
| 2872 |
} |
| 2873 |
if(pkey_idx == (final_pkey_idx+1) && (! block_list->blocks[block_list->N-1]->complete)) { |
| 2874 |
|
| 2875 |
|
| 2876 |
if(block_list->blocks[block_list->N-1]->blockL > 0) { |
| 2877 |
block_list->blocks[block_list->N-1]->complete = TRUE; |
| 2878 |
} |
| 2879 |
else { |
| 2880 |
|
| 2881 |
free(block_list->blocks[block_list->N-1]); |
| 2882 |
block_list->blocks[block_list->N-1] = NULL; |
| 2883 |
block_list->N--; |
| 2884 |
} |
| 2885 |
} |
| 2886 |
|
| 2887 |
#if eslDEBUGLEVEL >= 1 |
| 2888 |
printf("\nEnd of add_blocks()\n"); |
| 2889 |
dump_mpi_block_list(stdout, block_list); |
| 2890 |
printf("\n"); |
| 2891 |
#endif |
| 2892 |
|
| 2893 |
*ret_pkey_idx = pkey_idx; |
| 2894 |
*ret_noverlap = tot_noverlap; |
| 2895 |
*ret_nseq = nseq; |
| 2896 |
|
| 2897 |
return status; |
| 2898 |
|
| 2899 |
} |
| 2900 |
|
| 2901 |
|
| 2902 |
|
| 2903 |
|
| 2904 |
|
| 2905 |
|
| 2906 |
|
| 2907 |
|
| 2908 |
|
| 2909 |
|
| 2910 |
|
| 2911 |
|
| 2912 |
|
| 2913 |
|
| 2914 |
|
| 2915 |
|
| 2916 |
|
| 2917 |
|
| 2918 |
|
| 2919 |
|
| 2920 |
|
| 2921 |
int |
| 2922 |
mpi_inspect_next_sequence_using_ssi(ESL_SQFILE *dbfp, ESL_SQ *sq, int64_t ncontext, int64_t pkey_idx, char *errbuf, MPI_BLOCK_LIST *block_list, int64_t *ret_noverlap) |
| 2923 |
{ |
| 2924 |
int status; |
| 2925 |
int64_t L; |
| 2926 |
int64_t ntoadd; |
| 2927 |
int64_t seq_from; |
| 2928 |
int64_t nremaining; |
| 2929 |
int64_t tot_noverlap = 0; |
| 2930 |
int64_t cur_noverlap = 0; |
| 2931 |
MPI_BLOCK *cur_block = NULL; |
| 2932 |
|
| 2933 |
|
| 2934 |
if(dbfp->data.ascii.ssi == NULL) ESL_FAIL(eslEINVAL, errbuf, "No SSI index available (it should've been opened earlier)"); |
| 2935 |
|
| 2936 |
|
| 2937 |
|
| 2938 |
|
| 2939 |
status = esl_ssi_FindNumber(dbfp->data.ascii.ssi, pkey_idx, NULL, NULL, NULL, &L, NULL); |
| 2940 |
|
| 2941 |
|
| 2942 |
|
| 2943 |
|
| 2944 |
|
| 2945 |
if(status == eslENOTFOUND) ESL_FAIL(status, errbuf, "unable to find sequence %ld in SSI index file, try re-indexing with esl-sfetch.", pkey_idx); |
| 2946 |
if(status == eslEFORMAT) ESL_FAIL(status, errbuf, "SSI index for database file is in incorrect format."); |
| 2947 |
if(status != eslOK) ESL_FAIL(status, errbuf, "problem with SSI index for database file."); |
| 2948 |
|
| 2949 |
|
| 2950 |
|
| 2951 |
if(block_list == NULL) { |
| 2952 |
|
| 2953 |
|
| 2954 |
|
| 2955 |
|
| 2956 |
|
| 2957 |
block_list = create_mpi_block_list(); |
| 2958 |
|
| 2959 |
block_list->blocks[0] = create_mpi_block(); |
| 2960 |
block_list->N++; |
| 2961 |
} |
| 2962 |
|
| 2963 |
|
| 2964 |
|
| 2965 |
|
| 2966 |
|
| 2967 |
|
| 2968 |
|
| 2969 |
|
| 2970 |
|
| 2971 |
|
| 2972 |
cur_block = block_list->blocks[0]; |
| 2973 |
nremaining = L; |
| 2974 |
cur_noverlap = 0; |
| 2975 |
while(nremaining > 0) { |
| 2976 |
ntoadd = CM_MAX_RESIDUE_COUNT + cur_noverlap; |
| 2977 |
ntoadd = ESL_MIN(ntoadd, nremaining); |
| 2978 |
if(cur_block->blockL == 0) { |
| 2979 |
cur_block->first_idx = pkey_idx; |
| 2980 |
} |
| 2981 |
cur_block->final_idx = pkey_idx; |
| 2982 |
if(nremaining <= ntoadd) { |
| 2983 |
|
| 2984 |
if(cur_block->blockL == 0) { |
| 2985 |
cur_block->first_from = (L - nremaining) + 1; |
| 2986 |
} |
| 2987 |
cur_block->final_to = L; |
| 2988 |
cur_block->blockL += nremaining; |
| 2989 |
if(cur_block->blockL >= CM_MAX_RESIDUE_COUNT) { |
| 2990 |
cur_block->complete = TRUE; |
| 2991 |
} |
| 2992 |
|
| 2993 |
nremaining = 0; |
| 2994 |
} |
| 2995 |
else { |
| 2996 |
|
| 2997 |
|
| 2998 |
|
| 2999 |
|
| 3000 |
|
| 3001 |
|
| 3002 |
seq_from = L - nremaining + 1; |
| 3003 |
if(cur_block->blockL == 0) { |
| 3004 |
cur_block->first_from = seq_from; |
| 3005 |
} |
| 3006 |
cur_block->final_to = seq_from + ntoadd - 1; |
| 3007 |
cur_block->blockL += ntoadd; |
| 3008 |
cur_block->complete = TRUE; |
| 3009 |
|
| 3010 |
|
| 3011 |
|
| 3012 |
|
| 3013 |
cur_noverlap = ESL_MIN(ncontext, (seq_from + ntoadd - 1)); |
| 3014 |
|
| 3015 |
|
| 3016 |
nremaining -= (ntoadd - cur_noverlap); |
| 3017 |
tot_noverlap += cur_noverlap; |
| 3018 |
} |
| 3019 |
|
| 3020 |
|
| 3021 |
if(cur_block->complete) { |
| 3022 |
if(block_list->N == block_list->nalloc) { |
| 3023 |
ESL_REALLOC(block_list->blocks, sizeof(MPI_BLOCK *) * (block_list->nalloc+100)); |
| 3024 |
block_list->nalloc += 100; |
| 3025 |
} |
| 3026 |
cur_block = create_mpi_block(); |
| 3027 |
block_list->blocks[block_list->N++] = cur_block; |
| 3028 |
} |
| 3029 |
} |
| 3030 |
*ret_noverlap = tot_noverlap; |
| 3031 |
|
| 3032 |
return status; |
| 3033 |
|
| 3034 |
ERROR: |
| 3035 |
ESL_FAIL(status, errbuf, "out of memory"); |
| 3036 |
} |
| 3037 |
|
| 3038 |
MPI_BLOCK * |
| 3039 |
create_mpi_block() |
| 3040 |
{ |
| 3041 |
int status; |
| 3042 |
|
| 3043 |
MPI_BLOCK *block = NULL; |
| 3044 |
ESL_ALLOC(block, sizeof(MPI_BLOCK)); |
| 3045 |
|
| 3046 |
block->first_idx = -1; |
| 3047 |
block->final_idx = -1; |
| 3048 |
block->first_from = 0; |
| 3049 |
block->final_to = 0; |
| 3050 |
block->blockL = 0; |
| 3051 |
block->complete = FALSE; |
| 3052 |
|
| 3053 |
return block; |
| 3054 |
|
| 3055 |
ERROR: |
| 3056 |
if(block != NULL) free(block); |
| 3057 |
return NULL; |
| 3058 |
} |
| 3059 |
|
| 3060 |
#if eslDEBUGLEVEL >= 1 |
| 3061 |
void |
| 3062 |
dump_mpi_block(FILE *fp, MPI_BLOCK *block) |
| 3063 |
{ |
| 3064 |
|
| 3065 |
fprintf(fp, "MPI_BLOCK:\n"); |
| 3066 |
fprintf(fp, "%-15s: %ld\n", "first_idx", block->first_idx); |
| 3067 |
fprintf(fp, "%-15s: %ld\n", "final_idx", block->final_idx); |
| 3068 |
fprintf(fp, "%-15s: %ld\n", "first_from", block->first_from); |
| 3069 |
fprintf(fp, "%-15s: %ld\n", "final_to", block->final_to); |
| 3070 |
fprintf(fp, "%-15s: %ld\n", "blockL", block->blockL); |
| 3071 |
fprintf(fp, "%-15s: %d\n", "complete", block->complete); |
| 3072 |
|
| 3073 |
return; |
| 3074 |
} |
| 3075 |
|
| 3076 |
void |
| 3077 |
dump_mpi_block_list(FILE *fp, MPI_BLOCK_LIST *list) |
| 3078 |
{ |
| 3079 |
int i; |
| 3080 |
|
| 3081 |
fprintf(fp, "MPI_BLOCK_LIST:\n"); |
| 3082 |
fprintf(fp, "%-15s: %d\n", "N", list->N); |
| 3083 |
fprintf(fp, "%-15s: %d\n", "nalloc", list->nalloc); |
| 3084 |
for(i = 0; i < list->N; i++) { |
| 3085 |
dump_mpi_block(fp, list->blocks[i]); |
| 3086 |
} |
| 3087 |
|
| 3088 |
return; |
| 3089 |
} |
| 3090 |
#endif |
| 3091 |
|
| 3092 |
MPI_BLOCK_LIST * |
| 3093 |
create_mpi_block_list() |
| 3094 |
{ |
| 3095 |
int status; |
| 3096 |
|
| 3097 |
MPI_BLOCK_LIST *list = NULL; |
| 3098 |
ESL_ALLOC(list, sizeof(MPI_BLOCK_LIST)); |
| 3099 |
|
| 3100 |
list->blocks = NULL; |
| 3101 |
ESL_ALLOC(list->blocks, sizeof(MPI_BLOCK *) * (100)); |
| 3102 |
list->N = 0; |
| 3103 |
list->nalloc = 100; |
| 3104 |
|
| 3105 |
return list; |
| 3106 |
|
| 3107 |
ERROR: |
| 3108 |
if(list != NULL) free(list); |
| 3109 |
return NULL; |
| 3110 |
} |
| 3111 |
|
| 3112 |
void |
| 3113 |
free_mpi_block_list(MPI_BLOCK_LIST *list) |
| 3114 |
{ |
| 3115 |
int i; |
| 3116 |
if(list->blocks != NULL) { |
| 3117 |
for(i = 0; i < list->N; i++) { |
| 3118 |
free(list->blocks[i]); |
| 3119 |
} |
| 3120 |
free(list->blocks); |
| 3121 |
} |
| 3122 |
free(list); |
| 3123 |
|
| 3124 |
return; |
| 3125 |
} |
| 3126 |
|
| 3127 |
|
| 3128 |
|
| 3129 |
|
| 3130 |
|
| 3131 |
|
| 3132 |
|
| 3133 |
int |
| 3134 |
mpi_block_send(MPI_BLOCK *block, int dest, int tag, MPI_Comm comm, char **buf, int *nalloc) |
| 3135 |
{ |
| 3136 |
int status; |
| 3137 |
int pos; |
| 3138 |
int n; |
| 3139 |
|
| 3140 |
|
| 3141 |
if ((status = mpi_block_pack_size(block, comm, &n)) != eslOK) goto ERROR; |
| 3142 |
|
| 3143 |
|
| 3144 |
if (*buf == NULL || n > *nalloc) { |
| 3145 |
void *tmp; |
| 3146 |
ESL_RALLOC(*buf, tmp, sizeof(char) * n); |
| 3147 |
*nalloc = n; |
| 3148 |
} |
| 3149 |
|
| 3150 |
|
| 3151 |
pos = 0; |
| 3152 |
if ((status = mpi_block_pack(block, *buf, n, &pos, comm)) != eslOK) goto ERROR; |
| 3153 |
|
| 3154 |
|
| 3155 |
if (MPI_Send(*buf, n, MPI_PACKED, dest, tag, comm) != 0) ESL_EXCEPTION(eslESYS, "mpi send failed"); |
| 3156 |
|
| 3157 |
return eslOK; |
| 3158 |
|
| 3159 |
ERROR: |
| 3160 |
return status; |
| 3161 |
|
| 3162 |
} |
| 3163 |
|
| 3164 |
|
| 3165 |
|
| 3166 |
|
| 3167 |
|
| 3168 |
int |
| 3169 |
mpi_block_recv(int source, int tag, MPI_Comm comm, char **buf, int *nalloc, MPI_BLOCK **ret_block) |
| 3170 |
{ |
| 3171 |
int n; |
| 3172 |
int status; |
| 3173 |
int pos; |
| 3174 |
MPI_Status mpistatus; |
| 3175 |
|
| 3176 |
|
| 3177 |
|
| 3178 |
MPI_Probe(source, tag, comm, &mpistatus); |
| 3179 |
MPI_Get_count(&mpistatus, MPI_PACKED, &n); |
| 3180 |
|
| 3181 |
|
| 3182 |
if (tag != MPI_ANY_TAG && mpistatus.MPI_TAG != tag) { |
| 3183 |
status = eslFAIL; |
| 3184 |
goto ERROR; |
| 3185 |
} |
| 3186 |
if (source != MPI_ANY_SOURCE && mpistatus.MPI_SOURCE != source) { |
| 3187 |
status = eslFAIL; |
| 3188 |
goto ERROR; |
| 3189 |
} |
| 3190 |
|
| 3191 |
|
| 3192 |
tag = mpistatus.MPI_TAG; |
| 3193 |
source = mpistatus.MPI_SOURCE; |
| 3194 |
|
| 3195 |
|
| 3196 |
if (*buf == NULL || n > *nalloc) { |
| 3197 |
void *tmp; |
| 3198 |
ESL_RALLOC(*buf, tmp, sizeof(char) * n); |
| 3199 |
*nalloc = n; |
| 3200 |
} |
| 3201 |
|
| 3202 |
|
| 3203 |
MPI_Recv(*buf, n, MPI_PACKED, source, tag, comm, &mpistatus); |
| 3204 |
|
| 3205 |
|
| 3206 |
pos = 0; |
| 3207 |
if ((status = mpi_block_unpack(*buf, n, &pos, comm, ret_block)) != eslOK) goto ERROR; |
| 3208 |
|
| 3209 |
return eslOK; |
| 3210 |
|
| 3211 |
ERROR: |
| 3212 |
return status; |
| 3213 |
} |
| 3214 |
|
| 3215 |
|
| 3216 |
|
| 3217 |
|
| 3218 |
|
| 3219 |
|
| 3220 |
|
| 3221 |
|
| 3222 |
|
| 3223 |
int |
| 3224 |
mpi_block_pack_size(MPI_BLOCK *block, MPI_Comm comm, int *ret_n) |
| 3225 |
{ |
| 3226 |
int status; |
| 3227 |
int n = 0; |
| 3228 |
int sz; |
| 3229 |
|
| 3230 |
if (MPI_Pack_size(1, MPI_LONG_LONG_INT, comm, &sz) != 0) ESL_XEXCEPTION(eslESYS, "pack size failed"); n += sz; |
| 3231 |
if (MPI_Pack_size(1, MPI_LONG_LONG_INT, comm, &sz) != 0) ESL_XEXCEPTION(eslESYS, "pack size failed"); n += sz; |
| 3232 |
if (MPI_Pack_size(1, MPI_LONG_LONG_INT, comm, &sz) != 0) ESL_XEXCEPTION(eslESYS, "pack size failed"); n += sz; |
| 3233 |
if (MPI_Pack_size(1, MPI_LONG_LONG_INT, comm, &sz) != 0) ESL_XEXCEPTION(eslESYS, "pack size failed"); n += sz; |
| 3234 |
if (MPI_Pack_size(1, MPI_LONG_LONG_INT, comm, &sz) != 0) ESL_XEXCEPTION(eslESYS, "pack size failed"); n += sz; |
| 3235 |
if (MPI_Pack_size(1, MPI_INT, comm, &sz) != 0) ESL_XEXCEPTION(eslESYS, "pack size failed"); n += sz; |
| 3236 |
|
| 3237 |
*ret_n = n; |
| 3238 |
return eslOK; |
| 3239 |
|
| 3240 |
ERROR: |
| 3241 |
*ret_n = 0; |
| 3242 |
return status; |
| 3243 |
} |
| 3244 |
|
| 3245 |
|
| 3246 |
|
| 3247 |
|
| 3248 |
|
| 3249 |
|
| 3250 |
|
| 3251 |
|
| 3252 |
|
| 3253 |
|
| 3254 |
|
| 3255 |
|
| 3256 |
|
| 3257 |
|
| 3258 |
|
| 3259 |
|
| 3260 |
int |
| 3261 |
mpi_block_pack(MPI_BLOCK *block, char *buf, int n, int *pos, MPI_Comm comm) |
| 3262 |
{ |
| 3263 |
int status; |
| 3264 |
|
| 3265 |
if (MPI_Pack(&block->first_idx, 1, MPI_LONG_LONG_INT, buf, n, pos, comm) != 0) ESL_XEXCEPTION(eslESYS, "pack failed"); |
| 3266 |
if (MPI_Pack(&block->final_idx, 1, MPI_LONG_LONG_INT, buf, n, pos, comm) != 0) ESL_XEXCEPTION(eslESYS, "pack failed"); |
| 3267 |
if (MPI_Pack(&block->first_from, 1, MPI_LONG_LONG_INT, buf, n, pos, comm) != 0) ESL_XEXCEPTION(eslESYS, "pack failed"); |
| 3268 |
if (MPI_Pack(&block->final_to, 1, MPI_LONG_LONG_INT, buf, n, pos, comm) != 0) ESL_XEXCEPTION(eslESYS, "pack failed"); |
| 3269 |
if (MPI_Pack(&block->blockL, 1, MPI_LONG_LONG_INT, buf, n, pos, comm) != 0) ESL_XEXCEPTION(eslESYS, "pack failed"); |
| 3270 |
if (MPI_Pack(&block->complete, 1, MPI_INT, buf, n, pos, comm) != 0) ESL_XEXCEPTION(eslESYS, "pack failed"); |
| 3271 |
|
| 3272 |
if (*pos > n) ESL_EXCEPTION(eslEMEM, "buffer overflow"); |
| 3273 |
return eslOK; |
| 3274 |
|
| 3275 |
ERROR: |
| 3276 |
return status; |
| 3277 |
} |
| 3278 |
|
| 3279 |
|
| 3280 |
|
| 3281 |
|
| 3282 |
|
| 3283 |
|
| 3284 |
|
| 3285 |
|
| 3286 |
|
| 3287 |
|
| 3288 |
|
| 3289 |
|
| 3290 |
|
| 3291 |
|
| 3292 |
int |
| 3293 |
mpi_block_unpack(char *buf, int n, int *pos, MPI_Comm comm, MPI_BLOCK **ret_block) |
| 3294 |
{ |
| 3295 |
int status; |
| 3296 |
MPI_BLOCK *block; |
| 3297 |
|
| 3298 |
ESL_ALLOC(block, sizeof(MPI_BLOCK)); |
| 3299 |
|
| 3300 |
if (MPI_Unpack(buf, n, pos, &block->first_idx, 1, MPI_LONG_LONG_INT, comm) != 0) ESL_XEXCEPTION(eslESYS, "mpi unpack failed"); |
| 3301 |
if (MPI_Unpack(buf, n, pos, &block->final_idx, 1, MPI_LONG_LONG_INT, comm) != 0) ESL_XEXCEPTION(eslESYS, "mpi unpack failed"); |
| 3302 |
if (MPI_Unpack(buf, n, pos, &block->first_from, 1, MPI_LONG_LONG_INT, comm) != 0) ESL_XEXCEPTION(eslESYS, "mpi unpack failed"); |
| 3303 |
if (MPI_Unpack(buf, n, pos, &block->final_to, 1, MPI_LONG_LONG_INT, comm) != 0) ESL_XEXCEPTION(eslESYS, "mpi unpack failed"); |
| 3304 |
if (MPI_Unpack(buf, n, pos, &block->blockL, 1, MPI_LONG_LONG_INT, comm) != 0) ESL_XEXCEPTION(eslESYS, "mpi unpack failed"); |
| 3305 |
if (MPI_Unpack(buf, n, pos, &block->complete, 1, MPI_INT, comm) != 0) ESL_XEXCEPTION(eslESYS, "mpi unpack failed"); |
| 3306 |
|
| 3307 |
*ret_block = block; |
| 3308 |
|
| 3309 |
return eslOK; |
| 3310 |
|
| 3311 |
ERROR: |
| 3312 |
return status; |
| 3313 |
} |
| 3314 |
#endif |
| 3315 |
|
| 3316 |
|