]> git.donarmstrong.com Git - samtools.git/blobdiff - bam_sort.c
* samtools-0.1.2-24
[samtools.git] / bam_sort.c
index 68d15dc58f7cde597615a5d49aa988f7a65cd366..7c5fbb2faf4e7cc5268cbf924550461979bb4a84 100644 (file)
@@ -66,13 +66,17 @@ void bam_merge_core(int by_qname, const char *out, int n, char * const *fn)
                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]);
-                               abort();
+                               exit(1);
                        }
                        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);
                }
@@ -115,7 +119,7 @@ int bam_merge(int argc, char *argv[])
                case 'n': is_by_qname = 1; break;
                }
        }
-       if (optind + 3 >= argc) {
+       if (optind + 2 >= argc) {
                fprintf(stderr, "Usage: samtools merge [-n] <out.bam> <in1.bam> <in2.bam> [...]\n");
                return 1;
        }
@@ -221,7 +225,7 @@ int bam_sort(int argc, char *argv[])
                }
        }
        if (optind + 2 > argc) {
-               fprintf(stderr, "Usage: samtools sort [-n] [-m <maxMem>] <in.baf> <out.prefix>\n");
+               fprintf(stderr, "Usage: samtools sort [-n] [-m <maxMem>] <in.bam> <out.prefix>\n");
                return 1;
        }
        bam_sort_core(is_by_qname, argv[optind], argv[optind+1], max_mem);