バローズ - ウィーラーによる高速かつ正確な短い読み取りアライメント変換
BWT(ブロックソート)
1.辞書のソートをフォロー
2.たとえば、X=googol$
S(I)、すなわち、I接尾語辞書の種類の数に応じて、番号が最初に対応します。
B [i]は、すなわち、接尾辞辞書のソート、最後の文字の番号iに従ってインチXは、($を含む)は、nの長さを示し、最後の一つは$です。
3.接尾辞シリーズ間隔(SA間隔)
Wは、Xサブストリングである場合、XにおけるWの発生位置は、範囲のサフィックス内に入るようにバインドされています。(異なる接尾部を落下した場合、次に、マルチヒットがある)
、例えば、Wは、Xは、上記と言われ、移動しています。そこに行く接頭辞としてサフィックスiは、 1、2、すなわちサフィックス区間[1,2]です。
境界部を残しサフィックスがので、上記の図に記載され得る:X拡張Wとして辞書における順序に従って設定、接頭新しい番号サフィックスは最小です。
同様に、接尾辞右境界の間隔が最大でした。
見ている時に必要の時間に注意してください、それはクエリがするかどうかを見つけることである主題を前に付け、むしろ、より単に存在または不在。
4.完全一致:後方検索
定義
文字、アルファベットを指します。
[0、N-2]の(元の文字列$の外側を除く)X比で:C(A)小辞典発注文字数。
O(I):文字B [0、i]がオンの出現回数。
結論は、
上記の条件は、XのAWサブ文字列を満たしている場合に限り、
例えば、W外出、= O、Rminの(AW)= 3 + 0 + 1、Rmaxは(AW)= 3 +1、それはXの大胡のサブストリングです。
逆探索を理解する方法我々は、前方に検索する接尾辞木の同等の文字を追加して続行する場合、我々は、Wの文字列の最初のを持っていた期間の後、接尾辞を下から検索を。サフィックス間隔に、サフィックスB以来[i]は、円形に形成されているので、B [i]は、実際に添え字iの前の文字です。我々はB [0、I-1]とBを比較した[0、i]は、実際には、単にB [I]を比較し、これがあるかどうか。
i = 0
j = len(X)
for x in range(len(query)):
newChar = query[-x-1] # 从后往前找
newI = C(newChar) + O(newChar, i - 1) +1 # 有了第一个后,第二个则在第一个的基础上找aW
newJ = C(newChar) + O(newChar, J)
i = newI
J = newJ
matches = S[i,J+1] # i>j不等时就已经说明该字符串已经不在X中
5.ファジーマッチ:有界トラバーサル/バックトラック(有界トラバーサル/バック)
定義
- Dを導入し、完全一致のアルゴリズムに従って計算されるが、O、逆X O_reverse確立されるように、文字Dのその後の書き込み位置、IがJよりも大きい場合、指示動作。
- ファジィ再帰:接尾辞木によって再帰的に+ Dファジーマッチのために。
終了条件:
- 所与D比異なる文字zの最大数が大きいです
- 以来Z セットペナルティが 0未満に低減されています
- 文字列全体が一致しています
- KおよびLは、iとj完全一致の役割に類似しています。
def inexact_recursion(self, query, i, z, k, l):
tempset = set()
# 2 stop conditions, one when too many differences have been encountered, another when the entire query has been matched, terminating in success
if (z < self.get_D(i) and use_lower_bound_tree_pruning) or (
z < 0 and not use_lower_bound_tree_pruning): # reached the limit of differences at this stage, terminate this path traversal
if debug: print "too many differences, terminating path\n"
return set() # return empty set
if i < 0: # empty query string, entire query has been matched, return SA indexes k:l
if debug: print "query string finished, terminating path, success! k=%d, l=%d\n" % (k, l)
for m in range(k, l + 1):
tempset.add(m)
return tempset
result = set()
if indels_allowed:
result = result.union(self.inexact_recursion(query, i - 1, z - insertion_penalty, k,
l)) # without finding a match or altering k or l, move on down the query string. Insertion
for char in self.alphabet: # for each character in the alphabet
# find the SA interval for the char
newK = self.C[char] + self.OCC(char, k - 1) + 1
newL = self.C[char] + self.OCC(char, l)
if newK <= newL: # if the substring was found
if indels_allowed: result = result.union(
self.inexact_recursion(query, i, z - deletion_penalty, newK, newL)) # Deletion
if debug: print "char '%s found' with k=%d, l=%d. z = %d: parent k=%d, l=%d" % (
char, newK, newL, z, k, l)
if char == query[
i]: # if the char was correctly aligned, then continue without decrementing z (differences)
result = result.union(self.inexact_recursion(query, i - 1, z, newK, newL))
else: # continue but decrement z, to indicate that this was a difference/unalignment
result = result.union(self.inexact_recursion(query, i - 1, z - mismatch_penalty, newK, newL))
return result
最後に、感謝Jwomersコードは、結局、それはあまりにもあいまいによるオリジナル記事です....