50 aln_seq->m_SeqId.Reset(master_first ? &align.
GetSecond_id()
63 range.SetFrom(0).SetLength(0);
69 aln_from = master_first ? starts_1[
i] : starts_2[
i];
70 from = master_first ? starts_2[
i] : starts_1[
i];
76 range.SetFrom(aln_from);
85 aln_seq->m_AlignColl = coll;
92 aln_seq->m_NegativeStrand =
true;
94 return aln_seq.release();
100 vector<SAlignedSeq*>& aln_seqs)
103 const TSegs& segs = align.
GetSegs();
105 switch(segs.Which()) {
106 case TSegs::e_Denseg: {
107 const CDense_seg& dense_seg = segs.GetDenseg();
127 vector<SAlignedSeq*>& aln_seqs)
133 for(
size_t i = 0;
i < aligns.size();
i++ ) {
138 LOG_POST(
"ConvertToPairwise( vector of CSeq_align) " << 1000 * timer.
Elapsed() <<
" ms");
149 const TRows& rows = sparse_seg.
GetRows();
150 TRows::const_iterator it = rows.begin();
153 for( ; it != rows.end(); ++it ) {
156 int master_index = -1;
163 if(master_index != -1) {
166 aln_seqs.push_back(aln_seq);
170 <<
"invalid, neither of its CSeq_ids match master id");
179 vector<SAlignedSeq*>& aln_seqs)
184 if(
row != anchor_row) {
187 aln_seqs.push_back(aln_seq);
197 vector<SAlignedSeq*>& aln_seqs,
198 objects::CScope& scope)
200 if(! aln_seqs.empty()) {
202 aln->
Init(master_id, aln_seqs, scope);
211 vector<SAlignedSeq*>& aln_seqs,
212 objects::CScope& scope)
214 if(! aln_seqs.empty()) {
229 unique_ptr<SAlignedSeq> aln_seq(
new SAlignedSeq());
230 aln_seq->m_SeqId.Reset(dense_seg.
GetIds()[row_2]);
247 for( TNum
i = 0;
i < n_seg;
i++ ) {
249 int from_1 = starts[row_1 +
offset];
250 int from_2 = starts[row_2 +
offset];
252 if(from_1 != -1 && from_2 != -1) {
258 direct = (! minus_1 && ! minus_2) || (minus_1 == minus_2);
264 range.SetFrom(from_1);
275 return aln_seq.release();
293 bool first = (index == 0);
301 TNumseg n_seg = sparse_align.
GetNumseg();
302 for( TNumseg
i = 0;
i < n_seg;
i++ ) {
303 int from_1 =
first ? starts_1[
i] : starts_2[
i];
304 int from_2 =
first ? starts_2[
i] : starts_1[
i];
324 align->SetFirst_id(*rid_1);
328 align->SetSecond_id(*rid_2);
332 TNumseg n_seg = (TNumseg)coll.
size();
333 align->SetNumseg(n_seg);
336 starts_1.resize(n_seg);
338 starts_2.resize(n_seg);
345 strands = &align->SetSecond_strands();
346 strands->resize(n_seg);
354 starts_1[
i] =
r.GetFirstFrom();
355 starts_2[
i] =
r.GetSecondFrom();
356 lens[
i] =
r.GetLength();
User-defined methods of the data storage class.
@ fMixedDir
contains at least one reversed range
@ fInvalid
collection was modified and not validated
@ fReversed
contains at least one direct range
const_iterator insert(const TAlignRange &r)
CAlignRange Represents an element of pairwise alignment of two sequences.
CSparseAlignment - an alignment based on CSparse_seg and CAlingRangeCollection classes rather than on...
void Init(const objects::CSeq_id &master_id, vector< SAlignedSeq * > &aln_seqs, objects::CScope &scope)
static DLIST_TYPE *DLIST_NAME() first(DLIST_LIST_TYPE *list)
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
#define LOG_POST(message)
This macro is deprecated and it's strongly recomended to move in all projects (except tests) to macro...
void Error(CExceptionArgs_Base &args)
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Optimized implementation of CSerialObject::Assign, which is not so efficient.
E_SIC Compare(const CSeq_id &sid2) const
Compare() - more general.
@ e_YES
SeqIds compared, but are different.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
double Elapsed(void) const
Return time elapsed since first Start() or last Restart() call (in seconds).
void Start(void)
Start the timer.
vector< CRef< CSparse_align > > TRows
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.
vector< ENa_strand > TStrands
const TLens & GetLens(void) const
Get the Lens member data.
const TFirst_id & GetFirst_id(void) const
Get the First_id member data.
vector< TSignedSeqPos > TStarts
const TMaster_id & GetMaster_id(void) const
Get the Master_id member data.
vector< CRef< CSeq_id > > TIds
TDim GetDim(void) const
Get the Dim member data.
const TSecond_starts & GetSecond_starts(void) const
Get the Second_starts member data.
const TLens & GetLens(void) const
Get the Lens member data.
bool IsSetSecond_strands(void) const
Check if a value has been assigned to Second_strands data member.
vector< int > TSecond_starts
const TFirst_starts & GetFirst_starts(void) const
Get the First_starts member data.
TNumseg GetNumseg(void) const
Get the Numseg member data.
const TIds & GetIds(void) const
Get the Ids member data.
const TSecond_strands & GetSecond_strands(void) const
Get the Second_strands member data.
const TSecond_id & GetSecond_id(void) const
Get the Second_id member data.
vector< int > TFirst_starts
TNumseg GetNumseg(void) const
Get the Numseg member data.
const TRows & GetRows(void) const
Get the Rows member data.
vector< ENa_strand > TSecond_strands
const TStrands & GetStrands(void) const
Get the Strands member data.
const TSegs & GetSegs(void) const
Get the Segs member data.
range(_Ty, _Ty) -> range< _Ty >
static bool Equals(const CVariation::TPlacements &p1, const CVariation::TPlacements &p2)
Defines: CTimeFormat - storage class for time format.
double r(size_t dimension_, const Int4 *score_, const double *prob_, double theta_)
CAlnVec * BuildDenseAlignment(const CSeq_id &master_id, vector< SAlignedSeq * > &aln_seqs, objects::CScope &scope)
Builder function.
bool ConvertToPairwise(const CSeq_align &align, const CSeq_id &master_id, vector< SAlignedSeq * > &aln_seqs)
Converter.
USING_SCOPE(ncbi::objects)
SAlignedSeq * CreateAlignRow(const CSparse_align &align, bool master_first)
CRef< CSparse_align > CreateSparseAlign(const CSeq_id &id_1, const CSeq_id &id_2, const SAlignTools::TAlignColl &coll)
Reverse Converter Converts Align Collection into a CSparse_align.
CSparseAlignment * BuildSparseAlignment(const CSeq_id &master_id, vector< SAlignedSeq * > &aln_seqs, objects::CScope &scope)
Builder function.
void GetAlignColl(const CSparse_align &sparse_align, const CSeq_id &master_id, SAlignTools::TAlignColl &coll)
Creates Align Collection from a CSparse_seg.
#define row(bind, expected)
This is a building block for a Builder represents a Sequence aligned to an Anchor (pairwise alignment...
SAlignTools::TAlignColl TAlignColl