本文整理汇总了C++中SamRecord::getFlag方法的典型用法代码示例。如果您正苦于以下问题:C++ SamRecord::getFlag方法的具体用法?C++ SamRecord::getFlag怎么用?C++ SamRecord::getFlag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SamRecord
的用法示例。
在下文中一共展示了SamRecord::getFlag方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: writeFastQ
void Bam2FastQ::handlePairedRN(SamRecord& samRec)
{
static SamRecord* prevRec = NULL;
static std::string prevRN = "";
if(prevRec == NULL)
{
prevRec = &samRec;
}
else
{
if(strcmp(prevRec->getReadName(), samRec.getReadName()) != 0)
{
// Read Name does not match, error, did not find pair.
std::cerr << "Paired Read, " << prevRec->getReadName()
<< " but couldn't find mate, so writing as "
<< "unpaired (single-ended)\n";
++myNumMateFailures;
writeFastQ(*prevRec, myUnpairedFile,
myUnpairedFileNameExt);
// Save this record to check against the next one.
prevRec = &samRec;
}
else
{
// Matching ReadNames.
// Found the mate.
++myNumPairs;
// Check which is the first in the pair.
if(SamFlag::isFirstFragment(samRec.getFlag()))
{
if(SamFlag::isFirstFragment(prevRec->getFlag()))
{
std::cerr << "Both reads of " << samRec.getReadName()
<< " are first fragment, so "
<< "splitting one to be in the 2nd fastq.\n";
}
writeFastQ(samRec, myFirstFile, myFirstFileNameExt,
myFirstRNExt.c_str());
writeFastQ(*prevRec, mySecondFile, mySecondFileNameExt,
mySecondRNExt.c_str());
}
else
{
if(!SamFlag::isFirstFragment(prevRec->getFlag()))
{
std::cerr << "Neither read of " << samRec.getReadName()
<< " are first fragment, so "
<< "splitting one to be in the 2nd fastq.\n";
}
writeFastQ(*prevRec, myFirstFile, myFirstFileNameExt, myFirstRNExt.c_str());
writeFastQ(samRec, mySecondFile, mySecondFileNameExt, mySecondRNExt.c_str());
}
// No previous record.
prevRec = NULL;
}
}
}
示例2: getFlankingCount
int Likelihood::getFlankingCount( string & chr, int pos )
{
bool status = bam.SetReadSection( chr.c_str(), pos - avr_read_length * 2, pos + avr_read_length/2 );
if (!status)
return 0;
int n = 0;
SamRecord rec;
while(bam.ReadRecord(bam_header, rec)) {
if ( !(rec.getFlag() & 0x2) )
continue;
if (IsSupplementary(rec.getFlag()))
continue;
if (rec.getReadLength() < avr_read_length / 3)
continue;
if (rec.getMapQuality() < MIN_QUALITY)
continue;
if (rec.get1BasedPosition() + MIN_CLIP/2 <= pos && rec.get1BasedAlignmentEnd() - MIN_CLIP/2 >= pos )
n++;
}
return n;
}
示例3: filterRead
void SamFilter::filterRead(SamRecord& record)
{
// Filter the read by marking it as unmapped.
uint16_t flag = record.getFlag();
SamFlag::setUnmapped(flag);
// Clear N/A flags.
flag &= ~SamFlag::PROPER_PAIR;
flag &= ~SamFlag::SECONDARY_ALIGNMENT;
flag &= ~SamFlag::SUPPLEMENTARY_ALIGNMENT;
record.setFlag(flag);
// Clear Cigar
record.setCigar("*");
// Clear mapping quality
record.setMapQuality(0);
}
示例4: ifprintf
void Bam2FastQ::writeFastQ(SamRecord& samRec, IFILE filePtr,
const char* readNameExt)
{
static int16_t flag;
static std::string sequence;
static String quality;
if(filePtr == NULL)
{
return;
}
flag = samRec.getFlag();
const char* readName = samRec.getReadName();
sequence = samRec.getSequence();
quality = samRec.getQuality();
if(SamFlag::isReverse(flag) && myReverseComp)
{
// It is reverse, so reverse compliment the sequence
BaseUtilities::reverseComplement(sequence);
// Reverse the quality.
quality.Reverse();
}
else
{
// Ensure it is all capitalized.
int seqLen = sequence.size();
for (int i = 0; i < seqLen; i++)
{
sequence[i] = (char)toupper(sequence[i]);
}
}
if(myRNPlus)
{
ifprintf(filePtr, "@%s%s\n%s\n+%s%s\n%s\n", readName, readNameExt,
sequence.c_str(), readName, readNameExt, quality.c_str());
}
else
{
ifprintf(filePtr, "@%s%s\n%s\n+\n%s\n", readName, readNameExt,
sequence.c_str(), quality.c_str());
}
// Release the record.
myPool.releaseRecord(&samRec);
}
示例5: verify
bool Demux::verify(){ //at least one decoy should be present
BamReader bamReader(bamFilePath);
SamRecord samRecord;
int verifiedDecoys = 0;
while ( bamReader.getNextRecord(samRecord)) {
string recordName(samRecord.getReadName());
recordName = cHandler.decrypt(recordName);
//clean record name
int len=recordName.find("$");
recordName=recordName.substr(0,len);
//clean ended
if (isDecoy(recordName)){
char decoyChromosome[2][20];
int decoyLocation[2];
int decoyJobID;
sscanf( recordName.c_str(),"DECOY.%[^.].%d_%[^.].%d.%d",
decoyChromosome[0], decoyLocation,
decoyChromosome[1], decoyLocation + 1, &decoyJobID);
int pair = !SamFlag::isFirstFragment(samRecord.getFlag());
if (strcmp(decoyChromosome[pair],samRecord.getReferenceName())){
cout << "Chromosome mismatch\n";
cout << "Expected: " << decoyChromosome[pair] << endl;
cout << "Got: " << samRecord.getReferenceName() << endl;
return false;
}
if ( decoyLocation[pair] != samRecord.get0BasedPosition()){
cout << "Position mismatch\n";
cout << "Expected: " << decoyLocation[pair] << endl;
cout << "Got: " << samRecord.get0BasedPosition() << endl;
return false;
}
if (decoyJobID != jobID){
cout << "Job ID mismatch\n";
cout << "Expected: " << decoyJobID << endl;
cout << "Got: " << jobID << endl;
return false;
}
verifiedDecoys++;
}
}
if (verifiedDecoys)
return true;
else
return false;
}
示例6: CalcClusters
void GenomeRegionSeqStats::CalcClusters(String &bamFile, int minMapQuality)
{
SamFile sam;
SamRecord samRecord;
SamFileHeader samHeader;
if(!sam.OpenForRead(bamFile.c_str()))
error("Open BAM file %s failed!\n", bamFile.c_str());
if(!sam.ReadHeader(samHeader)) {
error("Read BAM file header %s failed!\n", bamFile.c_str());
}
if(depth.size()==0) depth.resize(referencegenome.sequenceLength());
String contigLabel;
uint32_t start;
uint32_t gstart;
Reset();
while(sam.ReadRecord(samHeader, samRecord))
{
nReads++;
if(samRecord.getFlag() & SamFlag::UNMAPPED) nUnMapped++;
if(samRecord.getMapQuality() < minMapQuality) continue;
CigarRoller cigar(samRecord.getCigar());
int nonClipSequence = 0;
if(cigar.size()!=0 && cigar[0].operation==Cigar::softClip)
nonClipSequence = cigar[0].count;
contigLabel = samRecord.getReferenceName();
start = nonClipSequence + samRecord.get0BasedPosition(); // start is 0-based
gstart = referencegenome.getGenomePosition(contigLabel.c_str(), start);
if(IsInRegions(contigLabel, start, start+samRecord.getReadLength())) continue;
for(uint32_t i=gstart; i<gstart+samRecord.getReadLength(); i++)
if(depth[i]<MAXDP)
depth[i]++;
nMappedOutTargets++;
}
}
示例7: setNewCluster
void Sites::setNewCluster( vector<bool> & is_in_coord, SingleSite & new_site, SamRecord & rec )
{
if (is_in_coord.size() != NMEI)
morphError("[Sites::setNewCluster] is_in_coord size error");
// set info
new_site.breakp = getEstimatedBreakPoint(rec);
new_site.rcount = 1;
new_site.evidence = 1;
for(int m=0; m<NMEI; m++) {
new_site.left[m] = 0;
new_site.right[m] = 0;
}
new_site.left_clip_only = 1;
new_site.right_clip_only = 1;
new_site.depth = current_depth;
new_site.depth_add = 1;
// set position & mtype
if ( rec.getFlag() & 0x10 ) { // right anchor
new_site.start = rec.get1BasedPosition();
new_site.end = rec.get1BasedAlignmentEnd();
Cigar * myCigar = rec.getCigarInfo();
int begin_clip = myCigar->getNumBeginClips();
if ( begin_clip < MIN_CLIP/2)
new_site.right_clip_only = 0;
for(int m=0; m<NMEI; m++) {
if (is_in_coord[m])
new_site.right[m] = 1;
}
}
else {
new_site.start = rec.get1BasedPosition();
new_site.end = rec.get1BasedAlignmentEnd();
Cigar * myCigar = rec.getCigarInfo();
int end_clip = myCigar->getNumEndClips();
if (end_clip < MIN_CLIP/2)
new_site.left_clip_only = 0;
for(int m=0; m<NMEI; m++) {
if (is_in_coord[m])
new_site.left[m] = 1;
}
}
}
示例8: addToCurrentCluster
void Sites::addToCurrentCluster( vector<bool> & is_in_coord, SingleSite & new_site, SamRecord & rec )
{
if (is_in_coord.size() != NMEI)
morphError("[Sites::setNewCluster] is_in_coord size error");
// update breakpoint
int old_evi = new_site.evidence;
float a1 = (float)1 / float(old_evi+1);
int ep = getEstimatedBreakPoint(rec);
new_site.breakp = round( a1 * (float)ep + (float)new_site.breakp * (1-a1));
new_site.evidence++;
// update position
if (rec.get1BasedPosition() < new_site.start)
new_site.start = rec.get1BasedPosition();
else if (rec.get1BasedAlignmentEnd() > new_site.end)
new_site.end = rec.get1BasedAlignmentEnd();
// update info
if (rec.getFlag() & 0x10) {
if (new_site.right_clip_only) {
Cigar * myCigar = rec.getCigarInfo();
int begin_clip = myCigar->getNumBeginClips();
if ( begin_clip < MIN_CLIP/2)
new_site.right_clip_only = 0;
}
for(int m=0; m<NMEI; m++) {
if (is_in_coord[m])
new_site.right[m]++;
}
}
else {
if (new_site.left_clip_only) {
Cigar * myCigar = rec.getCigarInfo();
int end_clip = myCigar->getNumEndClips();
if (end_clip < MIN_CLIP/2)
new_site.left_clip_only = 0;
}
for( int m=0; m<NMEI; m++) {
if (is_in_coord[m])
new_site.left[m]++;
}
}
}
示例9: getEstimatedBreakPoint
// given mapping start position
// if anchor on left
// expected_breakp = position + avr_ins_size / 2;
// if anchor on right
// expected_breakp = position + read_length - avr_ins_size / 2;
// key = round( expected_breakp / WIN )
int Sites::getEstimatedBreakPoint( SamRecord & rec )
{
int ep;
int clen = GetMaxClipLen(rec);
if ( !rec.getFlag() & 0x10 ) { // left anchor
if (clen < -MIN_CLIP/2) // end clip of anchor decides position
ep = rec.get1BasedAlignmentEnd();
else
ep = rec.get1BasedPosition() + avr_ins_size / 3;
}
else { // right anchor
if (clen > MIN_CLIP/2)
ep = rec.get1BasedPosition();
else
ep = rec.get1BasedPosition() + avr_read_length - avr_ins_size / 3;
}
return ep;
}
示例10: CalcRegionStats
void GenomeRegionSeqStats::CalcRegionStats(String &bamFile)
{
SamFile sam;
SamRecord samRecord;
SamFileHeader samHeader;
if(!sam.OpenForRead(bamFile.c_str()))
error("Open BAM file %s failed!\n", bamFile.c_str());
if(!sam.ReadHeader(samHeader)) {
error("Read BAM file header %s failed!\n", bamFile.c_str());
}
String contigLabel;
int start, end;
Reset();
while(sam.ReadRecord(samHeader, samRecord))
{
nReads++;
if(samRecord.getFlag() & SamFlag::UNMAPPED) nUnMapped++;
if(contigFinishedCnt>=contigs.size()) continue;
CigarRoller cigar(samRecord.getCigar());
int nonClipSequence = 0;
if(cigar.size()!=0 && cigar[0].operation==Cigar::softClip)
nonClipSequence = cigar[0].count;
contigLabel = samRecord.getReferenceName();
start = nonClipSequence + samRecord.get0BasedPosition(); // start is 0-based
end = start + samRecord.getReadLength() - 1;
if(UpdateRegionStats(contigLabel, start, end)) nMapped2Targets++;
}
CalcRegionReadCountInGCBins();
CalcGroupReadCountInGCBins();
std::cout << "Total reads : " << nReads << std::endl;
}
示例11: getGenomicCoordinate
// make a 64-bit genomic coordinate [24bit-chr][32bit-pos][8bit-orientation]
uint64_t getGenomicCoordinate(SamRecord& r) {
// 64bit string consisting of
// 24bit refID, 32bit pos, 8bit orientation
if ( ( r.getReferenceID() < 0 ) || ( r.get0BasedPosition() < 0 ) ) {
return UNMAPPED_GENOMIC_COORDINATE;
}
else {
return ( ( static_cast<uint64_t>(r.getReferenceID()) << 40 ) | ( static_cast<uint64_t>(r.get0BasedPosition()) << 8 ) | static_cast<uint64_t>( r.getFlag() & 0x0010 ) );
}
}
示例12: if
//.........这里部分代码省略.........
if(myFirstFile == NULL)
{
std::cerr << "Failed to open " << firstOut
<< " so can't convert bam2FastQ.\n";
return(-1);
}
if(mySecondFile == NULL)
{
std::cerr << "Failed to open " << secondOut
<< " so can't convert bam2FastQ.\n";
return(-1);
}
}
if((readName) || (strcmp(mySamHeader.getSortOrder(), "queryname") == 0))
{
readName = true;
}
else
{
// defaulting to coordinate sorted.
samIn.setSortedValidation(SamFile::COORDINATE);
}
// Setup the '=' translation if the reference was specified.
if(!refFile.IsEmpty())
{
GenomeSequence* refPtr = new GenomeSequence(refFile);
samIn.SetReadSequenceTranslation(SamRecord::BASES);
samIn.SetReference(refPtr);
}
SamRecord* recordPtr;
int16_t samFlag;
SamStatus::Status returnStatus = SamStatus::SUCCESS;
while(returnStatus == SamStatus::SUCCESS)
{
recordPtr = myPool.getRecord();
if(recordPtr == NULL)
{
// Failed to allocate a new record.
throw(std::runtime_error("Failed to allocate a new SAM/BAM record"));
}
if(!samIn.ReadRecord(mySamHeader, *recordPtr))
{
// Failed to read a record.
returnStatus = samIn.GetStatus();
continue;
}
// Have a record. Check to see if it is a pair or unpaired read.
samFlag = recordPtr->getFlag();
if(SamFlag::isPaired(samFlag))
{
if(readName)
{
handlePairedRN(*recordPtr);
}
else
{
handlePairedCoord(*recordPtr);
}
}
else
{
++myNumUnpaired;
writeFastQ(*recordPtr, myUnpairedFile,
myUnpairedFileNameExt);
}
}
// Flush All
cleanUpMateMap(0, true);
if(returnStatus == SamStatus::NO_MORE_RECS)
{
returnStatus = SamStatus::SUCCESS;
}
samIn.Close();
closeFiles();
// Output the results
std::cerr << "\nFound " << myNumPairs << " read pairs.\n";
std::cerr << "Found " << myNumUnpaired << " unpaired reads.\n";
if(myNumMateFailures != 0)
{
std::cerr << "Failed to find mates for " << myNumMateFailures
<< " reads, so they were written as unpaired\n"
<< " (not included in either of the above counts).\n";
}
if(myNumQualTagErrors != 0)
{
std::cerr << myNumQualTagErrors << " records did not have tag "
<< myQField.c_str() << " or it was invalid, so the quality field was used for those records.\n";
}
return(returnStatus);
}
示例13: handleSortedByReadName
SamStatus::Status ClipOverlap::handleSortedByReadName(SamFile& samIn,
SamFile* samOutPtr)
{
// Set returnStatus to success. It will be changed
// to the failure reason if any of the writes fail.
SamStatus::Status returnStatus = SamStatus::SUCCESS;
// Read the sam records.
SamRecord* prevSamRecord = NULL;
SamRecord* samRecord = new SamRecord;
SamRecord* tmpRecord = new SamRecord;
if((samRecord == NULL) || (tmpRecord == NULL))
{
std::cerr << "Failed to allocate a SamRecord, so exit.\n";
return(SamStatus::FAIL_MEM);
}
// Keep reading records until ReadRecord returns false.
while(samIn.ReadRecord(mySamHeader, *samRecord))
{
int16_t flag = samRecord->getFlag();
if((flag & myIntExcludeFlags) != 0)
{
// This read should not be checked for overlaps.
// Check if there is a previous SamRecord.
if(prevSamRecord != NULL)
{
// There is a previous record.
// If it has a different read name, write it.
if(strcmp(samRecord->getReadName(),
prevSamRecord->getReadName()) != 0)
{
// Different read name, so write the previous record.
if((samOutPtr != NULL) && !myOverlapsOnly)
{
if(!samOutPtr->WriteRecord(mySamHeader, *prevSamRecord))
{
// Failed to write a record.
fprintf(stderr, "%s\n", samOutPtr->GetStatusMessage());
returnStatus = samOutPtr->GetStatus();
}
}
// Clear the previous record info.
tmpRecord = prevSamRecord;
prevSamRecord = NULL;
}
// If it has the same read name, leave it in case there is another read with that name
}
// This record is not being checked for overlaps, so just write it and continue
if((samOutPtr != NULL) && !myOverlapsOnly)
{
if(!samOutPtr->WriteRecord(mySamHeader, *samRecord))
{
// Failed to write a record.
fprintf(stderr, "%s\n", samOutPtr->GetStatusMessage());
returnStatus = samOutPtr->GetStatus();
}
}
continue;
}
if(prevSamRecord == NULL)
{
// Nothing to compare this record to, so set this
// record to the previous, and the next record.
prevSamRecord = samRecord;
samRecord = tmpRecord;
tmpRecord = NULL;
continue;
}
// Check if the read name matches the previous read name.
if(strcmp(samRecord->getReadName(),
prevSamRecord->getReadName()) == 0)
{
bool overlap = false;
// Same Read Name, so check clipping.
OverlapHandler::OverlapInfo prevClipInfo =
myOverlapHandler->getOverlapInfo(*prevSamRecord);
OverlapHandler::OverlapInfo curClipInfo =
myOverlapHandler->getOverlapInfo(*samRecord);
// If either indicate a complete clipping, clip both.
if((prevClipInfo == OverlapHandler::NO_OVERLAP_WRONG_ORIENT) ||
(curClipInfo == OverlapHandler::NO_OVERLAP_WRONG_ORIENT))
{
overlap = true;
myOverlapHandler->handleNoOverlapWrongOrientation(*prevSamRecord);
// Don't update stats since this is the 2nd in the pair
myOverlapHandler->handleNoOverlapWrongOrientation(*samRecord,
false);
}
else if((prevClipInfo == OverlapHandler::OVERLAP) ||
(prevClipInfo == OverlapHandler::SAME_START))
{
// The previous read starts at or before the current one.
overlap = true;
myOverlapHandler->handleOverlapPair(*prevSamRecord,
*samRecord);
//.........这里部分代码省略.........
示例14: ReadRecord
// Read a record from the currently opened file.
bool SamFile::ReadRecord(SamFileHeader& header,
SamRecord& record)
{
myStatus = SamStatus::SUCCESS;
if(myIsOpenForRead == false)
{
// File is not open for read
myStatus.setStatus(SamStatus::FAIL_ORDER,
"Cannot read record since the file is not open for reading");
throw(std::runtime_error("SOFTWARE BUG: trying to read a SAM/BAM record prior to opening the file."));
return(false);
}
if(myHasHeader == false)
{
// The header has not yet been read.
// TODO - maybe just read the header.
myStatus.setStatus(SamStatus::FAIL_ORDER,
"Cannot read record since the header has not been read.");
throw(std::runtime_error("SOFTWARE BUG: trying to read a SAM/BAM record prior to reading the header."));
return(false);
}
// Check to see if a new region has been set. If so, determine the
// chunks for that region.
if(myNewSection)
{
if(!processNewSection(header))
{
// Failed processing a new section. Could be an
// order issue like the file not being open or the
// indexed file not having been read.
// processNewSection sets myStatus with the failure reason.
return(false);
}
}
// Read until a record is not successfully read or there are no more
// requested records.
while(myStatus == SamStatus::SUCCESS)
{
record.setReference(myRefPtr);
record.setSequenceTranslation(myReadTranslation);
// If reading by index, this method will setup to ensure it is in
// the correct position for the next record (if not already there).
// Sets myStatus if it could not move to a good section.
// Just returns true if it is not setup to read by index.
if(!ensureIndexedReadPosition())
{
// Either there are no more records in the section
// or it failed to move to the right section, so there
// is nothing more to read, stop looping.
break;
}
// File is open for reading and the header has been read, so read the
// next record.
myInterfacePtr->readRecord(myFilePtr, header, record, myStatus);
if(myStatus != SamStatus::SUCCESS)
{
// Failed to read the record, so break out of the loop.
break;
}
// Successfully read a record, so check if we should filter it.
// First check if it is out of the section. Returns true
// if not reading by sections, returns false if the record
// is outside of the section. Sets status to NO_MORE_RECS if
// there is nothing left ot read in the section.
if(!checkRecordInSection(record))
{
// The record is not in the section.
// The while loop will detect if NO_MORE_RECS was set.
continue;
}
// Check the flag for required/excluded flags.
uint16_t flag = record.getFlag();
if((flag & myRequiredFlags) != myRequiredFlags)
{
// The record does not conatain all required flags, so
// continue looking.
continue;
}
if((flag & myExcludedFlags) != 0)
{
// The record contains an excluded flag, so continue looking.
continue;
}
//increment the record count.
myRecordCount++;
if(myStatistics != NULL)
{
// Statistics should be updated.
myStatistics->updateStatistics(record);
//.........这里部分代码省略.........
示例15: processReadApplyTable
bool Recab::processReadApplyTable(SamRecord& samRecord)
{
static BaseData data;
static std::string readGroup;
static std::string aligTypes;
int seqLen = samRecord.getReadLength();
uint16_t flag = samRecord.getFlag();
// Check if the flag contains an exclude.
if((flag & myIntApplyExcludeFlags) != 0)
{
// Do not apply the recalibration table to this read.
++myNumApplySkipped;
return(false);
}
++myNumApplyReads;
readGroup = samRecord.getString("RG").c_str();
// Look for the read group in the map.
// TODO - extra string constructor??
RgInsertReturn insertRet =
myRg2Id.insert(std::pair<std::string, uint16_t>(readGroup, 0));
if(insertRet.second == true)
{
// New element inserted.
insertRet.first->second = myId2Rg.size();
myId2Rg.push_back(readGroup);
}
data.rgid = insertRet.first->second;
if(!myQField.IsEmpty())
{
// Check if there is an old quality.
const String* oldQPtr =
samRecord.getStringTag(myQField.c_str());
if((oldQPtr != NULL) && (oldQPtr->Length() == seqLen))
{
// There is an old quality, so use that.
myQualityStrings.oldq = oldQPtr->c_str();
}
else
{
myQualityStrings.oldq = samRecord.getQuality();
}
}
else
{
myQualityStrings.oldq = samRecord.getQuality();
}
if(myQualityStrings.oldq.length() != (unsigned int)seqLen)
{
Logger::gLogger->warning("Quality is not the correct length, so skipping recalibration on that record.");
return(false);
}
myQualityStrings.newq.resize(seqLen);
////////////////
////// iterate sequence
////////////////
int32_t seqPos = 0;
int seqIncr = 1;
bool reverse;
if(SamFlag::isReverse(flag))
{
reverse = true;
seqPos = seqLen - 1;
seqIncr = -1;
}
else
reverse = false;
// Check which read - this will be the same for all positions, so
// do this outside of the smaller loop.
if(!SamFlag::isPaired(flag) || SamFlag::isFirstFragment(flag))
// Mark as first if it is not paired or if it is the
// first in the pair.
data.read = 0;
else
data.read = 1;
// Set unsetbase for curBase.
// This will be used for the prebase of cycle 0.
data.curBase = 'K';
for (data.cycle = 0; data.cycle < seqLen; data.cycle++, seqPos += seqIncr)
{
// Set the preBase to the previous cycle's current base.
// For cycle 0, curBase was set to a default value.
data.preBase = data.curBase;
// Get the current base.
data.curBase = samRecord.getSequence(seqPos);
//.........这里部分代码省略.........