| 1 | #include "muscle.h" |
|---|
| 2 | #include "objscore.h" |
|---|
| 3 | #include "profile.h" |
|---|
| 4 | #include "enumopts.h" |
|---|
| 5 | |
|---|
| 6 | const double DEFAULT_MAX_MB_FRACT = 0.8; |
|---|
| 7 | |
|---|
| 8 | SCORE g_scoreCenter = 0; |
|---|
| 9 | SCORE g_scoreGapExtend = 0; |
|---|
| 10 | SCORE g_scoreGapOpen2 = MINUS_INFINITY; |
|---|
| 11 | SCORE g_scoreGapExtend2 = MINUS_INFINITY; |
|---|
| 12 | SCORE g_scoreGapAmbig = 0; |
|---|
| 13 | SCORE g_scoreAmbigFactor = 0; |
|---|
| 14 | |
|---|
| 15 | extern SCOREMATRIX VTML_LA; |
|---|
| 16 | extern SCOREMATRIX PAM200; |
|---|
| 17 | extern SCOREMATRIX PAM200NoCenter; |
|---|
| 18 | extern SCOREMATRIX VTML_SP; |
|---|
| 19 | extern SCOREMATRIX VTML_SPNoCenter; |
|---|
| 20 | extern SCOREMATRIX NUC_SP; |
|---|
| 21 | |
|---|
| 22 | PTR_SCOREMATRIX g_ptrScoreMatrix; |
|---|
| 23 | |
|---|
| 24 | const char *g_pstrInFileName = "-"; |
|---|
| 25 | const char *g_pstrOutFileName = "-"; |
|---|
| 26 | const char *g_pstrFASTAOutFileName = 0; |
|---|
| 27 | const char *g_pstrMSFOutFileName = 0; |
|---|
| 28 | const char *g_pstrClwOutFileName = 0; |
|---|
| 29 | const char *g_pstrClwStrictOutFileName = 0; |
|---|
| 30 | const char *g_pstrHTMLOutFileName = 0; |
|---|
| 31 | const char *g_pstrPHYIOutFileName = 0; |
|---|
| 32 | const char *g_pstrPHYSOutFileName = 0; |
|---|
| 33 | const char *g_pstrDistMxFileName1 = 0; |
|---|
| 34 | const char *g_pstrDistMxFileName2 = 0; |
|---|
| 35 | |
|---|
| 36 | const char *g_pstrFileName1 = 0; |
|---|
| 37 | const char *g_pstrFileName2 = 0; |
|---|
| 38 | |
|---|
| 39 | const char *g_pstrSPFileName = 0; |
|---|
| 40 | const char *g_pstrMatrixFileName = 0; |
|---|
| 41 | |
|---|
| 42 | const char *g_pstrUseTreeFileName = 0; |
|---|
| 43 | bool g_bUseTreeNoWarn = false; |
|---|
| 44 | |
|---|
| 45 | const char *g_pstrComputeWeightsFileName; |
|---|
| 46 | const char *g_pstrScoreFileName; |
|---|
| 47 | |
|---|
| 48 | const char *g_pstrProf1FileName = 0; |
|---|
| 49 | const char *g_pstrProf2FileName = 0; |
|---|
| 50 | |
|---|
| 51 | unsigned g_uSmoothWindowLength = 7; |
|---|
| 52 | unsigned g_uAnchorSpacing = 32; |
|---|
| 53 | unsigned g_uMaxTreeRefineIters = 1; |
|---|
| 54 | |
|---|
| 55 | unsigned g_uRefineWindow = 200; |
|---|
| 56 | unsigned g_uWindowFrom = 0; |
|---|
| 57 | unsigned g_uWindowTo = 0; |
|---|
| 58 | unsigned g_uSaveWindow = uInsane; |
|---|
| 59 | unsigned g_uWindowOffset = 0; |
|---|
| 60 | |
|---|
| 61 | unsigned g_uMaxSubFamCount = 5; |
|---|
| 62 | |
|---|
| 63 | unsigned g_uHydrophobicRunLength = 5; |
|---|
| 64 | float g_dHydroFactor = (float) 1.2; |
|---|
| 65 | |
|---|
| 66 | unsigned g_uMinDiagLength = 24; // TODO alpha -- should depend on alphabet? |
|---|
| 67 | unsigned g_uMaxDiagBreak = 1; |
|---|
| 68 | unsigned g_uDiagMargin = 5; |
|---|
| 69 | |
|---|
| 70 | float g_dSUEFF = (float) 0.1; |
|---|
| 71 | |
|---|
| 72 | bool g_bPrecompiledCenter = true; |
|---|
| 73 | bool g_bNormalizeCounts = false; |
|---|
| 74 | bool g_bDiags1 = false; |
|---|
| 75 | bool g_bDiags2 = false; |
|---|
| 76 | bool g_bAnchors = true; |
|---|
| 77 | bool g_bQuiet = false; |
|---|
| 78 | bool g_bVerbose = false; |
|---|
| 79 | bool g_bRefine = false; |
|---|
| 80 | bool g_bRefineW = false; |
|---|
| 81 | bool g_bProfDB = false; |
|---|
| 82 | bool g_bLow = false; |
|---|
| 83 | bool g_bSW = false; |
|---|
| 84 | bool g_bClusterOnly = false; |
|---|
| 85 | bool g_bProfile = false; |
|---|
| 86 | bool g_bPPScore = false; |
|---|
| 87 | bool g_bBrenner = false; |
|---|
| 88 | bool g_bDimer = false; |
|---|
| 89 | bool g_bVersion = false; |
|---|
| 90 | bool g_bStable = false; |
|---|
| 91 | bool g_bFASTA = false; |
|---|
| 92 | bool g_bPAS = false; |
|---|
| 93 | bool g_bTomHydro = false; |
|---|
| 94 | bool g_bMakeTree = false; |
|---|
| 95 | |
|---|
| 96 | #if DEBUG |
|---|
| 97 | bool g_bCatchExceptions = false; |
|---|
| 98 | #else |
|---|
| 99 | bool g_bCatchExceptions = true; |
|---|
| 100 | #endif |
|---|
| 101 | |
|---|
| 102 | bool g_bMSF = false; |
|---|
| 103 | bool g_bAln = false; |
|---|
| 104 | bool g_bClwStrict = false; |
|---|
| 105 | bool g_bHTML = false; |
|---|
| 106 | bool g_bPHYI = false; |
|---|
| 107 | bool g_bPHYS = false; |
|---|
| 108 | |
|---|
| 109 | unsigned g_uMaxIters = 8; |
|---|
| 110 | unsigned long g_ulMaxSecs = 0; |
|---|
| 111 | unsigned g_uMaxMB = 500; |
|---|
| 112 | |
|---|
| 113 | PPSCORE g_PPScore = PPSCORE_LE; |
|---|
| 114 | OBJSCORE g_ObjScore = OBJSCORE_SPM; |
|---|
| 115 | |
|---|
| 116 | SEQWEIGHT g_SeqWeight1 = SEQWEIGHT_ClustalW; |
|---|
| 117 | SEQWEIGHT g_SeqWeight2 = SEQWEIGHT_ClustalW; |
|---|
| 118 | |
|---|
| 119 | DISTANCE g_Distance1 = DISTANCE_Kmer6_6; |
|---|
| 120 | DISTANCE g_Distance2 = DISTANCE_PctIdKimura; |
|---|
| 121 | |
|---|
| 122 | CLUSTER g_Cluster1 = CLUSTER_UPGMB; |
|---|
| 123 | CLUSTER g_Cluster2 = CLUSTER_UPGMB; |
|---|
| 124 | |
|---|
| 125 | ROOT g_Root1 = ROOT_Pseudo; |
|---|
| 126 | ROOT g_Root2 = ROOT_Pseudo; |
|---|
| 127 | |
|---|
| 128 | bool g_bDiags; |
|---|
| 129 | |
|---|
| 130 | SEQTYPE g_SeqType = SEQTYPE_Auto; |
|---|
| 131 | |
|---|
| 132 | TERMGAPS g_TermGaps = TERMGAPS_Half; |
|---|
| 133 | |
|---|
| 134 | //------------------------------------------------------ |
|---|
| 135 | // These parameters depending on the chosen prof-prof |
|---|
| 136 | // score (g_PPScore), initialized to "Undefined". |
|---|
| 137 | float g_dSmoothScoreCeil = fInsane; |
|---|
| 138 | float g_dMinBestColScore = fInsane; |
|---|
| 139 | float g_dMinSmoothScore = fInsane; |
|---|
| 140 | SCORE g_scoreGapOpen = fInsane; |
|---|
| 141 | //------------------------------------------------------ |
|---|
| 142 | |
|---|
| 143 | static unsigned atou(const char *s) |
|---|
| 144 | { |
|---|
| 145 | return (unsigned) atoi(s); |
|---|
| 146 | } |
|---|
| 147 | |
|---|
| 148 | const char *MaxSecsToStr() |
|---|
| 149 | { |
|---|
| 150 | if (0 == g_ulMaxSecs) |
|---|
| 151 | return "(No limit)"; |
|---|
| 152 | return SecsToStr(g_ulMaxSecs); |
|---|
| 153 | } |
|---|
| 154 | |
|---|
| 155 | void ListParams() |
|---|
| 156 | { |
|---|
| 157 | Log("\n"); |
|---|
| 158 | Log("%s\n", MUSCLE_LONG_VERSION); |
|---|
| 159 | Log("http://www.drive5.com/muscle\n"); |
|---|
| 160 | Log("\n"); |
|---|
| 161 | Log("Profile-profile score %s\n", PPSCOREToStr(g_PPScore)); |
|---|
| 162 | Log("Max iterations %u\n", g_uMaxIters); |
|---|
| 163 | Log("Max trees %u\n", g_uMaxTreeRefineIters); |
|---|
| 164 | Log("Max time %s\n", MaxSecsToStr()); |
|---|
| 165 | Log("Max MB %u\n", g_uMaxMB); |
|---|
| 166 | Log("Gap open %g\n", g_scoreGapOpen); |
|---|
| 167 | Log("Gap extend (dimer) %g\n", g_scoreGapExtend); |
|---|
| 168 | Log("Gap ambig factor %g\n", g_scoreAmbigFactor); |
|---|
| 169 | Log("Gap ambig penalty %g\n", g_scoreGapAmbig); |
|---|
| 170 | Log("Center (LE) %g\n", g_scoreCenter); |
|---|
| 171 | Log("Term gaps %s\n", TERMGAPSToStr(g_TermGaps)); |
|---|
| 172 | |
|---|
| 173 | Log("Smooth window length %u\n", g_uSmoothWindowLength); |
|---|
| 174 | Log("Refine window length %u\n", g_uRefineWindow); |
|---|
| 175 | Log("Min anchor spacing %u\n", g_uAnchorSpacing); |
|---|
| 176 | Log("Min diag length (lambda) %u\n", g_uMinDiagLength); |
|---|
| 177 | Log("Diag margin (mu) %u\n", g_uDiagMargin); |
|---|
| 178 | Log("Min diag break %u\n", g_uMaxDiagBreak); |
|---|
| 179 | Log("Hydrophobic window %u\n", g_uHydrophobicRunLength); |
|---|
| 180 | |
|---|
| 181 | Log("Hydrophobic gap factor %g\n", g_dHydroFactor); |
|---|
| 182 | Log("Smooth score ceiling %g\n", g_dSmoothScoreCeil); |
|---|
| 183 | Log("Min best col score %g\n", g_dMinBestColScore); |
|---|
| 184 | Log("Min anchor score %g\n", g_dMinSmoothScore); |
|---|
| 185 | Log("SUEFF %g\n", g_dSUEFF); |
|---|
| 186 | |
|---|
| 187 | Log("Brenner root MSA %s\n", BoolToStr(g_bBrenner)); |
|---|
| 188 | Log("Normalize counts %s\n", BoolToStr(g_bNormalizeCounts)); |
|---|
| 189 | Log("Diagonals (1) %s\n", BoolToStr(g_bDiags1)); |
|---|
| 190 | Log("Diagonals (2) %s\n", BoolToStr(g_bDiags2)); |
|---|
| 191 | Log("Anchors %s\n", BoolToStr(g_bAnchors)); |
|---|
| 192 | Log("MSF output format %s\n", BoolToStr(g_bMSF)); |
|---|
| 193 | Log("Phylip interleaved %s\n", BoolToStr(g_bPHYI)); |
|---|
| 194 | Log("Phylip sequential %s\n", BoolToStr(g_bPHYS)); |
|---|
| 195 | Log("ClustalW output format %s\n", BoolToStr(g_bAln)); |
|---|
| 196 | Log("Catch exceptions %s\n", BoolToStr(g_bCatchExceptions)); |
|---|
| 197 | Log("Quiet %s\n", BoolToStr(g_bQuiet)); |
|---|
| 198 | Log("Refine %s\n", BoolToStr(g_bRefine)); |
|---|
| 199 | Log("ProdfDB %s\n", BoolToStr(g_bProfDB)); |
|---|
| 200 | Log("Low complexity profiles %s\n", BoolToStr(g_bLow)); |
|---|
| 201 | |
|---|
| 202 | Log("Objective score %s\n", OBJSCOREToStr(g_ObjScore)); |
|---|
| 203 | |
|---|
| 204 | Log("Distance method (1) %s\n", DISTANCEToStr(g_Distance1)); |
|---|
| 205 | Log("Clustering method (1) %s\n", CLUSTERToStr(g_Cluster1)); |
|---|
| 206 | Log("Root method (1) %s\n", ROOTToStr(g_Root1)); |
|---|
| 207 | Log("Sequence weighting (1) %s\n", SEQWEIGHTToStr(g_SeqWeight1)); |
|---|
| 208 | |
|---|
| 209 | Log("Distance method (2) %s\n", DISTANCEToStr(g_Distance2)); |
|---|
| 210 | Log("Clustering method (2) %s\n", CLUSTERToStr(g_Cluster2)); |
|---|
| 211 | Log("Root method (2) %s\n", ROOTToStr(g_Root2)); |
|---|
| 212 | Log("Sequence weighting (2) %s\n", SEQWEIGHTToStr(g_SeqWeight2)); |
|---|
| 213 | |
|---|
| 214 | Log("\n"); |
|---|
| 215 | } |
|---|
| 216 | |
|---|
| 217 | static void SetDefaultsLE() |
|---|
| 218 | { |
|---|
| 219 | g_ptrScoreMatrix = &VTML_LA; |
|---|
| 220 | |
|---|
| 221 | //g_scoreGapOpen = (SCORE) -3.00; |
|---|
| 222 | //g_scoreCenter = (SCORE) -0.55; |
|---|
| 223 | g_scoreGapOpen = (SCORE) -2.9; |
|---|
| 224 | g_scoreCenter = (SCORE) -0.52; |
|---|
| 225 | |
|---|
| 226 | g_bNormalizeCounts = true; |
|---|
| 227 | |
|---|
| 228 | //g_dSmoothScoreCeil = 5.0; |
|---|
| 229 | //g_dMinBestColScore = 4.0; |
|---|
| 230 | //g_dMinSmoothScore = 2.0; |
|---|
| 231 | g_dSmoothScoreCeil = 3.0; |
|---|
| 232 | g_dMinBestColScore = 2.0; |
|---|
| 233 | g_dMinSmoothScore = 1.0; |
|---|
| 234 | |
|---|
| 235 | g_Distance1 = DISTANCE_Kmer6_6; |
|---|
| 236 | g_Distance2 = DISTANCE_PctIdKimura; |
|---|
| 237 | } |
|---|
| 238 | |
|---|
| 239 | static void SetDefaultsSP() |
|---|
| 240 | { |
|---|
| 241 | g_ptrScoreMatrix = &PAM200; |
|---|
| 242 | |
|---|
| 243 | g_scoreGapOpen = -1439; |
|---|
| 244 | g_scoreCenter = 0.0; // center pre-added into score mx |
|---|
| 245 | |
|---|
| 246 | g_bNormalizeCounts = false; |
|---|
| 247 | |
|---|
| 248 | g_dSmoothScoreCeil = 200.0; |
|---|
| 249 | g_dMinBestColScore = 300.0; |
|---|
| 250 | g_dMinSmoothScore = 125.0; |
|---|
| 251 | |
|---|
| 252 | g_Distance1 = DISTANCE_Kmer6_6; |
|---|
| 253 | g_Distance2 = DISTANCE_PctIdKimura; |
|---|
| 254 | } |
|---|
| 255 | |
|---|
| 256 | static void SetDefaultsSV() |
|---|
| 257 | { |
|---|
| 258 | g_ptrScoreMatrix = &VTML_SP; |
|---|
| 259 | |
|---|
| 260 | g_scoreGapOpen = -300; |
|---|
| 261 | g_scoreCenter = 0.0; // center pre-added into score mx |
|---|
| 262 | |
|---|
| 263 | g_bNormalizeCounts = false; |
|---|
| 264 | |
|---|
| 265 | g_dSmoothScoreCeil = 90.0; |
|---|
| 266 | g_dMinBestColScore = 130.0; |
|---|
| 267 | g_dMinSmoothScore = 40.0; |
|---|
| 268 | |
|---|
| 269 | g_Distance1 = DISTANCE_Kmer6_6; |
|---|
| 270 | g_Distance2 = DISTANCE_PctIdKimura; |
|---|
| 271 | } |
|---|
| 272 | |
|---|
| 273 | //static void SetDefaultsSPN() |
|---|
| 274 | // { |
|---|
| 275 | // g_ptrScoreMatrix = &NUC_SP; |
|---|
| 276 | // |
|---|
| 277 | // g_scoreGapOpen = -400; |
|---|
| 278 | // g_scoreCenter = 0.0; // center pre-added into score mx |
|---|
| 279 | // |
|---|
| 280 | // g_bNormalizeCounts = false; |
|---|
| 281 | // |
|---|
| 282 | // g_dSmoothScoreCeil = 999.0; // disable |
|---|
| 283 | // g_dMinBestColScore = 90; |
|---|
| 284 | // g_dMinSmoothScore = 90; |
|---|
| 285 | // |
|---|
| 286 | // g_Distance1 = DISTANCE_Kmer4_6; |
|---|
| 287 | // g_Distance2 = DISTANCE_PctIdKimura; |
|---|
| 288 | // } |
|---|
| 289 | |
|---|
| 290 | static void SetDefaultsSPN_DNA() |
|---|
| 291 | { |
|---|
| 292 | g_ptrScoreMatrix = &NUC_SP; |
|---|
| 293 | |
|---|
| 294 | g_scoreGapOpen = -400; |
|---|
| 295 | g_scoreCenter = 0.0; // center pre-added into score mx |
|---|
| 296 | g_scoreGapExtend = 0.0; |
|---|
| 297 | |
|---|
| 298 | g_bNormalizeCounts = false; |
|---|
| 299 | |
|---|
| 300 | g_dSmoothScoreCeil = 999.0; // disable |
|---|
| 301 | g_dMinBestColScore = 90; |
|---|
| 302 | g_dMinSmoothScore = 90; |
|---|
| 303 | |
|---|
| 304 | g_Distance1 = DISTANCE_Kmer4_6; |
|---|
| 305 | g_Distance2 = DISTANCE_PctIdKimura; |
|---|
| 306 | } |
|---|
| 307 | |
|---|
| 308 | static void SetDefaultsSPN_RNA() |
|---|
| 309 | { |
|---|
| 310 | g_ptrScoreMatrix = &NUC_SP; |
|---|
| 311 | |
|---|
| 312 | g_scoreGapOpen = -420; |
|---|
| 313 | g_scoreCenter = -300; // total center = NUC_EXTEND - 300 |
|---|
| 314 | g_scoreGapExtend = 0.0; |
|---|
| 315 | |
|---|
| 316 | g_bNormalizeCounts = false; |
|---|
| 317 | |
|---|
| 318 | g_dSmoothScoreCeil = 999.0; // disable |
|---|
| 319 | g_dMinBestColScore = 90; |
|---|
| 320 | g_dMinSmoothScore = 90; |
|---|
| 321 | |
|---|
| 322 | g_Distance1 = DISTANCE_Kmer4_6; |
|---|
| 323 | g_Distance2 = DISTANCE_PctIdKimura; |
|---|
| 324 | } |
|---|
| 325 | |
|---|
| 326 | static void FlagParam(const char *OptName, bool *ptrParam, bool bValueIfFlagSet) |
|---|
| 327 | { |
|---|
| 328 | bool bIsSet = FlagOpt(OptName); |
|---|
| 329 | if (bIsSet) |
|---|
| 330 | *ptrParam = bValueIfFlagSet; |
|---|
| 331 | } |
|---|
| 332 | |
|---|
| 333 | static void StrParam(const char *OptName, const char **ptrptrParam) |
|---|
| 334 | { |
|---|
| 335 | const char *opt = ValueOpt(OptName); |
|---|
| 336 | if (0 != opt) |
|---|
| 337 | *ptrptrParam = opt; |
|---|
| 338 | } |
|---|
| 339 | |
|---|
| 340 | static void FloatParam(const char *OptName, float *ptrParam) |
|---|
| 341 | { |
|---|
| 342 | const char *opt = ValueOpt(OptName); |
|---|
| 343 | if (0 != opt) |
|---|
| 344 | *ptrParam = (float) atof(opt); |
|---|
| 345 | } |
|---|
| 346 | |
|---|
| 347 | static void UintParam(const char *OptName, unsigned *ptrParam) |
|---|
| 348 | { |
|---|
| 349 | const char *opt = ValueOpt(OptName); |
|---|
| 350 | if (0 != opt) |
|---|
| 351 | *ptrParam = atou(opt); |
|---|
| 352 | } |
|---|
| 353 | |
|---|
| 354 | static void EnumParam(const char *OptName, EnumOpt *Opts, int *Param) |
|---|
| 355 | { |
|---|
| 356 | const char *Value = ValueOpt(OptName); |
|---|
| 357 | if (0 == Value) |
|---|
| 358 | return; |
|---|
| 359 | |
|---|
| 360 | for (;;) |
|---|
| 361 | { |
|---|
| 362 | if (0 == Opts->pstrOpt) |
|---|
| 363 | Quit("Invalid parameter -%s %s", OptName, Value); |
|---|
| 364 | if (0 == stricmp(Value, Opts->pstrOpt)) |
|---|
| 365 | { |
|---|
| 366 | *Param = Opts->iValue; |
|---|
| 367 | return; |
|---|
| 368 | } |
|---|
| 369 | ++Opts; |
|---|
| 370 | } |
|---|
| 371 | } |
|---|
| 372 | |
|---|
| 373 | static void SetPPDefaultParams() |
|---|
| 374 | { |
|---|
| 375 | switch (g_PPScore) |
|---|
| 376 | { |
|---|
| 377 | case PPSCORE_SP: |
|---|
| 378 | SetDefaultsSP(); |
|---|
| 379 | break; |
|---|
| 380 | |
|---|
| 381 | case PPSCORE_LE: |
|---|
| 382 | SetDefaultsLE(); |
|---|
| 383 | break; |
|---|
| 384 | |
|---|
| 385 | case PPSCORE_SV: |
|---|
| 386 | SetDefaultsSV(); |
|---|
| 387 | break; |
|---|
| 388 | |
|---|
| 389 | case PPSCORE_SPN: |
|---|
| 390 | switch (g_Alpha) |
|---|
| 391 | { |
|---|
| 392 | case ALPHA_DNA: |
|---|
| 393 | SetDefaultsSPN_DNA(); |
|---|
| 394 | break; |
|---|
| 395 | case ALPHA_RNA: |
|---|
| 396 | SetDefaultsSPN_RNA(); |
|---|
| 397 | break; |
|---|
| 398 | default: |
|---|
| 399 | Quit("Invalid alpha %d", g_Alpha); |
|---|
| 400 | } |
|---|
| 401 | break; |
|---|
| 402 | |
|---|
| 403 | default: |
|---|
| 404 | Quit("Invalid g_PPScore"); |
|---|
| 405 | } |
|---|
| 406 | } |
|---|
| 407 | |
|---|
| 408 | static void SetPPCommandLineParams() |
|---|
| 409 | { |
|---|
| 410 | FloatParam("GapOpen", &g_scoreGapOpen); |
|---|
| 411 | FloatParam("GapOpen2", &g_scoreGapOpen2); |
|---|
| 412 | FloatParam("GapExtend", &g_scoreGapExtend); |
|---|
| 413 | FloatParam("GapExtend2", &g_scoreGapExtend2); |
|---|
| 414 | FloatParam("GapAmbig", &g_scoreAmbigFactor); |
|---|
| 415 | FloatParam("Center", &g_scoreCenter); |
|---|
| 416 | FloatParam("SmoothScoreCeil", &g_dSmoothScoreCeil); |
|---|
| 417 | FloatParam("MinBestColScore", &g_dMinBestColScore); |
|---|
| 418 | FloatParam("MinSmoothScore", &g_dMinSmoothScore); |
|---|
| 419 | |
|---|
| 420 | EnumParam("Distance", DISTANCE_Opts, (int *) &g_Distance1); |
|---|
| 421 | EnumParam("Distance", DISTANCE_Opts, (int *) &g_Distance2); |
|---|
| 422 | |
|---|
| 423 | EnumParam("Distance1", DISTANCE_Opts, (int *) &g_Distance1); |
|---|
| 424 | EnumParam("Distance2", DISTANCE_Opts, (int *) &g_Distance2); |
|---|
| 425 | } |
|---|
| 426 | |
|---|
| 427 | void SetPPScore(bool bRespectFlagOpts) |
|---|
| 428 | { |
|---|
| 429 | if (bRespectFlagOpts) |
|---|
| 430 | { |
|---|
| 431 | if (FlagOpt("SP")) |
|---|
| 432 | g_PPScore = PPSCORE_SP; |
|---|
| 433 | else if (FlagOpt("LE")) |
|---|
| 434 | g_PPScore = PPSCORE_LE; |
|---|
| 435 | else if (FlagOpt("SV")) |
|---|
| 436 | g_PPScore = PPSCORE_SV; |
|---|
| 437 | else if (FlagOpt("SPN")) |
|---|
| 438 | g_PPScore = PPSCORE_SPN; |
|---|
| 439 | } |
|---|
| 440 | |
|---|
| 441 | switch (g_PPScore) |
|---|
| 442 | { |
|---|
| 443 | case PPSCORE_LE: |
|---|
| 444 | case PPSCORE_SP: |
|---|
| 445 | case PPSCORE_SV: |
|---|
| 446 | if (ALPHA_RNA == g_Alpha || ALPHA_DNA == g_Alpha) |
|---|
| 447 | g_PPScore = PPSCORE_SPN; |
|---|
| 448 | break; |
|---|
| 449 | case PPSCORE_SPN: |
|---|
| 450 | if (ALPHA_Amino == g_Alpha) |
|---|
| 451 | g_PPScore = PPSCORE_LE; |
|---|
| 452 | break; |
|---|
| 453 | } |
|---|
| 454 | |
|---|
| 455 | SetPPDefaultParams(); |
|---|
| 456 | SetPPCommandLineParams(); |
|---|
| 457 | |
|---|
| 458 | if (g_bVerbose) |
|---|
| 459 | ListParams(); |
|---|
| 460 | } |
|---|
| 461 | |
|---|
| 462 | void SetPPScore(PPSCORE p) |
|---|
| 463 | { |
|---|
| 464 | g_PPScore = p; |
|---|
| 465 | SetPPScore(true); |
|---|
| 466 | } |
|---|
| 467 | |
|---|
| 468 | static void SetMaxSecs() |
|---|
| 469 | { |
|---|
| 470 | float fMaxHours = 0.0; |
|---|
| 471 | FloatParam("MaxHours", &fMaxHours); |
|---|
| 472 | if (0.0 == fMaxHours) |
|---|
| 473 | return; |
|---|
| 474 | g_ulMaxSecs = (unsigned long) (fMaxHours*60*60); |
|---|
| 475 | } |
|---|
| 476 | |
|---|
| 477 | static bool CanDoLowComplexity() |
|---|
| 478 | { |
|---|
| 479 | if (g_SeqWeight1 != SEQWEIGHT_ClustalW) |
|---|
| 480 | return false; |
|---|
| 481 | if (1 == g_uMaxIters) |
|---|
| 482 | return true; |
|---|
| 483 | return g_SeqWeight2 == SEQWEIGHT_ClustalW; |
|---|
| 484 | } |
|---|
| 485 | |
|---|
| 486 | bool MissingCommand() |
|---|
| 487 | { |
|---|
| 488 | if (strcmp(g_pstrInFileName, "-")) |
|---|
| 489 | return false; |
|---|
| 490 | if (0 != g_pstrFileName1) |
|---|
| 491 | return false; |
|---|
| 492 | if (0 != g_pstrSPFileName) |
|---|
| 493 | return false; |
|---|
| 494 | return true; |
|---|
| 495 | } |
|---|
| 496 | |
|---|
| 497 | void SetParams() |
|---|
| 498 | { |
|---|
| 499 | SetMaxSecs(); |
|---|
| 500 | |
|---|
| 501 | StrParam("in", &g_pstrInFileName); |
|---|
| 502 | StrParam("out", &g_pstrOutFileName); |
|---|
| 503 | |
|---|
| 504 | StrParam("FASTAOut", &g_pstrFASTAOutFileName); |
|---|
| 505 | StrParam("ClwOut", &g_pstrClwOutFileName); |
|---|
| 506 | StrParam("ClwStrictOut", &g_pstrClwStrictOutFileName); |
|---|
| 507 | StrParam("HTMLOut", &g_pstrHTMLOutFileName); |
|---|
| 508 | StrParam("PHYIOut", &g_pstrPHYIOutFileName); |
|---|
| 509 | StrParam("PHYSOut", &g_pstrPHYSOutFileName); |
|---|
| 510 | StrParam("MSFOut", &g_pstrMSFOutFileName); |
|---|
| 511 | |
|---|
| 512 | StrParam("in1", &g_pstrFileName1); |
|---|
| 513 | StrParam("in2", &g_pstrFileName2); |
|---|
| 514 | |
|---|
| 515 | StrParam("Matrix", &g_pstrMatrixFileName); |
|---|
| 516 | StrParam("SPScore", &g_pstrSPFileName); |
|---|
| 517 | |
|---|
| 518 | StrParam("UseTree_NoWarn", &g_pstrUseTreeFileName); |
|---|
| 519 | if (0 != g_pstrUseTreeFileName) |
|---|
| 520 | g_bUseTreeNoWarn = true; |
|---|
| 521 | |
|---|
| 522 | StrParam("UseTree", &g_pstrUseTreeFileName); |
|---|
| 523 | StrParam("ComputeWeights", &g_pstrComputeWeightsFileName); |
|---|
| 524 | StrParam("ScoreFile", &g_pstrScoreFileName); |
|---|
| 525 | StrParam("DistMx1", &g_pstrDistMxFileName1); |
|---|
| 526 | StrParam("DistMx2", &g_pstrDistMxFileName2); |
|---|
| 527 | |
|---|
| 528 | FlagParam("Core", &g_bCatchExceptions, false); |
|---|
| 529 | FlagParam("NoCore", &g_bCatchExceptions, true); |
|---|
| 530 | |
|---|
| 531 | FlagParam("Diags1", &g_bDiags1, true); |
|---|
| 532 | FlagParam("Diags2", &g_bDiags2, true); |
|---|
| 533 | |
|---|
| 534 | bool Diags = false; |
|---|
| 535 | FlagParam("Diags", &Diags, true); |
|---|
| 536 | if (Diags) |
|---|
| 537 | { |
|---|
| 538 | g_bDiags1 = true; |
|---|
| 539 | g_bDiags2 = true; |
|---|
| 540 | } |
|---|
| 541 | |
|---|
| 542 | FlagParam("Anchors", &g_bAnchors, true); |
|---|
| 543 | FlagParam("NoAnchors", &g_bAnchors, false); |
|---|
| 544 | |
|---|
| 545 | FlagParam("Quiet", &g_bQuiet, true); |
|---|
| 546 | FlagParam("Verbose", &g_bVerbose, true); |
|---|
| 547 | FlagParam("Version", &g_bVersion, true); |
|---|
| 548 | FlagParam("Stable", &g_bStable, true); |
|---|
| 549 | FlagParam("Group", &g_bStable, false); |
|---|
| 550 | FlagParam("Refine", &g_bRefine, true); |
|---|
| 551 | FlagParam("RefineW", &g_bRefineW, true); |
|---|
| 552 | FlagParam("ProfDB", &g_bProfDB, true); |
|---|
| 553 | FlagParam("SW", &g_bSW, true); |
|---|
| 554 | FlagParam("ClusterOnly", &g_bClusterOnly, true); |
|---|
| 555 | FlagParam("Profile", &g_bProfile, true); |
|---|
| 556 | FlagParam("PPScore", &g_bPPScore, true); |
|---|
| 557 | FlagParam("Brenner", &g_bBrenner, true); |
|---|
| 558 | FlagParam("Dimer", &g_bDimer, true); |
|---|
| 559 | |
|---|
| 560 | FlagParam("MSF", &g_bMSF, true); |
|---|
| 561 | FlagParam("PHYI", &g_bPHYI, true); |
|---|
| 562 | FlagParam("PHYS", &g_bPHYS, true); |
|---|
| 563 | FlagParam("clw", &g_bAln, true); |
|---|
| 564 | FlagParam("HTML", &g_bHTML, true); |
|---|
| 565 | FlagParam("FASTA", &g_bFASTA, true); |
|---|
| 566 | FlagParam("PAS", &g_bPAS, true); |
|---|
| 567 | FlagParam("MakeTree", &g_bMakeTree, true); |
|---|
| 568 | |
|---|
| 569 | if (g_bStable) |
|---|
| 570 | Quit("-stable not supported in this version of muscle"); |
|---|
| 571 | |
|---|
| 572 | bool b = false; |
|---|
| 573 | FlagParam("clwstrict", &b, true); |
|---|
| 574 | if (b) |
|---|
| 575 | { |
|---|
| 576 | g_bAln = true; |
|---|
| 577 | g_bClwStrict = true; |
|---|
| 578 | } |
|---|
| 579 | |
|---|
| 580 | UintParam("MaxIters", &g_uMaxIters); |
|---|
| 581 | UintParam("MaxTrees", &g_uMaxTreeRefineIters); |
|---|
| 582 | UintParam("SmoothWindow", &g_uSmoothWindowLength); |
|---|
| 583 | UintParam("RefineWindow", &g_uRefineWindow); |
|---|
| 584 | UintParam("FromWindow", &g_uWindowFrom); |
|---|
| 585 | UintParam("ToWindow", &g_uWindowTo); |
|---|
| 586 | UintParam("SaveWindow", &g_uSaveWindow); |
|---|
| 587 | UintParam("WindowOffset", &g_uWindowOffset); |
|---|
| 588 | UintParam("AnchorSpacing", &g_uAnchorSpacing); |
|---|
| 589 | UintParam("DiagLength", &g_uMinDiagLength); |
|---|
| 590 | UintParam("DiagMargin", &g_uDiagMargin); |
|---|
| 591 | UintParam("DiagBreak", &g_uMaxDiagBreak); |
|---|
| 592 | UintParam("MaxSubFam", &g_uMaxSubFamCount); |
|---|
| 593 | |
|---|
| 594 | UintParam("Hydro", &g_uHydrophobicRunLength); |
|---|
| 595 | FlagParam("TomHydro", &g_bTomHydro, true); |
|---|
| 596 | if (g_bTomHydro) |
|---|
| 597 | g_uHydrophobicRunLength = 0; |
|---|
| 598 | |
|---|
| 599 | FloatParam("SUEFF", &g_dSUEFF); |
|---|
| 600 | FloatParam("HydroFactor", &g_dHydroFactor); |
|---|
| 601 | |
|---|
| 602 | EnumParam("ObjScore", OBJSCORE_Opts, (int *) &g_ObjScore); |
|---|
| 603 | EnumParam("TermGaps", TERMGAPS_Opts, (int *) &g_TermGaps); |
|---|
| 604 | |
|---|
| 605 | EnumParam("Weight", SEQWEIGHT_Opts, (int *) &g_SeqWeight1); |
|---|
| 606 | EnumParam("Weight", SEQWEIGHT_Opts, (int *) &g_SeqWeight2); |
|---|
| 607 | |
|---|
| 608 | EnumParam("Weight1", SEQWEIGHT_Opts, (int *) &g_SeqWeight1); |
|---|
| 609 | EnumParam("Weight2", SEQWEIGHT_Opts, (int *) &g_SeqWeight2); |
|---|
| 610 | |
|---|
| 611 | EnumParam("Cluster", CLUSTER_Opts, (int *) &g_Cluster1); |
|---|
| 612 | EnumParam("Cluster", CLUSTER_Opts, (int *) &g_Cluster2); |
|---|
| 613 | |
|---|
| 614 | EnumParam("Cluster1", CLUSTER_Opts, (int *) &g_Cluster1); |
|---|
| 615 | EnumParam("Cluster2", CLUSTER_Opts, (int *) &g_Cluster2); |
|---|
| 616 | |
|---|
| 617 | EnumParam("Root1", ROOT_Opts, (int *) &g_Root1); |
|---|
| 618 | EnumParam("Root2", ROOT_Opts, (int *) &g_Root2); |
|---|
| 619 | |
|---|
| 620 | EnumParam("SeqType", SEQTYPE_Opts, (int *) &g_SeqType); |
|---|
| 621 | |
|---|
| 622 | g_scoreGapAmbig = g_scoreGapOpen*g_scoreAmbigFactor; |
|---|
| 623 | g_bLow = CanDoLowComplexity(); |
|---|
| 624 | |
|---|
| 625 | if (g_bDimer) |
|---|
| 626 | g_bPrecompiledCenter = false; |
|---|
| 627 | |
|---|
| 628 | UintParam("MaxMB", &g_uMaxMB); |
|---|
| 629 | if (0 == ValueOpt("MaxMB")) |
|---|
| 630 | g_uMaxMB = (unsigned) (GetRAMSizeMB()*DEFAULT_MAX_MB_FRACT); |
|---|
| 631 | } |
|---|