TSegs& segs = sa.
GetSegs();
77 switch(segs.Which()) {
80row_1, row_2, direction, ids);
84row_1, row_2, direction, ids);
89row_1, row_2, direction, ids);
93row_1, row_2, direction, ids);
98row_1, row_2, direction, ids);
103row_1, row_2, direction, ids);
107row_1, row_2, direction, ids);
111 "Invalid CSeq_align::TSegs type.");
120 if( !ids )
return false;
121 boolhave_nuc =
false;
122 boolhave_prot =
false;
124 switch((*id)->GetBaseWidth()) {
132 if(have_nuc && have_prot)
return true;
162 for(seg = 0, pos_1 = row_1, pos_2 = row_2;
164++seg, pos_1 += dim, pos_2 += dim) {
171 boolfirst_direct =
true;
173first_direct = !
IsReverse((*strands)[pos_1]);
174 boolminus_2 =
IsReverse((*strands)[pos_2]);
175direct = first_direct != minus_2;
186 if(mixed || base_width_1 > 1) {
191 if(base_width_1 > 1) {
192from_1 *= base_width_1;
194 if(base_width_2 > 1) {
195from_2 *= base_width_2;
201 if(from_1 >= 0 && from_2 >= 0) {
204from_1, from_2,
len, direct, first_direct));
205last_to_1 = first_direct ? from_1 +
len: from_1;
207 else if(from_1 < 0 && from_2 >= 0) {
210 if(!first_direct && ins_pos == 0) {
215 while(seg + skip_seg < numseg) {
216 intp = starts[pos_1 + skip_seg*dim];
218ins_pos = p + lens[seg + skip_seg];
225ins_pos, from_2,
len, direct, first_direct));
227 else if(from_1 >= 0) {
229last_to_1 = first_direct ? from_1 +
len: from_1;
260 for(seg = 0, pos_1 = row_1, pos_2 = row_2;
262++seg, pos_1 += dim, pos_2 += dim) {
263 TSeqPosfrom_1 = starts[pos_1];
264 TSeqPosfrom_2 = starts[pos_2];
265 boolpresent_1 = presents[pos_1];
266 boolpresent_2 = presents[pos_2];
271 boolfirst_direct =
true;
273first_direct = !
IsReverse((*strands)[pos_1]);
274 boolminus_2 =
IsReverse((*strands)[pos_2]);
275direct = first_direct != minus_2;
286 if(mixed || base_width_1 > 1) {
291 if(base_width_1 > 1) {
292from_1 *= base_width_1;
294 if(base_width_2 > 1) {
295from_2 *= base_width_2;
301 if(present_1 && present_2) {
304from_1, from_2,
len, direct, first_direct));
305last_to_1 = first_direct ? from_1 +
len: from_1;
307 else if(!present_1 && present_2) {
310last_to_1, from_2,
len, direct, first_direct));
312 else if(present_1) {
314last_to_1 = first_direct ? from_1 +
len: from_1;
333 intguessed_width_1 = 0;
334 intguessed_width_2 = 0;
337 boolglobal_first_direct =
true;
340 if( !loc[row_1]->GetTotalRange().
Empty() ) {
341global_first_direct = !loc[row_1]->IsReverseStrand();
357 boolfirst_direct = !loc[row_1]->IsReverseStrand();
358 booldirect = first_direct != loc[row_2]->IsReverseStrand();
360 if(len_1 > 0 && len_2 > 0) {
362last_to_1 = first_direct ? rng_1.
GetFrom() + len_1 : rng_1.
GetFrom();
374 boolrow_1_is_protein = prot_to_nuc_diff < nuc_to_nuc_diff;
375 boolrow_2_is_protein = nuc_to_prot_diff < nuc_to_nuc_diff;
377 if(nuc_to_nuc_diff != 0) {
382guessed_width_1 = row_1_is_protein ? 3 : 1;
383guessed_width_2 = row_2_is_protein ? 3 : 1;
388 if(!row_1_is_protein && !row_2_is_protein) {
391 if(len_1 != len_2) {
395pairwise_aln.
insert(aln_rng);
401direct, first_direct));
404pairwise_aln.
insert(aln_rng);
406}
else if(row_2_is_protein) {
409 if(len_1 / 3 < len_2) {
413pairwise_aln.
insert(aln_rng);
419direct, first_direct));
422pairwise_aln.
insert(aln_rng);
427 if(len_2 / 3 < len_1) {
431pairwise_aln.
insert(aln_rng);
437direct, first_direct));
440pairwise_aln.
insert(aln_rng);
445 else if(len_2 > 0) {
453 if(guessed_width_1 == 0) {
456 if(guessed_width_2 == 0) {
459from_1 *= guessed_width_1;
460from_2 *= guessed_width_2;
461 len*= guessed_width_2;
462 boolgap_direct = global_first_direct != loc[row_2]->IsReverseStrand();
464from_1, from_2,
len, gap_direct, global_first_direct));
466 else if(len_1 > 0) {
467last_to_1 = first_direct ? rng_1.
GetFrom() + len_1 : rng_1.
GetFrom();
498 boolfirst_direct =
true;
502direct = first_direct != minus_2;
513 if(mixed || base_width_1 > 1) {
518 if(base_width_1 > 1) {
519from_1 *= base_width_1;
521 if(base_width_2 > 1) {
522from_2 *= base_width_2;
529from_1, from_2,
len, direct, first_direct));
553 boolfirst_row =
true;
555TAlnRngColl curr_row;
562starts_1[seg], starts_1[seg], lens[seg]);
564pairwise_aln.
insert(aln_rng);
566curr_row.insert(aln_rng);
574 ITERATE(TAlnRngColl, aln_rng_it, diff) {
575pairwise_aln.
insert(*aln_rng_it);
591 for(seg = 0; seg < sa.
GetNumseg(); seg++) {
593starts_1[seg], starts_2[seg], lens[seg],
594strands ? !
IsReverse((*strands)[seg]) :
true));
609 _ALNMGR_ASSERT((row_1 == 0 || row_1 == 1) && (row_2 == 0 || row_2 == 1));
624 "Product strands are not consistent.");
626 boolproduct_plus =
true;
637 "Genomic strands are not consistent.");
639 boolgenomic_plus =
true;
645 booldirect = product_plus == genomic_plus;
646 boolfirst_direct = row_1 == 0 ? product_plus : genomic_plus;
652 TSeqPosproduct_pos = product_plus ? product_start : product_end;
656 TSeqPosgenomic_pos = (genomic_plus ?
661 TSeqPosproduct_len = product_end - product_start + 1;
662 TSeqPosgenomic_len = genomic_end - genomic_start + 1;
667 TSeqPosstarts[] = { product_start, genomic_start };
668 if(row_1 == row_2 ||
674starts[row_1], starts[row_2], genomic_len,
675row_1 == row_2 ?
true: direct,
688 switch(chunk.
Which()) {
690product_len = genomic_len = chunk.
GetMatch();
693product_len = genomic_len = chunk.
GetDiag();
707 TSeqPosppos = product_plus ? product_pos : product_pos - product_len + 1;
708 TSeqPosgpos = genomic_plus ? genomic_pos : genomic_pos - genomic_len + 1;
709 if(row_1 == 0 && row_2 == 0) {
710 if(product_len != 0) {
713ppos, ppos, product_len,
true, first_direct));
714last_product_to = first_direct ? ppos + product_len : ppos;
716}
else if(row_1 == 1 && row_2 == 1) {
717 if(genomic_len != 0) {
720gpos, gpos, genomic_len,
true, first_direct));
721last_genomic_to = first_direct ? gpos + genomic_len : gpos;
724 if(product_len != 0 && product_len == genomic_len &&
732ppos, gpos, genomic_len, direct, first_direct));
733last_product_to = first_direct ? ppos + product_len : ppos;
734last_genomic_to = direct ? gpos + genomic_len : gpos;
737gpos, ppos, genomic_len, direct, first_direct));
738last_product_to = direct ? ppos + product_len : ppos;
739last_genomic_to = first_direct ? gpos + genomic_len : gpos;
745 if(product_len == 0 && genomic_len != 0) {
747last_product_to, gpos, genomic_len,
748direct, first_direct));
750 else if(product_len != 0 && genomic_len == 0) {
752last_product_to += product_len;
755last_product_to -= product_len;
759 else if(row_1 == 1) {
760 if(genomic_len == 0 && product_len != 0) {
762last_genomic_to, ppos, product_len,
763direct, first_direct));
765 else if(genomic_len != 0 && product_len == 0) {
767last_genomic_to += genomic_len;
770last_genomic_to -= genomic_len;
777product_pos += product_len;
779product_pos -= product_len;
782genomic_pos += genomic_len;
784genomic_pos -= genomic_len;
794 constobjects::CSeq_loc& loc_1,
795 constobjects::CSeq_loc& loc_2,
805loc_1.IsReverseStrand() == loc_2.IsReverseStrand();
822 if(wid1 == 3 || wid2 == 3) {
849start1 += len1 -
len;
853start2 += len2 -
len;
870lshift1 = rshift1 = 0;
874lshift2 = rshift2 = 0;
888 if(best_it != syn_map.
end()) {
889 returnbest_it->second;
905 intscore = it->GetSeqId()->BestRankScore();
906 if(score < best_score) {
912syn_map[*it] = best_id;
918<<
" instead of GI "<< gi);
935 if(src_idh != id_it->first) {
939src_id->SetBaseWidth(mapper.GetWidthById(src_idh));
945 if(dst_idh == src_idh) {
950 if(aln_it == aln_map.
end()) {
952dst_id->SetBaseWidth(mapper.GetWidthById(dst_idh));
954aln->SetUsingGenomic();
955aln_map[dst_idh] = aln;
956aligns.push_back(aln);
959aln = aln_it->second;
User-defined methods of the data storage class.
bool IsReverse(ENa_strand s)
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
void ConvertSparseToPairwiseAln(CPairwiseAln &pairwise_aln, const CSparse_seg &sparse_seg, CSeq_align::TDim row_1, CSeq_align::TDim row_2, CAlnUserOptions::EDirection direction, const TAlnSeqIdVec *ids)
void ConvertDendiagToPairwiseAln(CPairwiseAln &pairwise_aln, const CSeq_align::TSegs::TDendiag &dendiags, CSeq_align::TDim row_1, CSeq_align::TDim row_2, CAlnUserOptions::EDirection direction, const TAlnSeqIdVec *ids)
CRef< CPairwiseAln > CreatePairwiseAlnFromSeqAlign(const CSeq_align &sa)
void ConvertSplicedToPairwiseAln(CPairwiseAln &pairwise_aln, const CSpliced_seg &spliced_seg, CSeq_align::TDim row_1, CSeq_align::TDim row_2, CAlnUserOptions::EDirection direction, const TAlnSeqIdVec *ids)
void ConvertSeqLocsToPairwiseAln(CPairwiseAln &aln, const objects::CSeq_loc &loc_1, const objects::CSeq_loc &loc_2, CAlnUserOptions::EDirection direction)
Build pairwise alignment from a pair of seq-locs.
map< CSeq_id_Handle, CRef< CPairwiseAln > > TAlnMap
void SeqLocMapperToPairwiseAligns(const objects::CSeq_loc_Mapper_Base &mapper, TPairwiseAlnList &aligns)
Build a list of pairwise alignments from a seq-loc mapper's mappings.
void ConvertDensegToPairwiseAln(CPairwiseAln &pairwise_aln, const CDense_seg &ds, CSeq_align::TDim row_1, CSeq_align::TDim row_2, CAlnUserOptions::EDirection direction, const TAlnSeqIdVec *ids)
void ConvertPackedsegToPairwiseAln(CPairwiseAln &pairwise_aln, const CPacked_seg &ps, CSeq_align::TDim row_1, CSeq_align::TDim row_2, CAlnUserOptions::EDirection direction, const TAlnSeqIdVec *ids)
void ConvertSeqAlignToPairwiseAln(CPairwiseAln &pairwise_aln, const CSeq_align &sa, CSeq_align::TDim row_1, CSeq_align::TDim row_2, CAlnUserOptions::EDirection direction, const TAlnSeqIdVec *ids)
void ConvertStdsegToPairwiseAln(CPairwiseAln &pairwise_aln, const CSeq_align::TSegs::TStd &stds, CSeq_align::TDim row_1, CSeq_align::TDim row_2, CAlnUserOptions::EDirection direction, const TAlnSeqIdVec *ids)
CSeq_id_Handle s_GetBestSynonym(const CSeq_id_Handle &idh, TSynonymsMap &syn_map, const CSeq_loc_Mapper_Base &mapper)
static bool IsMixedAlignment(const TAlnSeqIdVec *ids)
map< CSeq_id_Handle, CSeq_id_Handle > TSynonymsMap
list< CRef< CPairwiseAln > > TPairwiseAlnList
vector< TAlnSeqIdIRef > TAlnSeqIdVec
void SubtractAlnRngCollections(const CAlignRangeCollectionList< TAlnRng > &minuend, const CAlignRangeCollectionList< TAlnRng > &subtrahend, CAlignRangeCollectionList< TAlnRng > &difference)
Subtract one range collection from another.
#define _ALNMGR_ASSERT(expr)
class CAlignRangeCollectionList<TAlignRange> represent a sorted collection of TAlignRange.
const_iterator insert(const TAlignRange &r)
void AddInsertion(const TAlignRange &r)
CAlignRange Represents an element of pairwise alignment of two sequences.
Default IAlnSeqId implementation based on CSeq_id_Handle.
EDirection
Row direction flags.
@ eBothDirections
No filtering: use both direct and reverse sequences.
@ eDirect
Use only sequences whose strand is the same as that of the anchor.
@ eReverse
Use only sequences whose strand is opposite to that of the anchor.
CMappingRange - describes a single interval to interval mapping.
Storage for multiple mapping ranges.
A pairwise aln is a collection of ranges for a pair of rows.
int GetSecondBaseWidth(void) const
Base width of the second row.
const TAlnSeqIdIRef & GetFirstId(void) const
Get first sequence id.
int GetFirstBaseWidth(void) const
Base width of the first row.
void SetUsingGenomic(void)
Tell the pairwise alignment that the coordinates are already tranlated to genomic.
const TAlnSeqIdIRef & GetSecondId(void) const
Get second sequence id.
TDim CheckNumRows(void) const
Validatiors.
const CSeq_id & GetSeq_id(TDim row) const
Get seq-id (the first one if segments have different ids).
Seq-loc iterator class â iterates all intervals from a seq-loc in the correct order.
CSeq_loc_Mapper_Base â.
TDim CheckNumRows(void) const
container_type::const_iterator const_iterator
container_type::iterator iterator
const_iterator end() const
const_iterator find(const key_type &key) const
bool Empty(const CNcbiOstrstream &src)
unsigned int TSeqPos
Type for sequence locations and lengths.
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
int TSignedSeqPos
Type for signed sequence position.
#define ERR_POST(message)
Error posting with file, line number information but without error codes.
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
CConstRef< CSeq_id > GetSeqId(void) const
int BestRankScore(void) const
const CTextseq_id * GetTextseq_Id(void) const
Return embedded CTextseq_id, if any.
bool IsEmpty(void) const
True if the current location is empty.
TRange GetRange(void) const
Get the range.
ENa_strand GetStrand(void) const
const CSeq_id_Handle & GetDstIdHandle(void) const
const TIdMap & GetIdMap() const
TSeqPos GetLength(void) const
const CSeq_id_Handle & CollectSynonyms(const CSeq_id_Handle &id) const
TSeqPos GetDst_from(void) const
bool GetReverse(void) const
TSeqPos GetSrc_from(void) const
CRef< C > Ref(C *object)
Helper functions to get CRef<> and CConstRef<> objects.
position_type GetLength(void) const
position_type GetFirstToOpen(void) const
TThisType & SetLength(position_type len)
TThisType & SetSecondFrom(position_type second_from)
void SetDirect(bool direct=true)
TThisType & SetFirstFrom(position_type from)
void SetFirstDirect(bool direct=true)
position_type GetSecondToOpen(void) const
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
TFrom GetFrom(void) const
Get the From member data.
vector< TSeqPos > TStarts
vector< CRef< CSeq_loc > > TLoc
vector< ENa_strand > TStrands
vector< CRef< CSparse_align > > TRows
list< CRef< CStd_seg > > TStd
TMatch GetMatch(void) const
Get the variant data.
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.
const TStarts & GetStarts(void) const
Get the Starts member data.
TGenomic_start GetGenomic_start(void) const
Get the Genomic_start member data.
vector< ENa_strand > TStrands
const TLens & GetLens(void) const
Get the Lens member data.
TDiag GetDiag(void) const
Get the variant data.
TNumseg GetNumseg(void) const
Get the Numseg member data.
TLen GetLen(void) const
Get the Len member data.
vector< TSignedSeqPos > TStarts
TProduct_type GetProduct_type(void) const
Get the Product_type member data.
TMismatch GetMismatch(void) const
Get the variant data.
TGenomic_strand GetGenomic_strand(void) const
Get the Genomic_strand member data.
bool IsSetStrands(void) const
Check if a value has been assigned to Strands data member.
bool CanGetProduct_strand(void) const
Check if it is safe to call GetProduct_strand method.
const TParts & GetParts(void) const
Get the Parts member data.
const TProduct_start & GetProduct_start(void) const
Get the Product_start member data.
TDim GetDim(void) const
Get the Dim member data.
const TProduct_end & GetProduct_end(void) const
Get the Product_end member data.
TDim GetDim(void) const
Get the Dim member data.
const TLens & GetLens(void) const
Get the Lens member data.
const TSecond_starts & GetSecond_starts(void) const
Get the Second_starts member data.
bool CanGetGenomic_strand(void) const
Check if it is safe to call GetGenomic_strand method.
TGenomic_ins GetGenomic_ins(void) const
Get the variant data.
const TLens & GetLens(void) const
Get the Lens member data.
list< CRef< CSpliced_exon > > TExons
const TExons & GetExons(void) const
Get the Exons 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.
TGenomic_strand GetGenomic_strand(void) const
Get the Genomic_strand member data.
bool IsSetStrands(void) const
Check if a value has been assigned to Strands data member.
const TPresent & GetPresent(void) const
Get the Present member data.
TNumseg GetNumseg(void) const
Get the Numseg member data.
TProduct_strand GetProduct_strand(void) const
Get the Product_strand member data.
const TStrands & GetStrands(void) const
Get the Strands member data.
const TStrands & GetStrands(void) const
Get the Strands member data.
const TSecond_strands & GetSecond_strands(void) const
Get the Second_strands member data.
list< CRef< CSpliced_exon_chunk > > TParts
vector< int > TFirst_starts
bool CanGetProduct_strand(void) const
Check if it is safe to call GetProduct_strand method.
TGenomic_end GetGenomic_end(void) const
Get the Genomic_end member data.
const TStarts & GetStarts(void) const
Get the Starts member data.
TNumseg GetNumseg(void) const
Get the Numseg member data.
TProduct_strand GetProduct_strand(void) const
Get the Product_strand member data.
list< CRef< CSeq_align > > Tdata
TDim GetDim(void) const
Get the Dim member data.
const TRows & GetRows(void) const
Get the Rows member data.
TProduct_ins GetProduct_ins(void) const
Get the variant data.
vector< ENa_strand > TSecond_strands
list< CRef< CDense_diag > > TDendiag
const TStrands & GetStrands(void) const
Get the Strands member data.
const TSegs & GetSegs(void) const
Get the Segs member data.
bool CanGetGenomic_strand(void) const
Check if it is safe to call GetGenomic_strand method.
E_Choice Which(void) const
Which variant is currently selected.
@ e_Product_ins
insertion in product sequence (i.e. gap in the genomic sequence)
@ e_Diag
both sequences are represented, there is sufficient similarity between product and genomic sequences....
@ e_Genomic_ins
insertion in genomic sequence (i.e. gap in the product sequence)
@ e_Match
both sequences represented, product and genomic sequences match
@ e_Mismatch
both sequences represented, product and genomic sequences do not match
@ e_not_set
No variant selected.
bool IsSetVersion(void) const
Check if a value has been assigned to Version data member.
const TAccession & GetAccession(void) const
Get the Accession member data.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4