Skip to content

Commit

Permalink
r419: print the @pg line
Browse files Browse the repository at this point in the history
  • Loading branch information
lh3 committed Nov 19, 2013
1 parent deb1959 commit ff6faf8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions bwa.c
Original file line number Diff line number Diff line change
Expand Up @@ -277,9 +277,11 @@ void bwa_idx_destroy(bwaidx_t *idx)
void bwa_print_sam_hdr(const bntseq_t *bns, const char *rg_line)
{
int i;
extern char *bwa_pg;
for (i = 0; i < bns->n_seqs; ++i)
err_printf("@SQ\tSN:%s\tLN:%d\n", bns->anns[i].name, bns->anns[i].len);
if (rg_line) err_printf("%s\n", rg_line);
err_printf("%s\n", bwa_pg);
}

static char *bwa_escape(char *s)
Expand Down
10 changes: 9 additions & 1 deletion main.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#include <stdio.h>
#include <string.h>
#include "kstring.h"
#include "utils.h"

#ifndef PACKAGE_VERSION
#define PACKAGE_VERSION "0.7.5a-r418"
#define PACKAGE_VERSION "0.7.5a-r419"
#endif

int bwa_fa2pac(int argc, char *argv[]);
Expand All @@ -24,6 +25,8 @@ int main_mem(int argc, char *argv[]);

int main_pemerge(int argc, char *argv[]);

char *bwa_pg;

static int usage()
{
fprintf(stderr, "\n");
Expand Down Expand Up @@ -63,7 +66,11 @@ int main(int argc, char *argv[])
{
int i, ret;
double t_real;
kstring_t pg = {0,0,0};
t_real = realtime();
ksprintf(&pg, "@PG\tID:bwa\tPN:bwa\tVN:%s\tCL:%s", PACKAGE_VERSION, argv[0]);
for (i = 1; i < argc; ++i) ksprintf(&pg, " %s", argv[i]);
bwa_pg = pg.s;
if (argc < 2) return usage();
if (strcmp(argv[1], "fa2pac") == 0) ret = bwa_fa2pac(argc-1, argv+1);
else if (strcmp(argv[1], "pac2bwt") == 0) ret = bwa_pac2bwt(argc-1, argv+1);
Expand Down Expand Up @@ -93,5 +100,6 @@ int main(int argc, char *argv[])
fprintf(stderr, " %s", argv[i]);
fprintf(stderr, "\n[%s] Real time: %.3f sec; CPU: %.3f sec\n", __func__, realtime() - t_real, cputime());
}
free(bwa_pg);
return ret;
}

0 comments on commit ff6faf8

Please sign in to comment.