Example #1
0
void FileRecordMgr::deleteAllMergedItemsButKey(RecordKeyList &recList) {
	//if the key is also in the list, this method won't delete it.
	for (RecordKeyList::const_iterator_type iter = recList.begin(); iter != recList.end(); iter = recList.next()) {
		if (iter->value() == recList.getKey()) {
			continue;
		}
		deleteRecord(iter->value());
	}
	recList.clearList();
}
Example #2
0
unsigned long Jaccard::getTotalIntersection(RecordKeyList *recList)
{
	unsigned long intersection = 0;
	const Record *key = recList->getKey();
	int keyStart = key->getStartPos();
	int keyEnd = key->getEndPos();

	int hitIdx = 0;
	for (RecordKeyList::const_iterator_type iter = recList->begin(); iter != recList->end(); iter = recList->next()) {
		const Record *currRec = iter->value();
		int maxStart = max(currRec->getStartPos(), keyStart);
		int minEnd = min(currRec->getEndPos(), keyEnd);
		if (_context->getObeySplits()) {
			intersection += _blockMgr->getOverlapBases(hitIdx);
			hitIdx++;
		} else {
			intersection += (unsigned long)(minEnd - maxStart);
		}
	}
	_numIntersections += (int)recList->size();
	return intersection;
}
Example #3
0
void BamRecord::printRemainingBamFields(QuickString &outBuf, RecordKeyList *keyList) const
{
        outBuf.append('\t');
        outBuf.append(_startPosStr);
        outBuf.append('\t');
        outBuf.append(_endPos);
        outBuf.append("\t0,0,0", 6);
        outBuf.append('\t');

        int numBlocks = (int)keyList->size();

        if (numBlocks > 0) {
                outBuf.append(numBlocks);

                vector<int> blockLengths;
                vector<int> blockStarts;
                for (RecordKeyList::const_iterator_type iter = keyList->begin(); iter != keyList->end(); iter = keyList->next()) {
                        const Record *block = iter->value();
                        blockLengths.push_back(block->getEndPos() - block->getStartPos());
                        blockStarts.push_back(block->getStartPos() - _startPos);
                }

                outBuf.append('\t');
                for (int i=0; i < (int)blockLengths.size(); i++) {
                        outBuf.append(blockLengths[i]);
                        outBuf.append(',');
                }
                outBuf.append('\t');
                for (int i=0; i < (int)blockStarts.size(); i++) {
                        outBuf.append( blockStarts[i]);
                        outBuf.append(',');
                }
        }
        else {
                outBuf.append("1\t0,\t0,");
        }
}