NCBI C++ ToolKit
Macros | Functions | Variables
blast_seqalign.cpp File Reference

Utility function to convert internal BLAST result structures into CSeq_align_set objects. More...

#include <ncbi_pch.hpp>
#include "blast_seqalign.hpp"
#include <algo/blast/api/blast_aux.hpp>
#include <algo/blast/api/query_data.hpp>
#include <objects/seqloc/Seq_loc.hpp>
#include <objects/seqloc/Seq_interval.hpp>
#include <objects/seqalign/seqalign__.hpp>
#include <objects/general/Object_id.hpp>
#include <objects/general/User_object.hpp>
#include <serial/iterator.hpp>
#include <objmgr/util/seq_align_util.hpp>
#include "../core/jumper.h"
#include <algorithm>
+ Include dependency graph for blast_seqalign.cpp:

Go to the source code of this file.

Go to the SVN repository for this file.

Macros

#define SMALLEST_EVALUE   1.0e-180
 Threshold below which e-values are saved as 0. More...
 
#define GAP_VALUE   -1
 Value in the Dense-seg indicating a gap. More...
 

Functions

 USING_SCOPE (objects)
 
static ENa_strand s_Frame2Strand (short frame)
 Converts a frame into the appropriate strand. More...
 
static int s_GetCurrPos (int &pos, int pos2advance)
 Advances position in a sequence, according to an edit script instruction. More...
 
static TSeqPos s_GetAlignmentStart (int &curr_pos, int num, ENa_strand strand, bool translate, int length, int original_length, short frame)
 Finds the starting position of a sequence segment in an alignment, given an editing script. More...
 
static Int4 s_GetProteinFrameLength (Int4 nuc_length, Int2 frame)
 Finds length of a protein frame given a nucleotide length and a frame number. More...
 
static void s_CollectSeqAlignData (const BlastHSP *hsp, const GapEditScript *esp, unsigned int first, unsigned int nsegs, CDense_seg::TStarts &starts, CDense_seg::TLens &lengths, CDense_seg::TStrands &strands, Int4 query_length, Int4 subject_length, bool translate1, bool translate2)
 Fills vectors of start positions, lengths and strands for all alignment segments. More...
 
static void s_CreateDenseg (CDense_seg &dense_seg, CRef< CSeq_id > master, CRef< CSeq_id > slave, CDense_seg::TStarts &starts, CDense_seg::TLens &lengths, CDense_seg::TStrands &strands)
 Creates a Dense-seg object from the starts, lengths and strands vectors and two Seq-ids. More...
 
static CSeq_align::C_Segs::TStd s_CreateStdSegs (CRef< CSeq_id > master, CRef< CSeq_id > slave, CDense_seg::TStarts &starts, CDense_seg::TLens &lengths, CDense_seg::TStrands &strands, bool translate_master, bool translate_slave)
 Creates a Std-seg object from the starts, lengths and strands vectors and two Seq-ids for a translated search. More...
 
static void s_CorrectUASequence (BlastHSP *hsp)
 Checks if any decline-to-align segments immediately follow an insertion or deletion, and swaps any such segments so indels are always to the right of the decline-to-align segments. More...
 
static void s_ValidateExon (const CSpliced_exon &exon, const CSeq_id &product_id, const CSeq_id &genomic_id)
 
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. More...
 
static CRef< CSeq_aligns_CreateSeqAlign (CRef< CSeq_id > master, CRef< CSeq_id > slave, CDense_seg::TStarts starts, CDense_seg::TLens lengths, CDense_seg::TStrands strands, bool translate_master, bool translate_slave)
 Creates a Seq-align for a single HSP from precalculated vectors of start positions, lengths and strands of segments, sequence identifiers and other information. More...
 
static CRef< CSeq_aligns_BlastHSP2SeqAlign (EBlastProgramType program, BlastHSP *hsp, CRef< CSeq_id > id1, CRef< CSeq_id > id2, Int4 query_length, Int4 subject_length)
 Converts a traceback editing block to a Seq-align, provided the 2 sequence identifiers. More...
 
static CRef< CSeq_aligns_OOFBlastHSP2SeqAlign (EBlastProgramType program, BlastHSP *hsp, CRef< CSeq_id > query_id, CRef< CSeq_id > subject_id, Int4 query_length, Int4 subject_length)
 This function is used for out-of-frame traceback conversion Converts an OOF editing script chain to a Seq-align of type Std-seg. More...
 
static CRef< CScores_MakeScore (const string &ident_string, double d, int i, bool is_integer)
 Creates and initializes CScore with a given name, and with integer or double value. More...
 
static size_t s_CalculateScoreVectorSize (const BlastHSP *hsp, const vector< string > &seqid_list)
 Computes the exact size of a CSeq_align::TScore for a given HSP. More...
 
static void s_BuildScoreList (const BlastHSP *hsp, CSeq_align::TScore &scores, const vector< string > &seqid_list, Int4 query_length)
 Creates a list of score objects for a Seq-align, given an HSP structure. More...
 
static void s_AddUserObjectToSeqAlign (CRef< CSeq_align > &seqalign, const vector< string > &seqid_list)
 Produce UserObject with Seq-ids to limit formatting to ("use_this_gi") More...
 
static void s_AddScoresToSeqAlign (CRef< CSeq_align > &seqalign, const BlastHSP *hsp, const vector< string > &seqid_list, Int4 query_length)
 Given an HSP structure, creates a list of scores and inserts them into a Seq-align. More...
 
CRef< CDense_diagx_UngappedHSPToDenseDiag (BlastHSP *hsp, CRef< CSeq_id > query_id, CRef< CSeq_id > subject_id, Int4 query_length, Int4 subject_length, const vector< string > &seqid_list)
 Creates a Dense-diag object from HSP information and sequence identifiers for a non-translated ungapped search. More...
 
CRef< CStd_segx_UngappedHSPToStdSeg (BlastHSP *hsp, CRef< CSeq_id > query_id, CRef< CSeq_id > subject_id, Int4 query_length, Int4 subject_length, const vector< string > &seqid_list)
 Creates a Std-seg object from HSP information and sequence identifiers for a translated ungapped search. More...
 
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. More...
 
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. More...
 
CRef< CSeq_align_setCreateEmptySeq_align_set (void)
 Constructs an empty Seq-align-set containing an empty discontinuous seq-align, and appends it to a previously constructed Seq-align-set. More...
 
void RemapToQueryLoc (CRef< CSeq_align > sar, const CSeq_loc &query)
 Remaps Seq-align offsets relative to the query Seq-loc. More...
 
static void s_RemapToSubjectLoc (CRef< CSeq_align > &subj_aligns, const CSeq_loc &subj_loc)
 Remap subject alignment if its location specified the reverse strand or a starting location other than the beginning of the sequence. More...
 
CRef< CSeq_align_setBlastHitList2SeqAlign_OMF (const BlastHitList *hit_list, EBlastProgramType prog, const CSeq_loc &query_loc, TSeqPos query_length, const IBlastSeqInfoSrc *seqinfo_src, bool is_gapped, bool is_ooframe, TSeqLocInfoVector &subj_masks)
 
TSeqAlignVector PhiBlastResults2SeqAlign_OMF (const BlastHSPResults *results, EBlastProgramType prog, class ILocalQueryData &query, const IBlastSeqInfoSrc *seqinfo_src, const SPHIQueryInfo *pattern_info, vector< TSeqLocInfoVector > &subj_masks)
 
static void s_AdjustNegativeSubjFrameInBlastn (ENa_strand subj_strand, EBlastProgramType program, BlastHSPList *hsp_list)
 This function changes the subject frame for HSPs if the program is blastn and the subject was specified with a negative strand. More...
 
static TSeqAlignVector s_BLAST_OneSubjectResults2CSeqAlign (const BlastHSPResults *results, ILocalQueryData &query_data, const IBlastSeqInfoSrc &seqinfo_src, EBlastProgramType prog, Uint4 subj_idx, bool is_gapped, bool is_ooframe, vector< TSeqLocInfoVector > &subj_masks)
 Extracts results from the BlastHSPResults structure for only one subject sequence, identified by its index, and converts them into a vector of CSeq_align_set objects. More...
 
static TSeqAlignVector s_TransposeSeqAlignVector (const TSeqAlignVector &alnvec, const size_t num_queries, const size_t num_subjects)
 Transpose the (linearly organized) seqalign set matrix from (q1 s1 q2 s1 ... More...
 
static TSeqAlignVector s_BlastResults2SeqAlignSequenceCmp_OMF (const BlastHSPResults *results, EBlastProgramType prog, class ILocalQueryData &query_data, const IBlastSeqInfoSrc *seqinfo_src, bool is_gapped, bool is_ooframe, vector< TSeqLocInfoVector > &subj_masks)
 
static TSeqAlignVector s_BlastResults2SeqAlignDatabaseSearch_OMF (const BlastHSPResults *results, EBlastProgramType prog, class ILocalQueryData &query, const IBlastSeqInfoSrc *seqinfo_src, bool is_gapped, bool is_ooframe, vector< TSeqLocInfoVector > &subj_masks)
 
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=eDatabaseSearch)
 Convert traceback output into Seq-align format. More...
 
CRef< CStd_segx_NonTranslatedHSPToStdSeg (BlastHSP *hsp, CRef< CSeq_id > query_id, CRef< CSeq_id > subject_id, Int4 query_length, Int4 subject_length, const vector< string > &seqid_list)
 Creates a Std-seg object from HSP information and sequence identifiers for a non-translated ungapped search. More...
 
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)
 

Variables

static const TSeqPos kBlastAlignmentDim = 2
 BLAST alignments have always 2 dimensions (i.e. More...
 

Detailed Description

Utility function to convert internal BLAST result structures into CSeq_align_set objects.

Definition in file blast_seqalign.cpp.

Modified on Fri Jun 14 16:50:10 2024 by modify_doxy.py rev. 669887