summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
3c65ee9)
* in merge, gives a warning rather than error if the target sequence length is different
* allow empty header
bam_read(fp, header->text, header->l_text);
bam_read(fp, &header->n_targets, 4);
if (bam_is_be) bam_swap_endian_4p(&header->n_targets);
bam_read(fp, header->text, header->l_text);
bam_read(fp, &header->n_targets, 4);
if (bam_is_be) bam_swap_endian_4p(&header->n_targets);
- assert(header->n_targets > 0);
// read reference sequence names and lengths
header->target_name = (char**)calloc(header->n_targets, sizeof(char*));
header->target_len = (uint32_t*)calloc(header->n_targets, 4);
// read reference sequence names and lengths
header->target_name = (char**)calloc(header->n_targets, sizeof(char*));
header->target_len = (uint32_t*)calloc(header->n_targets, 4);
assert(fp);
ks = ks_init(fp);
str = (kstring_t*)calloc(1, sizeof(kstring_t));
assert(fp);
ks = ks_init(fp);
str = (kstring_t*)calloc(1, sizeof(kstring_t));
- while (ks_getuntil(ks, 0, str, &dret) >= 0) {
+ while (ks_getuntil(ks, 0, str, &dret) > 0) {
char *s = strdup(str->s);
int len, i;
i = kh_size(hash);
char *s = strdup(str->s);
int len, i;
i = kh_size(hash);
else { // validate multiple baf
if (hout->n_targets != hin->n_targets) {
fprintf(stderr, "[bam_merge_core] file '%s' has different number of target sequences. Abort!\n", fn[i]);
else { // validate multiple baf
if (hout->n_targets != hin->n_targets) {
fprintf(stderr, "[bam_merge_core] file '%s' has different number of target sequences. Abort!\n", fn[i]);
}
for (j = 0; j < hout->n_targets; ++j) {
}
for (j = 0; j < hout->n_targets; ++j) {
- if (strcmp(hout->target_name[j], hin->target_name[j]) || hout->target_len[j] != hin->target_len[j]) {
- fprintf(stderr, "[bam_merge_core] file '%s' has a different target sequence. Abort!\n", fn[i]);
- abort();
+ if (strcmp(hout->target_name[j], hin->target_name[j])) {
+ fprintf(stderr, "[bam_merge_core] different target sequence name: '%s' != '%s' in file '%s'. Abort!\n",
+ hout->target_name[j], hin->target_name[j], fn[i]);
+ exit(1);
+ if (hout->target_len[j] != hin->target_len[j])
+ fprintf(stderr, "[bam_merge_core] different target sequence length: %d != %d in file '%s'. Continue.\n",
+ hout->target_len[j], hin->target_len[j], fn[i]);
}
bam_header_destroy(hin);
}
}
bam_header_destroy(hin);
}
#include "bam.h"
#ifndef PACKAGE_VERSION
#include "bam.h"
#ifndef PACKAGE_VERSION
-#define PACKAGE_VERSION "0.1.2-23"
+#define PACKAGE_VERSION "0.1.2-24"
#endif
int bam_taf2baf(int argc, char *argv[]);
#endif
int bam_taf2baf(int argc, char *argv[]);
+ if (str->l == 0) { \
+ str->m = 1; \
+ str->s = (char*)calloc(1, 1); \
+ } \
str->s[str->l] = '\0'; \
return str->l; \
}
str->s[str->l] = '\0'; \
return str->l; \
}