コード例 #1
0
ファイル: make_graph.c プロジェクト: andrewdyates/qubic
void make_graph (const char* fn)
{
	FILE *fw = mustOpen(fn, "w");
	int i, j, cnt;
	int rec_num = 0;
	if (po->COL_WIDTH == 2) po->COL_WIDTH = MAX(cols/20, 2);
	
	/* edge_ptr describe edges */
	AllocArray(edge_list, HEAP_SIZE);

    /* Allocating heap structure */
    struct fibheap *heap;
    heap = fh_makeheap();
    fh_setcmp(heap, edge_cmpr);

    /* Generating seed list and push into heap */
	progress("Generating seed list (minimum weight %d)", po->COL_WIDTH);	

    Edge __cur_min = {0, 0, po->COL_WIDTH};
    Edge *_cur_min = &__cur_min;
    Edge **cur_min = & _cur_min;
	/* iterate over all genes to retrieve all edges */
	for (i = 0; i < rows; i++)
	{
		for (j = i+1; j < rows; j++)
		{
			cnt = str_intersect_r(arr_c[i], arr_c[j]);
			if (cnt < (*cur_min)->score) continue;
		
			AllocVar(edge_ptr);
			edge_ptr -> gene_one = i;
			edge_ptr -> gene_two = j;
			edge_ptr -> score = cnt;
			
            fh_insert_fixed(heap, edge_ptr, cur_min);
            rec_num++;
		}
	}
	
    /*rec_num = heap->fh_n;*/
	if (rec_num == 0)
		errAbort("Not enough overlap between genes");

    /* sort the seeds */
	uglyTime("%d seeds generated", rec_num);
    ReAllocArray(edge_list, rec_num);
    fh_dump(heap, edge_list);
	
    /* bi-clustering */
        int n_blocks = 0;
	progress("Clustering started");
	n_blocks = cluster(fw, edge_list, rec_num);
	uglyTime("%d clusters are written to %s", n_blocks, fn);

    /* clean up */
	for (i=0; i<rec_num; i++)
		free(edge_list[i]);
	free(edge_list);
}
コード例 #2
0
ファイル: fheap.c プロジェクト: spadonidavide/tesi-immagini
void _fh_dump(void *h) {
#if FHEAP_DUMP
    fh_dump((fheap_t *)h);
#endif
}