Exemple #1
0
void RNAForestSZ::buildForest(unsigned int &pos, unsigned int &node) {
    unsigned int node2;

    switch (viennaStr_[pos]) {
    case '.':
        // set label
        if (baseStr_.length())
            lb_[node]=alpha2RNA_Alpha(baseStr_[pos]);
        else
            lb_[node]=ALPHA_BASE;

        lml_[node]=node;

        break;
    case '(':
        // left paring base
        if (baseStr_.length())
            lb_[node]=alpha2RNA_Alpha(baseStr_[pos]);
        else
            lb_[node]=ALPHA_BASE;

        lml_[node]=node;

        // build subforest right to (
        node2=node;
        node++;
        pos++;
        buildForest(pos,node);


        // right bracket
        assert(viennaStr_[pos]==')');

        // right pairing base
        if (baseStr_.length())
            lb_[node]=alpha2RNA_Alpha(baseStr_[pos]);
        else
            lb_[node]=ALPHA_BASE;

        lml_[node]=node;


        node++;
        lb_[node]=ALPHA_BASEPAIR;
        lml_[node]=node2;
        break;

    case ')':
        return;
        break;
    }

    pos++;
    node++;
    if (pos<viennaStr_.length())
        buildForest(pos,node);
}
void RNAProfileAlignment::makeLabel(RNA_Alphabet_Profile &p,char c)
{ 
  int i;

  // initialize profile entries to zero
  for(i=0;i<RNA_ALPHABET_SIZE;i++)
    p.p[i]=0.0;

  i=alpha2RNA_Alpha(c);
  p.p[i]=1.0;

  // if it is acgu it is also a base 
  if(i<=ALPHA_PRO_BASE_U)
    p.p[ALPHA_PRO_BASE]=1.0;

  // set column string
  p.columnStr=c;
}