/* Copyright by Matthias Hoechsmann (C) 2002-2004 ===================================== You may use, copy and distribute this file freely as long as you - do not change the file, - leave this copyright notice in the file, - do not make any profit with the distribution of this file - give credit where credit is due You are not allowed to copy or distribute this file otherwise The commercial usage and distribution of this file is prohibited Please report bugs and suggestions to */ #include #include #ifndef WIN32 #include "config.h" #endif #include "misc.h" #include "rna_alignment.h" #include "rnafuncs.h" #include "utils.h" /* ****************************************** */ /* Private functions */ /* ****************************************** */ void RNA_Alignment::makePairTable(map &pairs, bool first) const { pair *baseIndex; // stores for each node in the alignment the index position of the left and right base (or -1) RNA_Alphabet c; baseIndex=new pair[m_size]; // initialize pairs, all gaps for(int i=size()-1;i>=0;i--) { baseIndex[i].first=-1; baseIndex[i].second=-1; } for(int i=size()-1;i>=0;i--) { // first or second component if(first) c=m_lb[i].a; else c=m_lb[i].b; if(isLeave(i)) { if(c!=ALPHA_GAP) { baseIndex[i].first=i; baseIndex[i].second=i; } } else { // internal node // leftmost and rightmost base bool lmBaseFound=false; for(size_type r=0,h=i+1;r pairs; makePairTable(pairs, first); // iterate through leaves nodes and use information of pairs for(size_type i=0;i