deps/kb_meme/meme-5.0.1/src/momo-motifx.c
/**
 * Given a bg frequency matrix and a phospho count matrix, we will convert the bg
 * freq matrix into a binomial matrix. No reason to keep a bg freq matrix, so we will recycle.
 */
Given a bg frequency matrix and a phospho count matrix, we will convert the bg
freq matrix into a binomial matrix. No reason to keep a bg freq matrix, so we will recycle.
Given a bg frequency matrix and a phospho count matrix we will convert the bg freq matrix into a binomial matrix . No reason to keep a bg freq matrix so we will recycle .
void convert_bg_freqs_to_binomial(MATRIX_T* phospho_count, MATRIX_T* bg_freqs, int num_phospho_seqs, bool harvard) {
  int i;
  int j;
  double min_log_prob = -16 * log(10);
  for (i = 0; i < get_num_rows(bg_freqs); ++i) {
    for (j = 0; j < get_num_cols(bg_freqs); ++j) {
      double p = get_matrix_cell(i, j, bg_freqs);
      double cxj = get_matrix_cell(i, j, phospho_count);
      int n = num_phospho_seqs;
      double log_value = log_betai(cxj, n-cxj+1, p);
      if (harvard && log_value < min_log_prob) log_value = min_log_prob - cxj*1e-6;
      set_matrix_cell(i, j, log_value, bg_freqs);
    }
  }
}
void convert_bg_freqs_to_binomial ( MATRIX_T * phospho_count , MATRIX_T * bg_freqs , int num_phospho_seqs , bool harvard ) { int i ; int j ; double min_log_prob = -16 * log ( 10 ) ; for ( i = 0 ; i < get_num_rows ( bg_freqs ) ; ++ i ) { for ( j = 0 ; j < get_num_cols ( bg_freqs ) ; ++ j ) { double p = get_matrix_cell ( i , j , bg_freqs ) ; double cxj = get_matrix_cell ( i , j , phospho_count ) ; int n = num_phospho_seqs ; double log_value = log_betai ( cxj , n - cxj + 1 , p ) ; if ( harvard && log_value < min_log_prob ) log_value = min_log_prob - cxj * 1e-6 ; set_matrix_cell ( i , j , log_value , bg_freqs ) ; } } }
Given a bg frequency matrix and a phospho count matrix, we will convert the bg
 freq matrix into a binomial matrix.
Given a bg frequency matrix and a phospho count matrix we will convert the bg freq matrix into a binomial matrix .
// Mimic original motif-x where 1e-16 is smallest p-value, and ties sorted by number of matches?