X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=bam_sort.c;h=03196a8bab9892b5022f477044520c769b2ae557;hb=64fd9dc2c049f72448ff02f5f5c180dfdfe87c60;hp=bbb8f2dbaf0a48b211c789746cec0c3e836371c8;hpb=4c016a8c036a60ae84e7d59d0cb6f49aab35f534;p=samtools.git diff --git a/bam_sort.c b/bam_sort.c index bbb8f2d..03196a8 100644 --- a/bam_sort.c +++ b/bam_sort.c @@ -321,7 +321,7 @@ static inline int bam1_lt(const bam1_p a, const bam1_p b) if (g_is_by_qname) { int t = strnum_cmp(bam1_qname(a), bam1_qname(b)); return (t < 0 || (t == 0 && (((uint64_t)a->core.tid<<32|(a->core.pos+1)) < ((uint64_t)b->core.tid<<32|(b->core.pos+1))))); - } else return (((uint64_t)a->core.tid<<32|(a->core.pos+1)) < ((uint64_t)b->core.tid<<32|(b->core.pos+1))); + } else return (((uint64_t)a->core.tid<<32|(a->core.pos+1)<<1|bam1_strand(a)) < ((uint64_t)b->core.tid<<32|(b->core.pos+1)<<1|bam1_strand(b))); } KSORT_INIT(sort, bam1_p, bam1_lt)