--- /dev/null
+//#if UCHIMES\r
+\r
+#include "myutils.h"\r
+#include "chime.h"\r
+#include "ultra.h"\r
+#include <set>\r
+\r
+const float MAX_WORD_COUNT_DROP = 1;\r
+\r
+void SortDescending(const vector<float> &Values, vector<unsigned> &Order);\r
+bool GlobalAlign(const SeqData &Query, const SeqData &Target, string &Path);\r
+double GetFractIdGivenPath(const byte *A, const byte *B, const char *Path);\r
+void USort(const SeqData &Query, const SeqDB &DB, vector<float> &WordCounts,\r
+ vector<unsigned> &Order);\r
+\r
+void AddTargets(SeqDB &DB, const SeqData &Query, set<unsigned> &TargetIndexes)\r
+ {\r
+ const unsigned SeqCount = DB.GetSeqCount();\r
+ if (SeqCount == 0)\r
+ return;\r
+\r
+ vector<float> WordCounts;\r
+ vector<unsigned> Order;\r
+ USort(Query, DB, WordCounts, Order);\r
+ asserta(SIZE(Order) == SeqCount);\r
+ unsigned TopSeqIndex = Order[0];\r
+ float TopWordCount = WordCounts[TopSeqIndex];\r
+ for (unsigned i = 0; i < SeqCount; ++i)\r
+ {\r
+ unsigned SeqIndex = Order[i];\r
+ float WordCount = WordCounts[SeqIndex];\r
+ if (TopWordCount - WordCount > MAX_WORD_COUNT_DROP)\r
+ return;\r
+ TargetIndexes.insert(SeqIndex);\r
+ }\r
+ }\r
+\r
+//#endif\r