Skip to content

Commit a43a987

Browse files
authored
Merge pull request #84 from gordonrix/add-batch-mode-indexing
Add batch mode indexing to consensus sequence headers
2 parents e963511 + ea5195c commit a43a987

4 files changed

Lines changed: 11 additions & 0 deletions

File tree

src/abpoa.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,12 @@ int abpoa_main(char *file_fn, int is_list, abpoa_para_t *abpt){
150150
abpoa_t *ab = abpoa_init();
151151
if (is_list) { // input file list
152152
FILE *list_fp = fopen(file_fn, "r"); char read_fn[1024];
153+
int batch_index = 1;
153154
while (fgets(read_fn, sizeof(read_fn), list_fp)) {
154155
read_fn[strlen(read_fn)-1] = '\0';
156+
abpt->batch_index = batch_index;
155157
abpoa_msa1(ab, abpt, read_fn, stdout);
158+
batch_index++;
156159
}
157160
fclose(list_fp);
158161
} else // input file

src/abpoa.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ typedef struct {
8383
int align_mode, gap_mode, max_n_cons, cons_algrm; // consensus calling algorithm: 0: partial order graph, 1: majority voting
8484
double min_freq; // for multiploid data
8585
int verbose; // to control output msg
86+
int batch_index; // index of current file in batch mode (for output header)
8687

8788
// char LogTable65536[65536];
8889
// char bit_table16[65536];

src/abpoa_align.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ abpoa_para_t *abpoa_init_para(void) {
149149
abpt->progressive_poa = 0; // progressive partial order alignment
150150

151151
abpt->verbose = ABPOA_NONE_VERBOSE;
152+
abpt->batch_index = 0; // 0 means not in batch mode
152153

153154
// abpt->simd_flag = simd_check();
154155

src/abpoa_output.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -579,6 +579,9 @@ void abpoa_output_fx_consensus(abpoa_t *ab, abpoa_para_t *abpt, FILE *out_fp) {
579579
for (cons_i = 0; cons_i < abc->n_cons; ++cons_i) {
580580
if (abpt->out_fq) fprintf(out_fp, "@Consensus_sequence");
581581
else fprintf(out_fp, ">Consensus_sequence");
582+
if (abpt->batch_index > 0) {
583+
fprintf(out_fp, "_%d", abpt->batch_index); // batch index for file mapping
584+
}
582585
if (abc->n_cons > 1) {
583586
fprintf(out_fp, "_%d ", cons_i+1); // cons_id
584587
for (j = 0; j < abc->clu_n_seq[cons_i]; ++j) { // cluter read_id
@@ -592,6 +595,9 @@ void abpoa_output_fx_consensus(abpoa_t *ab, abpoa_para_t *abpt, FILE *out_fp) {
592595
} fprintf(out_fp, "\n");
593596
if (abpt->out_fq) {
594597
fprintf(out_fp, "+Consensus_sequence");
598+
if (abpt->batch_index > 0) {
599+
fprintf(out_fp, "_%d", abpt->batch_index); // batch index for file mapping
600+
}
595601
if (abc->n_cons > 1) {
596602
fprintf(out_fp, "_%d ", cons_i+1); // cons_id
597603
for (j = 0; j < abc->clu_n_seq[cons_i]; ++j) { // cluter read_id

0 commit comments

Comments
 (0)