NCBI C++ ToolKit
gapinfo.h
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: gapinfo.h 40629 2009-01-07 16:27:23Z ivanov $
2  * ===========================================================================
3  *
4  * PUBLIC DOMAIN NOTICE
5  * National Center for Biotechnology Information
6  *
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 official 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.
13  *
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
20  * purpose.
21  *
22  * Please cite the author in any work or product based on this material.
23  *
24  * ===========================================================================
25  *
26  * Author: Ilya Dondoshansky
27  *
28  */
29 
30 /** @file gapinfo.h
31  * Definitions of structures used for saving traceback information.
32  */
33 
34 #ifndef ALGO_BLAST_CORE__GAPINFO__H
35 #define ALGO_BLAST_CORE__GAPINFO__H
36 
38 
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42 
43 /** Operation types within the edit script*/
44 typedef enum EGapAlignOpType {
45  eGapAlignDel = 0, /**< Deletion: a gap in query */
46  eGapAlignDel2 = 1,/**< Frame shift deletion of two nucleotides */
47  eGapAlignDel1 = 2,/**< Frame shift deletion of one nucleotide */
48  eGapAlignSub = 3, /**< Substitution */
49  eGapAlignIns1 = 4,/**< Frame shift insertion of one nucleotide */
50  eGapAlignIns2 = 5,/**< Frame shift insertion of two nucleotides */
51  eGapAlignIns = 6, /**< Insertion: a gap in subject */
52  eGapAlignDecline = 7, /**< Non-aligned region */
53  eGapAlignInvalid = 8 /**< Invalid operation */
55 
56 /** Edit script: linked list of correspondencies between two sequences */
57 typedef struct GapEditScript {
58  EGapAlignOpType* op_type; /**< Array of type of operation */
59  Int4* num; /**< Array of number of operations */
60  Int4 size; /**< Size of above arrays. */
62 
63 /** A version of GapEditScript used to store initial results
64  from the gapped alignment routines */
65 typedef struct GapPrelimEditScript {
66  EGapAlignOpType op_type; /**< Type of operation */
67  Int4 num; /**< Number of operations */
69 
70 /** Preliminary version of GapEditBlock, used directly by the low-
71  * level dynamic programming routines
72  */
73 typedef struct GapPrelimEditBlock {
74  GapPrelimEditScript *edit_ops; /**< array of edit operations */
75  Int4 num_ops_allocated; /**< size of allocated array */
76  Int4 num_ops; /**< number of edit ops presently in use */
77  EGapAlignOpType last_op; /**< most recent operation added */
79 
80 /** Structure to keep memory for state structure. */
81 typedef struct GapStateArrayStruct {
82  Int4 length, /**< length of the state_array. */
83  used; /**< how much of length is used. */
84  Uint1* state_array; /**< array to be used. */
85  struct GapStateArrayStruct* next; /**< Next link in the list. */
87 
88 /** Initialize the edit script structure.
89  * @param size number of elements to allocate.
90  * @return Pointer to the new edit script
91  */
95 
96 /** Free edit script structure.
97  * @param esp Pointer to the edit script [in]
98  * @return NULL
99  */
103 
104 /** Duplicates the edit script structure.
105  * @param old object to be duplicated [in]
106  * @return Pointer to the new edit script
107  */
110 GapEditScriptDup (const GapEditScript* old);
111 
112 /** Copies the portion of the GapEditScript specified by start and stop to a new one
113  * the new one should already exist.
114  * @param new_esp edit script to copy to [in|out]
115  * @param offset starting element in new one to copy to [in]
116  * @param old_esp edit script to copy from [in]
117  * @param start first element to copy from (zero-offset) [in]
118  * @param stop last element to copy [in]
119  * @return 0 on success
120  */
122 Int2
123 GapEditScriptPartialCopy(GapEditScript* new_esp, int offset, const GapEditScript* old_esp, int start, int stop);
124 
125 /** Frees a preliminary edit block structure
126  * @param edit_block The edit block to free [in]
127  * @return Always NULL
128  */
132 
133 /** Allocates a preliminary edit block structure
134  * @return Pointer to the allocated preliminary edit block
135  */
139 
140 /** Add a new operation to a preliminary edit block, possibly combining
141  * it with the last operation if the two operations are identical
142  *
143  * @param edit_block The script to update [in/modified]
144  * @param op_type The operation type to add [in]
145  * @param num_ops The number of the specified type of operation to add [in]
146  */
148 void
150  EGapAlignOpType op_type, Int4 num_ops);
151 
152 /** Append one GapPrelimEditBlock to the end of the other.
153  * @param edit_block1 First traceback block [in]
154  * @param edit_block2 Second traceback block, to be appended at the end of
155  * the first.
156  */
158 void
160  GapPrelimEditBlock *edit_block2);
161 
162 
163 /** Reset a preliminary edit block without freeing it
164  * @param edit_block The preliminary edit block to reset
165  */
167 void
169 
170 /** Free the gap state structure.
171  * @param state_struct The state structure to free
172  * @return Always NULL
173  */
176 GapStateFree(GapStateArrayStruct* state_struct);
177 
178 #ifdef __cplusplus
179 }
180 #endif
181 #endif /* !ALGO_BLAST_CORE__GAPINFO__H */
#define NCBI_XBLAST_EXPORT
NULL operations for other cases.
Definition: blast_export.h:65
int offset
Definition: replacements.h:160
struct GapPrelimEditScript GapPrelimEditScript
A version of GapEditScript used to store initial results from the gapped alignment routines.
void GapPrelimEditBlockAdd(GapPrelimEditBlock *edit_block, EGapAlignOpType op_type, Int4 num_ops)
Add a new operation to a preliminary edit block, possibly combining it with the last operation if the...
Definition: gapinfo.c:175
GapPrelimEditBlock * GapPrelimEditBlockFree(GapPrelimEditBlock *edit_block)
Frees a preliminary edit block structure.
Definition: gapinfo.c:202
GapEditScript * GapEditScriptDup(const GapEditScript *old)
Duplicates the edit script structure.
Definition: gapinfo.c:89
struct GapPrelimEditBlock GapPrelimEditBlock
Preliminary version of GapEditBlock, used directly by the low- level dynamic programming routines.
GapStateArrayStruct * GapStateFree(GapStateArrayStruct *state_struct)
Free the gap state structure.
Definition: gapinfo.c:39
EGapAlignOpType
Operation types within the edit script.
Definition: gapinfo.h:44
@ eGapAlignDel2
Frame shift deletion of two nucleotides.
Definition: gapinfo.h:46
@ eGapAlignIns2
Frame shift insertion of two nucleotides.
Definition: gapinfo.h:50
@ eGapAlignInvalid
Invalid operation.
Definition: gapinfo.h:53
@ eGapAlignIns1
Frame shift insertion of one nucleotide.
Definition: gapinfo.h:49
@ eGapAlignIns
Insertion: a gap in subject.
Definition: gapinfo.h:51
@ eGapAlignDel1
Frame shift deletion of one nucleotide.
Definition: gapinfo.h:47
@ eGapAlignDecline
Non-aligned region.
Definition: gapinfo.h:52
@ eGapAlignSub
Substitution.
Definition: gapinfo.h:48
@ eGapAlignDel
Deletion: a gap in query.
Definition: gapinfo.h:45
GapEditScript * GapEditScriptNew(Int4 size)
Initialize the edit script structure.
Definition: gapinfo.c:56
void GapPrelimEditBlockAppend(GapPrelimEditBlock *edit_block1, GapPrelimEditBlock *edit_block2)
Append one GapPrelimEditBlock to the end of the other.
Definition: gapinfo.c:222
Int2 GapEditScriptPartialCopy(GapEditScript *new_esp, int offset, const GapEditScript *old_esp, int start, int stop)
Copies the portion of the GapEditScript specified by start and stop to a new one the new one should a...
Definition: gapinfo.c:105
GapEditScript * GapEditScriptDelete(GapEditScript *esp)
Free edit script structure.
Definition: gapinfo.c:75
GapPrelimEditBlock * GapPrelimEditBlockNew(void)
Allocates a preliminary edit block structure.
Definition: gapinfo.c:188
void GapPrelimEditBlockReset(GapPrelimEditBlock *edit_block)
Reset a preliminary edit block without freeing it.
Definition: gapinfo.c:213
struct GapStateArrayStruct GapStateArrayStruct
Structure to keep memory for state structure.
struct GapEditScript GapEditScript
Edit script: linked list of correspondencies between two sequences.
uint8_t Uint1
1-byte (8-bit) unsigned integer
Definition: ncbitype.h:99
int16_t Int2
2-byte (16-bit) signed integer
Definition: ncbitype.h:100
int32_t Int4
4-byte (32-bit) signed integer
Definition: ncbitype.h:102
const struct ncbi::grid::netcache::search::fields::SIZE size
Type and macro definitions from C toolkit that are not defined in C++ toolkit.
Edit script: linked list of correspondencies between two sequences.
Definition: gapinfo.h:57
Int4 * num
Array of number of operations.
Definition: gapinfo.h:59
Int4 size
Size of above arrays.
Definition: gapinfo.h:60
EGapAlignOpType * op_type
Array of type of operation.
Definition: gapinfo.h:58
Preliminary version of GapEditBlock, used directly by the low- level dynamic programming routines.
Definition: gapinfo.h:73
Int4 num_ops_allocated
size of allocated array
Definition: gapinfo.h:75
GapPrelimEditScript * edit_ops
array of edit operations
Definition: gapinfo.h:74
EGapAlignOpType last_op
most recent operation added
Definition: gapinfo.h:77
Int4 num_ops
number of edit ops presently in use
Definition: gapinfo.h:76
A version of GapEditScript used to store initial results from the gapped alignment routines.
Definition: gapinfo.h:65
Int4 num
Number of operations.
Definition: gapinfo.h:67
EGapAlignOpType op_type
Type of operation.
Definition: gapinfo.h:66
Structure to keep memory for state structure.
Definition: gapinfo.h:81
struct GapStateArrayStruct * next
Next link in the list.
Definition: gapinfo.h:85
Int4 used
how much of length is used.
Definition: gapinfo.h:83
Int4 length
length of the state_array.
Definition: gapinfo.h:82
Uint1 * state_array
array to be used.
Definition: gapinfo.h:84
Modified on Tue May 28 05:50:03 2024 by modify_doxy.py rev. 669887