本文整理汇总了C++中SamRecord::set0BasedPosition方法的典型用法代码示例。如果您正苦于以下问题:C++ SamRecord::set0BasedPosition方法的具体用法?C++ SamRecord::set0BasedPosition怎么用?C++ SamRecord::set0BasedPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SamRecord
的用法示例。
在下文中一共展示了SamRecord::set0BasedPosition方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: softClip
// Soft clip the record from the front and/or the back.
SamFilter::FilterStatus SamFilter::softClip(SamRecord& record,
int32_t numFrontClips,
int32_t numBackClips)
{
//////////////////////////////////////////////////////////
Cigar* cigar = record.getCigarInfo();
FilterStatus status = NONE;
int32_t startPos = record.get0BasedPosition();
CigarRoller updatedCigar;
status = softClip(*cigar, numFrontClips, numBackClips,
startPos, updatedCigar);
if(status == FILTERED)
{
/////////////////////////////
// The entire read is clipped, so rather than clipping it,
// filter it out.
filterRead(record);
return(FILTERED);
}
else if(status == CLIPPED)
{
// Part of the read was clipped, and now that we have
// an updated cigar, update the read.
record.setCigar(updatedCigar);
// Update the starting position.
record.set0BasedPosition(startPos);
}
return(status);
}
示例2: processRecord
//.........这里部分代码省略.........
);
// convert alignment to cigar
ref_shift = roll_cigar (roller, batches_, bno, clean_len, clips, qry_off, ref_off);
}
break;
case ContalignParams::POLY:
{
new_score = contalign_.align_band (
clean_read, // xseq
clean_len, // xlen
ref_buffer_, // yseq
ref_len, // ylen
0, // xpos
0, // ypos
std::max (clean_len, ref_len), // segment length
qry_ins + band_width_, // width_left
false, // unpack
ref_ins + band_width_, // width_right - forces to width_left
true, // to_beg
true // to_end
);
unsigned bno = contalign_.backtrace (
batches_, // BATCH buffer
max_batch_no_, // size of BATCH buffer
false, // fill the BATCH array in reverse direction
ref_ins + band_width_ // width
);
// convert alignment to cigar
ref_shift = roll_cigar (roller, batches_, bno, clean_len, clips, qry_off, ref_off);
}
break;
default:
break;
}
++realigned_cnt_;
// compare original and new cigar (and location)
if (ref_shift || !(*cigar_p == roller))
{
// save original cigar and position for reporting
std::string orig_cigar_str;
rec_.getCigarInfo ()->getCigarString (orig_cigar_str);
int32_t prior_pos = rec_.get0BasedPosition ();
// replace cigar
rec_.setCigar (roller);
++ modified_cnt_;
// update pos_adjusted_cnt if position changed
if (ref_shift != 0)
{
myassert (prior_pos + ref_shift >= 0);
rec_.set0BasedPosition (prior_pos + ref_shift);
++ pos_adjusted_cnt_;
}
if (log_diff_)
{
const unsigned MAX_BATCH_PRINTED = 100;
BATCH batches [MAX_BATCH_PRINTED];
std::string new_cigar_str;
unsigned bno;
int swscore;
rec_.getCigarInfo ()->getCigarString (new_cigar_str);
if (!log_base_ && !log_matr_)
logfile_ << "Record " << read_cnt_ << ": " << rec_.getReadName () << " (" << rec_.getReadLength () << " bases)\n";
logfile_ << " ORIG ALIGNMENT:" << std::right << std::setw (9) << prior_pos+1 << "->" << orig_cigar_str << "\n";
bno = cigar_to_batches (orig_cigar_str, batches, MAX_BATCH_PRINTED);
swscore = align_score (batches, bno, clean_read, ref_buffer_, p_->gip (), p_->gep (), p_->mat (), p_->mis ());
print_batches (clean_read, clean_len, false, ref_buffer_, ref_len, false, batches, bno, logfile_, false, prior_pos + clips.soft_beg_, clips.soft_beg_, 0, 160);
logfile_ << "\n 'classic' SW score is " << swscore << "\n";
logfile_ << " NEW ALIGNMENT:" << std::right << std::setw (9) << rec_.get1BasedPosition () << "->" << new_cigar_str << std::endl;
bno = cigar_to_batches (new_cigar_str, batches, MAX_BATCH_PRINTED);
swscore = align_score (batches, bno, clean_read + qry_off, ref_buffer_ + ref_off, p_->gip (), p_->gep (), p_->mat (), p_->mis ());
print_batches (clean_read + qry_off, clean_len - qry_off, false, ref_buffer_ + ref_off, ref_len - ref_off, false, batches, bno, logfile_, false, prior_pos + clips.soft_beg_ + ref_off, clips.soft_beg_ + qry_off, 0, 160);
logfile_ << "\n 'classic' SW score is " << swscore;
logfile_ << "\n alternate (context-aware) score is " << new_score << ", used bandwidth left: " << qry_ins + band_width_ << ", right: " << ref_ins + band_width_ << "\n" << std::endl;
}
else if (log_base_)
{
logfile_ << "Recomputed alignment differs from original:\n";
logfile_ << " ORIG ALIGNMENT:" << std::right << std::setw (9) << prior_pos+1 << "->" << orig_cigar_str << "\n";
std::string new_cigar_str;
rec_.getCigarInfo ()->getCigarString (new_cigar_str);
logfile_ << " NEW ALIGNMENT:" << std::right << std::setw (9) << rec_.get1BasedPosition () << "->" << new_cigar_str << "\n" << std::endl;
}
}
else
{
if (log_base_)
{
logfile_ << "Recomputed alignment matches the original:\n";
std::string orig_cigar_str;
rec_.getCigarInfo ()->getCigarString (orig_cigar_str);
int32_t prior_pos = rec_.get0BasedPosition ();
logfile_ << " " << std::right << std::setw (9) << prior_pos+1 << "->" << orig_cigar_str << "\n" << std::endl;
}
}
return true;
}