61 {
"red.gif",
"purple.gif",
"green.gif",
"yellow.gif",
"white.gif"};
63 {
"Strong",
"Moderate",
"Weak",
"Suspect"};
65 {
"Strong match",
"Moderate match",
"Weak match",
"Suspect origin"};
88 CSeq_align_set::Tdata::iterator next_iter;
89 CSeq_align_set::Tdata::iterator cur_iter = seqalign.
Set().begin();
91 while(cur_iter != seqalign.
Set().end()){
95 const CSeq_id& cur_id = (*cur_iter)->GetSeq_id(1);
96 while(next_iter != seqalign.
Set().end()){
103 if(next_iter != seqalign.
Set().end()){
104 const CSeq_id& next_id = (*next_iter)->GetSeq_id(1);
105 if (cur_id.
Match(next_id)){
106 CSeq_align_set::Tdata::iterator temp_iter = next_iter;
110 seqalign.
Set().insert(cur_iter, *temp_iter);
113 seqalign.
Set().erase(temp_iter);
131 int score1, score2, sum_n, num_ident;
133 list<TGi> use_this_gi;
137 sum_n, num_ident, use_this_gi);
139 sum_n, num_ident, use_this_gi);
143 return score2 > score1;
145 return from1 < from2;
157 int score1, score2, sum_n, num_ident;
159 list<TGi> use_this_gi;
162 sum_n, num_ident, use_this_gi);
164 sum_n, num_ident, use_this_gi);
166 return (score1 > score2);
175 int score, sum_n, num_ident;
178 list<TGi> use_this_gi;
180 aln_start =
min(seqalign.GetSeqRange(0).GetTo(),
181 seqalign.GetSeqRange(0).GetFrom());
182 aln_stop =
max(seqalign.GetSeqRange(0).GetTo(),
183 seqalign.GetSeqRange(0).GetFrom());
185 sum_n, num_ident,use_this_gi);
187 if (aln_stop > start_edge) {
197 if (aln_start < end_edge) {
199 end_edge = aln_start;
201 end_edge = aln_start;
203 end_edge = aln_start;
215 int score, sum_n, num_ident;
218 list<TGi> use_this_gi;
225 sum_n, num_ident,use_this_gi);
237 }
else if ((
int)aln_start - (
int)start_edge <= 1 ||
238 (
int)aln_stop + 1 >= (
int) end_edge){
265 list<CRange<TSeqPos> > range_list;
269 cur_range.
Set((*iter)->GetSeqRange(0).GetFrom(),
270 (*iter)->GetSeqRange(0).GetTo());
273 prev_range = range_list.back();
277 range_to_id[range_list.back()] = range_to_id[prev_range];
279 range_to_id[cur_range]=
x_GetId(**iter);
280 range_list.push_back(cur_range);
283 range_to_id[cur_range]=
x_GetId(**iter);
284 range_list.push_back(cur_range);
295 CSeq_align_set::Tdata::iterator iter_lower =
296 seqalign_lower.
Set().begin();
297 while(iter_lower != seqalign_lower.
Set().end()){
298 if((*iter_lower)->GetSeqRange(0).GetFrom() >=
299 iter_higher->GetFrom() &&
300 (*iter_lower)->GetSeqRange(0).GetTo() <=
301 iter_higher->GetTo()){
306 CSeq_align_set::Tdata::iterator temp_iter = iter_lower;
308 seqalign_lower.
Set().erase(temp_iter);
309 }
else if ((*iter_lower)->GetSeqRange(0).
310 IntersectingWith(*iter_higher)){
311 int id= range_to_id[*iter_higher];
316 range_to_id[*iter_higher]=id;
330 m_HelpDocsUrl =
"//www.ncbi.nlm.nih.gov/tools/vecscreen/about/";
347 CSeq_align_set::Tdata::iterator next_iter;
348 CSeq_align_set::Tdata::iterator cur_iter = seqalign.
Set().begin();
350 while(cur_iter != seqalign.
Set().end()){
351 next_iter = cur_iter;
355 while(next_iter != seqalign.
Set().end()){
362 CSeq_align_set::Tdata::iterator temp_iter = next_iter;
364 seqalign.
Set().erase(temp_iter);
383 for(
unsigned int i = 0;
i < catagorized_seqalign.size();
i ++){
401 new_align->
Assign(**iter);
408 catagorized_seqalign[
type]->Set().push_back(new_align);
412 for(
unsigned int i = 0;
i < catagorized_seqalign.size();
i ++){
424 *(catagorized_seqalign[j]));
428 for(
unsigned int i = 0;
i < catagorized_seqalign.size();
i ++){
450 (*aln_info_iter)->add_drops(aligns_to_add);
467 b->AppendPlainText(
"Distribution of Vector Matches on the Query Sequence");
472 tbl->SetCellSpacing(0)->SetCellPadding(0)->SetAttribute(
"border",
"0");
480 tc = tbl->InsertAt(0,
column, font);
491 tbl->SetCellSpacing(0)->SetCellPadding(0)->SetAttribute(
"border",
"0");
493 int width_adjust = 1;
495 double width = (*iter)->range.GetLength()*pixel_factor;
497 width = width + (width < 0.0 ? -0.5 : 0.5);
498 if(((
int)width) > 1){
505 image->SetAttribute(
"border", 1);
506 tc = tbl->InsertAt(0,
column, image);
517 b->AppendPlainText(
"Match to Vector: ");
521 image->SetAttribute(
"border",
"1");
530 b->AppendPlainText(
"Segment of suspect origin: ");
533 image->SetAttribute(
"border",
"1");
539 b->AppendPlainText(
"Segments matching vector: ");
544 bool is_first =
true;
546 if((*iter)->type ==
i){
551 a->SetAttribute(
"TARGET",
"VecScreenInfo");
558 if((*iter)->range.GetFrom() == (*iter)->range.GetTo()){
559 out <<
" " << (*iter)->range.GetFrom() + 1;
561 out <<
" " << (*iter)->range.GetFrom() + 1 <<
"-"
562 << (*iter)->range.GetTo() + 1;
599 vector< list<AlnInfo*> > aln_info_vec(seqalign_vec.size());
603 for(
unsigned int i = 0;
i < seqalign_vec.size();
i ++){
607 cur_aln_info->
range.
Set((*iter)->GetSeqRange(0).GetFrom(),
608 (*iter)->GetSeqRange(0).GetTo());
613 prev_range = &(aln_info_vec[
i].back()->range);
616 aln_info_vec[
i].back()->range =
621 aln_info_vec[
i].push_back(cur_aln_info);
624 aln_info_vec[
i].push_back(cur_aln_info);
631 for(
unsigned int i = 0;
i < aln_info_vec.size();
i ++){
632 ITERATE(list<AlnInfo*>, iter_higher, aln_info_vec[
i]){
633 for(
unsigned int j =
i + 1; j < aln_info_vec.size(); j ++){
634 list<AlnInfo*>::iterator iter_temp;
635 list<AlnInfo*>::iterator iter_lower = aln_info_vec[j].begin();
636 while(iter_lower != aln_info_vec[j].end()){
638 higher_range = (*iter_higher)->range;
639 lower_range = (*iter_lower)->range;
640 if((*iter_higher)->range.IntersectingWith((*iter_lower)->range)){
642 if((*iter_higher)->range.GetFrom() <=
643 (*iter_lower)->range.GetFrom()){
645 if((*iter_higher)->range.GetTo() >=
646 (*iter_lower)->range.GetTo()){
648 (*iter_higher)->add_aligns((*iter_lower)->get_aligns());
649 iter_temp = iter_lower;
651 aln_info_vec[j].erase(iter_temp);
655 (*iter_lower)->range.
656 Set((*iter_higher)->range.GetTo() + 1,
657 (*iter_lower)->range.GetTo());
662 if((*iter_higher)->range.GetTo() <=
663 (*iter_lower)->range.GetTo()){
672 (*iter_higher)->range.
675 (*iter_lower)->get_aligns() ));
677 if ((*iter_higher)->range.GetTo() <
678 (*iter_lower)->range.GetTo()) {
684 (*iter_lower)->range.GetTo() ,
686 (*iter_lower)->get_aligns() ));
689 iter_temp = iter_lower;
691 aln_info_vec[j].erase(iter_temp);
697 (*iter_lower)->range.
698 Set((*iter_lower)->range.GetFrom(),
699 (*iter_higher)->range.GetFrom() - 1);
705 if ((*iter_lower)->range.GetFrom() > (*iter_higher)->range.GetFrom()) {
717 for(
unsigned int i = 0;
i < aln_info_vec.size();
i++){
718 ITERATE(list<AlnInfo*>, iter, aln_info_vec[
i]){
729 list<AlnInfo*>::iterator temp_iter;
735 prev_range = (*prev_iter)->range;
736 cur_range = (*cur_iter)->range;
753 if((*cur_iter)->range.GetFrom() > 0){
764 prev_iter = cur_iter;
773 ((*prev_iter)->range.GetTo() + 1) +1 >
User-defined methods of the data storage class.
User-defined methods of the data storage class.
void Reverse(void)
Reverse the segments' orientation NOTE: currently *only* works for dense-seg.
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...
void SetNamedScore(const string &id, int score)
ENa_strand GetSeqStrand(TDim row) const
Get strand (the first one if segments have different strands).
void x_MergeSeqalign(objects::CSeq_align_set &seqalign)
merge overlapping seqalign
MatchType
vector match defines
TIdToDropIdMap x_IdToDropIdMap
AlnInfo * x_GetAlnInfo(TSeqPos from, TSeqPos to, MatchType type, const AlnInfo::TAlignList aligns=AlnInfo::TAlignList())
get align info
CVecscreen(const objects::CSeq_align_set &seqalign, TSeqPos master_length, TSeqPos terminal_flexibility=25)
Constructors.
void x_MergeInclusiveSeqalign(objects::CSeq_align_set &seqalign)
merge a seqalign if its range is in another seqalign
TSeqPos m_TerminalFlexibility
void x_BuildHtmlBar(CNcbiOstream &out)
Output the graphic.
static string GetStrengthString(MatchType match_type)
Returns a string concerning the strength of the match for a given enum value.
void x_GetEdgeRanges(const objects::CSeq_align &seqalign, TSeqPos master_len, TSeqPos &start_edge, TSeqPos &end_edge)
list< AlnInfo * > m_AlnInfoList
internal match list
CConstRef< objects::CSeq_align_set > m_SeqalignSetRef
the current seqalign
int x_GetId(const objects::CSeq_align &a)
void x_MergeLowerRankSeqalign(objects::CSeq_align_set &seqalign_higher, objects::CSeq_align_set &seqalign_lower)
merge a seqalign if its range is in another higher ranked seqalign
string m_ImagePath
gif image file path
string m_HelpDocsUrl
help url
static bool FromRangeAscendingSort(AlnInfo *const &info1, AlnInfo *const &info2)
Sort on range from.
MatchType x_GetMatchType(const objects::CSeq_align &seqalign, TSeqPos master_len, TSeqPos start_edge, TSeqPos end_edge)
Get match type.
void VecscreenPrint(CNcbiOstream &out)
show alignment graphic view
TSeqPos m_MasterLen
master seq length
vector< CRef< objects::CSeq_align > > x_OrigAlignsById
bool m_ShowWeakMatch
Show weak match?
TDropToKeepMap x_DropToKeepMap
void x_BuildNonOverlappingRange(vector< CRef< objects::CSeq_align_set > > seqalign_vec)
Build non overlapping internal match list.
void x_GetAllDropIdsForKeepId(int keep_id, set< int > &drop_ids)
CRef< objects::CSeq_align_set > ProcessSeqAlign(void)
Process alignment to show.
CRef< objects::CSeq_align_set > m_FinalSeqalign
the processed seqalign
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.
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Set object to copy of another one.
void SetAttribute(const string &name, const string &value)
bool Match(const CSeq_id &sid2) const
Match() - TRUE if SeqIds are equivalent.
TThisType CombinationWith(const TThisType &r) const
bool AbuttingWith(const TThisType &r) const
bool IntersectingWith(const TThisType &r) 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 IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
TTo GetTo(void) const
Get the To member data.
TFrom GetFrom(void) const
Get the From member data.
Tdata & Set(void)
Assign a value to data member.
list< CRef< CSeq_align > > Tdata
const Tdata & Get(void) const
Get the member data.
const TYPE & Get(const CNamedParameterList *param)
void add_align(CRef< objects::CSeq_align > a)
void add_aligns(const TAlignList &al)
list< CRef< objects::CSeq_align > > TAlignList