]> git.donarmstrong.com Git - samtools.git/blobdiff - bcftools/bcf.c
faster for large sample size (in principle)
[samtools.git] / bcftools / bcf.c
index fdc13b83f4ea7f714e159afbf6ba1e761fe42d60..c3313881ef90fc2930c72d218c090b35e5cf9466 100644 (file)
@@ -208,7 +208,9 @@ void bcf_fmt_core(const bcf_hdr_t *h, bcf1_t *b, kstring_t *s)
 {
        int i, j, x;
        s->l = 0;
-       kputs(h->ns[b->tid], s); kputc('\t', s);
+       if (h->n_ref) kputs(h->ns[b->tid], s);
+       else kputw(b->tid, s);
+       kputc('\t', s);
        kputw(b->pos + 1, s); kputc('\t', s);
        fmt_str(b->str, s); kputc('\t', s);
        fmt_str(b->ref, s); kputc('\t', s);
@@ -221,6 +223,7 @@ void bcf_fmt_core(const bcf_hdr_t *h, bcf1_t *b, kstring_t *s)
                fmt_str(b->fmt, s);
        }
        x = b->n_alleles * (b->n_alleles + 1) / 2;
+       if (b->n_gi == 0) return;
        for (j = 0; j < h->n_smpl; ++j) {
                kputc('\t', s);
                for (i = 0; i < b->n_gi; ++i) {