Browse Source

a few fixes to get maq caller working again

remotes/georgeg/no_streams
Artem Tarasov 9 years ago
parent
commit
d2bea0a0da
  1. 6
      bio/bam/pileup.d
  2. 10
      bio/bam/snpcallers/maq.d
  3. 4
      bio/core/tinymap.d

6
bio/bam/pileup.d

@ -177,8 +177,6 @@ struct PileupRead(Read=bio.bam.read.EagerBamRead) {
// find first M/=/X/D operation
auto cigar = _read.cigar;
for (_cur_op_index = 0; _cur_op_index < cigar.length; ++_cur_op_index) {
assertCigarIndexIsValid();
_cur_op = cigar[_cur_op_index];
if (_cur_op.is_reference_consuming) {
if (_cur_op.type != 'N') {
@ -470,7 +468,7 @@ auto takeUntil(alias pred, Range, Sentinel)(Range range, Sentinel sentinel) {
}
auto pileupInstance(alias P, R)(R reads, ulong start_from, ulong end_at, bool skip_zero_coverage) {
auto rs = filter!"!a.is_unmapped"(reads);
auto rs = filter!"a.basesCovered() > 0"(reads);
while (!rs.empty) {
auto r = rs.front;
if (r.position + r.basesCovered() < start_from) {
@ -499,7 +497,7 @@ auto pileupInstance(alias P, R)(R reads, ulong start_from, ulong end_at, bool sk
}
auto pileupColumns(R)(R reads, bool use_md_tag=false, bool skip_zero_coverage=true) {
auto rs = filter!"!a.is_unmapped"(reads);
auto rs = filter!"a.basesCovered() > 0"(reads);
alias typeof(rs) ReadRange;
PileupRange!ReadRange columns;
if (use_md_tag) {

10
bio/bam/snpcallers/maq.d

@ -421,15 +421,15 @@ final class MaqSnpCaller {
_reads = reads; minimum_base_quality = minbq; _findNextValid();
}
ReadBase front() @property const {
ReadBase front() @property {
auto read = _reads.front;
return ReadBase(Base(read.current_base),
min(read.current_base_quality, read.mapping_quality),
read.is_reverse_strand);
}
bool empty() @property const { return _reads.empty; }
bool empty() @property { return _reads.empty; }
void popFront() { _reads.popFront(); _findNextValid(); }
ReadBaseRange save() @property { return ReadBaseRange!R(_reads[], minimum_base_quality); }
ReadBaseRange save() @property { return ReadBaseRange!R(_reads, minimum_base_quality); }
private void _findNextValid() {
while (!_reads.empty &&
@ -505,11 +505,11 @@ final class MaqSnpCaller {
_fetchNextSNP();
}
DiploidCall5 front() @property const {
DiploidCall5 front() @property {
return _front;
}
bool empty() @property const {
bool empty() @property {
return _empty;
}

4
bio/core/tinymap.d

@ -56,7 +56,7 @@ struct TinyMap(K, V, alias TinyMapPolicy=useBitArray) {
/// Indexed access
auto ref V opIndex(Key)(auto ref Key key)
if(is(Key == K))
if(is(Unqual!Key == K))
{
assert(key in this);
return _dict[key.internal_code];
@ -64,7 +64,7 @@ struct TinyMap(K, V, alias TinyMapPolicy=useBitArray) {
/// ditto
auto ref const(V) opIndex(Key)(auto ref Key key) const
if(is(Key == K))
if(is(Unqual!Key == K))
{
assert(key in this);
return _dict[key.internal_code];

Loading…
Cancel
Save