Esempio n. 1
0
//
// Collect region indices for either all region types, or just a few specific region types.
//
//
int CollectRegionIndices(SMRTSequence &read, RegionTable &regionTable, 
    std::vector<int> &regionIndices, RegionType *regionTypes,
    int numRegionTypes) {

    int regionLow, regionHigh;
    int prevNumRegionIndices = regionIndices.size();
    if (FindRegionIndices(read, &regionTable, 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;
}
Esempio n. 2
0
// General functions.
bool LookupHQRegion(int holeNumber, RegionTable &regionTable, 
    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;
	}
}