deps/kb_meme/meme-5.0.1/src/tomtom.c
/*****************************************************************************
 * Load motifs from a list of paths to motif files.
 * Optionally filter if ids or idxs are specified.
 * Store/check alphabet with alph.
 * Optionally store first motif db background in bg.
 * Returns the list of databases.
 *****************************************************************************/
Load motifs from a list of paths to motif files.
Optionally filter if ids or idxs are specified.
Store/check alphabet with alph.
Optionally store first motif db background in bg.
Returns the list of databases.
Load motifs from a list of paths to motif files . Optionally filter if ids or idxs are specified . Store / check alphabet with alph . Optionally store first motif db background in bg . Returns the list of databases .
static ARRAYLST_T *load_motifs(
  ARRAYLST_T *paths,		
  char *type,			
  RBTREE_T *ids, 		
  RBTREE_T *idxs, 		
  bool allow_zeros, 
  double pseudocount, 
  bool xalph, 
  ALPH_T *query_alph, 		
  char *bg_src,			
  ARRAY_T **bg,			
  bool *stdin_used,		
  ARRAYLST_T **motifs		
) {
  int i, j;
  ARRAYLST_T *dbs = arraylst_create_sized(arraylst_size(paths));
  *motifs = arraylst_create();
  for (i = 0; i < arraylst_size(paths); i++) {
    char *path = (char *)arraylst_get(i, paths);
    MOTIF_DB_T *db = read_motifs_and_background(
      i,                        
      path,                     
      type,                     
      ids,                      
      idxs,                     
      NULL,			
      NULL,			
      allow_zeros,		
      false,                    
      pseudocount,		
      true,                     
      0,			
      &bg_src,			
      true,                     
      bg,			
      NULL,  			
      query_alph,		
      xalph,			
      false,                    
      true,                     
      false,                    
      stdin_used                
    );
    arraylst_add(db, dbs);
    db->list_index = arraylst_size(*motifs);
    for (j=0; j<arraylst_size(db->motifs); j++) {
      arraylst_add(arraylst_get(j, db->motifs), *motifs);
    }
  } 
  return(dbs);
}
static ARRAYLST_T * load_motifs ( ARRAYLST_T * paths , char * type , RBTREE_T * ids , RBTREE_T * idxs , bool allow_zeros , double pseudocount , bool xalph , ALPH_T * query_alph , char * bg_src , ARRAY_T * * bg , bool * stdin_used , ARRAYLST_T * * motifs ) { int i , j ; ARRAYLST_T * dbs = arraylst_create_sized ( arraylst_size ( paths ) ) ; * motifs = arraylst_create ( ) ; for ( i = 0 ; i < arraylst_size ( paths ) ; i ++ ) { char * path = ( char * ) arraylst_get ( i , paths ) ; MOTIF_DB_T * db = read_motifs_and_background ( i , path , type , ids , idxs , NULL , NULL , allow_zeros , false , pseudocount , true , 0 , & bg_src , true , bg , NULL , query_alph , xalph , false , true , false , stdin_used ) ; arraylst_add ( db , dbs ) ; db -> list_index = arraylst_size ( * motifs ) ; for ( j = 0 ; j < arraylst_size ( db -> motifs ) ; j ++ ) { arraylst_add ( arraylst_get ( j , db -> motifs ) , * motifs ) ; } } return ( dbs ) ; }
Load motifs from a list of paths to motif files.
Load motifs from a list of paths to motif files .
// paths of the motif files // type of DB for error messages // motifs to include by name // motifs to include by index // the query alphabet // the background source // IN/OUT the background // IN/OUT check and set if any path is "-" // OUT The motifs. // Create the empty list of motif databases. // Create the empty list of motifs. // Process each motif database path. // Get the name of the next DB file. // Load the motifs from this file. // id of DB // motif file // type of database for error messages // motifs to include by name // motifs to exclude index // get set of motifs by name (or NULL) // exclude this set of motifs by name (or NULL) // allow zeros in motif entries // don't create RC copies, appended // multiply times background model // set_trim // trim_bit_threshold (not used) // the background source // make background symmetrical if alph complementable // background model // there is no sequence file name // the query alphabet // set motif conversion alphabet // don't remove extension from name // remove ".meme" extension from name // don't replace underscores in name // IN/OUT check and set if path is "-" // Add the DB struct to the DB list. // Set the start index of in the motif list of this DB's motifs. // Append the new DB's motifs to the motif list. // path // Return motif DBs.