當前位置: 首頁>>代碼示例>>C++>>正文


C++ Interval::getChr方法代碼示例

本文整理匯總了C++中Interval::getChr方法的典型用法代碼示例。如果您正苦於以下問題:C++ Interval::getChr方法的具體用法?C++ Interval::getChr怎麽用?C++ Interval::getChr使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Interval的用法示例。


在下文中一共展示了Interval::getChr方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: targJ

XHMM::xhmmInputManager::LoadedReadDepths
XHMM::xhmmInputManager::loadReadDepthsFromFile(string readDepthFile, IntervalSet* excludeTargets, StringSet* excludeTargetChromosomes, StringSet* excludeSamples,
		const ullint minTargetSize, const ullint maxTargetSize) {

	HMM_PP::DoubleMat* rdMat = MatrixReader<double>::readMatrixFromFile(readDepthFile);
	StringSet* excludedSamples = new StringSet();
	IntervalSet* excludedTargets = new IntervalSet();

	set<ullint>* excludeSampleIndices = new set<ullint>();
	if (excludeSamples != NULL) {
		for (ullint row = 0; row < rdMat->nrow(); ++row) {
			string samp = rdMat->rowName(row);

			if (excludeSamples->find(samp) != excludeSamples->end()) {
				cerr << "Excluded sample " << samp << endl;

				excludedSamples->insert(samp);
				excludeSampleIndices->insert(row);
			}
		}
	}

	set<ullint>* excludeTargetIndices = new set<ullint>();
	if (excludeTargets != NULL || excludeTargetChromosomes != NULL || minTargetSize > 0 || maxTargetSize < ULLINT_INFINITY) {
		for (ullint j = 0; j < rdMat->ncol(); ++j) {
			const Interval targJ(rdMat->colName(j));
			const ullint targLen = targJ.span();
			bool targLenFails = (targLen < minTargetSize || targLen > maxTargetSize);

			if ((excludeTargets != NULL && excludeTargets->find(targJ) != excludeTargets->end()) ||
					(excludeTargetChromosomes != NULL && excludeTargetChromosomes->find(targJ.getChr()) != excludeTargetChromosomes->end()) ||
					targLenFails) {
				cerr << "Excluded target " << targJ;
				if (targLenFails)
					cerr << " of length " << targLen;
				cerr << endl;

				excludeTargetIndices->insert(j);
				excludedTargets->insert(targJ);
			}
		}
	}

	if (!excludeSampleIndices->empty() || !excludeTargetIndices->empty()) {
		HMM_PP::DoubleMat* newRdMat = rdMat->deleteRowsAndColumns(excludeSampleIndices, excludeTargetIndices);
		delete rdMat;
		rdMat = newRdMat;
	}
	delete excludeSampleIndices;
	delete excludeTargetIndices;

	return LoadedReadDepths(rdMat, excludedTargets, excludedSamples);
}
開發者ID:coderChase,項目名稱:jxcnv,代碼行數:53,代碼來源:xhmmInputManager.cpp

示例2: Exception

void XHMM::ReadDepthMatrixLoader::readTargets() {
	stringstream* lineStream = new stringstream(*_header);
	delete _header;
	_header = NULL;

	Interval* prevTarget = NULL;
	while (*lineStream && !lineStream->eof()) {
		string targetString;
		*lineStream >> targetString;
		if (!*lineStream)
			throw new Exception("Data input stream failed while reading target " + targetString);

		Interval* curTarget = new Interval(targetString);
		if (_chrStopInds->find(curTarget->getChr()) != _chrStopInds->end())
			throw new Exception("MUST provide targets in order and GROUPED BY CHROMOSOME: target " + curTarget->intervalString() + " reverts to chromosome " + curTarget->getChr() + ", which was interrupted by targets in other chromosomes");
		_targets->push_back(*curTarget);

		if (prevTarget == NULL || curTarget->getChr() != prevTarget->getChr()) // curTarget is a new chromosome
			(*_chrStartInds)[curTarget->getChr()] = _targets->size() - 1;

		if (prevTarget != NULL) {
			if (curTarget->getChr() != prevTarget->getChr()) // switched to a new chromosome, so can never go back to prevTarget->getChr()
				(*_chrStopInds)[prevTarget->getChr()] = _targets->size() - 2; // subtract 2 (and not 1) since already added curTarget
			else if (!(curTarget->getBp1() > prevTarget->getBp2()))
				throw new Exception("MUST provide NON-OVERLAPPING targets IN ORDER: target " + curTarget->intervalString() + " either overlaps with or precedes previous target " + prevTarget->intervalString());

			delete prevTarget;
		}
		prevTarget = curTarget;
	}

	if (prevTarget != NULL) {
		(*_chrStopInds)[prevTarget->getChr()] = _targets->size() - 1; // since now prevTarget points to the LAST target, which ends its chromosome
		delete prevTarget;
	}

	for (map<string, uint>::const_iterator stopIt = _chrStopInds->begin(); stopIt != _chrStopInds->end(); ++stopIt)
		_listAllChrStopInds->insert(stopIt->second);

	delete lineStream;
}
開發者ID:coderChase,項目名稱:jxcnv,代碼行數:41,代碼來源:ReadDepthMatrixLoader.cpp


注:本文中的Interval::getChr方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。