prot_seq, trans_seq;
114prot_seq = trans_seq;
122 TSeqPosifrom = lit.GetRange().GetFrom();
123 TSeqPosito = lit.GetRange().GetTo();
125 charbasesIN[2], basesOUT[2];
130 for(
TSeqPospos = neg ? ito : ifrom;
131(neg ? (pos -
offset>= ifrom) : (pos +
offset<= ito)) &&
132idx != prot_seq.length() && idx != trans_seq.length() ;
133(neg ? pos -= 3 : pos += 3), ++idx)
135 boolmismatch = (prot_seq[idx] != trans_seq[idx]);
142basesIN [0] = prot_seq[idx];
143basesOUT[0] = trans_seq[idx];
156seq_start + 0.5, trans_y,
true);
160 stringmain_seq, tmp_seq;
161vec.
GetSeqData(seq_start - 1, seq_start + 2, tmp_seq);
1650,
static_cast<TSeqPos>(tmp_seq.length()), main_seq);
171reverse(main_seq.begin(), main_seq.end());
175seq_start + 0.5, gen_y,
true);
185 intdiff = neg ? seq_start - ifrom : ito - seq_start;
188}
else if(diff == 1) {
190}
else if(diff == 0) {
199 boolwill_fit =
false;
202 intbase_width = aln_mgr->
GetBaseWidth(aln_mgr->GetAnchor());
209 if(will_fit &&
GetFeature().IsSetExcept() &&
GetFeature().HasExceptionText(
"trans-splicing"))
253prot_len = prot_vec.
size();
255gen_len = prot_len * 3;
274 if(cds_seq.empty()) {
278&
GetFeature().GetData().GetCdregion().GetCode() :
nullptr;
282 if(cds_seq.empty()) {
288gen_len =
GetLocation().GetTotalRange().GetLength();
289prot_len = gen_len / 3 + 1;
292 #ifdef HIGHLIGHT_MISMATCHES 298&
GetFeature().GetData().GetCdregion().GetCode() :
nullptr;
302 if(prot_seq.empty())
303prot_seq = trans_seq;
311 intaligned_seq = aln_mgr->GetQuery();
312 intbase_width = aln_mgr->GetBaseWidth(anchor);
313 intanchor_step = base_width == 3 ? 1 : 3;
319 static const CRgbaColorcodon_mismatch_col(
"red");
320 static const CRgbaColortranslated_col(
"dark blue");
324 boolaligned_neg = aln_mgr->IsNegativeStrand(aligned_seq);
325 boolanchor_neg = aln_mgr->IsNegativeStrand(anchor);
328 auto& anchor_range = map_it.m_AnchorRange;
332 auto& prod_int = *map_it.m_ProductInt;
333 auto& gen_int = *map_it.m_MappedInt;
334 auto& prod_range = map_it.m_MappedProdRange;
336 boolneg = gen_int.IsSetStrand() && gen_int.GetStrand() ==
eNa_strand_minus;
337 boolaln_strand = anchor_neg || aligned_neg;
338 intanchor_sign = (aln_strand && neg || !aln_strand && !neg) ? 1 : -1;
340 TSeqRangegen_range(gen_int.GetFrom(), gen_int.GetTo());
343 TSeqPosprod_pos = prod_int.GetFrom();
344 TSeqPosprod_stop = prod_int.GetTo() + 1;
346prod_stop = min<int>(prod_stop, prod_pos +
round(
float(gen_range.
GetLength()) / base_width));
349anchor_range.GetTo() : anchor_range.GetFrom();
355 intprod_from = prod_range.GetFrom();
356 intframe = prod_from > 0 ? prod_from % 3 : prot_offset;
357 TSeqPosprod_pos_f1 = (prod_from / 3) * 3 + 1;
358pos += ((anchor_sign * anchor_step) / 3) * (prod_pos_f1 - prod_from);
360pos += (anchor_sign * anchor_step);
362 while(prod_pos < prod_stop) {
363 if(prod_pos >= prot_seq.size())
366 if(anchor_sign > 0 && pos > (
TSignedSeqPos)anchor_range.GetTo())
368 if(anchor_sign < 0 && pos < (
TSignedSeqPos)anchor_range.GetFrom())
372 if(prod_pos < prot_seq.size())
373prot_in[0] = prot_seq[prod_pos];
374 #ifdef HIGHLIGHT_MISMATCHES 376 if(prod_pos < trans_seq.size())
377prot_out[0] = trans_seq[prod_pos];
378 boolmismatch = (prot_in[0] != prot_out[0]);
384pos + 0.5, prot_y,
true);
387 TSeqPosp = prod_pos > 0 ? (prod_pos * 3) : 0;
388 stringcodon = cds_seq.substr(p, 3);
389 #ifdef HIGHLIGHT_MISMATCHES 390 stringgen_codon = gen_seq.substr(p, 3);
396 x_PutCodon(codon, pos, gen_y, flip_strand != (anchor_sign < 0),
false);
399gl.
ColorC(translated_col);
404pos += anchor_sign * anchor_step;
436prot_len = prot_vec.
size();
439cerr <<
"prot_seq (obtained as feature product): "<< endl << prot_seq << endl <<
"prot_seq.length(): "<<
440prot_seq.length() <<
", * 3: "<< prot_seq.length() * 3 << endl;
442gen_len = prot_len * 3;
451cerr <<
"sfp (cds feature obtained for the product): "<< endl <<
MSerial_AsnText<< *sfp << endl;
459cerr <<
"cds_seq (obtained from product):"<< endl << cds_seq << endl <<
"cds_seq.length(): "<< cds_seq.length() <<
469gen_len =
GetLocation().GetTotalRange().GetLength();
470prot_len = gen_len / 3 + 1;
476cerr <<
"gen_sec (parts of original seq obtained via intervals): "<< endl;
478gen_seq.reserve(gen_len);
483 TSeqPosf1 = iter.first->GetFrom();
484 TSeqPosf2 = iter.second->GetFrom();
485 TSeqPost2 = iter.second->GetTo();
487gen_seq.append(f1 - pre_t1,
'N');
489cerr <<
string(f1 - pre_t1,
'N');
4970,
static_cast<TSeqPos>(tmp_seq.length()), seq);
500pre_t1 = iter.first->GetTo() + 1;
503cerr << tmp_seq.length() <<
":\t"<< tmp_seq << endl;
514cerr <<
"trans_seq (translation from gen_seq): "<< endl << trans_seq << endl <<
"trans_seq.length(): "<<
515trans_seq.length() <<
", * 3: "<< trans_seq.length() * 3 << endl;
519 if(prot_seq.empty())
520prot_seq = trans_seq;
523 charprot_in[2], prot_out[2];
527 static const CRgbaColorcodon_mismatch_col(
"red");
528 static const CRgbaColortranslated_col(
"dark blue");
541 auto& prod_int = *map_it.first;
542 auto& gen_int = *map_it.second;
544 if(
nullptr!= previous_prod_int) {
545 if(previous_prod_int->
GetTo() != (prod_int.GetFrom() - 1)) {
546prev_frame += prod_int.
GetFrom() - previous_prod_int->
GetTo() - 1;
550previous_prod_int = &prod_int;
553cerr <<
"product range: ("<< prod_int.
GetFrom() <<
", "<< prod_int.GetTo() <<
")"<< endl;
554cerr <<
"general range: ("<< gen_int.GetFrom() <<
", "<< gen_int.GetTo() <<
")"<< endl;
557 boolneg = gen_int.IsSetStrand() && gen_int.GetStrand() ==
eNa_strand_minus;
558 TSeqRangegen_range(gen_int.GetFrom(), gen_int.GetTo());
559 intstep = neg ? -3 : 3;
561 while(current_exon !=
m_Intervals.end() && current_exon->GetFrom() > gen_range.
GetTo()) {
566 while(current_exon !=
m_Intervals.end() && current_exon->GetTo() < gen_range.
GetFrom()) {
572 intframe = (gen_range.
GetLength() + prev_frame) % 3;
584 TSeqPosprod_pos = prod_int.GetFrom();
590 switch(prev_frame) {
594c_pos += (neg ? -1 : 1);
600c_pos += (neg ? 1 : -1);
608 size_tprot_idx = (prod_pos > offs) ? (prod_pos - offs) / 3 : 0;
613 while(prod_pos <= prod_stop) {
618prot_in[0] = prot_out[0] =
'X';
619 if(prot_idx < prot_seq.size())
620prot_in[0] = prot_seq[prot_idx];
621 if(prot_idx < trans_seq.size())
622prot_out[0] = trans_seq[prot_idx];
623 boolmismatch = (prot_in[0] != prot_out[0]);
630 if(prod_pos - 1 < gen_seq.size())
631gen_codon = gen_seq.substr(prod_pos - 1, 3);
634 if(prot_idx * 3 < cds_seq.size())
635codon = cds_seq.substr(prot_idx * 3 + offs, 3);
639 x_PutCodon(codon, c_pos, gen_y, flip_strand != neg,
false);
642gl.
ColorC(translated_col);
651 if(prev_prod->GetTo() + 1 != prod_int.GetFrom()) {
652c_pos = neg ? gen_int.GetTo() + 1 : gen_int.GetFrom();
654 x_DrawInsertion(c_pos, prot_y - (font_height + font_height), prot_y, prot_y - font_height);
658 if(prev_gen->GetFrom() - 1 != gen_int.GetTo()) {
659c_pos = prev_gen->GetFrom() - 1;
663 if(prev_gen->GetTo() + 1 != gen_int.GetFrom()) {
664c_pos = prev_gen->GetTo() + 1;
673c_pos += (neg ? -1 : 1);
679prev_gen.
Reset(&gen_int);
680prev_prod.
Reset(&prod_int);
689 stringnew_codon = codon_str;
690 size_t len= codon_str.size();
691 if(
len> 0 &&
len< 5) {
693 if(
append) new_codon +=
" ";
694 elsenew_codon.insert(0,
" ");
696 if(neg) std::reverse(new_codon.begin(), new_codon.end());
698pos + 0.5, y,
true);
User-defined methods of the data storage class.
static const int kVertSpace
CRgbaColor m_SeqProtMismatch
mismatched sequence color.
CGlTextureFont m_ProdFont
CRgbaColor m_SeqProtTrans
translated sequence color.
CGlTextureFont m_TransFont
CRef< CCdsConfig > m_CdsConfig
void x_DrawProtSeqWithMapping(TModelUnit trans_y, TModelUnit gen_y, TModelUnit prot_y) const
void x_DrawProjectedProtSeq(TModelUnit trans_y, TModelUnit gen_y, TModelUnit prot_y) const
void x_PutCodon(const string &codon_str, TSeqPos pos, TModelUnit y, bool neg, bool append) const
virtual void x_Draw() const
The default renderer for this layout object.
CCdsGlyph(const objects::CMappedFeat &feat)
virtual void x_UpdateBoundingBox()
Update the bounding box assuming children's sizes are fixed if any.
TSeqPos x_GetProtOffset() const
Returns protein translation offset.
virtual void x_Draw() const
The default renderer for this layout object.
void x_DrawInsertion(TModelUnit SeqPosTriangleMidPointX, TModelUnit BoundaryYLow, TModelUnit BoundaryYHigh, TModelUnit YCenterLine) const
TIntervals m_Intervals
intervals (like for features or alignments).
virtual void x_UpdateBoundingBox()
Update the bounding box assuming children's sizes are fixed if any.
CConstRef< CFeatureParams > m_Config
All the configs needed for rendering a feature.
CProjectedMappingInfo m_ProjectedMappingInfo
const TMappingInfo & GetMappingInfo() const
virtual const objects::CSeq_loc & GetLocation(void) const
access the position of this object.
bool x_IsProjected() const
const objects::CMappedFeat & GetMappedFeature(void) const
Access a new, fully remapped feature.
const objects::CSeq_feat & GetFeature(void) const
Access the original feature.
TModelUnit GetBarHeight(bool overview) const
void GetAnchorSequence(objects::CScope &scope, string &buffer) const
const IAlnGraphicDataSource * GetAlignmentDataSource() const
void TextOut(const CGlTextureFont *font, const char *text, TModelUnit x, TModelUnit y, bool center, bool adjust_flip=true) const
CRef< CSGSequenceDS > GetSeqDS() const
bool IsInVisibleRange(TSeqPos pos) const
TModelRange IntersectVisible(const CSeqGlyph *obj) const
const TModelUnit & GetScale() const
bool IsFlippedStrand() const
bool WillSeqLetterFit() const
is it enougth space to sequence letters.
class CRgbaColor provides a simple abstraction for managing colors.
objects::CScope & GetScope(void) const
Get the scope from the handle.
const objects::CSeqVector & GetSeqVector(void) const
CRenderingContext * m_Context
the rendering context
virtual void SetHeight(TModelUnit h)
virtual TModelUnit GetTop() const
virtual TModelUnit GetHeight() const
static SIZE_TYPE ReverseComplement(const string &src, TCoding src_coding, TSeqPos pos, TSeqPos length, string &dst)
static SIZE_TYPE Complement(const string &src, TCoding src_coding, TSeqPos pos, TSeqPos length, string &dst)
namespace ncbi::objects::
Seq-loc iterator class â iterates all intervals from a seq-loc in the correct order.
virtual TSeqPos GetBaseWidth(IAlnExplorer::TNumrow) const =0
virtual IAlnExplorer::TNumrow GetAnchor() const =0
static void DLIST_NAME() append(DLIST_LIST_TYPE *list, DLIST_TYPE *item)
unsigned int TSeqPos
Type for sequence locations and lengths.
int TSignedSeqPos
Type for signed sequence position.
IRender & GetGl()
convenience function for getting current render manager
virtual TModelUnit TextHeight(const CGlTextureFont *font) const =0
virtual TModelUnit GetMetric(const CGlTextureFont *font, IGlFont::EMetric metric, const char *text=NULL, int len=-1) const =0
Calls the standard font metric functions except for pdf in which case it first replaces any bitmap fo...
virtual void ColorC(const CRgbaColor &c)=0
Set current color (glColor{3,4}{f,d}{v,})
#define MSerial_AsnText
I/O stream manipulators â.
TRange GetTotalRange(void) const
const CSeq_feat * GetCDSForProduct(const CBioseq &product, CScope *scope)
Get the encoding CDS feature of a given protein sequence.
static void Translate(const string &seq, string &prot, const CGenetic_code *code, bool include_stop=true, bool remove_trailing_X=false, bool *alt_start=NULL, bool is_5prime_complete=true, bool is_3prime_complete=true)
Translate a string using a specified genetic code.
@ fIs5PrimePartial
= 0x4 Translate first codon even if not start codon (because sequence is 5' partial)
CBioseq_Handle GetBioseqHandle(const CSeq_id &id)
Get bioseq handle by seq-id.
@ eCoding_Iupac
Set coding to printable coding (Iupacna or Iupacaa)
void GetSeqData(TSeqPos start, TSeqPos stop, string &buffer) const
Fill the buffer string with the sequence data for the interval [start, stop).
void Reset(void)
Reset reference object.
position_type GetLength(void) const
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
TTo GetTo(void) const
Get the To member data.
TFrom GetFrom(void) const
Get the From member data.
const TLocation & GetLocation(void) const
Get the Location member data.
TFrame GetFrame(void) const
Get the Frame member data.
const TData & GetData(void) const
Get the Data member data.
const TCdregion & GetCdregion(void) const
Get the variant data.
bool IsSetFrame(void) const
Check if a value has been assigned to Frame data member.
TFrom GetFrom(void) const
Get the From member data.
TTo GetTo(void) const
Get the To member data.
bm::gap_word_t gap_length(const bm::gap_word_t *buf) noexcept
Returs GAP block length.
constexpr bool empty(list< Ts... >) noexcept
static const float kSequenceLevel
string GetProduct(const CProt_ref &prot_ref)
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