deps/kb_meme/meme-5.0.1/src/tomtom.c
/**************************************************************************
 * Computes euclidian distance between all columns of the query matrix
 * This score is not normalized on length and cannot be used without a
 * normalization criterion as our DP based p-value approach.
 **************************************************************************/
Computes euclidian distance between all columns of the query matrix
This score is not normalized on length and cannot be used without a
normalization criterion as our DP based p-value approach.
Computes euclidian distance between all columns of the query matrix This score is not normalized on length and cannot be used without a normalization criterion as our DP based p - value approach .
void ed_scores(
    MOTIF_T* query_motif,
    MOTIF_T* target_motif,
    ARRAY_T* background,
    int offset,
    MATRIX_T** score
    ) {
  int index_query;
  int index_target;
  for (index_query = 0; index_query < get_motif_length(query_motif); index_query++) {
    for (index_target = 0; index_target < get_motif_length(target_motif); index_target++) {
      double SCORE_T = 0;
      int index; 
      for (index = 0; index < get_motif_alph_size(query_motif); index++) {
        double query_freq = get_matrix_cell(index_query, index, get_motif_freqs(query_motif));
        double target_freq = get_matrix_cell(index_target, index, get_motif_freqs(target_motif));
        double sq;
        sq = pow((query_freq - target_freq), 2);
        SCORE_T = SCORE_T + sq;
      }
      double SCORE_F;
      SCORE_F = - sqrt(SCORE_T);
      set_matrix_cell(index_query, offset + index_target, SCORE_F, *score);
    } 
  } 
}
void ed_scores ( MOTIF_T * query_motif , MOTIF_T * target_motif , ARRAY_T * background , int offset , MATRIX_T * * score ) { int index_query ; int index_target ; for ( index_query = 0 ; index_query < get_motif_length ( query_motif ) ; index_query ++ ) { for ( index_target = 0 ; index_target < get_motif_length ( target_motif ) ; index_target ++ ) { double SCORE_T = 0 ; int index ; for ( index = 0 ; index < get_motif_alph_size ( query_motif ) ; index ++ ) { double query_freq = get_matrix_cell ( index_query , index , get_motif_freqs ( query_motif ) ) ; double target_freq = get_matrix_cell ( index_target , index , get_motif_freqs ( target_motif ) ) ; double sq ; sq = pow ( ( query_freq - target_freq ) , 2 ) ; SCORE_T = SCORE_T + sq ; } double SCORE_F ; SCORE_F = - sqrt ( SCORE_T ) ; set_matrix_cell ( index_query , offset + index_target , SCORE_F , * score ) ; } } }
Computes euclidian distance between all columns of the query matrix
 This score is not normalized on length and cannot be used without a
 normalization criterion as our DP based p-value approach.
Computes euclidian distance between all columns of the query matrix This score is not normalized on length and cannot be used without a normalization criterion as our DP based p - value approach .
/*   Recurse pairwise over the columns */ /* Index corresponds to the alphabets. */ /* Euclidean distance */ /* Target motif */ /* Query motif */