NCBI C++ ToolKit
|
#include <corelib/ncbistd.hpp>
#include <corelib/ncbiobj.hpp>
#include <objects/seqalign/Seq_align.hpp>
#include <objects/seq/seq_loc_mapper_base.hpp>
#include <objtools/alnmgr/alnexception.hpp>
#include <objtools/alnmgr/pairwise_aln.hpp>
#include <objtools/alnmgr/aln_user_options.hpp>
#include <objtools/alnmgr/aln_stats.hpp>
Go to the source code of this file.
Go to the SVN repository for this file.
Typedefs | |
typedef vector< TAlnSeqIdIRef > | TAlnSeqIdVec |
typedef list< CRef< CPairwiseAln > > | TPairwiseAlnList |
Functions | |
void | ConvertSeqAlignToPairwiseAln (CPairwiseAln &pairwise_aln, const objects::CSeq_align &sa, objects::CSeq_align::TDim row_1, objects::CSeq_align::TDim row_2, CAlnUserOptions::EDirection direction=CAlnUserOptions::eBothDirections, const TAlnSeqIdVec *ids=0) |
Build pairwise alignment from the selected rows of a seq-align. More... | |
void | ConvertDensegToPairwiseAln (CPairwiseAln &pairwise_aln, const objects::CDense_seg &ds, objects::CSeq_align::TDim row_1, objects::CSeq_align::TDim row_2, CAlnUserOptions::EDirection direction=CAlnUserOptions::eBothDirections, const TAlnSeqIdVec *ids=0) |
Build pairwise alignment from the selected rows of a dense-seg. More... | |
void | ConvertPackedsegToPairwiseAln (CPairwiseAln &pairwise_aln, const objects::CPacked_seg &ps, objects::CSeq_align::TDim row_1, objects::CSeq_align::TDim row_2, CAlnUserOptions::EDirection direction=CAlnUserOptions::eBothDirections, const TAlnSeqIdVec *ids=0) |
Build pairwise alignment from the selected rows of a packed-seg. More... | |
void | ConvertStdsegToPairwiseAln (CPairwiseAln &pairwise_aln, const objects::CSeq_align::TSegs::TStd &stds, objects::CSeq_align::TDim row_1, objects::CSeq_align::TDim row_2, CAlnUserOptions::EDirection direction=CAlnUserOptions::eBothDirections, const TAlnSeqIdVec *ids=0) |
Build pairwise alignment from the selected rows of an std-seg. More... | |
void | ConvertDendiagToPairwiseAln (CPairwiseAln &pairwise_aln, const objects::CSeq_align::TSegs::TDendiag &dendiags, objects::CSeq_align::TDim row_1, objects::CSeq_align::TDim row_2, CAlnUserOptions::EDirection direction=CAlnUserOptions::eBothDirections, const TAlnSeqIdVec *ids=0) |
Build pairwise alignment from the selected rows of a dendiag. More... | |
void | ConvertSparseToPairwiseAln (CPairwiseAln &pairwise_aln, const objects::CSparse_seg &sparse_seg, objects::CSeq_align::TDim row_1, objects::CSeq_align::TDim row_2, CAlnUserOptions::EDirection direction=CAlnUserOptions::eBothDirections, const TAlnSeqIdVec *ids=0) |
Build pairwise alignment from the selected rows of a sparse-seg. More... | |
void | ConvertSplicedToPairwiseAln (CPairwiseAln &pairwise_aln, const objects::CSpliced_seg &spliced_seg, objects::CSeq_align::TDim row_1, objects::CSeq_align::TDim row_2, CAlnUserOptions::EDirection direction=CAlnUserOptions::eBothDirections, const TAlnSeqIdVec *ids=0) |
Build pairwise alignment from the selected rows of a spliced-seg. More... | |
void | ConvertSeqLocsToPairwiseAln (CPairwiseAln &aln, const objects::CSeq_loc &loc_1, const objects::CSeq_loc &loc_2, CAlnUserOptions::EDirection direction=CAlnUserOptions::eBothDirections) |
Build pairwise alignment from a pair of seq-locs. More... | |
void | SeqLocMapperToPairwiseAligns (const objects::CSeq_loc_Mapper_Base &mapper, TPairwiseAlnList &aligns) |
Build a list of pairwise alignments from a seq-loc mapper's mappings. More... | |
template<class _TAlnStats > | |
CRef< CAnchoredAln > | CreateAnchoredAlnFromAln (const _TAlnStats &aln_stats, size_t aln_idx, const CAlnUserOptions &options, objects::CSeq_align::TDim explicit_anchor_row=-1) |
Create an anchored alignment from Seq-align using hints. More... | |
template<class _TAlnStats > | |
void | CreateAnchoredAlnVec (_TAlnStats &aln_stats, TAnchoredAlnVec &out_vec, const CAlnUserOptions &options) |
Create anchored alignment from each seq-align in the stats. More... | |
CRef< CPairwiseAln > | CreatePairwiseAlnFromSeqAlign (const objects::CSeq_align &seq_align) |
A simple API that assumes that the seq_align has exactly two rows and you want to create a pairwise with the default policy. More... | |
typedef vector<TAlnSeqIdIRef> TAlnSeqIdVec |
Definition at line 52 of file aln_converters.hpp.
typedef list< CRef<CPairwiseAln> > TPairwiseAlnList |
Definition at line 181 of file aln_converters.hpp.
void ConvertDendiagToPairwiseAln | ( | CPairwiseAln & | pairwise_aln, |
const objects::CSeq_align::TSegs::TDendiag & | dendiags, | ||
objects::CSeq_align::TDim | row_1, | ||
objects::CSeq_align::TDim | row_2, | ||
CAlnUserOptions::EDirection | direction = CAlnUserOptions::eBothDirections , |
||
const TAlnSeqIdVec * | ids = 0 |
||
) |
Build pairwise alignment from the selected rows of a dendiag.
void ConvertDensegToPairwiseAln | ( | CPairwiseAln & | pairwise_aln, |
const objects::CDense_seg & | ds, | ||
objects::CSeq_align::TDim | row_1, | ||
objects::CSeq_align::TDim | row_2, | ||
CAlnUserOptions::EDirection | direction = CAlnUserOptions::eBothDirections , |
||
const TAlnSeqIdVec * | ids = 0 |
||
) |
Build pairwise alignment from the selected rows of a dense-seg.
void ConvertPackedsegToPairwiseAln | ( | CPairwiseAln & | pairwise_aln, |
const objects::CPacked_seg & | ps, | ||
objects::CSeq_align::TDim | row_1, | ||
objects::CSeq_align::TDim | row_2, | ||
CAlnUserOptions::EDirection | direction = CAlnUserOptions::eBothDirections , |
||
const TAlnSeqIdVec * | ids = 0 |
||
) |
Build pairwise alignment from the selected rows of a packed-seg.
void ConvertSeqAlignToPairwiseAln | ( | CPairwiseAln & | pairwise_aln, |
const objects::CSeq_align & | sa, | ||
objects::CSeq_align::TDim | row_1, | ||
objects::CSeq_align::TDim | row_2, | ||
CAlnUserOptions::EDirection | direction = CAlnUserOptions::eBothDirections , |
||
const TAlnSeqIdVec * | ids = 0 |
||
) |
Build pairwise alignment from the selected rows of a seq-align.
pairwise_aln | Output pairwise alignment. Should be initialized with the correct ids (the functions does not check if the ids in the pairwise alignment correspond to the ids of the selected rows). |
sa | Input seq-align object. |
row_1 | First row index. |
row_2 | Second row index. |
direction | Flag indicating if the output pairwise alignment should include direct, reverse, or any segments. NOTE: segment direction in pariwise alignments is relative (second vs first row). |
ids | Optional vector of alignment seq-ids used only to check if the source alignment contains mixed sequence types. All ids from the vector are compared, not just the two selected rows. |
Referenced by BOOST_AUTO_TEST_CASE(), CreateAnchoredAlnFromAln(), CAlnTestApp::Run(), s_GetAlignmentSpans_Interval(), s_GetSplicedSegIdentityMismatch(), and CHitMatrixDataSource::x_CreateHits_Diagonal().
void ConvertSeqLocsToPairwiseAln | ( | CPairwiseAln & | aln, |
const objects::CSeq_loc & | loc_1, | ||
const objects::CSeq_loc & | loc_2, | ||
CAlnUserOptions::EDirection | direction = CAlnUserOptions::eBothDirections |
||
) |
Build pairwise alignment from a pair of seq-locs.
Each seq-loc must reference a single sequence.
aln | Output pairwise alignment. Should be initialized with the correct ids (the functions does not check if the ids in the pairwise alignment correspond to the ids of the seq-locs). |
loc_1 | First seq-loc. |
loc_2 | Second seq-loc. |
direction | Flag indicating if the output pairwise alignment should include direct, reverse, or any segments. NOTE: segment direction in pariwise alignments is relative (second vs first row). |
Definition at line 793 of file aln_converters.cpp.
References _ASSERT, CAlnUserOptions::eBothDirections, CAlnUserOptions::eDirect, CAlnUserOptions::eReverse, CPairwiseAln::GetFirstBaseWidth(), CRange_Base::GetFrom(), COpenRange< Position >::GetLength(), CSeq_loc_CI::GetRange(), CPairwiseAln::GetSecondBaseWidth(), CSeq_loc_CI::GetStrand(), CAlignRangeCollectionList< TAlnRange >::insert(), CSeq_loc_CI::IsEmpty(), IsReverse(), len, and CPairwiseAln::SetUsingGenomic().
Referenced by CFeatGlyph::x_DrawProjectedRuler(), and CFeatGlyph::x_DrawRuler().
void ConvertSparseToPairwiseAln | ( | CPairwiseAln & | pairwise_aln, |
const objects::CSparse_seg & | sparse_seg, | ||
objects::CSeq_align::TDim | row_1, | ||
objects::CSeq_align::TDim | row_2, | ||
CAlnUserOptions::EDirection | direction = CAlnUserOptions::eBothDirections , |
||
const TAlnSeqIdVec * | ids = 0 |
||
) |
Build pairwise alignment from the selected rows of a sparse-seg.
void ConvertSplicedToPairwiseAln | ( | CPairwiseAln & | pairwise_aln, |
const objects::CSpliced_seg & | spliced_seg, | ||
objects::CSeq_align::TDim | row_1, | ||
objects::CSeq_align::TDim | row_2, | ||
CAlnUserOptions::EDirection | direction = CAlnUserOptions::eBothDirections , |
||
const TAlnSeqIdVec * | ids = 0 |
||
) |
Build pairwise alignment from the selected rows of a spliced-seg.
void ConvertStdsegToPairwiseAln | ( | CPairwiseAln & | pairwise_aln, |
const objects::CSeq_align::TSegs::TStd & | stds, | ||
objects::CSeq_align::TDim | row_1, | ||
objects::CSeq_align::TDim | row_2, | ||
CAlnUserOptions::EDirection | direction = CAlnUserOptions::eBothDirections , |
||
const TAlnSeqIdVec * | ids = 0 |
||
) |
Build pairwise alignment from the selected rows of an std-seg.
CRef<CAnchoredAln> CreateAnchoredAlnFromAln | ( | const _TAlnStats & | aln_stats, |
size_t | aln_idx, | ||
const CAlnUserOptions & | options, | ||
objects::CSeq_align::TDim | explicit_anchor_row = -1 |
||
) |
Create an anchored alignment from Seq-align using hints.
Optionally, choose the anchor row explicitly (this overrides options.GetAnchorId()). NOTE: Potentially, this "shrinks" the alignment vertically in case some row was not aligned to the anchor.
aln_stats | Input alignment stats (see CAlnStats template). |
aln_idx | Index of the input alignment in the stats. |
options | Options for building the anchored alignment. |
explicit_anchor_row | Explicit anchor row index (this overrides anchor id set in the options). By default the anchor row is selected automatically. |
Definition at line 205 of file aln_converters.hpp.
References _ALNMGR_ASSERT, ConvertSeqAlignToPairwiseAln(), CAlnUserOptions::eDirect, ctll::empty(), CAlignRangeCollectionList< CAlignRange< TSignedSeqPos > >::fAllowMixedDir, CAlignRangeCollectionList< CAlignRange< TSignedSeqPos > >::fAllowOverlap, CAlnUserOptions::fAnchorRowFirst, CAlnUserOptions::fIgnoreInsertions, CAlignRangeCollectionList< CAlignRange< TSignedSeqPos > >::fIgnoreInsertions, map_checker< Container >::find(), CAlignRangeCollectionList< CAlignRange< TSignedSeqPos > >::fKeepNormalized, flags, CAlnUserOptions::GetAnchorId(), CSeq_align_Base::GetSegs(), i, CSeq_align_Base::C_Segs::IsStd(), CAlnUserOptions::m_Direction, CAlnUserOptions::m_MergeFlags, NCBI_THROW, CRef< C, Locker >::Reset(), row, CAnchoredAln::SetAnchorRow(), CAnchoredAln::SetDim(), CAnchoredAln::SetPairwiseAlns(), and ncbi::grid::netcache::search::fields::size.
Referenced by BOOST_AUTO_TEST_CASE(), BuildAlignDataSource(), ConvertSeq_align(), CreateAnchoredAlnVec(), CAlnBuildApp::Run(), and CAlnTestApp::Run().
void CreateAnchoredAlnVec | ( | _TAlnStats & | aln_stats, |
TAnchoredAlnVec & | out_vec, | ||
const CAlnUserOptions & | options | ||
) |
Create anchored alignment from each seq-align in the stats.
Definition at line 363 of file aln_converters.hpp.
References _ASSERT, CAlignRangeCollectionList< TAlnRange >::begin(), CreateAnchoredAlnFromAln(), CAlignRangeCollectionList< TAlnRange >::end(), CAlignRangeCollectionList< CAlignRange< TSignedSeqPos > >::fMixedDir, CAlignRangeCollectionList< CAlignRange< TSignedSeqPos > >::fOverlap, CAnchoredAln::GetAnchorRow(), CAnchoredAln::GetDim(), CPairwiseAln::GetFirstId(), CAnchoredAln::GetPairwiseAlns(), CAlignRangeCollectionList< TAlnRange >::GetPolicyFlags(), CPairwiseAln::GetSecondId(), CSeq_align_Base::GetSegs(), CAlignRangeCollectionList< TAlnRange >::IsSet(), CSeq_align_Base::C_Segs::IsStd(), ITERATE, row, CAnchoredAln::SetAnchorRow(), CAnchoredAln::SetDim(), CAnchoredAln::SetPairwiseAlns(), and CAnchoredAln::SetScore().
Referenced by BOOST_AUTO_TEST_CASE(), CAlnSpanVertModel::CAlnSpanVertModel(), CAlignCleanup::CreatePairwiseFromMultiple(), CAlnBuildApp::Run(), CAlnTestApp::Run(), CAlignCleanup::x_Cleanup_AnchoredAln(), CMergeAlignmentsJob::x_CreateProjectItems(), CTreeBuilderJob::x_CreateProjectItems(), CAlnMultiDSBuilder::x_PreCreateSparseDataSource(), and CValidError_align::x_ValidateAlignPercentIdentity().
CRef<CPairwiseAln> CreatePairwiseAlnFromSeqAlign | ( | const objects::CSeq_align & | seq_align | ) |
A simple API that assumes that the seq_align has exactly two rows and you want to create a pairwise with the default policy.
Referenced by CScoreBuilder::GetBlastScoreSpliced(), and CScoreBuilder::GetBlastScoreStd().
void SeqLocMapperToPairwiseAligns | ( | const objects::CSeq_loc_Mapper_Base & | mapper, |
TPairwiseAlnList & | aligns | ||
) |
Build a list of pairwise alignments from a seq-loc mapper's mappings.
Definition at line 925 of file aln_converters.cpp.
References map_checker< Container >::end(), map_checker< Container >::find(), CMappingRange::GetDst_from(), CMappingRange::GetDstIdHandle(), CMappingRanges::GetIdMap(), CMappingRange::GetLength(), CMappingRange::GetReverse(), CSeq_id_Handle::GetSeqId(), CMappingRange::GetSrc_from(), ITERATE, Ref(), and s_GetBestSynonym().