Skip to content

Commit 639a99d

Browse files
committed
Merge branch 'master' of github.com:biod/sambamba
2 parents 3a28970 + d4d46c4 commit 639a99d

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

sambamba/markdup.d

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -558,14 +558,14 @@ auto readPairsAndFragments(alias hashFunc=simpleHash, R)
558558
(reads, table_size_log2, overflow_list_size, tmp_dir, task_pool);
559559
}
560560

561-
/////////////////////////////////////////////////////////////////////////////////
562-
/// no more than 32767 libraries and 16383 reference sequences are supported ////
563-
/////////////////////////////////////////////////////////////////////////////////
561+
///////////////////////////////////////////////////////////////////////////////////////////
562+
/// no more than 536 million libraries and 2 billion reference sequences are supported ////
563+
///////////////////////////////////////////////////////////////////////////////////////////
564564

565565
// 8 bytes
566566
struct SingleEndBasicInfo {
567-
mixin(bitfields!(short, "library_id", 16,
568-
ushort, "ref_id", 14,
567+
mixin(bitfields!(int, "library_id", 30,
568+
uint, "ref_id", 32,
569569
ubyte, "reversed", 1,
570570
ubyte, "paired", 1));
571571
int coord;
@@ -575,7 +575,7 @@ struct SingleEndBasicInfo {
575575
reversed == other.reversed && library_id == other.library_id;
576576
}
577577
}
578-
static assert(SingleEndBasicInfo.sizeof == 8);
578+
static assert(SingleEndBasicInfo.sizeof == 16);
579579

580580
struct SingleEndInfo {
581581
SingleEndBasicInfo basic_info;
@@ -585,13 +585,13 @@ struct SingleEndInfo {
585585
}
586586

587587
struct PairedEndsInfo {
588-
mixin(bitfields!(short, "library_id", 16,
589-
ushort, "ref_id1", 14,
588+
mixin(bitfields!(long, "library_id", 30,
589+
uint, "ref_id1", 32,
590590
ubyte, "reversed1", 1,
591591
ubyte, "reversed2", 1));
592592
int coord1;
593593
int coord2;
594-
ushort ref_id2;
594+
uint ref_id2;
595595

596596
uint score; // sum of base qualities that are >= 15
597597
ulong idx1, idx2;
@@ -601,7 +601,7 @@ struct PairedEndsInfo {
601601
// HACK! HACK! HACK! use the fact that the structures are almost
602602
// the same except the one bit meaning 'paired' instead of 'reversed2'.
603603
auto p = cast(ubyte*)(&result);
604-
p[0 .. 8] = (cast(ubyte*)(&this))[0 .. 8];
604+
p[0 .. 16] = (cast(ubyte*)(&this))[0 .. 16];
605605
result.paired = true;
606606
return result;
607607
}
@@ -675,7 +675,7 @@ class ReadGroupIndex {
675675
}
676676
++i;
677677
}
678-
enforce(n_libs <= 32767, "More than 32767 libraries are unsupported");
678+
enforce(n_libs <= 536870911, "More than 536870911 libraries are unsupported");
679679
}
680680

681681
/// -1 if read group with such name is not found in the header
@@ -762,6 +762,7 @@ SingleEndBasicInfo basicInfo(E)(auto ref E e) {
762762
bool samePosition(E1, E2)(auto ref E1 e1, auto ref E2 e2) {
763763
static if (is(E1 == PairedEndsInfo) && is(E2 == PairedEndsInfo)) {
764764
return *cast(ulong*)(&e1) == *cast(ulong*)(&e2) &&
765+
e1.coord1 == e2.coord1 &&
765766
e1.ref_id2 == e2.ref_id2 && e1.coord2 == e2.coord2;
766767
} else {
767768
return basicInfo(e1).samePosition(basicInfo(e2));
@@ -1232,7 +1233,6 @@ int markdup_main(string[] args) {
12321233
// Set up the BAM reader and pass in the thread pool
12331234
auto bam = new MultiBamReader(args[1 .. $-1], taskPool);
12341235
auto n_refs = bam.reference_sequences.length;
1235-
enforce(n_refs < 16384, "More than 16383 reference sequences are unsupported");
12361236

12371237
auto rg_index = new ReadGroupIndex(bam.header);
12381238

0 commit comments

Comments
 (0)