Skip to content

Commit

Permalink
Merge pull request #68 from wtsi-npg/devel
Browse files Browse the repository at this point in the history
prep rel 0.9.10
  • Loading branch information
dozy authored Jul 11, 2017
2 parents 265be7c + 53e2ffc commit 58371d6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/decode.c
Original file line number Diff line number Diff line change
Expand Up @@ -739,9 +739,11 @@ int processTemplate(va_t *template, BAMit_t *bam_out, va_t *barcodeArray, opts_t
for (int n=0; n < template->end; n++) {
bam1_t *rec = template->entries[n];
if (bc_tag) {
char *newtag = strdup(bc_tag);
char *newtag;
if (opts->convert_low_quality) {
newtag = checkBarcodeQuality(bc_tag,rec,opts);
} else {
newtag = strdup(bc_tag);
}
if (strlen(bc_tag) > opts->tag_len) {
newtag[opts->tag_len] = 0; // truncate seq to barcode length
Expand Down
11 changes: 11 additions & 0 deletions test/t_decode.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ void setup_test_2(int* argc, char*** argv, char *outputfile)
(*argv)[17] = strdup("RT");
}

void free_argv(int argc, char *argv[])
{
for (int n=0; n < argc; free(argv[n++]));
free(argv);
}

void test_noCalls(char *s, int e)
{
int n;
Expand Down Expand Up @@ -163,6 +169,7 @@ int main(int argc, char**argv)

setup_test_1(&argc_1, &argv_1, outputfile);
main_decode(argc_1-1, argv_1+1);
free_argv(argc_1,argv_1);

char *cmd = calloc(1,1024);
sprintf(cmd,"diff -I ID:bambi %s %s", outputfile, MKNAME(DATA_DIR,"/out/6383_9_nosplit_nochange.sam"));
Expand All @@ -180,6 +187,7 @@ int main(int argc, char**argv)
sprintf(outputfile,"%s/decode_2.sam",TMPDIR);
setup_test_2(&argc_2, &argv_2, outputfile);
main_decode(argc_2-1, argv_2+1);
free_argv(argc_2,argv_2);

sprintf(cmd,"diff -I ID:bambi %s %s", outputfile, MKNAME(DATA_DIR,"/out/6383_8_nosplitN.sam"));
result = system(cmd);
Expand All @@ -190,6 +198,9 @@ int main(int argc, char**argv)
success++;
}

free(outputfile);
free(cmd);

printf("decode tests: %s\n", failure ? "FAILED" : "Passed");
return failure ? EXIT_FAILURE : EXIT_SUCCESS;
}

0 comments on commit 58371d6

Please sign in to comment.