Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for (i0 = 0; i0 < inputStrs->m_str[0].m_length - motifLen; i0++) {
- t1 = time(NULL);
- numExploredNodes = 0;
- totNumDNeighs = 0;
- HashStrV2_Reset(&hashStr);
- strsTemp[0] = inputStrs->m_str[0].m_data + i0;
- for (group = 0; group <= maxGroup; group++) {
- numHits = 0;
- maxNumDNeighs = 0;
- strIndex1 = 2 * group + 1;
- strIndex2 = 2 * group + 2;
- gettimeofday(&v1, 0);
- for (i1 = 0; i1 < inputStrs->m_str[strIndex1].m_length - motifLen; i1++) {
- strsTemp[1] = inputStrs->m_str[strIndex1].m_data + i1;
- a01 = hdmat[0][strIndex1][i0][i1];
- if ( a01 > 2 * hammingDist ) {
- continue;
- }
- for (i2 = 0; i2 < inputStrs->m_str[strIndex2].m_length - motifLen; i2++) {
- strsTemp[2] = inputStrs->m_str[strIndex2].m_data + i2;
- a02 = hdmat[0][strIndex2][i0][i2];
- if ( a02 > 2 * hammingDist ) {
- continue;
- }
- a12 = HammingDistStrStr(strsTemp[1], strsTemp[2], motifLen);
- if ( a12 > 2 * hammingDist ) {
- continue;
- }
- if (GetDMinValue(strsTemp[0], strsTemp[1], strsTemp[2], motifLen) > hammingDist) {
- continue;
- }
- ChooseRootStr3Strs(a01, a02, a12, strsTemp[0], strsTemp[1], strsTemp[2],
- &(strs[0]), &(strs[1]), &(strs[2]));
- if (group == 0) {
- numDNeighs = GenDNeigh3Strs(strs[0], strs[1], strs[2],
- hammingDist, motifLen, nodeStack, dst0, dst1,
- hashStr.m_lastStr, comMotifLen,
- maxDNeighsAllowed > (hashStr.m_bucketBufMaxSize - hashStr.m_bucketTotalSize)?
- (hashStr.m_bucketBufMaxSize - hashStr.m_bucketTotalSize): maxDNeighsAllowed);
- if (hashStr.m_bucketTotalSize + numDNeighs < hashStr.m_bucketBufMaxSize) {
- hashStr.m_bucketTotalSize += numDNeighs;
- hashStr.m_lastStr += comMotifLen * numDNeighs;
- }
- } else {
- numDNeighs = GenDNeigh3StrsNonEncoded(strs[0], strs[1], strs[2],
- hammingDist, motifLen, nodeStack, dst0, dst1,
- dNeighsBuf, comMotifLen, maxDNeighsAllowed);
- EncodeManyDNAStrings(dNeighsBuf, numDNeighs, motifLen, dNeighsBuf);
- gettimeofday(&v3, 0);
- if (isWithHash[0] == 'y' || isWithHash[0] == 'Y') {
- dNeighsEnd = dNeighsBuf + comMotifLen * numDNeighs;
- for (dNeighsRun = dNeighsBuf; dNeighsRun < dNeighsEnd; dNeighsRun += comMotifLen) {
- HashStrV2_FindAndMarkString(&hashStr, (char *)(dNeighsRun));
- }
- }
- gettimeofday(&v4, 0);
- interTime += (v4.tv_sec - v3.tv_sec) * 1000000 + (v4.tv_usec - v3.tv_usec);
- }
- numHits += numDNeighs;
- totNumDNeighs += numDNeighs;
- if (maxNumDNeighs < numDNeighs) {
- maxNumDNeighs = numDNeighs;
- }
- }//end i2
- }//end i1
- //subT2 = time(NULL);
- gettimeofday(&v2, 0);
- genTime += (v2.tv_sec - v1.tv_sec) * 1000000 + (v2.tv_usec - v1.tv_usec);
- if ( group == 0) {
- HashStrV2_SortStrings(&hashStr);
- HashStrV2_RemoveDuplicateStrings(&hashStr);
- HashStrV2_UpdateBucketPointers(&hashStr);
- } else {
- HashStrV2_RmvUmrkdStrAndUpdtBcktPtr(&hashStr);
- }
- HashStrV2_ResetMarkBucket(&hashStr, 0);
- if (hashStr.m_bucketTotalSize < 500) {
- break;
- }
- }//end group
- if (totCanMotifs + hashStr.m_bucketTotalSize < maxCanMotifsAllowed) {
- memcpy( canMotifsBuf + totCanMotifs * hashStr.m_strLen,
- hashStr.m_bucketBuf, hashStr.m_bucketTotalSize * hashStr.m_strLen);
- totCanMotifs += hashStr.m_bucketTotalSize;
- }
- t2 = time(NULL);
- total_genTime += (genTime - interTime);
- if ( (i0 % 20) == 0) {
- fprintf(stderr, "\ni0=%d nNodes=%d totNNeis=%d bksize= %d T=%d(s) generation = %lld(us) intersection = %lld(us)\n",
- i0, numExploredNodes, totNumDNeighs, hashStr.m_bucketTotalSize, t2 - t1, genTime - interTime, interTime);
- }
- genTime = interTime = 0;
- }//end i0
- fprintf(stderr, "\n Total generation time = %lld(s)\n", total_genTime);
Add Comment
Please, Sign In to add comment