~ubuntu-branches/ubuntu/edgy/ncbi-tools6/edgy

« back to all changes in this revision

Viewing changes to algo/blast/api/blast_options_api.c

  • Committer: Bazaar Package Importer
  • Author(s): Barry deFreese
  • Date: 2006-07-19 23:28:07 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20060719232807-et3cdmcjgmnyleyx
Tags: 6.1.20060507-3ubuntu1
Re-merge with Debian

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* $Id: blast_options_api.c,v 1.15 2005/10/31 14:14:29 madden Exp $
 
1
/* $Id: blast_options_api.c,v 1.18 2006/04/26 12:45:28 madden Exp $
2
2
***************************************************************************
3
3
*                                                                         *
4
4
*                             COPYRIGHT NOTICE                            *
68
68
               "Program name %s is not supported. The supported programs "
69
69
               "are blastn, blastp, blastx, tblastn, tblastx, rpsblast, "
70
70
               "rpstblastn\n", program_name);
71
 
       Blast_MessageWrite(&extra_returns->error, 2, 1, 0, message);
 
71
       SBlastMessageWrite(&extra_returns->error, SEV_ERROR, message, NULL, FALSE);
72
72
       return -1;
73
73
   }
74
74
 
79
79
   
80
80
   if (status) {
81
81
       *options_out = NULL;
82
 
       Blast_MessageWrite(&extra_returns->error, 2, 1, 0, 
83
 
                          "Failed to initialize default options\n");
 
82
       SBlastMessageWrite(&extra_returns->error, SEV_ERROR, "Failed to initialize default options\n", NULL, FALSE);
84
83
       return status;
85
84
   }
86
85
 
103
102
   options->psi_options = psi_options;
104
103
   options->db_options = db_options;
105
104
   options->num_cpus = 1;
 
105
   options->believe_query = FALSE;
106
106
 
107
107
   /* Set default filter string to low complexity filtering. */
108
108
   SBlastOptionsSetFilterString(options, "T");
216
216
    /* Reward penalty do not apply to blastn. */
217
217
    if (options->program == eBlastTypeBlastn)
218
218
        return 0;
 
219
 
 
220
    status = BLAST_FillScoringOptions(options->score_options, options->program,
 
221
                        FALSE, -1, -1, matrix_name, gap_open, gap_extend);
 
222
    if (status != 0)
 
223
        return status;
219
224
    
220
 
    status = 
221
 
        BlastScoringOptionsSetMatrix(options->score_options, matrix_name);
222
 
 
223
 
    if (status != 0)
224
 
         return status;
225
 
 
226
225
    if (gap_open < 0 || gap_extend < 0)
227
226
    {
228
227
        Int4 gap_open_priv = 0;
243
242
 
244
243
Int2 SBlastOptionsSetRewardPenaltyAndGapCosts(SBlastOptions* options, 
245
244
                                       Int4 reward, Int4 penalty,
246
 
                                       Int4 gap_open, Int4 gap_extend)
 
245
                                       Int4 gap_open, Int4 gap_extend,
 
246
                                       Boolean greedy)
247
247
{
248
248
    Int2 status = 0;
249
249
 
254
254
    if (options->program != eBlastTypeBlastn)
255
255
        return 0;
256
256
    
 
257
    status = BLAST_FillScoringOptions(options->score_options, options->program,
 
258
                        greedy, penalty, reward, NULL, gap_open, gap_extend);
 
259
    if (status != 0)
 
260
        return status;
 
261
    
257
262
    if (gap_open < 0 || gap_extend < 0)
258
263
    {
259
 
        Int4 gap_open_priv = BLAST_GAP_OPEN_NUCL;
260
 
        Int4 gap_extend_priv = BLAST_GAP_EXTN_NUCL;
261
 
 
262
 
        BLAST_GetNucleotideGapExistenceExtendParams(reward, penalty, &gap_open_priv, &gap_extend_priv);
 
264
        Int4 gap_open_priv;
 
265
        Int4 gap_extend_priv;
 
266
      
 
267
        if (greedy)
 
268
        {
 
269
             gap_open_priv = BLAST_GAP_OPEN_MEGABLAST;
 
270
             gap_extend_priv = BLAST_GAP_EXTN_MEGABLAST;
 
271
        }
 
272
        else
 
273
        {
 
274
             gap_open_priv = BLAST_GAP_OPEN_NUCL;
 
275
             gap_extend_priv = BLAST_GAP_EXTN_NUCL;
 
276
        }
 
277
 
 
278
        status = BLAST_GetNucleotideGapExistenceExtendParams(reward, penalty, &gap_open_priv, &gap_extend_priv);
 
279
        if (status)
 
280
           return status;
 
281
 
263
282
        if (gap_open < 0)
264
283
            gap_open = gap_open_priv;
265
284
        if (gap_extend < 0)
320
339
    return options->query_options->filtering_options->mask_at_hash;
321
340
}
322
341
 
 
342
Int2 SBlastOptionsSetBelieveQuery(SBlastOptions* options, Boolean believe_query)
 
343
{
 
344
    Int2 status = 0;
 
345
 
 
346
    if (!options)
 
347
       return -1;
 
348
 
 
349
    options->believe_query = believe_query;
 
350
 
 
351
    return status;
 
352
}
 
353
 
 
354
Boolean SBlastOptionsGetBelieveQuery(const SBlastOptions* options)
 
355
{
 
356
 
 
357
    ASSERT(options);
 
358
 
 
359
    return options->believe_query;
 
360
}
 
361
 
323
362
/* @} */
324
363