Skip to content

Commit

Permalink
Make a gkpStore pointer mandatory for creating an ovOverlap object.
Browse files Browse the repository at this point in the history
  • Loading branch information
brianwalenz committed Jun 25, 2015
1 parent f8ce3b6 commit 81f3aeb
Show file tree
Hide file tree
Showing 23 changed files with 60 additions and 43 deletions.
4 changes: 2 additions & 2 deletions src/bogart/AS_BAT_OverlapCache.C
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ OverlapCache::OverlapCache(ovStore *ovlStoreUniq,

_maxPer = maxOverlaps;

_ovs = new ovOverlap [_ovsMax];
_ovs = ovOverlap::allocateOverlaps(NULL, _ovsMax); // So can't call bgn or end.
_ovsSco = new uint64 [_ovsMax];
_ovsTmp = new uint64 [_ovsMax];

Expand Down Expand Up @@ -550,7 +550,7 @@ OverlapCache::loadOverlaps(double erate, uint32 minOverlap, const char *prefix,
delete [] _ovs;
delete [] _ovsSco;
delete [] _ovsTmp;
_ovs = new ovOverlap [_ovsMax];
_ovs = ovOverlap::allocateOverlaps(NULL, _ovsMax); // So can't call bgn or end.
_ovsSco = new uint64 [_ovsMax];
_ovsTmp = new uint64 [_ovsMax];
_memUsed += (_ovsMax) * sizeof(ovOverlap);
Expand Down
4 changes: 2 additions & 2 deletions src/correction/filterCorrectionOverlaps.C
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@ main(int argc, char **argv) {

uint32 ovlLen = 0;
uint32 ovlMax = 131072;
ovOverlap *ovl = new ovOverlap [ovlMax];
ovOverlap swapped;
ovOverlap *ovl = ovOverlap::allocateOverlaps(gkpStore, ovlMax);
ovOverlap swapped(gkpStore);

uint32 histLen = 0;
uint32 histMax = ovlMax;
Expand Down
2 changes: 1 addition & 1 deletion src/correction/generateCorrectionLayouts.C
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ main(int argc, char **argv) {

uint32 ovlMax = 1024 * 1024;
uint32 ovlLen = 0;
ovOverlap *ovl = new ovOverlap [ovlMax];
ovOverlap *ovl = ovOverlap::allocateOverlaps(gkpStore, ovlMax);

ovlLen = ovlStore->readOverlaps(ovl, ovlMax, true);

Expand Down
4 changes: 2 additions & 2 deletions src/erateEstimate/erateEstimate.C
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ outputOverlaps(gkStore *gkpStore,
// walk down each.

uint32 overlapblock = 100000000;
ovOverlap *overlapsload = new ovOverlap [overlapblock];
ovOverlap *overlapsload = ovOverlap::allocateOverlaps(gkpStore, overlapblock);

for (uint64 no=0; no<numOvls; ) {
uint64 nLoad = inpStore->readOverlaps(overlapsload, overlapblock, false);
Expand Down Expand Up @@ -669,7 +669,7 @@ main(int argc, char **argv) {
} else {
FILE *ESTcache = NULL;
uint32 overlapblock = 100000000;
ovOverlap *overlapsload = new ovOverlap [overlapblock];
ovOverlap *overlapsload = ovOverlap::allocateOverlaps(gkpStore, overlapblock);

overlaps = new ESToverlap [numOvls];

Expand Down
2 changes: 1 addition & 1 deletion src/mhap/mhapConvert.C
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ main(int argc, char **argv) {

char *ovStr = new char [1024];

ovOverlap ov;
ovOverlap ov(NULL);
ovFile *of = new ovFile(outName, ovFileFullWrite);

for (uint32 ff=0; ff<files.size(); ff++) {
Expand Down
2 changes: 1 addition & 1 deletion src/overlapBasedTrimming/splitReads.C
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ main(int argc, char **argv) {

uint32 ovlLen = 0;
uint32 ovlMax = 64 * 1024;
ovOverlap *ovl = new ovOverlap [ovlMax];
ovOverlap *ovl = ovOverlap::allocateOverlaps(gkp, ovlMax);

memset(ovl, 0, sizeof(ovOverlap) * ovlMax);

Expand Down
2 changes: 1 addition & 1 deletion src/overlapBasedTrimming/trimReads.C
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ main(int argc, char **argv) {

uint32 ovlLen = 0;
uint32 ovlMax = 64 * 1024;
ovOverlap *ovl = new ovOverlap [ovlMax];
ovOverlap *ovl = ovOverlap::allocateOverlaps(gkp, ovlMax);

memset(ovl, 0, sizeof(ovOverlap) * ovlMax);

Expand Down
2 changes: 1 addition & 1 deletion src/overlapErrorAdjustment/correctOverlaps-Read_Olaps.C
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Read_Olaps(coParameters *G, gkStore *gkpStore) {
G->olaps = new Olap_Info_t [numolaps];
G->olapsLen = 0;

ovOverlap olap;
ovOverlap olap(gkpStore);

while (ovs->readOverlap(&olap)) {
G->olaps[G->olapsLen].a_iid = olap.a_iid;
Expand Down
2 changes: 1 addition & 1 deletion src/overlapErrorAdjustment/findErrors-Read_Olaps.C
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Read_Olaps(feParameters *G, gkStore *gkpStore) {
G->olaps = new Olap_Info_t [numolaps];
G->olapsLen = 0;

ovOverlap olap;
ovOverlap olap(gkpStore);

while (ovs->readOverlap(&olap)) {
G->olaps[G->olapsLen].a_iid = olap.a_iid;
Expand Down
2 changes: 1 addition & 1 deletion src/overlapInCore/overlapConvert.C
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ main(int argc, char **argv) {

for (uint32 ff=0; ff<files.size(); ff++) {
ovFile *of = new ovFile(files[ff], ovFileFull);
ovOverlap ov;
ovOverlap ov(gkpStore);

while (of->readOverlap(&ov))
fputs(ov.toString(ovStr, dt, true), stdout);
Expand Down
2 changes: 1 addition & 1 deletion src/overlapInCore/overlapImport.C
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ main(int argc, char **argv) {

char *S = new char [1024];
splitToWords W;
ovOverlap ov;
ovOverlap ov(gkpStore);

ovFile *of = (ovlFileName == NULL) ? NULL : new ovFile(ovlFileName, ovFileFullWrite);
ovStore *os = (ovlStoreName == NULL) ? NULL : new ovStore(ovlStoreName, gkpStore, ovStoreWrite);
Expand Down
2 changes: 1 addition & 1 deletion src/overlapInCore/overlapInCore.C
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ Initialize_Work_Area(Work_Area_t *WA, int id) {

WA->overlapsLen = 0;
WA->overlapsMax = 1024 * 1024 / sizeof(ovOverlap);
WA->overlaps = new ovOverlap [WA->overlapsMax];
WA->overlaps = ovOverlap::allocateOverlaps(WA->gkpStore, WA->overlapsMax);

allocated += sizeof(ovOverlap) * WA->overlapsMax;

Expand Down
4 changes: 2 additions & 2 deletions src/overlapInCore/overlapPair.C
Original file line number Diff line number Diff line change
Expand Up @@ -381,8 +381,8 @@ main(int argc, char **argv) {

uint32 overlapsALen = 0;
uint32 overlapsBLen = 0;
ovOverlap *overlapsA = new ovOverlap [overlapsMax];
ovOverlap *overlapsB = new ovOverlap [overlapsMax];
ovOverlap *overlapsA = ovOverlap::allocateOverlaps(gkpStore, overlapsMax);
ovOverlap *overlapsB = ovOverlap::allocateOverlaps(gkpStore, overlapsMax);

// Set the globals

Expand Down
4 changes: 2 additions & 2 deletions src/stores/ovStore.C
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ ovStore::readOverlaps(uint32 iid,
if (ovl == NULL) {
ovlLen = 0;
ovlMax = 65 * 1024;
ovl = new ovOverlap [ovlMax];
ovl = ovOverlap::allocateOverlaps(_gkp, ovlMax);
}

if (iid < ovl[0].a_iid)
Expand All @@ -456,7 +456,7 @@ ovStore::readOverlaps(uint32 iid,
while (ovlMax < ovlLen) {
ovlMax *= 2;
delete [] ovl;
ovl = new ovOverlap [ovlMax];
ovl = ovOverlap::allocateOverlaps(_gkp, ovlMax);
}

// Load the overlaps
Expand Down
24 changes: 20 additions & 4 deletions src/stores/ovStore.H
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,31 @@ enum ovOverlapDisplayType {


class ovOverlap {
public:
private:
ovOverlap() {
clear();
};

public:
ovOverlap(gkStore *gkp) {
g = gkp;
clear();
};

~ovOverlap() {
};

static
ovOverlap *allocateOverlaps(gkStore *gkp, uint64 num) {
ovOverlap *r = new ovOverlap [num];

for (uint32 ii=0; ii<num; ii++)
r[ii].g = gkp;

return(r);
};


// Dovetail if any of the following are true:
// ahg3 == 0 && ahg5 == 0 (a is contained)
// ahg3 == 0 && bhg5 == 0 (a3' dovetail b5')
Expand Down Expand Up @@ -223,9 +241,6 @@ public:
#endif
};

//gkStore *gkpStore(void) { return(g); };
//void gkpStore(gkStore *g_) { g = g_; };

bool
operator<(const ovOverlap &that) const {
if (a_iid < that.a_iid) return(true);
Expand Down Expand Up @@ -261,6 +276,7 @@ public:
};



// If ovOverlapWORD is uint32, we have no problems.

// If ovOverlapWORD is uint64, and we are internal, then we have a problem with the internal format.
Expand Down
4 changes: 2 additions & 2 deletions src/stores/ovStoreBucketizer.C
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,8 @@ main(int argc, char **argv) {
fprintf(stderr, "Bucketizing %s\n", ovlInput);

ovStoreFilter *filter = new ovStoreFilter(gkp, maxError);
ovOverlap foverlap;
ovOverlap roverlap;
ovOverlap foverlap(gkp);
ovOverlap roverlap(gkp);
ovFile *inputFile = new ovFile(ovlInput, ovFileFull);

// Do bigger buffers increase performance? Do small ones hurt?
Expand Down
6 changes: 3 additions & 3 deletions src/stores/ovStoreBuild.C
Original file line number Diff line number Diff line change
Expand Up @@ -372,8 +372,8 @@ main(int argc, char **argv) {
ovStoreFilter *filter = new ovStoreFilter(gkp, maxError);

for (uint32 i=0; i<fileList.size(); i++) {
ovOverlap foverlap;
ovOverlap roverlap;
ovOverlap foverlap(gkp);
ovOverlap roverlap(gkp);

fprintf(stderr, "bucketizing %s\n", fileList[i]);

Expand Down Expand Up @@ -421,7 +421,7 @@ main(int argc, char **argv) {
if (dumpLengthMax < dumpLength[i])
dumpLengthMax = dumpLength[i];

ovOverlap *overlapsort = new ovOverlap [dumpLengthMax];
ovOverlap *overlapsort = ovOverlap::allocateOverlaps(gkp, dumpLengthMax);

time_t beginTime = time(NULL);

Expand Down
6 changes: 3 additions & 3 deletions src/stores/ovStoreDump.C
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ dumpStore(ovStore *ovlStore,
ovOverlapDisplayType type,
bool beVerbose) {

ovOverlap overlap;
ovOverlap overlap(gkpStore);
uint64 evalue = AS_OVS_encodeEvalue(dumpERate);
char ovlString[1024];

Expand Down Expand Up @@ -314,8 +314,8 @@ dumpPicture(ovStore *ovlStore,
ovlStore->setRange(qryID, qryID);

uint64 novl = 0;
ovOverlap overlap;
ovOverlap *overlaps = new ovOverlap [ovlStore->numOverlapsInRange()];
ovOverlap overlap(gkpStore);
ovOverlap *overlaps = ovOverlap::allocateOverlaps(gkpStore, ovlStore->numOverlapsInRange());
uint64 evalue = AS_OVS_encodeEvalue(dumpERate);

// Load all the overlaps so we can sort by the A begin position.
Expand Down
15 changes: 8 additions & 7 deletions src/stores/ovStoreSorter.C
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,13 @@ using namespace std;
int
main(int argc, char **argv) {
char *storePath = NULL;
uint32 fileLimit = 512; // Number of 'slices' from bucketizer
uint32 fileID = 0; // 'slice' that we are going to be sorting
uint32 jobIdxMax = 0; // Number of 'buckets' from bucketizer
char *gkpName = NULL;

uint64 maxMemory = UINT64_MAX;
uint32 fileLimit = 512; // Number of 'slices' from bucketizer
uint32 fileID = 0; // 'slice' that we are going to be sorting
uint32 jobIdxMax = 0; // Number of 'buckets' from bucketizer

uint64 maxMemory = UINT64_MAX;

bool deleteIntermediateEarly = false;
bool deleteIntermediateLate = false;
Expand All @@ -55,8 +57,7 @@ main(int argc, char **argv) {
storePath = argv[++arg];

} else if (strcmp(argv[arg], "-g") == 0) {
//unused gkpName = argv[++arg];
++arg;
gkpName = argv[++arg];

} else if (strcmp(argv[arg], "-F") == 0) {
fileLimit = atoi(argv[++arg]);
Expand Down Expand Up @@ -177,7 +178,7 @@ main(int argc, char **argv) {
fprintf(stderr, "Overlaps need %.2f GB memory, allowed to use up to (via -M) "F_U64" GB.\n",
sizeof(ovOverlap) * totOvl / (1024.0 * 1024.0 * 1024.0), maxMemory >> 30);

ovOverlap *ovls = new ovOverlap [totOvl];
ovOverlap *ovls = ovOverlap::allocateOverlaps(NULL, totOvl);

// Load all overlaps - we're guaranteed that either 'name.gz' or 'name' exists (we checked above)
// or funny business is happening with our files.
Expand Down
2 changes: 1 addition & 1 deletion src/unitigger/AS_CGB_Bubble.C
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ AS_CGB_Bubble_find_and_remove_bubbles
ALNoverlapFull *ovl = AS_CGB_Bubble_pop_bubble(&bp, bubs->start, bubs->start_sx, bubs->end, bubs->end_sx, &num_ovl);

for (int32 o=0; o<num_ovl; ++o) {
ovOverlap olap;
ovOverlap olap(gkpStore);

#if 0
fprintf(stderr, "ALNoverlapFull: ID %d %d HG %d %d orient %c type %c qual %f\n",
Expand Down
2 changes: 1 addition & 1 deletion src/unitigger/AS_CGB_unitigger.C
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ main(int argc, char **argv) {
sprintf(bon, "%s.edges.blessed", rg->Output_Graph_Store_Prefix);

ovFile *bof = new ovFile(bon, ovFileFullWrite);
ovOverlap overlap;
ovOverlap overlap(NULL); // We could keep the gkpStore around, but we don't call bgn/end in unitigger.

for (ie=0; ie < nedge; ie ++) {
Tnes nes = get_nes_edge(heapva->edges,ie);
Expand Down
4 changes: 2 additions & 2 deletions src/unitigger/AS_FGB_io.C
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ void process_ovl_store(char * OVL_Store_Path,
const int intrude_with_non_blessed_overlaps_flag,
const uint32 overlap_error_threshold) {
ovStore *ovs;
ovOverlap olap;
ovOverlap olap(NULL); // Don't call bgn/end!

IntEdge_ID novl_dovetail = 0;
IntEdge_ID novl_containment = 0;
Expand Down Expand Up @@ -724,7 +724,7 @@ void input_messages_from_a_file(ovFile *bof,
/* It is assumed that in the overlap records that new fragments
point to old fragments. */

ovOverlap olap;
ovOverlap olap(NULL); // Don't call bgn/end!

while (bof->readOverlap(&olap)) {

Expand Down
2 changes: 1 addition & 1 deletion src/unitigger/AS_FGB_main.C
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ static void output_mesgs(Tfragment frags[],
const IntEdge_ID nedge = GetNumEdges(edges);
IntEdge_ID ie;
for(ie=0;ie<nedge;ie++){
ovOverlap overlap;
ovOverlap overlap(NULL); // Don't call bgn/end!

const uint32 avx = get_avx_edge(edges,ie);
const int asx = get_asx_edge(edges,ie);
Expand Down

0 comments on commit 81f3aeb

Please sign in to comment.