deps/kb_meme/meme-5.0.1/src/tomtom.c
/**************************************************************************
 * Computes log likelihood ratio scores for all pairs of positions in two motifs.
 **************************************************************************/
Computes log likelihood ratio scores for all pairs of positions in two motifs.
Computes log likelihood ratio scores for all pairs of positions in two motifs .
static void llr_scores(
    int num_dirichlets,     
    MOTIF_T* query_motif,   
    MOTIF_T* target_motif,  
    ARRAY_T* background,    
    int offset,
    MATRIX_T** scores       
    ) {
  int index_query;
  for (index_query = 0; index_query < get_motif_length(query_motif); index_query++) {
    ARRAY_T* query_counts = get_motif_counts(index_query, query_motif);
    int index_target;
    for (index_target = 0; index_target < get_motif_length(target_motif); index_target++) {
      ARRAY_T* target_counts = get_motif_counts(index_target, target_motif);
      double my_score 
        = one_llr_score(
            num_dirichlets,
            query_counts,
            target_counts,
            background
            );
      free_array(target_counts);
      set_matrix_cell(index_query, offset + index_target, my_score, *scores);
    }
    free_array(query_counts);
  }
}
static void llr_scores ( int num_dirichlets , MOTIF_T * query_motif , MOTIF_T * target_motif , ARRAY_T * background , int offset , MATRIX_T * * scores ) { int index_query ; for ( index_query = 0 ; index_query < get_motif_length ( query_motif ) ; index_query ++ ) { ARRAY_T * query_counts = get_motif_counts ( index_query , query_motif ) ; int index_target ; for ( index_target = 0 ; index_target < get_motif_length ( target_motif ) ; index_target ++ ) { ARRAY_T * target_counts = get_motif_counts ( index_target , target_motif ) ; double my_score = one_llr_score ( num_dirichlets , query_counts , target_counts , background ) ; free_array ( target_counts ) ; set_matrix_cell ( index_query , offset + index_target , my_score , * scores ) ; } free_array ( query_counts ) ; } }
Computes log likelihood ratio scores for all pairs of positions in two motifs.
Computes log likelihood ratio scores for all pairs of positions in two motifs .
// Number of Dirichlets [IN] // Single query motif [IN]. // Single target motif [IN]. // Background distribution [IN]. // BLiC score matrix, indexed by start. [OUT] // Traverse the query and target motifs // Store the computed score.