// // Collect region indices for either all region types, or just a few specific region types. // // int CollectRegionIndices(SMRTSequence &read, RegionTable ®ionTable, std::vector<int> ®ionIndices, RegionType *regionTypes, int numRegionTypes) { int regionLow, regionHigh; int prevNumRegionIndices = regionIndices.size(); if (FindRegionIndices(read, ®ionTable, regionLow, regionHigh)) { int i; for (i = regionLow; i < regionHigh; i++) { if (regionTypes == NULL) { regionIndices.push_back(i); } else { int t; for (t = 0; t < numRegionTypes; t++) { if (regionTable.GetType(i) == regionTypes[t]) { regionIndices.push_back(i); break; } } } } } return regionIndices.size() - prevNumRegionIndices; }
// General functions. bool LookupHQRegion(int holeNumber, RegionTable ®ionTable, int &start, int &end, int &score) { int regionLowIndex, regionHighIndex; regionLowIndex = regionHighIndex = 0; regionTable.LookupRegionsByHoleNumber(holeNumber, regionLowIndex, regionHighIndex); bool readHasGoodRegion = true; int regionIndex = regionLowIndex; while (regionIndex < regionHighIndex and regionTable.GetType(regionIndex) != HQRegion) { regionIndex++; } if (regionIndex == regionHighIndex) { start = end = score = 0; return false; } else { start = regionTable.GetStart(regionIndex); end = regionTable.GetEnd(regionIndex); score = regionTable.GetScore(regionIndex); return true; } }