]> git.donarmstrong.com Git - samtools.git/blobdiff - sam.c
* samtools-0.1.4-1 (r304)
[samtools.git] / sam.c
diff --git a/sam.c b/sam.c
index 671b5042bc17ec1948c83fe54093c03ff7065120..8411d81f0af8b19e04cc1ffc77e1f741efd6987b 100644 (file)
--- a/sam.c
+++ b/sam.c
@@ -67,10 +67,10 @@ samfile_t *samopen(const char *fn, const char *mode, const void *aux)
                                sam_header_parse(alt);
                                alt->l_text = 0; alt->text = 0;
                                // check if there are @SQ lines in the header
+                               fwrite(fp->header->text, 1, fp->header->l_text, fp->x.tamw);
                                if (alt->n_targets) { // then write the header text without dumping ->target_{name,len}
                                        if (alt->n_targets != fp->header->n_targets)
                                                fprintf(stderr, "[samopen] inconsistent number of target sequences.\n");
-                                       fwrite(fp->header->text, 1, fp->header->l_text, fp->x.tamw);
                                } else { // then dump ->target_{name,len}
                                        for (i = 0; i < fp->header->n_targets; ++i)
                                                fprintf(fp->x.tamw, "@SQ\tSN:%s\tLN:%d\n", fp->header->target_name[i], fp->header->target_len[i]);