95 TDim seg_numrows = (*std_i)->CheckNumRows();
97 if ( seg_numrows != numrows ) {
99 "CSeq_align::CheckNumRows(): Number of rows "
100 "is not the same for each disc seg.");
103 numrows = seg_numrows;
113 TDim seg_numrows = (*std_i)->CheckNumRows();
115 if (seg_numrows != numrows) {
117 "CSeq_align::CheckNumRows(): Number of rows "
118 "is not the same for each std seg.");
121 numrows = seg_numrows;
131 TDim seg_numrows = (*it)->CheckNumRows();
133 if ( seg_numrows != numrows ) {
135 "CSeq_align::CheckNumRows(): Number of rows "
136 "is not the same for each dendiag seg.");
139 numrows = seg_numrows;
147 "CSeq_align::CheckNumRows() currently does not handle "
148 "this type of alignment");
180 if (row_i++ ==
row) {
188 "CSeq_align::GetSeqRange():"
189 " Row seqids not consistent."
190 " Cannot determine range.");
196 }
else if (loc.
IsPnt()) {
203 "CSeq_align::GetSeqRange():"
204 " Row seqids not consistent."
205 " Cannot determine range.");
214 if (row < 0 || row >= row_i) {
216 "CSeq_align::GetSeqRange():"
217 " Invalid row number");
221 "CSeq_align::GetSeqRange():"
222 " loc.size is inconsistent with dim");
228 "CSeq_align::GetSeqRange(): Row is empty");
247 "CSeq_align::GetSeqRange() currently does not handle "
248 "this type of alignment.");
267 "CSeq_align::GetSeqStart() currently does not handle "
268 "this type of alignment.");
288 "CSeq_align::GetSeqStop() currently does not handle "
289 "this type of alignment.");
311 "CSeq_align::GetSeqStrand() currently does not handle "
312 "this type of alignment.");
331 if( (*seg)->IsSetIds() &&
332 (
size_t)
row < (*seg)->GetIds().size() ) {
333 return *(*seg)->GetIds()[
row];
344 if ( (*seg)->IsSetIds() &&
345 (
size_t)
row < (*seg)->GetIds().size()) {
346 return *((*seg)->GetIds()[
row]);
348 else if ( (*seg)->IsSetLoc() &&
349 (size_t)
row < (*seg)->GetLoc().size() ) {
366 const CSeq_id& rv = (*sub_aln)->GetSeq_id(
row);
382 if (
row == 0 && spliced_seg.IsSetProduct_id()) {
384 }
else if (
row == 1 && spliced_seg.IsSetGenomic_id()) {
385 return spliced_seg.GetGenomic_id();
392 "CSeq_align::GetSeq_id() currently does not handle "
393 "this type of alignment.");
397 "CSeq_align::GetSeq_id(): "
398 "can not get seq-id for the row requested.");
433 "Blast-style bit score",
434 "Blast-style e-value",
435 "Length of the aligned segments, including the length of all gap segments",
436 "Count of identities",
437 "Count of positives; protein-to-DNA score",
438 "Count of negatives; protein-to-DNA score",
439 "Count of mismatches",
440 "Number of gaps in the alignment",
441 "Percent identity (0.0-100.0); count each base in a gap in any row as a mismatch",
442 "Percent identity (0.0-100.0); don't count gaps",
443 "Percent identity (0.0-100.0); count a gap of any length in any row as a mismatch of length 1",
444 "Percentage of query sequence aligned to subject (0.0-100.0)",
446 "Composition-adjustment method from BLAST",
447 "Percent coverage (0.0-100.0) of high quality region",
448 "Count of identities",
449 "Percent identity; count gaps within exons and introns on product",
450 "Number of splices; 2 x number of introns that have no gap on product",
451 "Number of splices with consensus splice sequence",
452 "Percentage of query sequence aligned to subject (0.0-100.0)",
453 "Percent identity; count gaps within exons only"
489 if (m_ScoreNameMap.
empty()) {
499 return m_ScoreNameMap;
525 if ((*iter)->IsSetId() && (*iter)->GetId().IsStr() &&
526 (*iter)->GetId().GetStr() == name) {
542 if ((*iter)->IsSetId() && (*iter)->GetId().IsStr() &&
543 (*iter)->GetId().GetStr() == name) {
552 score->SetId().SetStr(name);
567 if (ref->GetValue().IsInt()) {
568 score = ref->GetValue().GetInt();
570 score = (
int)ref->GetValue().GetReal();
584 if (ref->GetValue().IsInt()) {
585 score = (double)ref->GetValue().GetInt();
587 score = ref->GetValue().GetReal();
610 if ((*iter)->IsSetId() && (*iter)->GetId().IsStr() &&
611 (*iter)->GetId().GetStr() == name) {
627 ref->SetValue().SetInt(score);
633 ref->SetValue().SetReal(score);
639 ref->SetValue().SetInt(score);
645 ref->SetValue().SetReal(score);
654 (*dendiag_it)->Validate();
662 (*seq_align_it)->Validate(full_test);
676 "CSeq_align::Validate() currently does not handle "
677 "this type of alignment");
693 "CSeq_align::Reverse() currently only handles dense-seg "
710 (*it)->SwapRows(row1, row2);
719 "CSeq_align::SwapRows currently only handles dense-seg "
732 "CSeq_align::CreateDensegFromStdseg(): "
733 "Input Seq-align should have segs of type StdSeg!");
746 vector<TSeqPos> row_lens;
751 vector<bool> widths_determined;
759 TNumrow dim = 0,
row = 0;
764 seg_lens.push_back(0);
765 TSeqPos& seg_len = seg_lens.back();
767 widths_determined.push_back(
false);
784 to = interval.
GetTo();
785 starts.push_back(from);
786 row_len = to - from + 1;
787 row_lens.push_back(row_len);
795 if (row_len * 3 == seg_len) {
798 }
else if (row_len / 3 == seg_len) {
800 }
else if (row_len != seg_len) {
802 "CreateDensegFromStdseg(): "
803 "Std-seg segment lengths not accurate!");
807 widths_determined[seg] =
true;
808 if (widths[
row] > 0 && widths[
row] != width) {
810 "CreateDensegFromStdseg(): "
811 "Std-seg segment lengths not accurate!");
818 seq_id = &(*i)->GetInt().GetId();
824 strands[
row] = strand;
826 if (strands[
row] != strand) {
828 eInvalidInputAlignment,
829 "CreateDensegFromStdseg(): "
830 "Inconsistent strands!");
834 }
else if ((*i)->IsEmpty()) {
835 starts.push_back(-1);
839 seq_id = &(*i)->GetEmpty();
840 row_lens.push_back(0);
847 ds.
SetIds().push_back(
id);
855 string(
"CreateDensegFromStdseg(): Seq-ids: ") +
856 id.AsFastaString() +
" and " +
858 " Without the OM it cannot be determined if they belong to"
859 " the same sequence."
860 " Define and pass ChooseSeqId to resolve seq-ids.";
874 "CreateDensegFromStdseg(): "
875 "Inconsistent dimentions!");
878 if (widths_determined[seg]) {
881 if ((row_len = row_lens[
row]) > 0) {
883 if (row_len == seg_len * 3) {
885 }
else if (row_len == seg_len) {
888 if (widths[
row] > 0 && widths[
row] != width) {
890 "CreateDensegFromStdseg(): "
891 "Std-seg segment lengths not accurate!");
907 bool widths_failure =
false;
908 bool widths_success =
false;
909 for (seg = 0; seg < ds.
GetNumseg(); seg++) {
910 if (!widths_determined[seg]) {
912 if (starts[seg * dim +
row] >= 0) {
913 int width = widths[
row];
916 }
else if (width == 0) {
917 widths_failure =
true;
923 widths_success =
true;
927 if (widths_failure) {
928 if (widths_success) {
930 "CreateDensegFromStdseg(): "
931 "Some widths cannot be determined!");
938 for (seg = 1; seg < ds.
GetNumseg(); seg++) {
940 strands.push_back(strands[
row]);
957 "CSeq_align::CreateTranslatedDensegFromNADenseg(): "
958 "Input Seq-align should have segs of type Dense-seg!");
964 if (
GetSegs().GetDenseg().IsSetWidths()) {
966 "CSeq_align::CreateTranslatedDensegFromNADenseg(): "
967 "Widths already exist for the original alignment");
980 if (orig_lens[numseg] % 3) {
982 string(
"CSeq_align::CreateTranslatedDensegFromNADenseg(): ") +
984 " is not divisible by 3.";
987 lens[numseg] = orig_lens[numseg] / 3;
1004 template <
typename T,
typename Pred = less<TSeqPos> >
1007 return m_Pred(x.first, y.first);
1019 "CSeq_align::CreateDensegFromDisc(): "
1020 "Input Seq-align should have segs of type StdSeg!");
1036 typedef pair<TSeqPos, const CDense_seg *> TPosDsPair;
1037 typedef vector<TPosDsPair> TDsVec;
1042 const CDense_seg& ds = (*sa_i)->GetSegs().GetDenseg();
1043 ds_vec.push_back(make_pair<TSeqPos, const CDense_seg *>(ds.
GetSeqStart(0), &ds));
1051 "CreateDensegFromDisc(): "
1052 "Inconsistent strands!");
1058 sort(ds_vec.begin(), ds_vec.end(),
1061 sort(ds_vec.begin(), ds_vec.end(),
1062 ds_cmp<TPosDsPair, greater<TSeqPos> >());
1068 ITERATE(TDsVec, ds_i, ds_vec) {
1075 if ( !new_ds.
GetDim() ) {
1079 "CreateDensegFromDisc(): "
1080 "All disc dense-segs need to have the same dimension!");
1085 if (single_segment_strands.empty()) {
1086 single_segment_strands.assign(ds.
GetStrands().begin(),
1089 if ( !equal(single_segment_strands.begin(),
1090 single_segment_strands.end(),
1093 "CreateDensegFromDisc(): "
1094 "All disc dense-segs need to have the same strands!");
1102 if ( !single_segment_strands.empty() ) {
1109 single_segment_strands.begin(),
1110 single_segment_strands.begin() + new_ds.
GetDim());
1118 int new_starts_i = 0;
1120 ITERATE(TDsVec, ds_i, ds_vec) {
1127 if (new_ds.
GetIds().empty()) {
1146 string(
"CreateDensegFromDisc(): Seq-ids: ") +
1148 id.AsFastaString() +
" are not identical!" +
1149 " Without the OM it cannot be determined if they belong to"
1150 " the same sequence."
1151 " Define and pass ChooseSeqId to resolve seq-ids.";
1169 ++starts_i, ++new_starts_i, ++
row) {
1189 return max(range1,range2).GetFrom() -
min(range1,range2).GetTo();
1195 if (aligns.
Get().size() == 1) {
1196 return aligns.
Get().front();
1203 align->
SetSegs().SetDisc().Set() = aligns.
Get();
1218 TSeqPos discontinuity_threshold)
const
1222 "SplitOnLongDiscontinuity() only implemented for pairwise alignments");
1225 size_t num_splits = 0;
1235 for ( ; curr_seg < seg.
GetNumseg(); ++curr_seg) {
1238 if (p0_curr < 0 || p1_curr < 0) {
1246 curr_range0 =
TSeqRange(p0_curr, p0_curr+curr_seg_len);
1247 curr_range1 =
TSeqRange(p1_curr, p1_curr+curr_seg_len);
1249 if (prev_range0.
Empty()) {
1255 (
s_Distance(curr_range0, prev_range0) > discontinuity_threshold ||
1256 s_Distance(curr_range1, prev_range1) > discontinuity_threshold))
1260 last_seg = curr_seg;
1280 curr_range0 = (*seg_it)->GetSeqRange(0);
1281 curr_range1 = (*seg_it)->GetSeqRange(1);
1282 list< CRef<CSeq_align> > seg_splits;
1283 (*seg_it)->SplitOnLongDiscontinuity(seg_splits,
1284 discontinuity_threshold);
1286 if (prev_range0.
Empty() ||
1287 (
s_Distance(curr_range0, prev_range0) <= discontinuity_threshold &&
1288 s_Distance(curr_range1, prev_range1) <= discontinuity_threshold))
1293 curr_disc.
Set().push_back(seg_splits.front());
1294 seg_splits.pop_front();
1295 if (seg_splits.empty()) {
1307 num_splits += seg_splits.size();
1308 curr_disc.
Set().clear();
1309 curr_disc.
Set().push_back(seg_splits.back());
1310 seg_splits.pop_back();
1312 aligns.splice(aligns.end(), seg_splits);
1353 (*seq_align_it)->OffsetRow(
row,
offset);
1358 "CSeq_align::OffsetRow() currently does not handle "
1359 "this type of alignment");
1370 switch (dst_loc.
Which()) {
1377 "CSeq_align::RemapToLoc only supports int target seq-locs");
1386 (*std_it)->RemapToLoc(
row, dst_loc, ignore_strand);
1391 (*seq_align_it)->RemapToLoc(
row, dst_loc, ignore_strand);
1396 "CSeq_align::RemapToLoc only supports Dense-seg and Std-seg alignments.");
1407 copy->Assign(align);
1413 "Location with multiple ids can not be used to "
1414 "remap seq-aligns.");
1417 id->Assign(*orig_id);
1422 if ( it.IsWhole() ) {
1424 "Whole seq-loc can not be used to "
1425 "remap seq-aligns.");
1427 len += it.GetRange().GetLength();
1435 return mapper.
Map(align,
row);
1444 length += it->IntersectionWith(
range).GetLength();
1457 bool get_total_count)
1459 if (ranges.
empty()) {
1469 bool is_gapped =
false;
1480 if (!ranges.
begin()->IsWhole()) {
1482 if (gap_start >= 0) {
1484 TSeqRange(gap_start, gap_start + gap_len - 1));
1495 retval += (get_total_count ? gap_len : (gap_len ? 1 : 0));
1516 (*iter)->GetRowSeq_insertions(
1519 : insertions.
size();
1527 if (
row < 0 && !get_total_count && ranges.
begin()->IsWhole()) {
1543 "CSeq_align::GetGapCount() currently does not handle "
1544 "this type of alignment.");
1591 + (
row == 0 ?
'I' :
'D')
1595 static vector<CSeq_align::SIndel>
1598 bool include_frameshifts,
bool include_non_frameshifts)
1600 vector<CSeq_align::SIndel>
results;
1601 if (ranges.
empty()) {
1629 ? after_origin : before_origin)
1632 vector<CSeq_align::SIndel> before_origin_frameshifts =
1633 s_GetIndels(before_origin,
row, ranges, include_frameshifts, include_non_frameshifts),
1634 after_origin_frameshifts =
1635 s_GetIndels(after_origin,
row, ranges, include_frameshifts, include_non_frameshifts);
1636 results = before_origin_frameshifts;
1638 after_origin_frameshifts.end());
1647 "CSeq_align::GetNumFrameshifts() currently does not handle "
1648 "this type of alignment.");
1651 if (generated_denseg) {
1652 generated_denseg->
SetSegs().SetDenseg().OrderAdjacentGaps();
1653 generated_denseg->
SetSegs().SetDenseg().Compact();
1654 generated_denseg->
SetSegs().SetDenseg().RemovePureGapSegs();
1657 const CDense_seg &ds = (generated_denseg ? *generated_denseg : align)
1661 bool is_gapped =
false;
1671 if (!ranges.
begin()->IsWhole()) {
1673 if (gap_start >= 0) {
1675 TSeqRange(gap_start, gap_start + gap_len - 1));
1687 ((include_frameshifts && gap_len % 3 != 0) ||
1688 (include_non_frameshifts && gap_len % 3 == 0)))
1693 if (product_gap_start < 0) {
1804 bool is_gapped =
false;
1824 ranges += (*iter)->GetAlignedBases(
row);
1832 ranges += (*iter)->GetRowSeq_range(
row,
true);
1833 ranges -= (*iter)->GetRowSeq_insertions(
row,
GetSegs().GetSpliced());
1840 "CSeq_align::GetInsertedRanges() currently does not handle "
1841 "this type of alignment.");
1853 if(ranges.
begin()->IsWhole())
1869 if (ranges.
empty()) {
1880 bool is_gap_seg =
false;
1882 !is_gap_seg && j < ds.
GetDim(); ++j) {
1888 if ( !is_gap_seg ) {
1910 if(!ranges.
begin()->IsWhole())
1912 "Can't calculate alignment length within a range "
1913 "for standard seg representation");
1917 vector<TSeqPos> sizes;
1922 bool is_gap =
false;
1924 if ((*it)->IsEmpty()) {
1930 if ( !ungapped || !is_gap) {
1933 if ( !(*it)->IsEmpty() ) {
1934 if (sizes.empty()) {
1935 sizes.resize(seg.
GetDim(), 0);
1936 }
else if (sizes.size() != (
size_t)seg.
GetDim()) {
1939 "inconsistent number of locs");
1942 for (
CSeq_loc_CI loc_it(**it); loc_it; ++loc_it) {
1943 sizes[
i] += loc_it.GetRange().GetLength();
1953 if ( sizes.empty() )
return 0;
1954 vector<TSeqPos>::iterator iter = sizes.begin();
1955 vector<TSeqPos>::iterator smallest = iter;
1956 for (++iter; iter != sizes.end(); ++iter) {
1957 if (*iter < *smallest) {
1969 exon_ranges &= (*iter)->GetRowSeq_range(0,
true);
1972 len -= (*iter)->GetRowSeq_insertions(
1978 len += (*iter)->GetRowSeq_insertions(
2002 bool include_gaps)
const
2011 bool include_gaps)
const
2021 if (
r0.GetLength()) {
2022 r = double(
r1.GetLength()) / double(
r0.GetLength());
2036 (*it)->CreateRowSeq_interval(
row));
2050 loc->
SetMix().Set().push_back(
2051 (*it)->CreateRowSeq_loc(
row));
2058 loc->
SetMix().Set().push_back((*it)->CreateRowSeq_loc(
row));
2066 "CSeq_align::CreateRowSeq_loc() - row number must "
2067 "be 0 or 1 for spliced-segs.");
2074 (*ex)->CreateRowSeq_interval(
row, spl));
2082 "CSeq_align::CreateRowSeq_loc() currently does not handle "
2083 "this type of alignment.");
2094 if (
range.first > length) {
2095 range.first = length;
2097 if (
range.second < length) {
2098 range.second = length;
2103 if (
range.first > new_range.first) {
2104 range.first = new_range.first;
2106 if (
range.second < new_range.second) {
2107 range.second = new_range.second;
2122 bool is_gapped =
false;
2139 vector<TSeqRange> last_seg_ranges;
2142 length_range.
AddRange((*iter)->GapLengthRange());
2143 vector<TSeqRange> seg_ranges;
2144 for (
int i=0;
i < num_rows;
i++) {
2145 seg_ranges.push_back((*iter)->GetSeqRange(
i));
2148 if (!last_seg_ranges.empty()) {
2155 last_seg_ranges = seg_ranges;
2163 GetSegs().GetSpliced().GetExons()) {
2165 for (
unsigned r = 0;
r < 2; ++
r) {
2171 length_range.
AddLength(ins_it->GetLength());
2181 "Can't get gap lengths for this type of alignment.");
2183 return length_range.
range;
2190 "Requested exon lengths for a non-spliced alignment.");
2196 GetSegs().GetSpliced().GetExons()) {
2198 if (previous_exon) {
2201 if (descending_pos != minus_strand) {
2205 TSeqRange intron((minus_strand ? exon : previous_exon)->GetGenomic_end() + 1,
2206 (minus_strand ? previous_exon : exon)->GetGenomic_start() - 1);
2209 previous_exon = exon;
2211 return length_range.
range;
2218 "Requested exon lengths for a non-spliced alignment.");
2222 GetSegs().GetSpliced().GetExons()) {
2227 return length_range.
range;
2250 for (
i = from;
i <= to; ++
i) {
2279 const CObject_id& obj_type = (*it)->GetType();
2280 if ( obj_type.
IsStr() && obj_type.
GetStr() == ext_type ) {
2281 ret.
Reset(it->GetPointer());
2294 const CObject_id& obj_type = (*it)->GetType();
2295 if ( obj_type.
IsStr() && obj_type.
GetStr() == ext_type ) {
2296 ret.
Reset(it->GetPointer());
User-defined methods of the data storage class.
bool IsReverse(ENa_strand s)
User-defined methods of the data storage class.
static const bool sc_IsInteger[]
static TSeqPos s_Distance(const TSeqRange &range1, const TSeqRange &range2)
static vector< CSeq_align::SIndel > s_GetIndels(const CSeq_align &align, CSeq_align::TDim row, const CRangeCollection< TSeqPos > &ranges, bool include_frameshifts, bool include_non_frameshifts)
static const TScoreNamePair sc_ScoreNames[]
static TSeqPos s_GetGapCount(const CSeq_align &align, CSeq_align::TDim row, const CRangeCollection< TSeqPos > &ranges, bool get_total_count)
Retrieves the number of gaps in an alignment.
CRef< CSeq_align > RemapAlignToLoc(const CSeq_align &align, CSeq_align::TDim row, const CSeq_loc &loc)
Remap seq-align row to the seq-loc.
static const char *const sc_ScoreHelpText[]
static CRef< CSeq_align > s_GetJoinedAlignment(const CSeq_align_set &aligns)
Join the alignments in the set into one alignment.
static TSeqPos s_IntersectionLength(const CRangeCollection< TSeqPos > &ranges, const TSeqRange &range)
Get length of intersection between a range and a range collection.
static TSeqPos s_DenseSegLength(const CDense_seg &ds, CDense_seg::TNumseg seg, const CRangeCollection< TSeqPos > &ranges)
Get length of dense-seg alignment within range.
static TSeqPos s_GetAlignmentLength(const CSeq_align &align, const CRangeCollection< TSeqPos > &ranges, bool ungapped)
calculate the length of our alignment within given range
SStaticPair< CSeq_align::EScoreType, const char * > TScoreNamePair
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.
Seq-loc and seq-align mapper exceptions.
void TrimEndGaps()
Trim leading/training gaps if possible.
const CSeq_id & GetSeq_id(TDim row) const
ENa_strand GetSeqStrand(TDim row) const
TSeqPos GetSeqStop(TDim row) const
void Reverse(void)
Reverse the segments' orientation.
void OffsetRow(TDim row, TSignedSeqPos offset)
Offset row's coords.
TWidths & SetWidths(void)
void SwapRows(TDim row1, TDim row2)
Swap two rows (changing *order*, not content)
TSeqPos GetSeqStart(TDim row) const
TDim CheckNumRows(void) const
CRange< TSeqPos > GetSeqRange(TDim row) const
void Validate(bool full_test=false) const
void RemapToLoc(TDim row, const CSeq_loc &loc, bool ignore_strand=false)
const_iterator begin() const
position_type GetCoveredLength(void) const
Returns total length covered by ranges in this collection, i.e.
void SwapRows(TDim row1, TDim row2)
Swap two rows (changing *order*, not content)
CRef< CSeq_align > CreateTranslatedDensegFromNADenseg(void) const
Create a Dense-seg with widths from Dense-seg of nucleotides Used by AlnMgr to handle translated nucl...
EScoreType
enum controlling known named scores
@ eScore_PercentIdentity_GapOpeningOnly
@ eScore_PercentIdentity_Gapped
@ eScore_ConsensusSplices
@ eScore_PercentIdentity_Ungapped
@ eScore_HighQualityPercentCoverage
CRef< CSeq_align > CreateDensegFromDisc(SSeqIdChooser *SeqIdChooser=0) const
CRef< CScore > x_SetNamedScore(const string &name)
TSeqPos GetNumGapOpeningsWithinRanges(const CRangeCollection< TSeqPos > &ranges, TDim row=-1) const
CRef< CSeq_align > CreateDensegFromStdseg(SSeqIdChooser *SeqIdChooser=0) const
---------------------------------------------------------------------------- PRE : the Seq-align has ...
CRef< CSeq_align > x_CreateSubsegAlignment(int from, int to) const
Create a partial alignment containing the specified range of segments.
TSeqPos GetTotalGapCount(TDim row=-1) const
Retrieves the total number of gaps in the given row an alignment; all gaps by default.
TLengthRange ExonLengthRange() const
vector< SIndel > GetIndelsWithinRanges(const CRangeCollection< TSeqPos > &ranges, TDim row=-1) const
void OffsetRow(TDim row, TSignedSeqPos offset)
Offset row's coords.
CRangeCollection< TSeqPos > GetAlignedBases(TDim row) const
Retrieves the locations of aligned bases in the given row, excluding gaps and incontinuities.
vector< SIndel > GetNonFrameshiftsWithinRange(const TSeqRange &range, TDim row=-1) const
void Reverse(void)
Reverse the segments' orientation NOTE: currently *only* works for dense-seg.
TSeqPos GetNumGapOpeningsWithinRange(const TSeqRange &range, TDim row=-1) const
TLengthRange IntronLengthRange() const
static string ScoreName(EScoreType score)
CRange< TSeqPos > GetSeqRange(TDim row) const
GetSeqRange NB: On a Spliced-seg, in case the product-type is protein, these only return the amin par...
static string HelpText(EScoreType score)
CConstRef< CScore > x_GetNamedScore(const string &name) const
retrieve a named score object
vector< SIndel > GetNonFrameshifts(TDim row=-1) const
Retrieves descriptions of all non-frameshift indels on a given row; i.e.
TSeqPos GetNumFrameshiftsWithinRanges(const CRangeCollection< TSeqPos > &ranges, TDim row=-1) const
TSeqPos GetSeqStop(TDim row) const
CRef< CSeq_loc > CreateRowSeq_loc(TDim row) const
void SetNamedScore(const string &id, int score)
TDim CheckNumRows(void) const
Validatiors.
void SwapRows(TDim row1, TDim row2)
Swap the position of two rows in the alignment NOTE: currently *only* works for dense-seg & disc.
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 GetTotalGapCountWithinRanges(const CRangeCollection< TSeqPos > &ranges, TDim row=-1) const
void ResetNamedScore(const string &name)
void RemapToLoc(TDim row, const CSeq_loc &dst_loc, bool ignore_strand=false)
TSeqPos GetAlignLengthWithinRange(const TSeqRange &range, bool include_gaps=true) const
Get the length of this alignment within a specified range By default, this function computes an align...
void SplitOnLongDiscontinuity(list< CRef< CSeq_align > > &aligns, TSeqPos discontinuity_threshold) const
Split the alignment at any discontinuity greater than threshold; populate aligns list with new alignm...
vector< SIndel > GetFrameshiftsWithinRange(const TSeqRange &range, TDim row=-1) const
double AlignLengthRatio() const
vector< SIndel > GetIndelsWithinRange(const TSeqRange &range, TDim row=-1) const
TSeqPos GetTotalGapCountWithinRange(const TSeqRange &range, TDim row=-1) const
TSeqPos GetSeqStart(TDim row) const
ENa_strand GetSeqStrand(TDim row) const
Get strand (the first one if segments have different strands).
TSeqPos GetAlignLength(bool include_gaps=true) const
Get the length of this alignment.
vector< SIndel > GetFrameshifts(TDim row=-1) const
Retrieves descriptions of all frameshifts on a given row; i.e.
vector< SIndel > GetNonFrameshiftsWithinRanges(const CRangeCollection< TSeqPos > &ranges, TDim row=-1) const
TSeqPos GetNumFrameshiftsWithinRange(const TSeqRange &range, TDim row=-1) const
vector< SIndel > GetIndels(TDim row=-1) const
Retrieves descriptions of all indels on a given row.
TSeqPos GetNumFrameshifts(TDim row=-1) const
Retrieves the number of times a given row shifts frames; i.e.
TSeqPos GetAlignLengthWithinRanges(const CRangeCollection< TSeqPos > &ranges, bool include_gaps=true) const
Get the length of this alignment within a specified range By default, this function computes an align...
~CSeq_align(void)
destructor
static const TScoreNameMap & ScoreNameMap()
vector< SIndel > GetFrameshiftsWithinRanges(const CRangeCollection< TSeqPos > &ranges, TDim row=-1) const
void Validate(bool full_test=false) const
TLengthRange GapLengthRange() const
CConstRef< CUser_object > FindExt(const string &ext_type) const
Find extension by type in ext container.
static bool IsIntegerScore(EScoreType score)
pair< TSeqPos, TSeqPos > TLengthRange
TSeqPos GetNumGapOpenings(TDim row=-1) const
Retrieves the number of gap openings in a given row in an alignment (ignoring how many gaps are in th...
Seq-loc iterator class – iterates all intervals from a seq-loc in the correct order.
CSeq_loc_Mapper_Base –.
ENa_strand GetSeqStrand(TDim row) const
CRange< TSeqPos > GetSeqRange(TDim row) const
TDim CheckNumRows(void) const
void Validate(bool full_test=false) const
Validators.
TSeqPos GetSeqStart(TDim row) const
const CSeq_id & GetSeq_id(TDim row) const
TSeqPos GetSeqStop(TDim row) const
CRangeCollection< TSeqPos > GetRowSeq_insertions(CSeq_align::TDim row, const CSpliced_seg &seg) const
Return insertions within exon.
TSeqPos GetSeqStop(TDim row) const
CRange< TSeqPos > GetSeqRange(TDim row) const
GetSeqRange NB: In case the product-type is protein, these only return the amin part of Prot-pos.
TSeqPos GetSeqStart(TDim row) const
void Validate(bool full_test=false) const
Validators.
ENa_strand GetSeqStrand(TDim row) const
Get strand (the first one if segments have different strands).
CRef< CSeq_align > AsDiscSeg() const
Convert this alignment to a discontinuous segment.
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 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.
bool SerialEquals(const C &object1, const C &object2, ESerialRecursionMode how=eRecursive)
Compare serial objects.
C & SerialAssign(C &dest, const C &src, ESerialRecursionMode how=eRecursive)
Set object to copy of another one.
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Set object to copy of another one.
#define MSerial_AsnText
I/O stream manipulators –.
const string AsFastaString(void) const
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.
void SetPacked_int(TPacked_int &v)
ENa_strand GetStrand(void) const
Get the location's strand.
const CSeq_id * GetId(void) const
Get the id of the location return NULL if has multiple ids or no id at all.
void SetStrand(ENa_strand strand)
Set the strand for all of the location's ranges.
CRef< CSeq_loc > Map(const CSeq_loc &src_loc)
Map seq-loc.
void Reset(void)
Reset reference object.
void Reset(void)
Reset reference object.
#define numeric_limits
Pre-declaration of the "numeric_limits<>" template Forcibly overrides (using preprocessor) the origin...
position_type GetLength(void) const
bool NotEmpty(void) const
bool IntersectingWith(const TThisType &r) const
TThisType & CombineWith(const TThisType &r)
CRange< TSeqPos > TSeqRange
typedefs for sequence ranges
static TThisType GetWhole(void)
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static string IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
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.
#define DEFINE_STATIC_FAST_MUTEX(id)
Define static fast mutex and initialize it.
TTo GetTo(void) const
Get the To member data.
TFrom GetFrom(void) const
Get the From member data.
bool IsStr(void) const
Check if variant Str is selected.
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.
TScore & SetScore(void)
Assign a value to Score data member.
vector< CRef< CSeq_loc > > TLoc
TSegs & SetSegs(void)
Assign a value to Segs data member.
TLens & SetLens(void)
Assign a value to Lens data member.
TDenseg & SetDenseg(void)
Select the variant.
E_Choice Which(void) const
Which variant is currently selected.
vector< CRef< CScore > > TScore
const TLoc & GetLoc(void) const
Get the Loc member data.
list< CRef< CStd_seg > > TStd
bool IsSetStrands(void) const
Check if a value has been assigned to Strands data member.
bool IsSetExt(void) const
extra info Check if a value has been assigned to Ext data member.
const TStarts & GetStarts(void) const
Get the Starts member data.
TDim GetDim(void) const
Get the Dim member data.
const TProduct_id & GetProduct_id(void) const
Get the Product_id member data.
TGenomic_start GetGenomic_start(void) const
Get the Genomic_start member data.
void SetSegs(TSegs &value)
Assign a value to Segs data member.
vector< ENa_strand > TStrands
const TLens & GetLens(void) const
Get the Lens member data.
void SetDim(TDim value)
Assign a value to Dim data member.
vector< TSignedSeqPos > TStarts
void SetDim(TDim value)
Assign a value to Dim data member.
list< CRef< CUser_object > > TExt
void SetType(TType value)
Assign a value to Type data member.
const TSpliced & GetSpliced(void) const
Get the variant data.
TDim GetDim(void) const
Get the Dim member data.
TExt & SetExt(void)
Assign a value to Ext data member.
const TStd & GetStd(void) const
Get the variant data.
TStarts & SetStarts(void)
Assign a value to Starts data member.
TStrands & SetStrands(void)
Assign a value to Strands data member.
list< CRef< CSpliced_exon > > TExons
const TExons & GetExons(void) const
Get the Exons member data.
bool CanGetDim(void) const
Check if it is safe to call GetDim method.
TDim GetDim(void) const
Get the Dim member data.
const TDendiag & GetDendiag(void) const
Get the variant data.
TDisc & SetDisc(void)
Select the variant.
bool IsSetDim(void) const
dimensionality Check if a value has been assigned to Dim data member.
void SetNumseg(TNumseg value)
Assign a value to Numseg data member.
const TIds & GetIds(void) const
Get the Ids member data.
const TExt & GetExt(void) const
Get the Ext member data.
bool IsSetScore(void) const
for whole alignment Check if a value has been assigned to Score data member.
TGenomic_end GetGenomic_end(void) const
Get the Genomic_end member data.
TNumseg GetNumseg(void) const
Get the Numseg member data.
list< CRef< CSeq_align > > Tdata
const TSparse & GetSparse(void) const
Get the variant data.
TIds & SetIds(void)
Assign a value to Ids data member.
const TScore & GetScore(void) const
Get the Score member data.
const TDisc & GetDisc(void) const
Get the variant data.
list< CRef< CDense_diag > > TDendiag
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_partial
mapping pieces together
@ eType_disc
discontinuous alignment
bool IsEmpty(void) const
Check if variant Empty is selected.
ENa_strand
strand of nucleic acid
bool CanGetStrand(void) const
Check if it is safe to call GetStrand method.
const TId & GetId(void) const
Get the Id member data.
const TPnt & GetPnt(void) const
Get the variant data.
TPoint GetPoint(void) const
Get the Point member data.
TFrom GetFrom(void) const
Get the From member data.
E_Choice Which(void) const
Which variant is currently selected.
const TId & GetId(void) const
Get the Id member data.
TStrand GetStrand(void) const
Get the Strand member data.
TTo GetTo(void) const
Get the To member data.
bool IsWhole(void) const
Check if variant Whole is selected.
bool IsInt(void) const
Check if variant Int is selected.
const TInt & GetInt(void) const
Get the variant data.
bool IsPnt(void) const
Check if variant Pnt is selected.
unsigned int
A callback function used to compare two keys in a database.
const TYPE & Get(const CNamedParameterList *param)
range(_Ty, _Ty) -> range< _Ty >
constexpr auto sort(_Init &&init)
const struct ncbi::grid::netcache::search::fields::SIZE size
double r(size_t dimension_, const Int4 *score_, const double *prob_, double theta_)
void copy(Njn::Matrix< S > *matrix_, const Njn::Matrix< T > &matrix0_)
static const sljit_gpr r1
static const sljit_gpr r0
#define row(bind, expected)
string AsString(int row_pos) const
Create a Dense-seg from a Std-seg Used by AlnMgr to handle nucl2prot alignments.
virtual void ChooseSeqId(CSeq_id &id1, const CSeq_id &id2)=0
CSeq_align::TLengthRange range
void AddRange(CSeq_align::TLengthRange new_range)
void AddLength(TSeqPos length)
Template structure SStaticPair is simlified replacement of STL pair<> Main reason of introducing this...
Strict weak ordering for pairs (by first) Used by CreateDensegFromDisc.
bool operator()(const T &x, const T &y)