void junctions_from_alignment(const BowtieHit& spliced_alignment, JunctionSet& junctions) { vector<pair<Junction, JunctionStats> > juncs; junctions_from_spliced_hit(spliced_alignment, juncs); for (size_t i = 0; i < juncs.size(); ++i) { pair<Junction, JunctionStats>& junc = juncs[i]; JunctionSet::iterator itr = junctions.find(junc.first); if (itr != junctions.end()) { JunctionStats& j = itr->second; j.left_extent = max(j.left_extent, junc.second.left_extent); j.right_extent = max(j.right_extent, junc.second.right_extent); j.min_splice_mms = min(j.min_splice_mms, junc.second.min_splice_mms); j.supporting_hits++; } else { assert(junc.first.refid != 0xFFFFFFFF); junctions[junc.first] = junc.second; } } }
/** * Parse the cigar string of a BowtieHit in order to determine the alignment status. */ AlignStatus::AlignStatus(const BowtieHit& bh, const JunctionSet& gtf_junctions) { const vector<CigarOp>& cigar = bh.cigar(); _aligned = cigar.size() > 0; _indelFreeAlignment = true; _unannotatedSpliceFreeAlignment = true; _edit_dist = bh.edit_dist(); int j = bh.left(); for (size_t c = 0 ; c < cigar.size(); ++c) { Junction junc; switch(cigar[c].opcode) { case REF_SKIP: junc.refid = bh.ref_id(); junc.left = j; junc.right = junc.left + cigar[c].length; junc.antisense = bh.antisense_splice(); j += cigar[c].length; if (gtf_junctions.find(junc) == gtf_junctions.end()) _unannotatedSpliceFreeAlignment = false; break; case MATCH: j += cigar[c].length; break; case DEL: j += cigar[c].length; _indelFreeAlignment = false; break; case INS: _indelFreeAlignment = false; break; default: break; } } }