void NDalign::realignForward(bool verbose, bool displayAlign) { Match_Node_t match; match.Start = abgn(); // Begin position in a match.Offset = bbgn(); // Begin position in b match.Len = 0; match.Next = 0; // Not used here int32 aLo=0, aHi=0; int32 bLo=0, bHi=0; if (displayAlign) fprintf(stderr, "NDalign::realignForward()--\n"); pedOverlapType olapType = _editDist->Extend_Alignment(&match, // Initial exact match, relative to start of string _aStr, _aLen, _bStr, _bLen, aLo, aHi, // Output: Regions which the match extends bLo, bHi); aHi++; // Add one to the end point because Extend_Alignment returns the base-based coordinate. bHi++; // Is this a better overlap than what we have? if (((score() < _editDist->score())) || ((score() <= _editDist->score()) && (length() > ((aHi - aLo) + (bHi - bLo) + _editDist->Left_Delta_Len) / 2))) { if (displayAlign) fprintf(stderr, "NDalign::realignForward()-- Save better alignment - OLD length %u erate %f score %u (%d-%d %d-%d)\n", length(), erate(), score(), abgn(), aend(), bbgn(), bend()); _bestResult.save(aLo, aHi, bLo, bHi, _editDist->score(), olapType, _editDist->Left_Delta_Len, _editDist->Left_Delta); display("NDalign::realignForward()-- ", false); _bestResult.setErate(1.0 - (double)(_matches + _gapmatches) / (length() - _freegaps)); if (displayAlign) fprintf(stderr, "NDalign::realignForward()-- Save better alignment - NEW length %u erate %f score %u (%d-%d %d-%d)\n", length(), erate(), score(), abgn(), aend(), bbgn(), bend()); } else if (displayAlign) { fprintf(stderr, "NDalign::realignForward()-- Alignment no better - OLD length %u erate %f score %u (%d-%d %d-%d)\n", length(), erate(), score(), abgn(), aend(), bbgn(), bend()); fprintf(stderr, "NDalign::realignForward()-- Alignment no better - NEW length %u erate %f score %u (%d-%d %d-%d)\n", ((aHi - aLo) + (bHi - bLo) + _editDist->Left_Delta_Len) / 2, 0.0, _editDist->score(), aLo, aHi, bLo, bHi); //display("NDalign::realignForward(NB)--", aLo, aHi, bLo, bHi, _editDist->Left_Delta, _editDist->Left_Delta_Len, true, false); } }
ase_clr_script_engine::ase_clr_script_engine(ase_unified_engine_ref& ue, const ase_variant& gl) : ueref(ue), clrpr_endnode(0), asepr_endnode(0), global(gl) { DBG(fprintf(stderr, "GLOBAL vtbl=%p vtype=%d\n", global.get_vtable_address(), global.get_type())); ase_clr_set_engine_ref(global, this); ase_clr_ase_variant_impl::init_arg ciarg; ciarg.sc = this; ciarg.obj = nullptr; std::auto_ptr<ase_clr_ase_variant_implnode> cend( new ase_clr_ase_variant_implnode(ciarg)); std::auto_ptr<aseproxy_node> aend(new aseproxy_node); clrpr_endnode = cend.release(); asepr_endnode = aend.release(); }
// The scalar cases in llsd_matches() use this helper. In most cases, we can // accept not only the exact type specified in the prototype, but also other // types convertible to the expected type. That implies looping over an array // of such types. If the actual type doesn't match any of them, we want to // provide a list of acceptable conversions as well as the exact type, e.g.: // "Integer (or Boolean, Real, String) required instead of UUID". Both the // implementation and the calling logic are simplified by separating out the // expected type from the convertible types. static std::string match_types(LLSD::Type expect, // prototype.type() const TypeVector& accept, // types convertible to that type LLSD::Type actual, // type we're checking const std::string& pfx) // as for llsd_matches { // Trivial case: if the actual type is exactly what we expect, we're good. if (actual == expect) return ""; // For the rest of the logic, build up a suitable error string as we go so // we only have to make a single pass over the list of acceptable types. // If we detect success along the way, we'll simply discard the partial // error string. std::ostringstream out; out << colon(pfx) << sTypes.lookup(expect); // If there are any convertible types, append that list. if (! accept.empty()) { out << " ("; const char* sep = "or "; for (TypeVector::const_iterator ai(accept.begin()), aend(accept.end()); ai != aend; ++ai, sep = ", ") { // Don't forget to return success if we match any of those types... if (actual == *ai) return ""; out << sep << sTypes.lookup(*ai); } out << ')'; } // If we got this far, it's because 'actual' was not one of the acceptable // types, so we must return an error. 'out' already contains colon(pfx) // and the formatted list of acceptable types, so just append the mismatch // phrase and the actual type. out << op << sTypes.lookup(actual); return out.str(); }
bool NDalign::processHits(void) { // If the first time here, set the hit iterator to zero, otherwise move to the next one. // And then return if there are no more hits to iterate over. if (_hitr == UINT32_MAX) _hitr = 0; else _hitr++; if (_hitr >= _hits.size()) return(false); // While hits, process them. // // If a good hit is found, return, leaving hitr as is. The next time we enter this function, // we'll increment hitr and process the next hit. If no good hit is found, we iterate the loop // until a good one is found, or we run out of hits. for (; _hitr < _hits.size(); _hitr++) { Match_Node_t match; match.Start = _hits[_hitr].aBgn; // Begin position in a match.Offset = _hits[_hitr].bBgn; // Begin position in b match.Len = _hits[_hitr].tLen; // tLen can include mismatches if alternate scoring is used! match.Next = 0; // Not used here #ifdef SEED_NON_OVERLAPPING match.Offset = _merSize; // Really should track this in the hits, oh well. #endif #ifdef DEBUG_ALGORITHM fprintf(stderr, "\n"); fprintf(stderr, "NDalign::processHits()-- Extend_Alignment Astart %d Bstart %d length %d\n", match.Start, match.Offset, match.Len); #endif int32 aLo=0, aHi=0; int32 bLo=0, bHi=0; pedOverlapType olapType = _editDist->Extend_Alignment(&match, // Initial exact match, relative to start of string _aStr, _aLen, _bStr, _bLen, aLo, aHi, // Output: Regions which the match extends bLo, bHi); aHi++; // Add one to the end point because Extend_Alignment returns the base-based coordinate. bHi++; // Is this a better overlap than what we have? Save it and update statistics. if (((score() < _editDist->score())) || ((score() <= _editDist->score()) && (length() > ((aHi - aLo) + (bHi - bLo) + _editDist->Left_Delta_Len) / 2))) { #ifdef DEBUG_ALGORITHM fprintf(stderr, "NDalign::processHits()-- Save better alignment - OLD length %u erate %f score %u (%d-%d %d-%d) ", length(), erate(), score(), abgn(), aend(), bbgn(), bend()); #endif _bestResult.save(aLo, aHi, bLo, bHi, _editDist->score(), olapType, _editDist->Left_Delta_Len, _editDist->Left_Delta); display("NDalign::processHits()-- ", false); _bestResult.setErate(1.0 - (double)(_matches + _gapmatches) / (length() - _freegaps)); #ifdef DEBUG_ALGORITHM fprintf(stderr, "NDalign::processHits()-- NEW length %u erate %f score %u (%d-%d %d-%d)\n", length(), erate(), score(), abgn(), aend(), bbgn(), bend()); #endif } else { olapType = pedBothBranch; #ifdef DEBUG_ALGORITHM fprintf(stderr, "NDalign::processHits()-- DON'T save alignment - OLD length %u erate %f score %u (%d-%d %d-%d) ", length(), erate(), score(), abgn(), aend(), bbgn(), bend()); fprintf(stderr, "NDalign::processHits()-- NEW length %u score %u coords %u-%u %u-%u\n", ((aHi - aLo) + (bHi - bLo) + _editDist->Left_Delta_Len) / 2, _editDist->score(), aLo, aHi, bLo, bHi); #endif } // If a dovetail, we're done. Let the client figure out if the quality is good. if (olapType == pedDovetail) return(true); } // Over all seeds. // No more seeds to align. Did we save an alignment? return(score() > 0); }