35
35
#ifndef SKIP_DOXYGEN_PROCESSING
36
36
static char const rcsid[] =
37
"$Id: blast_options.c,v 1.175 2005/11/16 14:27:03 madden Exp $";
37
"$Id: blast_options.c,v 1.183 2006/04/25 16:06:53 camacho Exp $";
38
38
#endif /* SKIP_DOXYGEN_PROCESSING */
40
40
#include <algo/blast/core/blast_options.h>
41
41
#include <algo/blast/core/blast_filter.h>
43
const int kUngappedHSPNumMax = 400;
43
const int kUngappedHSPNumMax = 400; /**< Suggested max. number of HSPs for an ungapped search. */
44
45
const double kPSSM_NoImpalaScaling = 1.0;
46
47
SDustOptions* SDustOptionsFree(SDustOptions* dust_options)
182
184
if (program_number != eBlastTypeBlastn)
184
186
if (blast_message)
185
Blast_MessageWrite(blast_message, eBlastSevWarning, 2, 1,
187
Blast_MessageWrite(blast_message, eBlastSevError, kBlastMessageNoContext,
186
188
"SBlastFilterOptionsValidate: Repeat filtering only supported with blastn");
189
if (filter_options->repeatFilterOptions->database == NULL)
191
if (filter_options->repeatFilterOptions->database == NULL ||
192
strlen(filter_options->repeatFilterOptions->database) == 0)
191
194
if (blast_message)
192
Blast_MessageWrite(blast_message, eBlastSevWarning, 2, 1,
195
Blast_MessageWrite(blast_message, eBlastSevError, kBlastMessageNoContext,
193
196
"SBlastFilterOptionsValidate: No repeat database specified for repeat filtering");
584
589
if (options->penalty >= 0)
588
Blast_MessageWrite(blast_msg, eBlastSevWarning, code, subcode,
591
Blast_MessageWrite(blast_msg, eBlastSevWarning, kBlastMessageNoContext,
589
592
"BLASTN penalty must be negative");
592
595
if (options->gapped_calculation && options->gap_open > 0 && options->gap_extend == 0)
596
Blast_MessageWrite(blast_msg, eBlastSevWarning,
597
Blast_MessageWrite(blast_msg, eBlastSevWarning, kBlastMessageNoContext,
598
598
"BLASTN gap extension penalty cannot be 0");
617
615
buffer = BLAST_PrintMatrixMessage(options->matrix);
618
Blast_MessageWrite(blast_msg, eBlastSevError,
619
code, subcode, buffer);
616
Blast_MessageWrite(blast_msg, eBlastSevError, kBlastMessageNoContext, buffer);
624
621
else if (status == 2)
630
625
buffer = BLAST_PrintAllowedValues(options->matrix,
631
626
options->gap_open, options->gap_extend,
632
627
options->decline_align);
633
Blast_MessageWrite(blast_msg, eBlastSevError, code, subcode,
628
Blast_MessageWrite(blast_msg, eBlastSevError, kBlastMessageNoContext, buffer);
924
915
const LookupTableOptions* options, Blast_Message* *blast_msg)
929
918
const Boolean kPhiBlast = Blast_ProgramIsPhiBlast(program_number);
931
920
if (options == NULL)
934
923
if (options->phi_pattern && !kPhiBlast) {
935
Blast_MessageWrite(blast_msg, eBlastSevError, code, subcode,
924
Blast_MessageWrite(blast_msg, eBlastSevError, kBlastMessageNoContext,
936
925
"PHI pattern can be specified only for blastp and blastn");
940
929
/* For PHI BLAST, the subsequent word size tests are not needed. */
945
934
(!Blast_ProgramIsRpsBlast(program_number)) &&
946
935
options->threshold <= 0)
948
Blast_MessageWrite(blast_msg, eBlastSevError, code, subcode,
937
Blast_MessageWrite(blast_msg, eBlastSevError, kBlastMessageNoContext,
949
938
"Non-zero threshold required");
953
942
if (options->word_size <= 0)
955
944
if ( !Blast_ProgramIsRpsBlast(program_number)) {
956
Blast_MessageWrite(blast_msg, eBlastSevError,
945
Blast_MessageWrite(blast_msg, eBlastSevError, kBlastMessageNoContext,
958
946
"Word-size must be greater than zero");
961
949
} else if (program_number == eBlastTypeBlastn && options->word_size < 4)
963
Blast_MessageWrite(blast_msg, eBlastSevError, code, subcode,
964
"Word-size must be 4"
965
"or greater for nucleotide comparison");
951
Blast_MessageWrite(blast_msg, eBlastSevError, kBlastMessageNoContext,
952
"Word-size must be 4 or greater for nucleotide comparison");
967
954
} else if (program_number != eBlastTypeBlastn && options->word_size > 5)
969
Blast_MessageWrite(blast_msg, eBlastSevError, code, subcode,
956
Blast_MessageWrite(blast_msg, eBlastSevError, kBlastMessageNoContext,
970
957
"Word-size must be less"
971
958
"than 6 for protein comparison");
976
/* FIXME: is this really needed?? */
977
if (options->variable_wordsize &&
978
((options->word_size % 4) != 0) ) {
979
Blast_MessageWrite(blast_msg, eBlastSevWarning, code, subcode,
980
"Word size must be divisible by 4 if only full "
981
"bytes of subject sequences are matched to query");
985
962
if (program_number != eBlastTypeBlastn &&
986
963
options->lut_type == MB_LOOKUP_TABLE)
988
Blast_MessageWrite(blast_msg, eBlastSevError, code, subcode,
965
Blast_MessageWrite(blast_msg, eBlastSevError, kBlastMessageNoContext,
989
966
"Megablast lookup table only supported with blastn");
993
if (options->lut_type == MB_LOOKUP_TABLE && options->word_size < 12 &&
994
options->mb_template_length == 0) {
995
Blast_MessageWrite(blast_msg, eBlastSevError, code, subcode,
996
"Word size must be 12 or greater with megablast"
1001
970
if (program_number == eBlastTypeBlastn && options->mb_template_length > 0) {
1002
971
if (!s_DiscWordOptionsValidate(options->word_size,
1003
972
options->mb_template_length, options->mb_template_type)) {
1004
Blast_MessageWrite(blast_msg, eBlastSevError, code, subcode,
973
Blast_MessageWrite(blast_msg, eBlastSevError, kBlastMessageNoContext,
1005
974
"Invalid discontiguous template parameters");
1007
976
} else if (options->lut_type != MB_LOOKUP_TABLE) {
1008
Blast_MessageWrite(blast_msg, eBlastSevError, code, subcode,
977
Blast_MessageWrite(blast_msg, eBlastSevError, kBlastMessageNoContext,
1009
978
"Invalid lookup table type for discontiguous Mega BLAST");
1067
1040
if (options->hitlist_size < 1)
1071
Blast_MessageWrite(blast_msg, eBlastSevError, code, subcode,
1042
Blast_MessageWrite(blast_msg, eBlastSevError, kBlastMessageNoContext,
1072
1043
"No hits are being saved");
1076
1047
if (options->expect_value <= 0.0 && options->cutoff_score <= 0)
1080
Blast_MessageWrite(blast_msg, eBlastSevError, code, subcode,
1049
Blast_MessageWrite(blast_msg, eBlastSevError, kBlastMessageNoContext,
1081
1050
"expect value or cutoff score must be greater than zero");
1085
1054
if (options->longest_intron != 0 &&
1086
1055
program_number != eBlastTypeTblastn &&
1087
1056
program_number != eBlastTypeBlastx) {
1090
Blast_MessageWrite(blast_msg, eBlastSevError, code, subcode,
1057
Blast_MessageWrite(blast_msg, eBlastSevError, kBlastMessageNoContext,
1091
1058
"Uneven gap linking of HSPs is allowed for blastx and tblastn only");
1095
1062
if (options->culling_limit < 0)
1099
Blast_MessageWrite(blast_msg, eBlastSevError, code, subcode,
1064
Blast_MessageWrite(blast_msg, eBlastSevError, kBlastMessageNoContext,
1100
1065
"culling limit must be greater than or equal to zero");
1138
1103
if (psi_options->pseudo_count <= 0) {
1139
Blast_MessageWrite(blast_msg, eBlastSevError, 0, 0,
1104
Blast_MessageWrite(blast_msg, eBlastSevError, kBlastMessageNoContext,
1140
1105
"Pseudo count must be greater than 0");
1144
1109
if (psi_options->inclusion_ethresh <= 0.0) {
1145
Blast_MessageWrite(blast_msg, eBlastSevError, 0, 0,
1110
Blast_MessageWrite(blast_msg, eBlastSevError, kBlastMessageNoContext,
1146
1111
"Inclusion threshold must be greater than 0");
1200
/** Checks that the extension and scoring options are consistent with each other
1201
* @param program_number identifies the program [in]
1202
* @param ext_options the extension options [in]
1203
* @param score_options the scoring options [in]
1204
* @param blast_msg returns a message on errors. [in|out]
1205
* @return zero on success, an error code otherwise.
1207
static Int2 s_BlastExtensionScoringOptionsValidate(EBlastProgramType program_number,
1208
const BlastExtensionOptions* ext_options,
1209
const BlastScoringOptions* score_options,
1210
Blast_Message* *blast_msg)
1212
if (ext_options == NULL || score_options == NULL)
1215
if (program_number == eBlastTypeBlastn)
1217
if (score_options->gap_open == 0 && score_options->gap_extend == 0)
1219
if (ext_options->ePrelimGapExt != eGreedyWithTracebackExt &&
1220
ext_options->ePrelimGapExt != eGreedyExt &&
1221
ext_options->eTbackExt != eGreedyTbck)
1223
Blast_MessageWrite(blast_msg, eBlastSevWarning, kBlastMessageNoContext,
1224
"Greedy extension must be used if gap existence and extension options are zero");
1235
1234
Int2 BLAST_ValidateOptions(EBlastProgramType program_number,
1236
1235
const BlastExtensionOptions* ext_options,
1237
1236
const BlastScoringOptions* score_options,
1265
1269
* ===========================================================================
1267
1271
* $Log: blast_options.c,v $
1272
* Revision 1.183 2006/04/25 16:06:53 camacho
1273
* tblastx scoring options must be set to false
1275
* Revision 1.182 2006/04/20 19:28:30 madden
1276
* Prototype change for Blast_MessageWrite
1278
* Revision 1.181 2006/03/02 13:28:34 madden
1279
* use BlastHspNumMax function, refactor how hsp_num_max is calculated
1281
* Revision 1.180 2006/02/09 18:47:07 camacho
1282
* Correct error reporting when there are errors in validation of filtering
1285
* Revision 1.179 2006/01/23 16:29:51 papadopo
1286
* allow the number of diagonals used in containment tests to be specified when initializing HitSavingOptions
1288
* Revision 1.178 2005/12/22 14:07:48 papadopo
1289
* remove variable wordsize, and change signature to BlastFillLookupTableOptions
1291
* Revision 1.177 2005/12/19 16:11:12 papadopo
1292
* no minimum value for megablast word size need be enforced; the engine will switch to a standard lookup table if the specified word size is too small
1294
* Revision 1.176 2005/12/12 13:38:27 madden
1295
* Add call to s_BlastExtensionScoringOptionsValidate to BLAST_ValidateOptions to check that scoring and extension options are consistent
1268
1297
* Revision 1.175 2005/11/16 14:27:03 madden
1269
1298
* Fix spelling in CRN