From: Heng Li Date: Tue, 5 May 2009 21:23:27 +0000 (+0000) Subject: * samtools-0.1.3-15 (r266) X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=5453d1b09f745d2e23e6394c2d329d19da7db061;p=samtools.git * samtools-0.1.3-15 (r266) * report an error if a non-* reference is present while @SQ is absent --- diff --git a/bam_import.c b/bam_import.c index fe9af91..77e3243 100644 --- a/bam_import.c +++ b/bam_import.c @@ -241,8 +241,12 @@ int sam_read1(tamFile fp, bam_header_t *header, bam1_t *b) { // flag, tid, pos, qual ret = ks_getuntil(ks, KS_SEP_TAB, str, &dret); z += str->l + 1; c->flag = atoi(str->s); ret = ks_getuntil(ks, KS_SEP_TAB, str, &dret); z += str->l + 1; c->tid = bam_get_tid(header, str->s); - if (c->tid < 0 && strcmp(str->s, "*")) - fprintf(stderr, "[sam_read1] reference '%s' is recognized as '*'.\n", str->s); + if (c->tid < 0 && strcmp(str->s, "*")) { + if (header->n_targets == 0) { + fprintf(stderr, "[sam_read1] missing header? Abort!\n"); + exit(1); + } else fprintf(stderr, "[sam_read1] reference '%s' is recognized as '*'.\n", str->s); + } ret = ks_getuntil(ks, KS_SEP_TAB, str, &dret); z += str->l + 1; c->pos = isdigit(str->s[0])? atoi(str->s) - 1 : -1; ret = ks_getuntil(ks, KS_SEP_TAB, str, &dret); z += str->l + 1; c->qual = isdigit(str->s[0])? atoi(str->s) : 0; if (ret < 0) return -2; diff --git a/bamtk.c b/bamtk.c index 316b128..31ef17c 100644 --- a/bamtk.c +++ b/bamtk.c @@ -3,7 +3,7 @@ #include "bam.h" #ifndef PACKAGE_VERSION -#define PACKAGE_VERSION "0.1.3-14 (r262)" +#define PACKAGE_VERSION "0.1.3-15 (r266)" #endif int bam_taf2baf(int argc, char *argv[]);