62 aln_container.
insert(multiple);
70 size_t count_accepted = 0;
78 <<
"CAlgoPlugin_AlignCleanup::x_Run_AlignMgr(): "
79 <<
"failed to extract IDs: " << e.GetMsg());
83 if (count_accepted != aln_container.
size()) {
84 if (count_accepted == 0) {
86 "No valid alignments found");
91 << count_accepted <<
"/" << aln_container.
size()
92 <<
" alignments had no IDs to extract.");
114 (*iter)->GetPairwiseAlns()) {
121 pairwise.push_back(aln);
140 id->Assign(*seg.
GetIds()[0]);
141 new_seg->
SetIds().push_back(
id);
145 new_seg->
SetIds().push_back(
id);
153 if ((start_0 < 0 && start_1 < 0)
154 || (segs==0 && (start_0 < 0 || start_1 < 0))
167 while (segs && (new_seg->
SetStarts()[segs*2-2] < 0 || new_seg->
SetStarts()[segs*2-1] < 0)) {
170 new_seg->
SetLens().resize(segs);
186 align->
SetSegs().SetDenseg(*new_seg);
192 pairwise.push_back(align);
196 <<
"CAlignCleanup::CreatePairwiseFromMultiple(): "
197 <<
"failed to validate: " << e.
GetMsg());
208 : m_SortByScore(
true)
209 , m_PreserveRows(
false)
210 , m_FillUnaligned(
false)
216 , m_SortByScore(
true)
217 , m_PreserveRows(
false)
218 , m_FillUnaligned(
false)
228 copy(aligns_in.begin(), aligns_in.end(), back_inserter(const_aligns_in));
236 size_t size = aligns_in.size();
243 align->
Assign(*aligns_in.front());
244 aligns_out.push_back(align);
269 size_t count_invalid = 0;
280 aln_container.
insert(*aln);
284 <<
"CAlgoPlugin_AlignCleanup::x_Run_AlignMgr(): "
285 <<
"failed to validate: " << e.
GetMsg());
295 msg +=
" alignments failed validation.";
296 if (count_invalid ==
count) {
306 size_t count_accepted = 0;
314 <<
"CAlgoPlugin_AlignCleanup::x_Run_AlignMgr(): "
315 <<
"failed to extract IDs: " << e.GetMsg());
319 if (count_accepted != aln_container.
size()) {
320 if (count_accepted == 0) {
322 "No valid alignments found");
327 << count_accepted <<
"/" << aln_container.
size()
328 <<
" alignments had no IDs to extract.");
347 if (ids.
size() == 1) {
348 preserve_rows =
true;
385 BuildAln(anchored_aln_vec, out_anchored_aln, opts);
391 vector< CRef<CSeq_align> > ds_aligns;
396 vector< CRef<CSeq_align> > ds_aligns;
403 aligns_out.push_back(*it);
410 (*align_iter)->SetSegs().SetDenseg(*ds);
422 TAlignments align_map;
424 bool all_pairwise =
true;
429 all_pairwise =
false;
434 for ( ; id_iter; ++id_iter) {
439 align_map[id_set].push_back(al);
452 ITERATE (TAlignments, iter, align_map) {
453 typedef list< CConstRef<CSeq_align> >
TAlignList;
454 list<TAlignList> alignments;
468 neg_strand.push_back(*it);
470 pos_strand.push_back(*it);
474 pos_strand.insert(pos_strand.end(),
475 neg_strand.begin(), neg_strand.end());
476 for ( ; it != iter->second.end(); ++it) {
477 pos_strand.push_back(*it);
486 ITERATE (list<TAlignList>, it, alignments) {
502 mix.
Merge(merge_flags);
506 "Mix produced empty alignment");
511 "Mix produced empty alignment");
514 list< CRef<CSeq_align> > aligns;
523 aligns.push_back(new_align);
527 if ((*align)->GetSegs().IsDenseg()) {
528 (*align)->SetSegs().SetDenseg().Compact();
530 aligns_out.push_back(*align);
535 "error merging alignments: "
537 if ( !
msg.empty() ) {
static CRef< CScope > m_Scope
void BuildAln(TAnchoredAlnVec &in_alns, CAnchoredAln &out_aln, const CAlnUserOptions &options, TAlnSeqIdIRef pseudo_seqid=TAlnSeqIdIRef())
Build anchored alignment from a set of alignmnets.
void CreateAnchoredAlnVec(_TAlnStats &aln_stats, TAnchoredAlnVec &out_vec, const CAlnUserOptions &options)
Create anchored alignment from each seq-align in the stats.
void CreateSeqAlignFromEachPairwiseAln(const CAnchoredAln::TPairwiseAlnVector pairwises, CAnchoredAln::TDim anchor, vector< CRef< CSeq_align > > &out_seqaligns, CSeq_align::TSegs::E_Choice choice, CScope *scope=NULL)
Create seq-align from each of the pairwise alignments vs the selected anchor row.
CRef< CSeq_align > CreateSeqAlignFromAnchoredAln(const CAnchoredAln &anchored_aln, CSeq_align::TSegs::E_Choice choice, CScope *scope=NULL)
Convert CAnchoredAln to seq-align of the selected type.
CRef< CDense_seg > CreateDensegFromPairwiseAln(const CPairwiseAln &pairwise_aln, CScope *scope=NULL)
set< CRef< CSeq_id >, PPtrLess< CRef< CSeq_id > >> TIdSet
void x_Cleanup_AlignVec(const TConstAligns &aligns_in, TAligns &aligns_out)
list< CConstRef< CSeq_align > > TConstAligns
list< CRef< CSeq_align > > TAligns
static void CreatePairwiseFromMultiple(const CSeq_align &multiple, TAligns &pairwise)
void x_Cleanup_AnchoredAln(const TConstAligns &aligns_in, TAligns &aligns_out)
void Cleanup(const TAligns &aligns_in, TAligns &aligns_out, EMode mode=eDefault)
const_iterator insert(const CSeq_align &seq_align)
Insert new CSeq_align into the list.
size_type size(void) const
Container mapping seq-aligns to vectors of participating seq-ids.
void push_back(const CSeq_align &aln)
Adding an alignment.
void Add(const CDense_seg &ds, TAddFlags flags=0)
void Merge(TMergeFlags flags=0)
const CSeq_align & GetSeqAlign(void) const
const CDense_seg & GetDenseg(void) const
Helper class which collects seq-align statistics: seq-ids participating in alignments and rows,...
_TAlnIdVec::TIdVec TIdVec
Vector of ids used in all alignments.
const TIdVec & GetIdVec(void) const
Get vector of all ids from all alignments.
Options for different alignment manager operations.
@ eMergeAllSeqs
Merge all sequences (greedy algo).
@ ePreserveRows
Preserve all rows as they were in the input (e.g.
@ eBothDirections
No filtering: use both direct and reverse sequences.
void SetMergeFlags(TMergeFlags flags, bool set)
Set/clear merge flags.
@ fUseAnchorAsAlnSeq
Use the anchor sequence as the alignment sequence.
@ fSkipSortByScore
In greedy algos, skip sorting input alignments by score thus allowing for user-defined sort order.
@ fTruncateOverlaps
Truncate overlapping ranges.
Query-anchored alignment can be 2 or multi-dimentional.
const TPairwiseAlnVector & GetPairwiseAlns(void) const
The vector of pairwise alns.
vector< CRef< CPairwiseAln > > TPairwiseAlnVector
TDim GetAnchorRow(void) const
Which is the anchor row?
CRef< CDense_seg > FillUnaligned() const
Create a new dense-seg with added all unaligned pieces (implicit inserts), if any,...
void Validate(bool full_test=false) const
Template class for iteration on objects of class C (non-medifiable version)
iterator_bool insert(const value_type &val)
list< CRef< CSeq_align > > TAlignList
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
int TSignedSeqPos
Type for signed sequence position.
#define NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
#define ERR_POST(message)
Error posting with file, line number information but without error codes.
void Error(CExceptionArgs_Base &args)
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
const string & GetMsg(void) const
Get message string.
void Warning(CExceptionArgs_Base &args)
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Set object to copy of another one.
static CSeq_id_Handle GetHandle(const CSeq_id &id)
Normal way of getting a handle, works for any seq-id.
void Reset(void)
Reset reference object.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static enable_if< is_arithmetic< TNumeric >::value||is_convertible< TNumeric, Int8 >::value, string >::type NumericToString(TNumeric value, TNumToStringFlags flags=0, int base=10)
Convert numeric value to string.
const TDenseg & GetDenseg(void) const
Get the variant data.
TLens & SetLens(void)
Assign a value to Lens data member.
bool IsSetStrands(void) const
Check if a value has been assigned to Strands data member.
const TStarts & GetStarts(void) const
Get the Starts member data.
void SetSegs(TSegs &value)
Assign a value to Segs data member.
const TLens & GetLens(void) const
Get the Lens member data.
void SetDim(TDim value)
Assign a value to Dim data member.
void SetType(TType value)
Assign a value to Type data member.
TDim GetDim(void) const
Get the Dim member data.
TStarts & SetStarts(void)
Assign a value to Starts data member.
TStrands & SetStrands(void)
Assign a value to Strands data member.
TType GetType(void) const
Get the Type member data.
void SetNumseg(TNumseg value)
Assign a value to Numseg data member.
const TIds & GetIds(void) const
Get the Ids member data.
TNumseg GetNumseg(void) const
Get the Numseg member data.
TIds & SetIds(void)
Assign a value to Ids data member.
const TStrands & GetStrands(void) const
Get the Strands member data.
const TSegs & GetSegs(void) const
Get the Segs member data.
bool IsDenseg(void) const
Check if variant Denseg is selected.
@ eType_partial
mapping pieces together
const struct ncbi::grid::netcache::search::fields::SIZE size
void copy(Njn::Matrix< S > *matrix_, const Njn::Matrix< T > &matrix0_)
vector< CRef< CAnchoredAln > > TAnchoredAlnVec
Collection of anchored alignments.
static SLJIT_INLINE sljit_ins msg(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
#define row(bind, expected)