1
/* $Id: blast_diagnostics.c,v 1.3 2004/07/06 15:38:23 dondosha Exp $
2
* ===========================================================================
5
* National Center for Biotechnology Information
7
* This software/database is a "United States Government Work" under the
8
* terms of the United States Copyright Act. It was written as part of
9
* the author's offical duties as a United States Government employee and
10
* thus cannot be copyrighted. This software/database is freely available
11
* to the public for use. The National Library of Medicine and the U.S.
12
* Government have not placed any restriction on its use or reproduction.
14
* Although all reasonable efforts have been taken to ensure the accuracy
15
* and reliability of the software and data, the NLM and the U.S.
16
* Government do not and cannot warrant the performance or results that
17
* may be obtained by using this software or data. The NLM and the U.S.
18
* Government disclaim all warranties, express or implied, including
19
* warranties of performance, merchantability or fitness for any particular
22
* Please cite the author in any work or product based on this material.
24
* ===========================================================================
26
* Author: Ilya Dondoshansky
30
/** @file blast_diagnostics.c
31
* Manipulating diagnostics data returned from BLAST
35
static char const rcsid[] =
36
"$Id: blast_diagnostics.c,v 1.3 2004/07/06 15:38:23 dondosha Exp $";
38
#include <algo/blast/core/blast_diagnostics.h>
39
#include <algo/blast/core/blast_def.h>
41
BlastDiagnostics* Blast_DiagnosticsFree(BlastDiagnostics* diagnostics)
44
sfree(diagnostics->ungapped_stat);
45
sfree(diagnostics->gapped_stat);
46
sfree(diagnostics->cutoffs);
47
if (diagnostics->mt_lock)
48
diagnostics->mt_lock = MT_LOCK_Delete(diagnostics->mt_lock);
54
BlastDiagnostics* Blast_DiagnosticsInit()
56
BlastDiagnostics* diagnostics =
57
(BlastDiagnostics*) calloc(1, sizeof(BlastDiagnostics));
59
diagnostics->ungapped_stat =
60
(BlastUngappedStats*) calloc(1, sizeof(BlastUngappedStats));
61
diagnostics->gapped_stat =
62
(BlastGappedStats*) calloc(1, sizeof(BlastGappedStats));
63
diagnostics->cutoffs =
64
(BlastRawCutoffs*) calloc(1, sizeof(BlastRawCutoffs));
69
BlastDiagnostics* Blast_DiagnosticsInitMT(MT_LOCK mt_lock)
71
BlastDiagnostics* retval = Blast_DiagnosticsInit();
72
retval->mt_lock = mt_lock;
77
void Blast_UngappedStatsUpdate(BlastUngappedStats* ungapped_stats,
78
Int4 total_hits, Int4 extended_hits,
81
if (!ungapped_stats || total_hits == 0)
84
ungapped_stats->lookup_hits += total_hits;
85
++ungapped_stats->num_seqs_lookup_hits;
86
ungapped_stats->init_extends += extended_hits;
87
ungapped_stats->good_init_extends += saved_hits;
89
++ungapped_stats->num_seqs_passed;
93
Blast_DiagnosticsUpdate(BlastDiagnostics* global, BlastDiagnostics* local)
96
MT_LOCK_Do(global->mt_lock, eMT_Lock);
98
if (global->ungapped_stat && local->ungapped_stat) {
99
global->ungapped_stat->lookup_hits +=
100
local->ungapped_stat->lookup_hits;
101
global->ungapped_stat->num_seqs_lookup_hits +=
102
local->ungapped_stat->num_seqs_lookup_hits;
103
global->ungapped_stat->init_extends +=
104
local->ungapped_stat->init_extends;
105
global->ungapped_stat->good_init_extends +=
106
local->ungapped_stat->good_init_extends;
107
global->ungapped_stat->num_seqs_passed +=
108
local->ungapped_stat->num_seqs_passed;
111
if (global->gapped_stat && local->gapped_stat) {
112
global->gapped_stat->seqs_ungapped_passed +=
113
local->gapped_stat->seqs_ungapped_passed;
114
global->gapped_stat->extra_extensions +=
115
local->gapped_stat->extra_extensions;
116
global->gapped_stat->extensions +=
117
local->gapped_stat->extensions;
118
global->gapped_stat->good_extensions +=
119
local->gapped_stat->good_extensions;
120
global->gapped_stat->num_seqs_passed +=
121
local->gapped_stat->num_seqs_passed;
124
if (global->cutoffs && local->cutoffs) {
125
global->cutoffs->x_drop_ungapped = local->cutoffs->x_drop_ungapped;
126
global->cutoffs->x_drop_gap = local->cutoffs->x_drop_gap;
127
global->cutoffs->x_drop_gap_final = local->cutoffs->x_drop_gap_final;
128
global->cutoffs->gap_trigger = local->cutoffs->gap_trigger;
132
MT_LOCK_Do(global->mt_lock, eMT_Unlock);