deps/kb_meme/meme-5.0.1/src/spamo.c
/**************************************************************************
 * Loads the matches to the secondary motifs by
 * directly interfacing with FIMO to scan the sequences.
 **************************************************************************/
Loads the matches to the secondary motifs by
directly interfacing with FIMO to scan the sequences.
Loads the matches to the secondary motifs by directly interfacing with FIMO to scan the sequences .
static void load_secondary_matches(
  SPAMO_OPTIONS_T *options, 
  RBTREE_T *sequences, 
  MOTIF_T *primary_motif, 
  RBTREE_T *secondary_motifs, 
  ARRAY_T *background
) {
  RBNODE_T *node;
  MOTIF_DB_T *db;
  SECONDARY_MOTIF_T *smotif;
  int i, count, total, report_step, *hits, hits_size, test_max;
  ARRAY_T **matches = NULL;
  test_max = (int)(options->test_range / options->bin) + (options->test_range % options->bin ? 1 : 0);
  int n_secondary_motifs = rbtree_size(secondary_motifs);
  DEBUG_MSG(NORMAL_VERBOSE, "Scanning For Secondary Matches\n");
  matches = (ARRAY_T**)mm_malloc(sizeof(ARRAY_T*) * rbtree_size(sequences));
  hits_size = 4 * options->margin;
  hits = (int*)mm_malloc(sizeof(int) * hits_size);
  total = rbtree_size(secondary_motifs);
  report_step = (int)(((double)total / 100) + 0.5);
  if (report_step == 0) report_step = 1; 
  for (node = rbtree_first(secondary_motifs), count = 0; node != NULL; node = rbtree_next(node), count++) {
    smotif = (SECONDARY_MOTIF_T*)rbtree_value(node);
    scan_spamo_secondary(options->margin, options->score_threshold, options->use_best_secondary, background,
        smotif->motif, sequences, matches, hits, hits_size);
    process_matches(options->margin, options->bin, options->pvalue_cutoff, options->motif_evalue_cutoff,
        test_max, primary_motif, sequences, smotif, n_secondary_motifs, matches);
    if (options->dump_seqs && smotif->sig_count > 0 && smotif->passes_evalue_cutoff) {
      output_sequence_matches(options->outdir, options->margin, 
        options->bin, options->pvalue_cutoff, options->dump_sig_only,
        sequences, primary_motif, smotif, matches);
    }
    if (count % report_step == 0) {
      DEBUG_FMT(NORMAL_VERBOSE, "\rScanned %d%% ", (int)(((double)(count + 1) / total) * 100 + 0.5));
    } else {
    }
  }
  DEBUG_MSG(NORMAL_VERBOSE, "\n");
  for (i = 0; matches && i < rbtree_size(sequences); i++) free_array(matches[i]);
  free(matches);
  free(hits);
}
static void load_secondary_matches ( SPAMO_OPTIONS_T * options , RBTREE_T * sequences , MOTIF_T * primary_motif , RBTREE_T * secondary_motifs , ARRAY_T * background ) { RBNODE_T * node ; MOTIF_DB_T * db ; SECONDARY_MOTIF_T * smotif ; int i , count , total , report_step , * hits , hits_size , test_max ; ARRAY_T * * matches = NULL ; test_max = ( int ) ( options -> test_range / options -> bin ) + ( options -> test_range % options -> bin ? 1 : 0 ) ; int n_secondary_motifs = rbtree_size ( secondary_motifs ) ; DEBUG_MSG ( NORMAL_VERBOSE , " \n " ) ; matches = ( ARRAY_T * * ) mm_malloc ( sizeof ( ARRAY_T * ) * rbtree_size ( sequences ) ) ; hits_size = 4 * options -> margin ; hits = ( int * ) mm_malloc ( sizeof ( int ) * hits_size ) ; total = rbtree_size ( secondary_motifs ) ; report_step = ( int ) ( ( ( double ) total / 100 ) + 0.5 ) ; if ( report_step == 0 ) report_step = 1 ; for ( node = rbtree_first ( secondary_motifs ) , count = 0 ; node != NULL ; node = rbtree_next ( node ) , count ++ ) { smotif = ( SECONDARY_MOTIF_T * ) rbtree_value ( node ) ; scan_spamo_secondary ( options -> margin , options -> score_threshold , options -> use_best_secondary , background , smotif -> motif , sequences , matches , hits , hits_size ) ; process_matches ( options -> margin , options -> bin , options -> pvalue_cutoff , options -> motif_evalue_cutoff , test_max , primary_motif , sequences , smotif , n_secondary_motifs , matches ) ; if ( options -> dump_seqs && smotif -> sig_count > 0 && smotif -> passes_evalue_cutoff ) { output_sequence_matches ( options -> outdir , options -> margin , options -> bin , options -> pvalue_cutoff , options -> dump_sig_only , sequences , primary_motif , smotif , matches ) ; } if ( count % report_step == 0 ) { DEBUG_FMT ( NORMAL_VERBOSE , " \r " , ( int ) ( ( ( double ) ( count + 1 ) / total ) * 100 + 0.5 ) ) ; } else { } } DEBUG_MSG ( NORMAL_VERBOSE , " \n " ) ; for ( i = 0 ; matches && i < rbtree_size ( sequences ) ; i ++ ) free_array ( matches [ i ] ) ; free ( matches ) ; free ( hits ) ; }
Loads the matches to the secondary motifs by
 directly interfacing with FIMO to scan the sequences.
Loads the matches to the secondary motifs by directly interfacing with FIMO to scan the sequences .
// mod 0 causes Arithmetic exception //if (verbosity >= NORMAL_VERBOSE) fprintf(stderr, "40.40%s\r", get_motif_id(smotif->motif)); //scan //process //dump sequences (if requested) //DEBUG_MSG(NORMAL_VERBOSE, ".");