+ //trim seq
+ decalc->trimSeqs(query, bestfit, trimmed);
+
+ //find windows
+ it = trimmed.begin();
+ windowsForeachQuery = decalc->findWindows(query, it->first, it->second, windowSizes, increment);
+
+ //find observed distance
+ obsDistance = decalc->calcObserved(query, bestfit, windowsForeachQuery, windowSizes);
+
+ if (m->control_pressed) { return 0; }
+
+ Qav = decalc->findQav(windowsForeachQuery, windowSizes, probabilityProfile);
+
+ if (m->control_pressed) { return 0; }
+
+ //find alpha
+ seqCoef = decalc->getCoef(obsDistance, Qav);
+
+ //calculating expected distance
+ expectedDistance = decalc->calcExpected(Qav, seqCoef);
+
+ if (m->control_pressed) { return 0; }
+
+ //finding de
+ DE = decalc->calcDE(obsDistance, expectedDistance);
+
+ if (m->control_pressed) { return 0; }
+
+ //find distance between query and closest match
+ it = trimmed.begin();
+ deviation = decalc->calcDist(query, bestfit, it->first, it->second);
+
+ delete bestfit;
+
+ return 0;