deps/kb_meme/meme-5.0.1/src/motif-in.c
/*
 * Add a motif format datastructure to the list of formats
 */
Add a motif format datastructure to the list of formats
Add a motif format datastructure to the list of formats
void add_format(
  MREAD_T *mread, 
  char *name,
  void* (*init)(const char *filename, int options), 
  void (*destroy)(void *data),
  void (*update)(void *data, const char *buffer, size_t size, short end),
  short (*match_score)(void *data),
  short (*has_warning)(void *data),
  char* (*next_warning)(void *data),
  short (*has_error)(void *data),
  char* (*next_error)(void *data),
  short (*has_motif)(void *data),
  MOTIF_T* (*next_motif)(void *data),
  ALPH_T* (*get_alphabet)(void *data),
  int (*get_strands)(void *data),
  bool (*get_bg)(void *data, ARRAY_T **bg),
  void* (*motif_optional)(void *data, int option), 
  void* (*file_optional)(void *data, int option) 
) {
  MFORMAT_T *format;
  mread->formats = mm_realloc(mread->formats, (mread->total + 1) * sizeof(MFORMAT_T));
  format = mread->formats+(mread->total);
  mread->total++;
  mread->valid++;
  format->name = name;
  format->data = init(mread->filename, mread->options);
  format->valid = true;
  format->destroy = destroy;
  format->update = update;
  format->match_score = match_score;
  format->has_warning = has_warning;
  format->next_warning = next_warning;
  format->has_error = has_error;
  format->next_error = next_error;
  format->has_motif = has_motif;
  format->next_motif = next_motif;
  format->get_alphabet = get_alphabet;
  format->get_strands = get_strands;
  format->get_bg = get_bg;
  format->motif_optional = motif_optional;
  format->file_optional = file_optional;
}
void add_format ( MREAD_T * mread , char * name , void * ( * init ) ( const char * filename , int options ) , void ( * destroy ) ( void * data ) , void ( * update ) ( void * data , const char * buffer , size_t size , short end ) , short ( * match_score ) ( void * data ) , short ( * has_warning ) ( void * data ) , char * ( * next_warning ) ( void * data ) , short ( * has_error ) ( void * data ) , char * ( * next_error ) ( void * data ) , short ( * has_motif ) ( void * data ) , MOTIF_T * ( * next_motif ) ( void * data ) , ALPH_T * ( * get_alphabet ) ( void * data ) , int ( * get_strands ) ( void * data ) , bool ( * get_bg ) ( void * data , ARRAY_T * * bg ) , void * ( * motif_optional ) ( void * data , int option ) , void * ( * file_optional ) ( void * data , int option ) ) { MFORMAT_T * format ; mread -> formats = mm_realloc ( mread -> formats , ( mread -> total + 1 ) * sizeof ( MFORMAT_T ) ) ; format = mread -> formats + ( mread -> total ) ; mread -> total ++ ; mread -> valid ++ ; format -> name = name ; format -> data = init ( mread -> filename , mread -> options ) ; format -> valid = true ; format -> destroy = destroy ; format -> update = update ; format -> match_score = match_score ; format -> has_warning = has_warning ; format -> next_warning = next_warning ; format -> has_error = has_error ; format -> next_error = next_error ; format -> has_motif = has_motif ; format -> next_motif = next_motif ; format -> get_alphabet = get_alphabet ; format -> get_strands = get_strands ; format -> get_bg = get_bg ; format -> motif_optional = motif_optional ; format -> file_optional = file_optional ; }
Add a motif format datastructure to the list of formats
Add a motif format datastructure to the list of formats
// use the filename to get a type hint // optional component at motif scope // optional component at file scope