// -*- mode: c++; indent-tabs-mode: nil; -*- // // Copyright 2009 Illumina, Inc. // // This software is covered by the "Illumina Genome Analyzer Software // License Agreement" and the "Illumina Source Code License Agreement", // and certain third party copyright/licenses, and any user of this // source file is bound by the terms therein (see accompanying files // Illumina_Genome_Analyzer_Software_License_Agreement.pdf and // Illumina_Source_Code_License_Agreement.pdf and third party // copyright/license notices). // // /// \file /// /// \author Chris Saunders /// #ifndef __INDEL_UTIL_HH #define __INDEL_UTIL_HH #include "indel.hh" #include "depth_buffer.hh" #include "blt_util/pos_range.hh" #include "starling/starling_shared.hh" // do these two indels overlap?: bool is_indel_conflict(const indel_key& ik1, const indel_key& ik2); bool is_range_intersect_indel_breakpoints(const known_pos_range read_pr, const indel_key& ik); // is an indel treated as a candidate for genotype calling and // realignment or as a "private" (ie. noise) indel? // inline bool is_candidate_indel(const starling_options& client_opt, const depth_buffer& db, const indel_key& ik, const indel_data& id){ if(not id.is_candidate_indel_cached) { const int n_reads(static_cast(id.all_read_ids.size())); const bool is_min_reads(n_reads >= client_opt.min_candidate_indel_reads); // note estdepth is based on genomic reads only, so readfrac can be > 1: // static const unsigned one(1); // <- get around type-mismatch error in std::max() below const unsigned estdepth(std::max(one,db.val(ik.pos-1))); const double readfrac(static_cast(n_reads)/static_cast(estdepth)); double min_frac(client_opt.min_candidate_indel_read_frac); if(static_cast(ik.length) <= client_opt.max_small_candidate_indel_size) { min_frac=std::max(min_frac,client_opt.min_small_candidate_indel_read_frac); } const bool is_min_frac(readfrac >= min_frac); id.is_candidate_indel=(is_min_reads and is_min_frac); id.is_candidate_indel_cached=true; } return id.is_candidate_indel; } // is an indel either a candidate indel or in at least one of the // discovery alignments for this read? // inline bool is_usable_indel(const starling_options& client_opt, const depth_buffer& db, const indel_key& ik, const indel_data& id, const align_id_t read_id){ return (is_candidate_indel(client_opt,db,ik,id) or (id.all_read_ids.count(read_id)>0) or (id.submap_read_ids.count(read_id)>0)); } #endif