コード例 #1
0
ファイル: dnahmm.c プロジェクト: PlantandFoodResearch/wise2
void make_consensus_DnaHmmProb(DnaHmmProb * dhp)
{
  int i;
  int j;
  double prob_max;
  int base;

  dhp->consensus = calloc(dhp->len+1,sizeof(char));

  for(i=0;i<dhp->len;i++) {
    prob_max = -1.0;
    for(j=0;j<4;j++) {
      if( dhp->unit[i]->match[j] > prob_max ) {
	prob_max =  dhp->unit[i]->match[j];
	base = j;
      }
    }
    if( prob_max > 0.5 ) {
      dhp->consensus[i] = char_from_base(base);
    } else if ( prob_max > 0.3 ) {
      dhp->consensus[i] = tolower(char_from_base(base));
    } else {
      dhp->consensus[i] = '.';
    }
  }
  dhp->consensus[i] = '\0';

}
コード例 #2
0
void show_single_codon_emission(double no,int base4codon,FILE * ofp)
{
  codon c;
  base one;
  base two;
  base three;

  c = codon_from_base4_codon(base4codon);

  all_bases_from_codon(c,&one,&two,&three);

  fprintf(ofp,"%c%c%c %.2f\n",char_from_base(one),char_from_base(two),char_from_base(three),no);
}
コード例 #3
0
void show_RandomModelDNAScore(RandomModelDNAScore * rds,FILE * ofp)
{
  register int i;

  for(i=0;i<5;i++) {
    fprintf(ofp,"Base %d[%c], Score %d [prob %.2f]\n",i,char_from_base(i),rds->base[i],Score2Probability(rds->base[i]));
  }
}
コード例 #4
0
ファイル: pairbase.c プロジェクト: PlantandFoodResearch/wise2
char char_for_base(int base)
{
  if( base < 5 ) {
    return char_from_base(base);
  } 
  if( base == BASE_GAP ) {
    return '-';
  } else {
    return ' ';
  }
}
コード例 #5
0
void show_base_emission(double * base,FILE * ofp)
{
  register int i;

  fprintf(ofp,"begin consensus\n");

  for(i=0;i<4;i++)
    fprintf(ofp,"%c %.2f\n",char_from_base(i),base[i]);

  fprintf(ofp,"end consensus\n");
}
コード例 #6
0
char draw_random_base_RandomModelDNA(RandomModelDNA * rm)
{
  double draw,tot;
  int i;

  draw = random_0_to_1();
  for(tot=rm->base[0],i=0;draw > tot && i<4;tot += rm->base[++i]) 
    ;
  if( i >= 26 ) {
    warn("Weird - got a draw %f which outside of random model total %f\n",draw,tot);
    return '?';
  }
  return char_from_base(i);
}
コード例 #7
0
char first_char_from_dnanumber(int dnanumber,int nmer_size,int flipped)
{
  int base = 1;
  int basepair;
  int power;
  int i;

  if( flipped == 1 ) {
    /* first number is therefore lowest bit */
    basepair = dnanumber % 4;
    /*    fprintf(stderr,"Going to use %d as number\n",basepair);*/
    basepair = complement_base(basepair);

    return char_from_base(basepair);
  } else {
    for(i=0;i<nmer_size-1;i++) 
      base *= 4;
    
    basepair = (int) (dnanumber / base);
    
    return char_from_base(basepair);
  }

}
コード例 #8
0
ファイル: codon.c プロジェクト: LilaJansen/bioperl-ext
char char_complement_base(char c)
{
  return char_from_base(complement_base(base_from_char(c)));
}