*
kDigitGif[] = {
"0.gif",
"1.gif",
"2.gif",
"3.gif",
"4.gif",
60 "5.gif",
"6.gif",
"7.gif",
"8.gif",
"9.gif"};
101}
else if(bits < 50) {
103}
else if(bits < 80) {
105}
else if(bits < 200) {
125}
else if(bits < 50) {
127}
else if(bits < 80) {
129}
else if(bits < 200) {
151 if(num_str.size() > 2) {
152 stringtrail_zero (num_str.size() - 2,
'0');
153mid_num_str =
"5"+ trail_zero;
171 if(!alninfo_list.empty()){
173alninfo_list.back()->range->GetTo());
180TAlnInfoListList::iterator iter_temp;
181list<CRange<TSeqPos>* > effective_range_list;
193effective_range_list.push_back(temp_range);
205 booloverlap =
false;
206 if(effective_range){
209effective_range_list){
211 intmin_to =
min(effective_range->
GetTo(),
212temp_range2->
GetTo());
213 intmax_from =
max(effective_range->
GetFrom(),
216 if((
int)((max_from - min_to)*pixel_factor) <=
kOverlapDiff){
227(*iter)->merge(**iter_temp);
228effective_range_list.push_back(effective_range);
231 deleteeffective_range;
239effective_range_list.clear();
245TAlnInfoList::iterator prev_iter;
249 if(
i> 0 && (*prev_iter)->range->IntersectingWith(*((*iter)->range))){
251(*iter)->range->Set(
min((*prev_iter)->range->GetFrom(),
252(*iter)->range->GetFrom()),
253 max((*prev_iter)->range->GetTo(),
254(*iter)->range->GetTo()));
256 if((*iter)->bits < (*prev_iter)->bits){
257(*iter)->bits = (*prev_iter)->bits;
258(*iter)->info = (*prev_iter)->info;
260 delete(*prev_iter)->range;
262alninfo_list.erase(prev_iter);
269 template<
classcontainer>
274 boolhasScore =
false;
275 ITERATE(
typenamecontainer, iter, scoreList) {
279 if(
id.GetStr()==
"score"){
280score = (*iter)->GetValue().GetInt();
282}
else if(
id.GetStr()==
"bit_score"){
283bits = (*iter)->GetValue().GetReal();
285}
else if(
id.GetStr()==
"e_value"||
id.GetStr()==
"sum_e") {
286evalue = (*iter)->GetValue().GetReal();
297 boolhasScore =
false;
306score, bits, evalue);
309score, bits, evalue);
323 stringbit_str, evalue_str;
358ostream << setprecision (2) << evalue;
360 info+=
" S="+ bit_str +
" E="+ formatted_evalue;
362aln_info->
bits= bits;
363aln_info->
score= bit_str;
364aln_info->
eval= formatted_evalue;
402:m_AlnSet(&seqalign),
m_Scope(&scope), m_MasterRange(master_range) {
422 delete(*iter2)->range;
436 boolis_first_aln =
true;
444center =
newCHTML_center;
446tbl_box->SetCellSpacing(0)->SetCellPadding(10)->SetAttribute(
"border",
"1");
447tbl_box->SetAttribute(
"bordercolorlight",
"#0000FF");
448tbl_box->SetAttribute(
"bordercolordark",
"#0000FF");
451 for(CSeq_align_set::Tdata::const_iterator iter =
m_AlnSet->
Get().begin();
453iter++, num_align++){
468subid = &((*iter)->GetSeq_id(1));
470master_id = &((*iter)->GetSeq_id(0));
482 if(!is_first_aln && !subid->
Match(*previous_id)) {
489alninfo->
range= seq_range;
493alninfo_list->push_back(alninfo);
494is_first_aln =
false;
511 doublepixel_factor = ((double)
kMasterPixel)/master_len;
529textbox->SetAttribute(
"id",
"df");
530textbox->SetAttribute(
"style",
"width:60em;background-color: white; border: 1px solid");
538tbl->SetCellSpacing(1)->SetCellPadding(0)->SetAttribute(
"border",
"0");
541score_margin_img->SetAttribute(
"alt",
"");
543tc = tbl->InsertAt(0, 0, score_margin_img);
549score->SetAttribute(
"alt",
"");
550tc = tbl->InsertAt(0, 1, score);
554tbl_box_tc = tbl_box->
InsertAt(0, 0, tbl);
560tbl->SetCellSpacing(1)->SetCellPadding(0)->SetAttribute(
"border",
"0");
565master->SetAttribute(
"alt",
"");
566tc = tbl->InsertAt(0, 0, master);
574 x_PrintTop(&(*center), &(*tbl_box), tbl_box_tc);
581tbl->SetCellSpacing(0)->SetCellPadding(0)->SetAttribute(
"border",
"0");
583image->SetAttribute(
"alt",
"");
584tc = tbl->InsertAt(0,
column, image);
590image->SetAttribute(
"alt",
"");
591tc = tbl->InsertAt(0,
column, image);
597 floatscale_unit = ((float)(master_len))/(
kNumMark- 1);
600 doublepixel_factor = ((double)
kMasterPixel)/master_len;
602 for(
int i= 1;
i*round_number <= master_len;
i++) {
603spacer_length = (
int)(pixel_factor*round_number) -
kScaleWidth;
605image->SetAttribute(
"alt",
"");
606tc = tbl->InsertAt(0,
column, image);
611image->SetAttribute(
"alt",
"");
612tc = tbl->InsertAt(0,
column, image);
621 stringdigit_str, previous_digitstr, first_digit_str;
632image->SetAttribute(
"alt",
"");
634tbl->SetCellSpacing(0)->SetCellPadding(0)->SetAttribute(
"border",
"0");
635tc = tbl->InsertAt(0,
column, image);
641 for(
size_tj = 0; j < first_digit_str.size(); j ++){
642 stringone_digit(1, first_digit_str[j]);
646image->SetAttribute(
"alt",
"");
647tc = tbl->InsertAt(0,
column, image);
654previous_digitstr = first_digit_str;
657 for(
TSeqPos i= 1; (
int)
i*round_number <= master_len;
i++) {
663spacer_length = (
int)(pixel_factor*round_number)
665- previous_digitstr.size()/2))
667previous_digitstr = digit_str;
670image->SetAttribute(
"alt",
"");
671tc = tbl->InsertAt(0,
column, image);
676 for(
size_tj = 0; j < digit_str.size(); j ++){
677 stringone_digit(1, digit_str[j]);
681image->SetAttribute(
"alt",
"");
682tc = tbl->InsertAt(0,
column, image);
697 doublepixel_factor = ((double)
kMasterPixel)/master_len;
708 doubletemp_value, temp_value2 ;
709 intprevious_end = -1;
710 intfront_margin = 0;
713 doubleprev_round = 0;
716 if(!(*iter)->empty()){
719tbl->SetCellSpacing(0)->SetCellPadding(0)->SetAttribute(
"border",
"0");
721image->SetAttribute(
"alt",
"");
722tc = tbl->InsertAt(0,
column, image);
728 boolis_first_segment =
true;
730current_id = (*iter2)->id;
734 intfrom = (*iter2)->range->GetFrom();
735 intstop = (*iter2)->range->GetTo();
736 if(from <= previous_end) {
737 if(stop > previous_end) {
738from = previous_end + 1;
739(*iter2)->range->SetFrom(from);
745 intbreak_len = from - (previous_end + 1);
746 boolbreak_len_added =
false;
747temp_value = break_len*pixel_factor + prev_round;
750front_margin = (
int)(temp_value + (temp_value < 0.0 ? -0.5 : 0.5));
751 if(front_margin > 0) {
752prev_round = temp_value - front_margin;
754prev_round = temp_value;
758temp_value2 = (*iter2)->range->GetLength()*pixel_factor +
760bar_length = (
int)(temp_value2 + (temp_value2 < 0.0 ? -0.5 : 0.5));
763 if(bar_length == 0 && (*iter2)->range->GetLength()*pixel_factor >= 0.50){
767 if(bar_length > 0) {
768prev_round = temp_value2 - bar_length;
770prev_round = temp_value2;
774 if(!is_first_segment && front_margin == 0 && bar_length > 1) {
777break_len_added =
true;
781 if(front_margin > 0) {
784&& previous_id->
Match(*current_id)){
785 if(break_len_added) {
797image->SetAttribute(
"alt",
"");
798tc = tbl->InsertAt(0,
column, image);
805previous_id = current_id;
808is_first_segment =
false;
811image->SetAttribute(
"border", 0);
813image->SetAttribute(
"ONMouseOver",
"document.getElementById('df').innerHTML='"+
816image->SetAttribute(
"ONMOUSEOUT",
817 "document.getElementById('df').innerHTML='Mouse-over to show defline and scores, click to show alignments'");
822 stringseqid = (*iter2)->gi ==
824ad =
new CHTML_a(
"#"+ seqid, image);
828tc = tbl->InsertAt(0,
column, ad);
831tc = tbl->InsertAt(0,
column, image);
845image->SetAttribute(
"alt",
"");
846tbl->SetCellSpacing(0)->SetCellPadding(0)->SetAttribute(
"border",
"0");
847tbl->InsertAt(0, 0, image);
881 stringdefline =
"",
909 boolis_first_aln =
true;
914 for(CSeq_align_set::Tdata::const_iterator iter =
m_AlnSet->
Get().begin();
916iter++, num_align++){
933subid = &((*iter)->GetSeq_id(1));
935master_id = &((*iter)->GetSeq_id(0));
949 if(!is_first_aln && !subid->
Match(*previous_id)) {
956alninfo->
range= seq_range;
960alninfo_list->push_back(alninfo);
961is_first_aln =
false;
999 returngrScaleDigits;
1009 intspacer = (
i== 0) ? 0 : spacer_length;
1017 stringdigit_str, previous_digitstr, first_digit_str;
1019 intfirst_digit = 0;
1026previous_digitstr = first_digit_str;
1037- previous_digitstr.size()/2))
1039previous_digitstr = digit_str;
1044 returngrScale + grScaleDigits;
1057 doubletemp_value, temp_value2 ;
1058 intprevious_end = -1;
1059 intfront_margin = 0;
1061 doubleprev_round = 0;
1063 if(!(*iter)->empty()){
1066 boolis_first_segment =
true;
1069current_id = (*iter2)->id;
1073 intfrom = (*iter2)->range->GetFrom();
1074 intstop = (*iter2)->range->GetTo();
1075 if(from <= previous_end) {
1076 if(stop > previous_end) {
1077from = previous_end + 1;
1078(*iter2)->range->SetFrom(from);
1084 intbreak_len = from - (previous_end + 1);
1085 boolbreak_len_added =
false;
1089front_margin = (
int)(temp_value + (temp_value < 0.0 ? -0.5 : 0.5));
1090 if(front_margin > 0) {
1091prev_round = temp_value - front_margin;
1093prev_round = temp_value;
1099bar_length = (
int)(temp_value2 + (temp_value2 < 0.0 ? -0.5 : 0.5));
1102 if(bar_length == 0 && (*iter2)->range->GetLength()*
m_Pixel_factor>= 0.50){
1106 if(bar_length > 0) {
1107prev_round = temp_value2 - bar_length;
1109prev_round = temp_value2;
1113 if(!is_first_segment && front_margin == 0 && bar_length > 1) {
1116break_len_added =
true;
1120 stringconnectingBar;
1123 if(front_margin > 0) {
1125 intimgWidth = front_margin;
1126 stringimgClass,imgFile;
1128&& previous_id->
Match(*current_id)){
1129 if(break_len_added) {
1144oneAlign += connectingBar;
1148previous_end = stop;
1149previous_id = current_id;
1151 if(bar_length > 0){
1152is_first_segment =
false;
1153 stringseqid,defline,eval,acc,score;
1156defline = (*iter2)->info;
1157acc = (*iter2)->accession;
1158eval = (*iter2)->eval;
1159score =(*iter2)->score;
1173 stringgraph_seq_popup;
static CRef< CScope > m_Scope
User-defined methods of the data storage class.
User-defined methods of the data storage class.
const TSeqPos kScoreLength
const TSeqPos kDigitHeight
const TSeqPos kScoreHeight
static string s_MapSeqInfoTemplate(string seqTemplate, string score, string seq, string defline, string acc, string eval)
const TSeqPos kScaleWidth
const TSeqPos kScoreMargin
const TSeqPos kDigitWidth
static bool s_GetBlastScore(const container &scoreList, int &score, double &bits, double &evalue)
static string s_GetScoreColor(int bits)
static string s_GetGif(int bits)
static const int kOverlapDiff
const TSeqPos kMasterBarLength
const TSeqPos kMasterPixel
const TSeqPos kGreakHeight
const TSeqPos kBlankBarHeight
static void s_GetAlnScores(const CSeq_align &aln, int &score, double &bits, double &evalue)
const TSeqPos kScaleMarginAdj
static int s_GetRoundNumber(int number)
const TSeqPos kScaleHeight
static string s_MapBarTemplate(string imageTemplate, int width, string imgType, string cssClass, string score="", string seq="", string defline="", string acc="", string eval="")
const TSeqPos kMasterHeight
static string MapTemplate(string inpString, string tmplParamName, Int8 templParamVal)
Replace template tags by real data.
void x_DisplayMaster(int master_len, CNCBINode *center, CHTML_table *tbl_box, CHTML_tc *&tbl_box_tc)
string x_FormatScaleDigit(string digitString, int spacer_length)
CAlnGraphic(const CSeq_align_set &seqalign, CScope &scope, CRange< TSeqPos > *master_range=NULL)
void x_MergeDifferentSeq(double pixel_factor)
static bool FromRangeAscendingSort(SAlignInfo *const &info1, SAlignInfo *const &info2)
CRange< TSeqPos > * m_MasterRange
CConstRef< CSeq_align_set > m_AlnSet
TAlnInfoListList m_AlninfoListList
void x_MergeSameSeq(TAlnInfoList &alninfo_list)
string m_MouseOverFormName
void x_FormatGraphOverview(CNcbiOstream &out)
void Display(CNcbiOstream &out)
list< SAlignInfo * > TAlnInfoList
CRange< TSeqPos > * x_GetEffectiveRange(TAlnInfoList &alninfo_list)
SAlignGraphTemplates * m_AlignGraphTemplates
void x_PrintTop(CNCBINode *center, CHTML_table *tbl_box, CHTML_tc *&tbl_box_tc)
list< TAlnInfoList * > TAlnInfoListList
void AlnGraphicDisplay(CNcbiOstream &out)
void x_BuildHtmlTable(int master_len, CHTML_table *tbl_box, CHTML_tc *&tbl_box_tc)
string x_FormatScale(void)
void x_GetAlnInfo(const CSeq_align &aln, const CSeq_id &id, SAlignInfo *aln_info)
Class for computing sequences' titles ("definitions").
CNcbiOstrstreamToString class helps convert CNcbiOstrstream to a string Sample usage:
API (CDeflineGenerator) for computing sequences' titles ("definitions").
std::ofstream out("events_result.xml")
main entry point for tests
static const char * column
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.
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
static string HTMLEncode(const string &str, THTMLEncodeFlags flags=fEncodeAll)
HTML encodes a string. E.g. <.
CNCBINode * AppendChild(CNCBINode *child)
virtual CNcbiOstream & Print(CNcbiOstream &out, TMode mode=eHTML)
CHTML_tc * InsertAt(TIndex row, TIndex column, CNCBINode *node)
void SetAttribute(const string &name, const string &value)
TGi FindGi(const container &ids)
Return gi from id list if exists, return 0 otherwise.
void GetLabel(string *label, ELabelType type=eDefault, TLabelFlags flags=fLabel_Default) const
Append a label for this Seq-id to the supplied string.
bool Match(const CSeq_id &sid2) const
Match() - TRUE if SeqIds are equivalent.
static int WorstRank(const CRef< CSeq_id > &id)
@ eContent
Untagged human-readable accession or the like.
string GenerateDefline(const CBioseq_Handle &bsh, TUserFlags flags=0)
Main method.
CBioseq_Handle GetBioseqHandle(const CSeq_id &id)
Get bioseq handle by seq-id.
TBioseqCore GetBioseqCore(void) const
Get bioseq core structure.
TSeqPos GetBioseqLength(void) const
CConstRef< TObject > GetObjectCore(void) const
bool Empty(void) const THROWS_NONE
Check if CConstRef is empty â not pointing to any object which means having a null value.
bool Empty(void) const THROWS_NONE
Check if CRef is empty â not pointing to any object, which means having a null value.
position_type GetLength(void) const
TThisType & Set(position_type from, position_type to)
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define END_SCOPE(ns)
End the previously defined scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
#define BEGIN_SCOPE(ns)
Define a new scope.
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
static string DoubleToString(double value, int precision=-1, TNumToStringFlags flags=0)
Convert double to string.
static int StringToInt(const CTempString str, TStringToNumFlags flags=0, int base=10)
Convert string to int.
static string IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
static SIZE_TYPE Find(const CTempString str, const CTempString pattern, ECase use_case=eCase, EDirection direction=eForwardSearch, SIZE_TYPE occurrence=0)
Find the pattern in the string.
static string JavaScriptEncode(const CTempString str)
Encode a string for JavaScript.
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.
C::value_type FindBestChoice(const C &container, F score_func)
Find the best choice (lowest score) for values in a container.
TTo GetTo(void) const
Get the To member data.
TFrom GetFrom(void) const
Get the From member data.
TId GetId(void) const
Get the variant data.
const TDenseg & GetDenseg(void) const
Get the variant data.
E_Choice Which(void) const
Which variant is currently selected.
const TStd & GetStd(void) const
Get the variant data.
const TDendiag & GetDendiag(void) const
Get the variant data.
const TScore & GetScore(void) const
Get the Score member data.
const TScores & GetScores(void) const
Get the Scores member data.
const Tdata & Get(void) const
Get the member data.
const TSegs & GetSegs(void) const
Get the Segs member data.
const TId & GetId(void) const
Get the Id member data.
list< CRef< CSeq_id > > TId
unsigned int
A callback function used to compare two keys in a database.
static SLJIT_INLINE sljit_ins br(sljit_gpr target)
CRange< TSeqPos > * range
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