62 #define MARKLINE cerr << __FILE__ << ":" << __LINE__ << endl
73 AccumResults->Get()) {
74 int BestRank = QueryIter->second->GetBestRank();
77 << QueryIter->second->GetQueryId()->AsFastaString()
78 <<
" needs Inversion Merger.");
93 PctCovExists[0] =
A->GetNamedScore(
"pct_coverage", PctCovs[0]);
94 PctCovExists[1] = B->
GetNamedScore(
"pct_coverage", PctCovs[1]);
97 if(PctCovExists[0] != PctCovExists[1])
98 return PctCovExists[0];
101 if (!PctCovExists[0])
105 return ( PctCovs[0] > PctCovs[1] );
130 if(Pluses->Set().empty() || Minuses->
Set().empty()) {
138 double PctCovs[2] = { 0.0, 0.0 };
139 double Expands[2] = { 0.0, 0.0 };
140 double NumIdts[2] = { 0.0, 0.0 };
142 Pluses->Get().front()->GetNamedScore(
"pct_coverage", PctCovs[0]);
143 Minuses->
Get().front()->GetNamedScore(
"pct_coverage", PctCovs[1]);
147 if(PctCovs[0] >= PctCovs[1]) {
149 NonDominant = Minuses;
152 NonDominant = Pluses;
159 (*DomIter)->GetNamedScore(
"pct_coverage", PctCovs[0]);
160 (*NonIter)->GetNamedScore(
"pct_coverage", PctCovs[1]);
162 (*DomIter)->GetNamedScore(
"expansion", Expands[0]);
163 (*NonIter)->GetNamedScore(
"expansion", Expands[1]);
165 (*DomIter)->GetNamedScore(
"num_ident", NumIdts[0]);
166 (*NonIter)->GetNamedScore(
"num_ident", NumIdts[1]);
176 if(DomSubjRange.
GetTo() > NonSubjRange.
GetTo())
182 if( (PctCovs[0]/PctCovs[1]) <= 1000.0 &&
183 (PctCovs[0]/PctCovs[1]) >= 1.0 &&
185 Expands[0] <= 3.0 && Expands[1] <= 3.0 ) {
190 cerr <<
"Making Disc: (" << NumIdts[0] <<
"," << Expands[0] <<
") to "
191 <<
"(" << NumIdts[1] <<
"," << Expands[1] <<
")" << endl;
192 ResultSet->
Set().push_back(Disc);
204 if(!ResultSet->
Get().empty()) {
212 vector<CRef<CSeq_align> > TempVec;
213 TempVec.reserve(AlignSet.
Set().size());
214 TempVec.resize(AlignSet.
Set().size());
215 copy(AlignSet.
Set().begin(), AlignSet.
Set().end(), TempVec.begin());
217 AlignSet.
Set().clear();
218 copy(TempVec.begin(), TempVec.end(),
219 insert_iterator<CSeq_align_set::Tdata>(AlignSet.
Set(), AlignSet.
Set().end()));
228 Pluses.
Set().push_back(*AlignIter);
230 Minuses.
Set().push_back(*AlignIter);
241 if(Source.
CanGet() && !Source.
Get().empty()) {
244 if(!
Out.IsNull() &&
Out->CanGet() && !
Out->Get().empty()) {
251 AlignLen = (*MergedIter)->GetSeqRange(1).GetLength();
252 (*MergedIter)->SetNamedScore(
"expansion",
double(AlignLen)/
double(AlignedLen) );
254 Source.
Set().push_back(*MergedIter);
255 Results.
Set().push_back(*MergedIter);
284 DomSlice = DomRef->GetSegs().GetDenseg().
ExtractSlice(0, SwitchSpot, DomRef->GetSeqStop(0));
287 DomRef->SetSegs().SetDenseg().
Assign(*DomSlice);
288 NonRef->
SetSegs().SetDenseg().Assign(*NonSlice);
300 Source->
Set().push_back(DomRef);
301 Source->Set().push_back(NonRef);
304 if(Cleaned.
IsNull() || Cleaned->
Set().size() != 2) {
307 DomRef = Cleaned->
Set().front();
308 NonRef = *( ++(Cleaned->
Set().begin()) );
310 swap(DomRef, NonRef);
313 CDense_seg& DomSeg = DomRef->SetSegs().SetDenseg();
317 int DomIndex = 0, NonIndex = 0;
318 for(DomIndex = 0; DomIndex < DomSeg.
GetNumseg(); DomIndex++) {
329 for(NonIndex = 0; NonIndex < NonSeg.
GetNumseg(); NonIndex++) {
355 if(!FillUnaligned.
IsNull()) {
356 NonSeg.
Assign(*FillUnaligned);
365 Disc->
SetSegs().SetDisc().Set().push_back(DomRef);
366 Disc->
SetSegs().SetDisc().Set().push_back(NonRef);
378 list<CConstRef<CSeq_align> > In;
412 if(
Out->Set().empty())
420 for(
int Index = 0; Index < Denseg.
GetNumseg(); Index++) {
Declares the CBl2Seq (BLAST 2 Sequences) class.
Declares the CBlastNucleotideOptionsHandle class.
Declares the CBlastOptionsHandle and CBlastOptionsFactory classes.
Definitions of special type used in BLAST.
Main argument class for BLASTN application.
class CAlignCleanup implements an alignment cleanup utility based on the C++ alignment manager.
void FillUnaligned(bool b)
Fill any unaligned regions with explicit gaps.
void SortInputsByScore(bool b)
flags these primarity affect the CAlnVec implementation
void Cleanup(const TAligns &aligns_in, TAligns &aligns_out, EMode mode=eDefault)
void TrimEndGaps()
Trim leading/training gaps if possible.
ENa_strand GetSeqStrand(TDim row) const
void Reverse(void)
Reverse the segments' orientation.
void RemovePureGapSegs()
Remove any segments in which every row has a gap (these can arise when ExtractRows is used)
CRef< CDense_seg > ExtractSlice(TDim row, TSeqPos from, TSeqPos to) const
Extract a slice of the alignment that includes the specified range.
CRef< CDense_seg > FillUnaligned() const
Create a new dense-seg with added all unaligned pieces (implicit inserts), if any,...
void Compact()
Join adjacent mergeable segments to create a more compact alignment.
CRange< TSeqPos > GetSeqRange(TDim row) const
void Assign(const CSerialObject &obj, ESerialRecursionMode how=eRecursive)
overloaded Assign()
void x_SplitAlignmentsByStrand(const objects::CSeq_align_set &Source, objects::CSeq_align_set &Pluses, objects::CSeq_align_set &Minuses)
void x_HandleSingleStrandMerging(objects::CSeq_align_set &Source, objects::CSeq_align_set &Results, objects::CScope &Scope)
void x_RunMerger(objects::CScope &Scope, CQuerySet &QueryAligns, TAlignResultsRef Results)
void x_SortAlignSet(objects::CSeq_align_set &AlignSet)
CRef< objects::CSeq_align > x_CreateDiscAlignment(const objects::CSeq_align &Dom, const objects::CSeq_align &Non, objects::CScope &Scope)
CRef< objects::CSeq_align_set > x_MergeSeqAlignSet(const objects::CSeq_align_set &InAligns, objects::CScope &Scope)
static bool s_SortByPctCoverage(const CRef< objects::CSeq_align > &A, const CRef< objects::CSeq_align > &B)
TAlignResultsRef GenerateAlignments(objects::CScope &Scope, ISequenceSet *QuerySet, ISequenceSet *SubjectSet, TAlignResultsRef AccumResults)
bool x_IsAllGap(const objects::CDense_seg &Denseg)
TAssemblyToSubjectSet & Get()
TSeqPos GetAlignLength(const CSeq_align &align, bool ungapped=false)
Compute the length of the alignment (= length of all segments, gaps + aligned)
void AddScore(CScope &scope, CSeq_align &align, EScoreType score)
deprecated: use CSeq_align::EScoreType directly
@ eScore_PercentIdentity_Ungapped
TSeqPos GetSeqStop(TDim row) const
void SetNamedScore(const string &id, int score)
const CSeq_id & GetSeq_id(TDim row) const
Get seq-id (the first one if segments have different ids).
bool GetNamedScore(const string &id, int &score) const
Get score.
TSeqPos GetSeqStart(TDim row) const
ENa_strand GetSeqStrand(TDim row) const
Get strand (the first one if segments have different strands).
Declares the CDiscNucleotideOptionsHandle class.
unsigned int TSeqPos
Type for sequence locations and lengths.
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
#define NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
void swap(NCBI_NS_NCBI::pair_base_member< T1, T2 > &pair1, NCBI_NS_NCBI::pair_base_member< T1, T2 > &pair2)
#define ERR_POST(message)
Error posting with file, line number information but without error codes.
void Error(CExceptionArgs_Base &args)
string ReportAll(TDiagPostFlags flags=eDPF_Exception) const
Report all exceptions.
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Set object to copy of another one.
bool IsNull(void) const THROWS_NONE
Check if pointer is null – same effect as Empty().
position_type GetLength(void) const
bool IntersectingWith(const TThisType &r) const
TThisType & SetLength(position_type length)
#define END_SCOPE(ns)
End the previously defined scope.
#define BEGIN_SCOPE(ns)
Define a new scope.
void SetFrom(TFrom value)
Assign a value to From data member.
TTo GetTo(void) const
Get the To member data.
TFrom GetFrom(void) const
Get the From member data.
const TStr & GetStr(void) const
Get the variant data.
const TDenseg & GetDenseg(void) const
Get the variant data.
Tdata & Set(void)
Assign a value to data member.
bool CanGet(void) const
Check if it is safe to call Get method.
E_Choice Which(void) const
Which variant is currently selected.
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 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.
bool CanGetStrands(void) const
Check if it is safe to call GetStrands method.
TNumseg GetNumseg(void) const
Get the Numseg member data.
list< CRef< CSeq_align > > Tdata
const TStrands & GetStrands(void) const
Get the Strands member data.
const Tdata & Get(void) const
Get the member data.
const TSegs & GetSegs(void) const
Get the Segs member data.
@ eType_disc
discontinuous alignment
const TLocal & GetLocal(void) const
Get the variant data.
bool IsLocal(void) const
Check if variant Local is selected.
Main class to perform a BLAST search on the local machine.
constexpr auto sort(_Init &&init)
Magic spell ;-) needed for some weird compilers... very empiric.
Defines NCBI C++ exception handling.
void copy(Njn::Matrix< S > *matrix_, const Njn::Matrix< T > &matrix0_)
void Out(T t, int w, CNcbiOstream &to=cout)