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