Ejemplo n.º 1
0
void alignment_print_matrices(const aligner_t *aligner)
{
  const score_t* match_scores = aligner->match_scores;
  const score_t* gap_a_scores = aligner->gap_a_scores;
  const score_t* gap_b_scores = aligner->gap_b_scores;

  size_t i, j;

  printf("seq_a: %.*s\nseq_b: %.*s\n",
         (int)aligner->score_width-1, aligner->seq_a,
         (int)aligner->score_height-1, aligner->seq_b);

  printf("match_scores:\n");
  for(j = 0; j < aligner->score_height; j++)
  {
    printf("%3i:", (int)j);
    for(i = 0; i < aligner->score_width; i++)
    {
      printf("\t%3i", (int)ARR_LOOKUP(match_scores, aligner->score_width, i, j));
    }
    putc('\n', stdout);
  }
  printf("gap_a_scores:\n");
  for(j = 0; j < aligner->score_height; j++)
  {
    printf("%3i:", (int)j);
    for(i = 0; i < aligner->score_width; i++)
    {
      printf("\t%3i", (int)ARR_LOOKUP(gap_a_scores, aligner->score_width, i, j));
    }
    putc('\n', stdout);
  }
  printf("gap_b_scores:\n");
  for(j = 0; j < aligner->score_height; j++)
  {
    printf("%3i:", (int)j);
    for(i = 0; i < aligner->score_width; i++)
    {
      printf("\t%3i", (int)ARR_LOOKUP(gap_b_scores, aligner->score_width, i, j));
    }
    putc('\n', stdout);
  }

  printf("match: %i mismatch: %i gapopen: %i gapexend: %i\n",
         aligner->scoring->match, aligner->scoring->mismatch,
         aligner->scoring->gap_open, aligner->scoring->gap_extend);
  printf("\n");
}
Ejemplo n.º 2
0
void alignment_print_matrices(const score_t* match_score,
                              const score_t* gap_a_score,
                              const score_t* gap_b_score,
                              int length_a, int length_b)
{
  int score_width = length_a+1;
  int i, j;

  printf("match_score:\n");
  for(j = 0; j <= length_b; j++)
  {
    printf("%3i:", j);
    for(i = 0; i <= length_a; i++)
    {
      printf(" %3i", (int)ARR_LOOKUP(match_score, score_width, i, j));
    }
    printf("\n");
  }
  printf("gap_a_score:\n");
  for(j = 0; j <= length_b; j++)
  {
    printf("%3i:", j);
    for(i = 0; i <= length_a; i++)
    {
      printf(" %3i", (int)ARR_LOOKUP(gap_a_score, score_width, i, j));
    }
    printf("\n");
  }
  printf("gap_b_score:\n");
  for(j = 0; j <= length_b; j++)
  {
    printf("%3i:", j);
    for(i = 0; i <= length_a; i++)
    {
      printf(" %3i", (int)ARR_LOOKUP(gap_b_score, score_width, i, j));
    }
    printf("\n");
  }
}
Ejemplo n.º 3
0
void scoring_add_mutations(scoring_t* scoring, const char *str, const int *scores,
                           char use_match_mismatch)
{
  size_t i, j, len = strlen(str);
  char a, b;
  int score;

  for(i = 0; i < len; i++)
  {
    a = scoring->case_sensitive ? str[i] : tolower(str[i]);

    for(j = 0; j < len; j++)
    {
      b = scoring->case_sensitive ? str[j] : tolower(str[j]);
      score = ARR_LOOKUP(scores, len, i, j);

      scoring_add_mutation(scoring, a, b, score);
    }
  }

  scoring->use_match_mismatch = use_match_mismatch;
}