deps/kb_meme/meme-5.0.1/src/starts.c
/**
 * make_width_prog
 *
 * Generate a list of central motif widths for global search, rounding values
 * to integer (using a cast to int) when they are not integers. The sequence
 * is identical that originally used by MEME: a geometric progression starting
 * from min_width, except that it is terminated by a specified max_width, and
 * the minimum increment between widths is 2.
 * 
 * If palindromes are being enforced, then width "w+1" will be included in
 * addition to every width "w".
 *
 * \return the array of integers in the sequence
 */
make_width_prog
Generate a list of central motif widths for global search, rounding values
to integer (using a cast to int) when they are not integers. The sequence
is identical that originally used by MEME: a geometric progression starting
from min_width, except that it is terminated by a specified max_width, and
the minimum increment between widths is 2.

If palindromes are being enforced, then width "w+1" will be included in
addition to every width "w".

\return the array of integers in the sequence
make_width_prog Generate a list of central motif widths for global search rounding values to integer ( using a cast to int ) when they are not integers . The sequence is identical that originally used by MEME : a geometric progression starting from min_width except that it is terminated by a specified max_width and the minimum increment between widths is 2 . If palindromes are being enforced then width " w + 1 " will be included in addition to every width " w " . \ return the array of integers in the sequence
static int *make_width_prog (
  int min_width, 
  int max_width, 
  double factor, 
  int *n_vals, 
  bool pal, 
  bool all_widths 
) {
  assert (max_width >= min_width); 
  int curr_width, inc_width;
  int *progression = NULL;
  *n_vals = 0;
  for (curr_width = min_width; curr_width < max_width;
       curr_width = all_widths? curr_width+1 :
         (MAX(curr_width+2, (int)(curr_width*factor)))) {
    (*n_vals)++; 
    Resize(progression, *n_vals, int);
    progression[*n_vals - 1] = curr_width;
    if (pal && !all_widths) {
      (*n_vals)++;
      Resize(progression, *n_vals, int);
      progression[*n_vals - 1] = curr_width+1;
    }
  }
  (*n_vals)++;
  Resize(progression, *n_vals, int);
  progression[*n_vals - 1] = max_width;
  if (pal) {
    (*n_vals)++;
    Resize(progression, *n_vals, int);
    progression[*n_vals - 1] = max_width+1;
  }
  assert (progression != NULL); 
  return progression;
}
static int * make_width_prog ( int min_width , int max_width , double factor , int * n_vals , bool pal , bool all_widths ) { assert ( max_width >= min_width ) ; int curr_width , inc_width ; int * progression = NULL ; * n_vals = 0 ; for ( curr_width = min_width ; curr_width < max_width ; curr_width = all_widths ? curr_width + 1 : ( MAX ( curr_width + 2 , ( int ) ( curr_width * factor ) ) ) ) { ( * n_vals ) ++ ; Resize ( progression , * n_vals , int ) ; progression [ * n_vals - 1 ] = curr_width ; if ( pal && ! all_widths ) { ( * n_vals ) ++ ; Resize ( progression , * n_vals , int ) ; progression [ * n_vals - 1 ] = curr_width + 1 ; } } ( * n_vals ) ++ ; Resize ( progression , * n_vals , int ) ; progression [ * n_vals - 1 ] = max_width ; if ( pal ) { ( * n_vals ) ++ ; Resize ( progression , * n_vals , int ) ; progression [ * n_vals - 1 ] = max_width + 1 ; } assert ( progression != NULL ) ; return progression ; }
make_width_prog
 Generate a list of central motif widths for global search, rounding values
 to integer (using a cast to int) when they are not integers.
make_width_prog Generate a list of central motif widths for global search rounding values to integer ( using a cast to int ) when they are not integers .
// Minimum width value in the progression // Maximum integer value in the progression // Factor specifying rate of increase in progression // The final number of values in the progression - OUT // Indicates whether palindromes are being enforced  // all widths between min and max // Precondition // Adding an extra value to the progression. // If palindromes are being enforced, then make sure adjacent widths are // "central", so that they will be considered for starting points (we // don't need to do this is all widths are being considered): // Add the terminal value: // If palindromes are being enforced, then add an extra starting point at // the end of the array (this time we do need to do this even if all // widths are considered): // Postcondition