NCBI C++ ToolKit
blast_seqalign.hpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: blast_seqalign.hpp 77238 2017-04-05 13:47:44Z boratyng $
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: Christiam Camacho
27 *
28 */
29 
30 /// @file blast_seqalign.hpp
31 /// Utility function to convert internal BLAST result structures into
32 /// objects::CSeq_align_set objects.
33 
34 #ifndef ALGO_BLAST_API___BLAST_SEQALIGN__HPP
35 #define ALGO_BLAST_API___BLAST_SEQALIGN__HPP
36 
37 #include <corelib/ncbistd.hpp>
38 
43 
44 /** @addtogroup AlgoBlast
45  *
46  * @{
47  */
48 
51 BEGIN_SCOPE(blast)
52 
53 /// Forward declaration
54 class ILocalQueryData;
55 
56 /// Remaps Seq-align offsets relative to the query Seq-loc.
57 /// Since the query strands were already taken into account when CSeq_align
58 /// was created, only start position shifts in the CSeq_loc's are relevant in
59 /// this function.
60 /// @param sar Seq-align for a given query [in] [out]
61 /// @param query The query Seq-loc [in]
62 void
64 
65 /// Constructs an empty Seq-align-set containing an empty discontinuous
66 /// seq-align, and appends it to a previously constructed Seq-align-set.
67 /// @param sas Pointer to a Seq-align-set, to which new object should be
68 /// appended (if not NULL).
69 /// @return Resulting Seq-align-set.
72 
73 void
75  BlastHSPList* hsp_list,
76  CRef<CSeq_id> query_id,
77  CRef<CSeq_id> subject_id,
78  Int4 query_length,
79  Int4 subject_length,
80  bool is_ooframe,
81  const vector<string> & seqid_list,
82  vector<CRef<CSeq_align > > & sa_vector);
83 
84 void
86  BlastHSPList* hsp_list,
87  CRef<CSeq_id> query_id,
88  CRef<CSeq_id> subject_id,
89  Int4 query_length,
90  Int4 subject_length,
91  const vector<string> & seqid_list,
92  vector<CRef<CSeq_align > > & sa_vector);
93 
94 /// Convert traceback output into Seq-align format.
95 ///
96 /// This converts the traceback stage output into a standard
97 /// Seq-align. The result_type argument indicates whether the
98 /// seqalign is for a database search or a sequence comparison
99 /// (eDatabaseSearch or eSequenceComparison). The seqinfo_src
100 /// argument is used to translate oids into Seq-ids.
101 ///
102 /// @param hsp_results
103 /// Results of a traceback search. [in]
104 /// @param local_data
105 /// The queries used to perform the search. [in]
106 /// @param seqinfo_src
107 /// Provides sequence identifiers and meta-data. [in]
108 /// @param program
109 /// The type of search done. [in]
110 /// @param gapped
111 /// True if this was a gapped search. [in]
112 /// @param oof_mode
113 /// True if out-of-frame matches are allowed. [in]
114 /// @param subj_masks
115 /// If applicable, it'll be populated with subject masks that intersect the
116 /// HSPs (each element corresponds to a query) [in|out]
117 /// @param result_type
118 /// Specify how to arrange the results in the return value. [in]
119 
122  ILocalQueryData & local_data,
123  const IBlastSeqInfoSrc& seqinfo_src,
124  EBlastProgramType program,
125  bool gapped,
126  bool oof_mode,
127  vector<TSeqLocInfoVector>& subj_masks,
128  EResultType result_type = eDatabaseSearch);
129 
130 // Convert PrelminSearch Output to CStdseg
131 //
132 // This converts the BlatsHitsLists for a query into a list of CStd_seg
133 // @param program
134 // Blast Program type [in]
135 // @param hit_list,
136 // ptr to BlastHitList, results from prelimiary search [in]
137 // @param query_loc
138 // seq-loc for the query [in]
139 // @param query_length,
140 // query length [in]
141 // @param subject_seqiinfo
142 // sbject seqinfosrc ptr [in]
143 // @param seg_list
144 // List of CStd_seg convetred from blast hsp [out]
145 void
147  BlastHitList* hit_list,
148  const CSeq_loc & query_loc,
149  TSeqPos query_length,
150  const IBlastSeqInfoSrc * subject_seqinfo,
151  list<CRef<CStd_seg > > & seg_list);
152 
153 
154 /// Convert a spliced alignmeny in BlastHSPChain into Spliced_seg
155 /// @param spliced_seg Spliced_seg object [in] [out]
156 /// @param product_id Sequence id of a read/query [in]
157 /// @param genomic_id Sequence id a genome/subject [in]
158 /// @param chain Alignment to be converted [in]
159 void MakeSplicedSeg(CSpliced_seg& spliced_seg,
160  CRef<CSeq_id> product_id,
161  CRef<CSeq_id> genomic_id,
162  int product_length,
163  const HSPChain* chain);
164 
165 
166 END_SCOPE(blast)
168 
169 /* @} */
170 
171 #endif /* ALGO_BLAST_API___BLAST_SEQALIGN__HPP */
Contains C++ wrapper classes to structures in algo/blast/core as well as some auxiliary functions to ...
Structures and API used for saving BLAST hits.
EBlastProgramType
Defines the engine's notion of the different applications of the BLAST algorithm.
Definition: blast_program.h:72
Declarations of auxiliary functions using IBlastSeqInfoSrc to retrieve ids and related sequence infor...
vector< CRef< objects::CSeq_align_set > > TSeqAlignVector
Vector of Seq-align-sets.
EResultType
Specifies the style of Seq-aligns that should be built from the internal BLAST data structures.
@ eDatabaseSearch
Seq-aligns in the style of a database search.
Abstract base class to encapsulate retrieval of sequence identifiers.
Provides access (not ownership) to the C structures used to configure local BLAST search class implem...
Definition: query_data.hpp:55
Include a standard set of the NCBI C++ Toolkit most basic headers.
void BLASTPrelminSearchHitListToStdSeg(EBlastProgramType program, BlastHitList *hit_list, const CSeq_loc &query_loc, TSeqPos query_length, const IBlastSeqInfoSrc *subject_seqinfo, list< CRef< CStd_seg > > &seg_list)
TSeqAlignVector LocalBlastResults2SeqAlign(BlastHSPResults *hsp_results, ILocalQueryData &local_data, const IBlastSeqInfoSrc &seqinfo_src, EBlastProgramType program, bool gapped, bool oof_mode, vector< TSeqLocInfoVector > &subj_masks, EResultType result_type)
Convert traceback output into Seq-align format.
CRef< CSeq_align_set > CreateEmptySeq_align_set()
Constructs an empty Seq-align-set containing an empty discontinuous seq-align, and appends it to a pr...
void BLASTHspListToSeqAlign(EBlastProgramType program, BlastHSPList *hsp_list, CRef< CSeq_id > query_id, CRef< CSeq_id > subject_id, Int4 query_length, Int4 subject_length, bool is_ooframe, const vector< string > &seqid_list, vector< CRef< CSeq_align > > &sa_vector)
This is called for each query and each subject in a BLAST search.
void MakeSplicedSeg(CSpliced_seg &spliced_seg, CRef< CSeq_id > product_id, CRef< CSeq_id > genomic_id, int product_length, const HSPChain *chain)
Convert a spliced alignmeny in BlastHSPChain into Spliced_seg.
void BLASTUngappedHspListToSeqAlign(EBlastProgramType program, BlastHSPList *hsp_list, CRef< CSeq_id > query_id, CRef< CSeq_id > subject_id, Int4 query_length, Int4 subject_length, const vector< string > &seqid_list, vector< CRef< CSeq_align > > &sa_vector)
Creates a Seq-align from an HSP list for an ungapped search.
void RemapToQueryLoc(CRef< CSeq_align > sar, const CSeq_loc &query)
Remaps Seq-align offsets relative to the query Seq-loc.
unsigned int TSeqPos
Type for sequence locations and lengths.
Definition: ncbimisc.hpp:875
int32_t Int4
4-byte (32-bit) signed integer
Definition: ncbitype.h:102
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define USING_SCOPE(ns)
Use the specified namespace.
Definition: ncbistl.hpp:78
#define END_SCOPE(ns)
End the previously defined scope.
Definition: ncbistl.hpp:75
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
#define BEGIN_SCOPE(ns)
Define a new scope.
Definition: ncbistl.hpp:72
The structure to hold all HSPs for a given sequence after the gapped alignment.
Definition: blast_hits.h:153
The structure to contain all BLAST results, for multiple queries.
Definition: blast_hits.h:183
The structure to contain all BLAST results for one query sequence.
Definition: blast_hits.h:169
A chain of HSPs: spliced alignment.
Definition: spliced_hits.h:60
static string query
Modified on Fri Sep 20 14:58:18 2024 by modify_doxy.py rev. 669887