// -*- 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 /// #include "starling/align_path_bam_util.hh" #include using namespace ALIGNPATH; void bam_cigar_to_apath(const uint32_t* bam_cigar, const unsigned n_cigar, path_t& apath){ assert(n_cigar>0); apath.resize(n_cigar); for(unsigned i(0);i>BAM_CIGAR_SHIFT); apath[i].type = static_cast(1+(bam_cigar[i]&BAM_CIGAR_MASK)); } } void apath_to_bam_cigar(const path_t& apath, uint32_t* bam_cigar){ const unsigned as(apath.size()); for(unsigned i(0);i(ps.type)-1)); } } void edit_bam_cigar(const path_t& apath, bam1_t& br){ bam1_core_t& bc(br.core); const int old_n_cigar(bc.n_cigar); const int new_n_cigar(apath.size()); const int delta(4*(new_n_cigar-old_n_cigar)); if(0 != delta) { const int end(bc.l_qname+(4*old_n_cigar)); change_bam_data_segment_len(end,delta,br); bc.n_cigar=new_n_cigar; } //update content of cigar array: apath_to_bam_cigar(apath,bam1_cigar(&br)); }