|
NCBI Home IEB Home C Toolkit docs C++ Toolkit source browser C Toolkit source browser (2) |
NCBI C Toolkit Cross ReferenceC/algo/blast/api/blast_seqalign.h |
source navigation diff markup identifier search freetext search file search |
1 /* $Id: blast_seqalign.h,v 1.31 2006/06/09 17:40:41 papadopo Exp $
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 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.
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 * Author: Ilya Dondoshansky
25 * ===========================================================================*/
26
27 /** @file blast_seqalign.h
28 * Functions to convert BLAST results to the SeqAlign form
29 */
30
31 #ifndef __BLAST_SEQALIGN__
32 #define __BLAST_SEQALIGN__
33
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37
38 #ifndef NCBI_C_TOOLKIT
39 #define NCBI_C_TOOLKIT
40 #endif
41
42 #include <readdb.h>
43 #include <algo/blast/core/blast_hits.h>
44
45 /** @addtogroup CToolkitAlgoBlast
46 *
47 * @{
48 */
49
50 /** Object to hold a vector of seqaligns.
51 * Specially designed for the case of multiple queries. */
52 typedef struct SBlastSeqalignArray {
53 SeqAlign** array; /**< array of pointers to SeqAligns, one for each query. */
54 Int4 num_queries; /**< length of array above. */
55 } SBlastSeqalignArray;
56
57 /** Returns a pointer to SBlastSeqalignArray,
58 * the array is allocated, but all pointers set to NULL.
59 * @param size length of array.
60 */
61 SBlastSeqalignArray* SBlastSeqalignArrayNew(Int4 size);
62
63 /** Frees memory of SBlastSeqalignArray, including
64 * the SeqAlignPtr's that are pointed to in the array.
65 * @param array object to be deallocated.
66 */
67 SBlastSeqalignArray* SBlastSeqalignArrayFree(SBlastSeqalignArray* array);
68
69 /** Convert BLAST results structure to a list of SeqAlign's.
70 * @param program_number Type of BLAST program [in]
71 * @param results_ptr The BLAST results, will be deleted as SeqAlign is built [in|out]
72 * @param query_slp List of query SeqLoc's [in]
73 * @param rdfp Pointer to a BLAST database structure [in]
74 * @param subject_slp List of subject sequences locations [in]
75 * @param is_gapped Is this a gapped alignment search? [in]
76 * @param is_ooframe Is this a search with out-of-frame gapping? [in]
77 * @param seqalign_arr object with resulting SeqAligns [out]
78 */
79 Int2 BLAST_ResultsToSeqAlign(EBlastProgramType program_number,
80 BlastHSPResults** results_ptr, SeqLocPtr query_slp,
81 ReadDBFILE* rdfp, SeqLoc* subject_slp,
82 Boolean is_gapped, Boolean is_ooframe, SBlastSeqalignArray* *seqalign_arr);
83
84 /** Given an internal edit block structure, returns the segments information in
85 * form of arrays.
86 * @param hsp HSP structure containing traceback for one local alignment [in]
87 * @param esp Link in editing script where to start collecting the data. [in]
88 * @param start first element of EditScript to use [in]
89 * @param number number of elements of EditScript to use [in]
90 * @param query_length Length of query sequence [in]
91 * @param subject_length Length of subject sequence [in]
92 * @param translate1 Is query translated? [in]
93 * @param translate2 Is subject translated? [in]
94 * @param start_out Array of segment starting offsets [out]
95 * @param length_out Array of segment lengths [out]
96 * @param strands_out Array of segment strands [out]
97 * @param start1 Starting query offset; modified to point to next starting
98 * offset if one edit block combines multiple alignments, like
99 * in an ungapped search. [in] [out]
100 * @param start2 Starting subject offset for this alignment. [in] [out]
101 * @return Status.
102 */
103 Int2
104 GapCollectDataForSeqalign(BlastHSP* hsp, GapEditScript* esp, Int4 start,
105 Int4 number, Int4 query_length, Int4 subject_length,
106 Boolean translate1, Boolean translate2,
107 Int4** start_out, Int4** length_out,
108 Uint1** strands_out, Int4* start1, Int4* start2);
109
110 /** Convert an HSP into a SeqAlign of type DenseSeg.
111 * Used for a non-simple interval (i.e., one without subs. or
112 * deletions).
113 * @param program Type of BLAST program [in]
114 * @param hsp HSP structure to convert. [in]
115 * @param subject_id Seq-id of the subject sequence [in]
116 * @param query_id Seq-id of the query sequence [in]
117 * @param query_length Length of query sequence [in]
118 * @param subject_length Length of subject sequence [in]
119 * @return Seq-align corresponding to this alignment.
120 */
121 SeqAlignPtr
122 BlastHSPToSeqAlign(EBlastProgramType program, BlastHSP* hsp,
123 SeqIdPtr subject_id, SeqIdPtr query_id,
124 Int4 query_length, Int4 subject_length);
125
126
127 /** This function is used for Out-Of-Frame traceback conversion
128 * Convert an OOF EditScript chain to a SeqAlign of type StdSeg.
129 * @param program Type of BLAST program (blastx or tblastn) [in]
130 * @param hsp Internal HSP structure. [in]
131 * @param query_id Seq-id of the query sequence [in]
132 * @param subject_id Seq-id of the subject sequence [in]
133 * @param query_length Length of query sequence [in]
134 * @param subject_length Length of subject sequence [in]
135 * @return Resulting Seq-align.
136 */
137 SeqAlignPtr
138 OOFBlastHSPToSeqAlign(EBlastProgramType program, BlastHSP* hsp,
139 SeqIdPtr query_id, SeqIdPtr subject_id,
140 Int4 query_length, Int4 subject_length);
141
142 /** Creates a score set corresponding to one HSP.
143 * @param hsp HSP structure [in]
144 * @return Score set for this HSP.
145 */
146 ScorePtr
147 GetScoreSetFromBlastHsp(BlastHSP* hsp);
148
149 /* @} */
150
151 #ifdef __cplusplus
152 }
153 #endif
154
155 #endif /* !__BLAST_SEQALIGN__ */
156
157 |
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more information. |