void addSupplementaryAlignmentEvidence( bam_record& bamRead, const std::string& svStr) { static const char svtag[] = {'S','A'}; bam_aux_append(bamRead.get_data(),svtag,'Z',(svStr.size()+1), (const uint8_t*)(svStr.c_str())); }
void buildTestBamRecord( bam_record& bamRead, int targetID, int pos, int mateTargetID, int matePos, int fragmentSize, int mapQ, std::string cigarString, std::string querySeq) { bam1_t& bamData(*(bamRead.get_data())); // set qname { edit_bam_qname("buildTestBamRecord", bamData); } // set CIGAR { if (cigarString.empty()) { cigarString = std::to_string(fragmentSize) + "M"; } ALIGNPATH::path_t inputPath; cigar_to_apath(cigarString.c_str(), inputPath); edit_bam_cigar(inputPath, bamData); } // set read and qual { if ( querySeq.empty() ) { querySeq = std::string(fragmentSize,'A'); } const unsigned querySize(querySeq.length()); // initialize test qual array to all Q30's: std::unique_ptr<uint8_t[]> qual(new uint8_t[querySize]); for (unsigned i(0); i<querySize; ++i) { qual[i] = 30; } edit_bam_read_and_quality(querySeq.c_str(), qual.get(), bamData); } // Set some defaults for the read bamRead.toggle_is_paired(); bamRead.toggle_is_mate_fwd_strand(); bamData.core.pos = pos; bamData.core.isize = fragmentSize; bamData.core.qual = mapQ; bamRead.set_target_id(targetID); // Set mate info bamData.core.mtid = mateTargetID; bamData.core.mpos = matePos; static const char nhTag[] = {'N','H'}; static const char nmTag[] = {'N','M'}; static const char rgTag[] = {'R','G'}; bam_aux_append_unsigned(bamData, nhTag, 1); bam_aux_append_unsigned(bamData, nmTag, 1); bam_aux_append_unsigned(bamData, rgTag, 1); }