Skip to content

Commit

Permalink
fix const
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiasrausch committed Sep 24, 2024
1 parent accc3c8 commit 1b40aa2
Show file tree
Hide file tree
Showing 13 changed files with 46 additions and 50 deletions.
4 changes: 2 additions & 2 deletions src/asmode.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ namespace torali {
uint32_t sp = 0; // sequence pointer

// Parse the CIGAR
uint32_t* cigar = bam_get_cigar(rec);
const uint32_t* cigar = bam_get_cigar(rec);
for (std::size_t i = 0; i < rec->core.n_cigar; ++i) {
if ((bam_cigar_op(cigar[i]) == BAM_CMATCH) || (bam_cigar_op(cigar[i]) == BAM_CEQUAL) || (bam_cigar_op(cigar[i]) == BAM_CDIFF)) {
sp += bam_cigar_oplen(cigar[i]);
Expand Down Expand Up @@ -229,7 +229,7 @@ namespace torali {
// Get sequence
std::string sequence;
sequence.resize(rec->core.l_qseq);
uint8_t* seqptr = bam_get_seq(rec);
const uint8_t* seqptr = bam_get_seq(rec);
for (int i = 0; i < rec->core.l_qseq; ++i) sequence[i] = "=ACMGRSVTWYHKDBN"[bam_seqi(seqptr, i)];
int32_t readlen = sequence.size();

Expand Down
14 changes: 7 additions & 7 deletions src/assemble.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace torali

template<typename TAlign>
inline void
convertAlignment(std::string const& query, TAlign& align, EdlibAlignMode const modeCode, EdlibAlignResult& cigar) {
convertAlignment(std::string const& query, TAlign& align, EdlibAlignMode const modeCode, EdlibAlignResult const& cigar) {
// Input alignment
TAlign alignIn;
alignIn.resize(boost::extents[align.shape()[0]][align.shape()[1]]);
Expand Down Expand Up @@ -88,7 +88,7 @@ namespace torali
}

inline void
buildSuperstring(std::string const& seqI, std::string const& seqJ, std::string& outStr, EdlibAlignResult& cigar, uint32_t const preI, uint32_t const postI, uint32_t const preJ, uint32_t const postJ) {
buildSuperstring(std::string const& seqI, std::string const& seqJ, std::string& outStr, EdlibAlignResult const& cigar, uint32_t const preI, uint32_t const postI, uint32_t const preJ, uint32_t const postJ) {
int32_t iIdx = 0;
int32_t jIdx = 0;
// prefix
Expand Down Expand Up @@ -135,7 +135,7 @@ namespace torali

template<typename TAlign>
inline void
convertAlignment(std::string const& query, TAlign& align, EdlibAlignMode const modeCode, EdlibAlignResult& cigar, uint32_t const preI, uint32_t const postI, uint32_t const preJ, uint32_t const postJ) {
convertAlignment(std::string const& query, TAlign& align, EdlibAlignMode const modeCode, EdlibAlignResult const& cigar, uint32_t const preI, uint32_t const postI, uint32_t const preJ, uint32_t const postJ) {
// Input alignment
TAlign alignIn;
alignIn.resize(boost::extents[align.shape()[0]][align.shape()[1]]);
Expand Down Expand Up @@ -811,7 +811,7 @@ namespace torali
// Get sequence
std::string sequence;
sequence.resize(rec->core.l_qseq);
uint8_t* seqptr = bam_get_seq(rec);
const uint8_t* seqptr = bam_get_seq(rec);
for (int i = 0; i < rec->core.l_qseq; ++i) sequence[i] = "=ACMGRSVTWYHKDBN"[bam_seqi(seqptr, i)];
int32_t readlen = sequence.size();

Expand Down Expand Up @@ -899,9 +899,9 @@ namespace torali
computeMSA = true;
// Lazy loading of references
if (sndSeq == NULL) {
int32_t seqlen = -1;
std::string tname(hdr->target_name[refIndex2]);
sndSeq = faidx_fetch_seq(fai, tname.c_str(), 0, hdr->target_len[refIndex2], &seqlen);
int32_t seqlen2 = -1;
std::string tname2(hdr->target_name[refIndex2]);
sndSeq = faidx_fetch_seq(fai, tname2.c_str(), 0, hdr->target_len[refIndex2], &seqlen2);
}
}
} else {
Expand Down
10 changes: 5 additions & 5 deletions src/coverage.h
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ namespace torali {
// Count aligned basepair (small InDels)
{
uint32_t rp = 0; // reference pointer
uint32_t* cigar = bam_get_cigar(rec);
const uint32_t* cigar = bam_get_cigar(rec);
for (std::size_t i = 0; i < rec->core.n_cigar; ++i) {
if (bam_cigar_op(cigar[i]) == BAM_CMATCH) {
for(std::size_t k = 0; k<bam_cigar_oplen(cigar[i]);++k) {
Expand All @@ -405,7 +405,7 @@ namespace torali {
bool hasSoftClip = false;
bool hasClip = false;
int32_t leadingSC = 0;
uint32_t* cigar = bam_get_cigar(rec);
const uint32_t* cigar = bam_get_cigar(rec);
for (std::size_t i = 0; i < rec->core.n_cigar; ++i) {
if (bam_cigar_op(cigar[i]) == BAM_CSOFT_CLIP) {
hasClip = true;
Expand Down Expand Up @@ -437,7 +437,7 @@ namespace torali {
// Get sequence
std::string sequence;
sequence.resize(rec->core.l_qseq);
uint8_t* seqptr = bam_get_seq(rec);
const uint8_t* seqptr = bam_get_seq(rec);
for (int i = 0; i < rec->core.l_qseq; ++i) sequence[i] = "=ACMGRSVTWYHKDBN"[bam_seqi(seqptr, i)];
_adjustOrientation(sequence, itBp->bpPoint, itBp->svt);

Expand Down Expand Up @@ -474,7 +474,7 @@ namespace torali {
if (++refAlignedReadCount[file_c][itBp->id] % 2) {
TQuality quality;
quality.resize(rec->core.l_qseq);
uint8_t* qualptr = bam_get_qual(rec);
const uint8_t* qualptr = bam_get_qual(rec);
for (int i = 0; i < rec->core.l_qseq; ++i) quality[i] = qualptr[i];
uint32_t rq = _getAlignmentQual(alignRef, quality);
if (rq >= c.minGenoQual) {
Expand All @@ -487,7 +487,7 @@ namespace torali {
} else {
TQuality quality;
quality.resize(rec->core.l_qseq);
uint8_t* qualptr = bam_get_qual(rec);
const uint8_t* qualptr = bam_get_qual(rec);
for (int i = 0; i < rec->core.l_qseq; ++i) quality[i] = qualptr[i];
uint32_t aq = _getAlignmentQual(alignAlt, quality);
if (aq >= c.minGenoQual) {
Expand Down
4 changes: 2 additions & 2 deletions src/gaf.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ namespace torali
std::vector<int8_t> cigarop;
std::vector<uint32_t> cigarlen;

AlignRecord() : qstart(0), hap('*'), seed(0) {}
AlignRecord(int32_t const q, std::size_t const s) : qstart(q), hap('*'), seed(s) {}
AlignRecord() : qlen(0), qstart(0), qend(0), plen(0), pstart(0), pend(0), matches(0), alignlen(0), mapq(0), strand('*'), hap('*'), seed(0) {}
AlignRecord(int32_t const q, std::size_t const s) : qlen(0), qstart(q), qend(0), plen(0), pstart(0), pend(0), matches(0), alignlen(0), mapq(0), strand('*'), hap('*'), seed(s) {}

bool operator<(const AlignRecord& s2) const {
return ((seed < s2.seed) || ((seed == s2.seed) && (qstart < s2.qstart)));
Expand Down
4 changes: 2 additions & 2 deletions src/gcbias.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ namespace torali
// Sequence
std::string sequence;
sequence.resize(rec->core.l_qseq);
uint8_t* seqptr = bam_get_seq(rec);
const uint8_t* seqptr = bam_get_seq(rec);
for (int i = 0; i < rec->core.l_qseq; ++i) sequence[i] = "=ACMGRSVTWYHKDBN"[bam_seqi(seqptr, i)];

// Reference slice
Expand All @@ -81,7 +81,7 @@ namespace torali
// Percent identity
uint32_t rp = 0; // reference pointer
uint32_t sp = 0; // sequence pointer
uint32_t* cigar = bam_get_cigar(rec);
const uint32_t* cigar = bam_get_cigar(rec);
int32_t matchCount = 0;
int32_t mismatchCount = 0;
for (std::size_t i = 0; i < rec->core.n_cigar; ++i) {
Expand Down
15 changes: 7 additions & 8 deletions src/genotype.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ namespace torali
inline int32_t
_readStart(bam1_t* rec) {
uint32_t rp = rec->core.pos;
uint32_t* cigar = bam_get_cigar(rec);
const uint32_t* cigar = bam_get_cigar(rec);
if (rec->core.n_cigar) {
if ((bam_cigar_op(cigar[0]) == BAM_CSOFT_CLIP) || (bam_cigar_op(cigar[0]) == BAM_CHARD_CLIP)) {
if (rp > bam_cigar_oplen(cigar[0])) rp -= bam_cigar_oplen(cigar[0]);
Expand All @@ -43,7 +43,7 @@ namespace torali
inline int32_t
_readEnd(bam1_t* rec) {
uint32_t rp = rec->core.pos;
uint32_t* cigar = bam_get_cigar(rec);
const uint32_t* cigar = bam_get_cigar(rec);
if (rec->core.n_cigar) {
for (uint32_t i = 0; i < rec->core.n_cigar; ++i) {
if ((bam_cigar_op(cigar[i]) == BAM_CMATCH) || (bam_cigar_op(cigar[i]) == BAM_CEQUAL) || (bam_cigar_op(cigar[i]) == BAM_CDIFF) || (bam_cigar_op(cigar[i]) == BAM_CDEL) || (bam_cigar_op(cigar[i]) == BAM_CREF_SKIP)) rp += bam_cigar_oplen(cigar[i]);
Expand All @@ -61,7 +61,7 @@ namespace torali
uint32_t sp = 0; // sequence pointer

// Parse the CIGAR
uint32_t* cigar = bam_get_cigar(rec);
const uint32_t* cigar = bam_get_cigar(rec);
if (rec->core.n_cigar) {
for (std::size_t i = 0; i < rec->core.n_cigar; ++i) {
if ((bam_cigar_op(cigar[i]) == BAM_CMATCH) || (bam_cigar_op(cigar[i]) == BAM_CEQUAL) || (bam_cigar_op(cigar[i]) == BAM_CDIFF)) {
Expand Down Expand Up @@ -93,7 +93,6 @@ namespace torali
inline void
genotypeLR(TConfig& c, std::vector<StructuralVariantRecord>& svs, TJunctionMap& jctMap, TReadCountMap& covMap) {
typedef std::vector<StructuralVariantRecord> TSVs;
typedef std::vector<uint8_t> TQuality;
if (svs.empty()) return;

// Open file handles
Expand Down Expand Up @@ -136,7 +135,7 @@ namespace torali
boost::posix_time::ptime now = boost::posix_time::second_clock::local_time();
std::cerr << '[' << boost::posix_time::to_simple_string(now) << "] " << "SV annotation" << std::endl;

faidx_t* fai = fai_load(c.genome.string().c_str());
const faidx_t* fai = fai_load(c.genome.string().c_str());
for(int32_t refIndex=0; refIndex < (int32_t) hdr[0]->n_targets; ++refIndex) {
// Fetch breakpoints
typedef std::multimap<int32_t, int32_t> TBreakpointMap;
Expand Down Expand Up @@ -177,7 +176,7 @@ namespace torali
// Annotate coverage
{
uint32_t rp = rec->core.pos; // reference pointer
uint32_t* cigar = bam_get_cigar(rec);
const uint32_t* cigar = bam_get_cigar(rec);
for (std::size_t i = 0; i < rec->core.n_cigar; ++i) {
if ((bam_cigar_op(cigar[i]) == BAM_CMATCH) || (bam_cigar_op(cigar[i]) == BAM_CEQUAL) || (bam_cigar_op(cigar[i]) == BAM_CDIFF)) {
for(uint32_t k = 0; k < bam_cigar_oplen(cigar[i]); ++k, ++rp) {
Expand Down Expand Up @@ -244,8 +243,8 @@ namespace torali
// Load sequence
if (sequence.empty()) {
sequence.resize(rec->core.l_qseq);
uint8_t* seqptr = bam_get_seq(rec);
for (int i = 0; i < rec->core.l_qseq; ++i) sequence[i] = "=ACMGRSVTWYHKDBN"[bam_seqi(seqptr, i)];
const uint8_t* seqptr = bam_get_seq(rec);
for (int ik = 0; ik < rec->core.l_qseq; ++ik) sequence[ik] = "=ACMGRSVTWYHKDBN"[bam_seqi(seqptr, ik)];
}
//std::cerr << hdr[file_c]->target_name[refIndex] << ":" << svs[svid].svStart << "-" << svs[svid].svEnd << "," << svs[svid].svt << "," << (int) (rec->core.flag & BAM_FREVERSE) << "," << ((pos == svs[svid].svStart) ? "Start" : "End") << std::endl;
std::string ref = boost::to_upper_copy(std::string(seq + pos - offset, seq + pos + offset));
Expand Down
4 changes: 2 additions & 2 deletions src/gfa.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ namespace torali
uint32_t mapq;

LinkCargo() {}
LinkCargo(Link const lk) : fromfwd(lk.fromfwd), tofwd(lk.tofwd), from(lk.from), to(lk.to), support(0), mapq(0) {}
LinkCargo(bool const fv, bool const tv, uint32_t const fr, uint32_t tos) : fromfwd(fv), tofwd(tv), from(fr), to(tos), support(0) {}
explicit LinkCargo(Link const lk) : fromfwd(lk.fromfwd), tofwd(lk.tofwd), from(lk.from), to(lk.to), support(0), mapq(0) {}
LinkCargo(bool const fv, bool const tv, uint32_t const fr, uint32_t tos) : fromfwd(fv), tofwd(tv), from(fr), to(tos), support(0), mapq(0) {}

bool operator<(const LinkCargo& l2) const {
return ((from < l2.from) || ((from==l2.from) && (to < l2.to)));
Expand Down
6 changes: 3 additions & 3 deletions src/junction.h
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ namespace torali
uint32_t sp = 0; // sequence pointer

// Parse the CIGAR
uint32_t* cigar = bam_get_cigar(rec);
const uint32_t* cigar = bam_get_cigar(rec);
for (std::size_t i = 0; i < rec->core.n_cigar; ++i) {
if ((bam_cigar_op(cigar[i]) == BAM_CMATCH) || (bam_cigar_op(cigar[i]) == BAM_CEQUAL) || (bam_cigar_op(cigar[i]) == BAM_CDIFF)) {
sp += bam_cigar_oplen(cigar[i]);
Expand Down Expand Up @@ -546,8 +546,8 @@ namespace torali
for(uint32_t svt = 0; svt < altSR.size(); ++svt) {
//std::cerr << '[' << boost::posix_time::to_simple_string(boost::posix_time::second_clock::local_time()) << "] " << "SVT Size: " << svt << ',' << altSR[svt].size() << std::endl;
if (altSR[svt].empty()) continue;
for(uint32_t i = 0; i < altSR[svt].size(); ++i) {
if (validSR.find(altSR[svt][i].id) != validSR.end()) newValidSR.insert(altSR[svt][i].id);
for(uint32_t ik = 0; ik < altSR[svt].size(); ++ik) {
if (validSR.find(altSR[svt][ik].id) != validSR.end()) newValidSR.insert(altSR[svt][ik].id);
}
}
validSR = newValidSR;
Expand Down
6 changes: 3 additions & 3 deletions src/merge.h
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ void _outputSelectedIntervals(MergeConfig& c, TGenomeIntervals const& iSelected,
bcf_update_info_int32(hdr_out, rout, "CIPOS", cipos, 2);
bcf_update_info_int32(hdr_out, rout, "CIEND", ciend, 2);
if (precise) {
int32_t tmpi = srMapQuality;
tmpi = srMapQuality;
bcf_update_info_int32(hdr_out, rout, "SRMAPQ", &tmpi, 1);
bcf_update_info_int32(hdr_out, rout, "INSLEN", &inslenVal, 1);
bcf_update_info_int32(hdr_out, rout, "HOMLEN", &homlenVal, 1);
Expand Down Expand Up @@ -1064,8 +1064,8 @@ int merge(int argc, char **argv) {
uint32_t chunks = ((c.files.size() - 1) / c.chunksize) + 1;
std::vector<boost::filesystem::path> chunkCollect(chunks);
for(uint32_t ic = 0; ic < chunks; ++ic) {
boost::uuids::uuid uuid = boost::uuids::random_generator()();
std::string chunkfile = "chunk" + boost::lexical_cast<std::string>(ic) + "_" + boost::lexical_cast<std::string>(uuid) + ".bcf";
boost::uuids::uuid uuid2 = boost::uuids::random_generator()();
std::string chunkfile = "chunk" + boost::lexical_cast<std::string>(ic) + "_" + boost::lexical_cast<std::string>(uuid2) + ".bcf";
chunkCollect[ic] = chunkfile;
c.files.clear();
for(uint32_t k = ic * c.chunksize; ((k < ((ic+1) * c.chunksize)) && (k < fileRestore.size())); ++k) c.files.push_back(fileRestore[k]);
Expand Down
4 changes: 2 additions & 2 deletions src/shortpe.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ namespace torali
if (svid == (int32_t) svs[svid].id) { // Should be always true
std::string sequence;
sequence.resize(rec->core.l_qseq);
uint8_t* seqptr = bam_get_seq(rec);
const uint8_t* seqptr = bam_get_seq(rec);
for (int i = 0; i < rec->core.l_qseq; ++i) sequence[i] = "=ACMGRSVTWYHKDBN"[bam_seqi(seqptr, i)];

// Adjust orientation
Expand Down Expand Up @@ -318,7 +318,7 @@ namespace torali
uint32_t sp = 0; // sequence pointer

// Parse the CIGAR
uint32_t* cigar = bam_get_cigar(rec);
const uint32_t* cigar = bam_get_cigar(rec);
for (std::size_t i = 0; i < rec->core.n_cigar; ++i) {
if ((bam_cigar_op(cigar[i]) == BAM_CMATCH) || (bam_cigar_op(cigar[i]) == BAM_CEQUAL) || (bam_cigar_op(cigar[i]) == BAM_CDIFF)) {
sp += bam_cigar_oplen(cigar[i]);
Expand Down
8 changes: 4 additions & 4 deletions src/split.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ namespace torali

// Check for single soft-clip
unsigned int numSoftClip = 0;
uint32_t* cigar = bam_get_cigar(rec);
const uint32_t* cigar = bam_get_cigar(rec);
for (unsigned int i = 0; i < rec->core.n_cigar; ++i) {
if (bam_cigar_op(cigar[i]) == BAM_CSOFT_CLIP) {
++numSoftClip;
Expand All @@ -96,7 +96,7 @@ namespace torali
typedef std::vector<uint8_t> TQuality;
TQuality quality;
quality.resize(rec->core.l_qseq);
uint8_t* qualptr = bam_get_qual(rec);
const uint8_t* qualptr = bam_get_qual(rec);
for (int i = 0; i < rec->core.l_qseq; ++i) quality[i] = qualptr[i];

// Get soft-clips
Expand All @@ -114,7 +114,7 @@ namespace torali
else leadingSC = false;
splitPoint = rec->core.pos + alen;
unsigned int qualSum = 0;
for(unsigned int i = alen; i < (alen+clipSize); ++i) qualSum += quality[i];
for(unsigned int ik = alen; ik < (alen+clipSize); ++ik) qualSum += quality[ik];
meanQuality = qualSum / clipSize;
}
}
Expand Down Expand Up @@ -462,7 +462,7 @@ namespace torali


inline void
editDistanceVec(std::string const& seqI, std::string const& seqJ, EdlibAlignResult& cigar, std::vector<uint32_t>& dist) {
editDistanceVec(std::string const& seqI, std::string const& seqJ, EdlibAlignResult const& cigar, std::vector<uint32_t>& dist) {
// Fill edit distance vector
dist.resize(seqI.size());
std::fill(dist.begin(), dist.end(), 0);
Expand Down
2 changes: 1 addition & 1 deletion src/tags.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ namespace torali {
// Initialize breakpoint
template<typename TBreakpoint>
inline void
_initBreakpoint(bam_hdr_t* hdr, TBreakpoint& bp, int32_t const boundary, int32_t const svt) {
_initBreakpoint(bam_hdr_t const* hdr, TBreakpoint& bp, int32_t const boundary, int32_t const svt) {
if (_translocation(svt)) {
bp.svStartBeg = std::max(0, bp.svStart - boundary);
bp.svStartEnd = std::min((int32_t) (hdr->target_len[bp.chr]), bp.svStart + boundary);
Expand Down
15 changes: 6 additions & 9 deletions src/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ namespace torali


inline uint32_t
infixStart(EdlibAlignResult& cigar) {
infixStart(EdlibAlignResult const& cigar) {
int32_t tIdx = cigar.endLocations[0];
for (int32_t i = 0; i < cigar.alignmentLength; i++) {
if (cigar.alignment[i] != EDLIB_EDOP_INSERT) tIdx--;
Expand All @@ -83,12 +83,12 @@ namespace torali
}

inline uint32_t
infixEnd(EdlibAlignResult& cigar) {
infixEnd(EdlibAlignResult const& cigar) {
return cigar.endLocations[0];
}

inline void
printAlignmentPretty(std::string const& query, std::string const& target, EdlibAlignMode const modeCode, EdlibAlignResult& align) {
printAlignmentPretty(std::string const& query, std::string const& target, EdlibAlignMode const modeCode, EdlibAlignResult const& align) {
int32_t tIdx = -1;
int32_t qIdx = -1;
if (modeCode == EDLIB_MODE_HW) {
Expand Down Expand Up @@ -130,7 +130,7 @@ namespace torali
}

inline void
printAlignment(std::string const& seqI, std::string const& seqJ, EdlibAlignMode const modeCode, EdlibAlignResult& cigar) {
printAlignment(std::string const& seqI, std::string const& seqJ, EdlibAlignMode const modeCode, EdlibAlignResult const& cigar) {
int32_t tIdx = -1;
int32_t qIdx = -1;
uint32_t missingEnd = 0;
Expand All @@ -142,9 +142,6 @@ namespace torali
if (cigar.alignment[i] != EDLIB_EDOP_INSERT) tIdx--;
}
if (tIdx >= 0) missingStart = tIdx + 1;
}
// infix alignment, fix start
if ((modeCode == EDLIB_MODE_HW) || (modeCode == EDLIB_MODE_SHW)) {
if (missingStart) {
for (uint32_t j = 0; j < missingStart; ++j) std::cerr << '-';
}
Expand Down Expand Up @@ -428,7 +425,7 @@ namespace torali
}

inline uint32_t sequenceLength(bam1_t const* rec) {
uint32_t* cigar = bam_get_cigar(rec);
const uint32_t* cigar = bam_get_cigar(rec);
uint32_t slen = 0;
for (uint32_t i = 0; i < rec->core.n_cigar; ++i)
if ((bam_cigar_op(cigar[i]) == BAM_CMATCH) || (bam_cigar_op(cigar[i]) == BAM_CEQUAL) || (bam_cigar_op(cigar[i]) == BAM_CDIFF) || (bam_cigar_op(cigar[i]) == BAM_CINS) || (bam_cigar_op(cigar[i]) == BAM_CSOFT_CLIP) || (bam_cigar_op(cigar[i]) == BAM_CHARD_CLIP)) slen += bam_cigar_oplen(cigar[i]);
Expand All @@ -442,7 +439,7 @@ namespace torali
}

inline uint32_t alignmentLength(bam1_t const* rec) {
uint32_t* cigar = bam_get_cigar(rec);
const uint32_t* cigar = bam_get_cigar(rec);
uint32_t alen = 0;
for (uint32_t i = 0; i < rec->core.n_cigar; ++i)
if ((bam_cigar_op(cigar[i]) == BAM_CMATCH) || (bam_cigar_op(cigar[i]) == BAM_CEQUAL) || (bam_cigar_op(cigar[i]) == BAM_CDIFF) || (bam_cigar_op(cigar[i]) == BAM_CDEL) || (bam_cigar_op(cigar[i]) == BAM_CREF_SKIP)) alen += bam_cigar_oplen(cigar[i]);
Expand Down

0 comments on commit 1b40aa2

Please sign in to comment.