-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathwrite_block.cpp
More file actions
51 lines (44 loc) · 1.73 KB
/
write_block.cpp
File metadata and controls
51 lines (44 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/******************************************************************/
/* Author: Qin Ma <maqin@uga.edu>, Step. 19, 2013
* Output the identified bicluster block.
*/
#include "write_block.h"
/*************************************************************************/
/* Identified clusters are backtraced to the original data, by
* putting the clustered vectors together, identify common column
*/
template <typename Block>
void print_bc(FILE *fw, const std::unique_ptr<Block> &b, const int num) {
/* block height (genes) */
const int block_rows = b->genes.size();
/* block_width (conditions) */
const int block_cols = b->conds.size();
const int core_rows = b->core_rownum; /* core height*/
const int core_cols = b->core_colnum; /* core width*/
fprintf(fw, "BC%03d\tS=%d\tEnrichment:%.2f\tRow=%d\tCol=%d\tCore_Row=%d\tCore_Col=%d\t\n", num, block_rows * block_cols,
b->score / 100.0,block_rows,block_cols,core_rows,core_cols);
fprintf(fw, " Genes [%d]: ", block_rows);
for (auto gene : b->genes)
fprintf(fw, "%s ", genes_n[gene]);
fprintf(fw, "\n");
fprintf(fw, " Conds [%d]: ", block_cols);
for (auto cond : b->conds)
fprintf(fw, "%s ", conds_n[cond]);
fprintf(fw, "\n");
/* the complete block data output */
int i = 0;
for (auto gene : b->genes) {
fprintf(fw, "%10s:", genes_n[gene]);
for (auto cond : b->conds) {
fprintf(fw, "\t%d", symbols[arr_c[gene][cond]]);
}
fputc('\n', fw);
if (i == b->block_rows_pre - 1)
fputc('\n', fw);
i++;
}
}
template void print_bc<Block>(FILE *fw, const std::unique_ptr<Block> &b,
int num);
template void print_bc<Block1>(FILE *fw, const std::unique_ptr<Block1> &b,
int num);