~ubuntu-branches/ubuntu/feisty/ncbi-tools6/feisty

« back to all changes in this revision

Viewing changes to algo/blast/core/blast_filter.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_filter.c,v 1.78 2005/11/16 14:27:03 madden Exp $
 
1
/* $Id: blast_filter.c,v 1.82 2006/04/20 19:27:47 madden Exp $
2
2
 * ===========================================================================
3
3
 *
4
4
 *                            PUBLIC DOMAIN NOTICE
30
30
 
31
31
#ifndef SKIP_DOXYGEN_PROCESSING
32
32
static char const rcsid[] = 
33
 
    "$Id: blast_filter.c,v 1.78 2005/11/16 14:27:03 madden Exp $";
 
33
    "$Id: blast_filter.c,v 1.82 2006/04/20 19:27:47 madden Exp $";
34
34
#endif /* SKIP_DOXYGEN_PROCESSING */
35
35
 
36
36
#include <algo/blast/core/blast_def.h>
300
300
                                     segOptions = SSegOptionsFree(segOptions);
301
301
                                     sprintf(error_buffer, "Error parsing filter string: %s", buffer);
302
302
                                     if (blast_message)
303
 
                                       Blast_MessageWrite(blast_message, eBlastSevError, 2, 1,
 
303
                                       Blast_MessageWrite(blast_message, eBlastSevError, kBlastMessageNoContext,
304
304
                                            error_buffer);
305
305
                                     sfree(buffer);
306
306
                                     return status;
323
323
                                     dustOptions = SDustOptionsFree(dustOptions);
324
324
                                     sprintf(error_buffer, "Error parsing filter string: %s", buffer);
325
325
                                     if (blast_message)
326
 
                                       Blast_MessageWrite(blast_message, eBlastSevError, 2, 1,
 
326
                                       Blast_MessageWrite(blast_message, eBlastSevError, kBlastMessageNoContext,
327
327
                                            error_buffer);
328
328
                                     sfree(buffer);
329
329
                                     return status;
346
346
                                  repeatOptions = SRepeatFilterOptionsFree(repeatOptions);
347
347
                                  sprintf(error_buffer, "Error parsing filter string: %s", buffer);
348
348
                                  if (blast_message)
349
 
                                     Blast_MessageWrite(blast_message, eBlastSevError, 2, 1,
 
349
                                     Blast_MessageWrite(blast_message, eBlastSevError, kBlastMessageNoContext,
350
350
                                            error_buffer);
351
351
                                   sfree(buffer);
352
352
                                   return status;
767
767
      Int4 left=0, right; /* Used for left/right extent of a region. */
768
768
      BlastSeqLoc* loc = NULL;
769
769
 
770
 
      if (query_info->contexts[context].query_length <= 0) {
 
770
      if (query_info->contexts[context].is_valid == FALSE) {
771
771
          continue;
772
772
      }
773
773
 
911
911
   return filter_out;
912
912
}
913
913
 
 
914
/** Calculates the mask locations one context at a time.
 
915
 * @param query_blk sequence [in]
 
916
 * @param query_info information about sequences [in]
 
917
 * @param context which context is this?  [in]
 
918
 * @param program_number program (blastn, blastp, etc.) [in]
 
919
 * @param filter_options instructions for producing mask [in]
 
920
 * @param filter_out results of filtering operations [out]
 
921
 * @param blast_message any error or warning messages [out]
 
922
 * @return zero on success
 
923
 */
914
924
static Int2
915
925
s_GetFilteringLocationsForOneContext(BLAST_SequenceBlk* query_blk, 
916
926
                                     const BlastQueryInfo* query_info, 
931
941
    context_offset = query_info->contexts[context].query_offset;
932
942
    buffer = &query_blk->sequence[context_offset];
933
943
 
934
 
    if ((query_length = query_info->contexts[context].query_length) <= 0) {
935
 
       return 0;
 
944
    if (query_info->contexts[context].is_valid == FALSE) {
 
945
          return 0;
936
946
    }
937
947
 
 
948
    query_length = query_info->contexts[context].query_length;
 
949
 
938
950
    status = BlastSetUp_Filter(program_number, 
939
951
                               buffer, 
940
952
                               query_length, 
996
1008
 
997
1009
    ASSERT(query_info && query_blk && filter_maskloc);
998
1010
 
 
1011
    ASSERT(blast_message);
999
1012
    ASSERT(kNumContexts == 
1000
1013
           query_info->num_queries*BLAST_GetNumberOfContexts(program_number));
1001
1014
    *filter_maskloc = BlastMaskLocNew(kNumContexts);
1012
1025
                                                      &filter_per_context, 
1013
1026
                                                      blast_message);
1014
1027
        if (status) {
1015
 
           Blast_MessageWrite(blast_message, eBlastSevError, 2, 1, 
1016
 
              "Failure at filtering");
1017
 
           return status;
 
1028
            Blast_MessageWrite(blast_message, eBlastSevError, context,
 
1029
                                   "Failure at filtering");
 
1030
            return status;
1018
1031
        }
1019
1032
 
1020
1033
    /* NB: for translated searches filter locations are returned in 
1035
1048
 
1036
1049
        Int4 index, start, stop;
1037
1050
        const Uint1 kMaskingLetter = is_na ? kNuclMask : kProtMask;
1038
 
 
 
1051
        
1039
1052
        if (reverse) {
1040
1053
            start = length - 1 - mask_loc->ssr->right;
1041
1054
            stop = length - 1 - mask_loc->ssr->left;
1043
1056
            start = mask_loc->ssr->left;
1044
1057
            stop = mask_loc->ssr->right;
1045
1058
        }
1046
 
 
 
1059
        
1047
1060
        start -= offset;
1048
1061
        stop -= offset;
1049
 
 
 
1062
        
 
1063
        ASSERT(start < length);
 
1064
        ASSERT(stop < length);
 
1065
        
1050
1066
        for (index = start; index <= stop; index++)
1051
1067
            buffer[index] = kMaskingLetter;
1052
1068
    }
1072
1088
        Int4 context_offset = 0;
1073
1089
        Uint1 *buffer = NULL;              /* holds sequence */
1074
1090
 
1075
 
        /* For each query, check if forward strand is present */
1076
 
        if ( (query_length = query_info->contexts[context].query_length) <= 0)
1077
 
            continue;
 
1091
        if (query_info->contexts[context].is_valid == FALSE) {
 
1092
          continue;
 
1093
        }
 
1094
 
 
1095
        query_length = query_info->contexts[context].query_length;
1078
1096
 
1079
1097
        context_offset = query_info->contexts[context].query_offset;
1080
1098
        buffer = &query_blk->sequence[context_offset];