跳到主要内容

東京大学 新領域創成科学研究科 メディカル情報生命専攻 2024年1月実施 問題12

Author

zephyr, 祭音Myyura

Description

ナノポアシークエンサーは DNA 配列を電流値の変化を通して読み取ることができる。 ある DNA 配列を読み取ったところ、時間 t=1,2,,nt = 1, 2, \ldots , n でそれぞれ読み取られた電流値列は {At} (0At1)\{A_t\} \ (0 \leq A_t \leq 1) であった。 この DNA 配列には基準配列が含まれていることが分かっており、基準配列を単独で読み取ったときの電流値列は時間 t=1,2,,mt = 1, 2, \ldots, m に対して {Bt} (0Bt1)\{B_t\} \ (0 \leq B_t \leq 1) であった(基準波形)。 このとき、AtA_t の中で基準配列に相当する時間区間を見つけたい。

DNA 配列を読み取る速度にはばらつきがあり急な変動があるため、基準配列を探す場合には時間軸方向へのずれを許したい。 このため、1p1p2pmn1 \leq p_1 \leq p_2 \leq \cdots \leq p_m \leq n (ただし 1t<m1 \leq t < m に対して pt+1ptWp_{t+1} - p_t \leq W, WW は正の整数) が存在して BtB_tAptA_{p_t} が対応していると仮定する。 読み取りノイズ等が無ければ Bt=AptB_t = A_{p_t} が成立して欲しいが、実際には読み取りノイズや電流値読み取りタイミングのずれを考慮して、相違度 t=1m(BtApt)2\sum_{t=1}^m (B_t - A_{p_t})^2 が最小値をとるような対応関係 p1,p2,,pmp_1, p_2, \ldots, p_m が基準波形とナノポアシークエンサー出力の一部分との正しい対応関係を示していると仮定する。

(1) m=1m = 1 とする。相違度が最小となる p1p_1 を1つ求めるアルゴリズムを示せ。

(2) m=2m = 2 とする。相違度が最小となる p1p_1, p2p_2 の組を1つ求めるアルゴリズムを示せ。

(3) WW はどのような物理条件に対応していると考えられるか。1行で説明せよ。

(4) Di,jD_{i,j}BiB_iAjA_j が対応しているときの、基準配列 {B1,B2,,Bi}\{B_1, B_2, \ldots, B_i\} に対する {A1,A2,,Aj}\{A_1, A_2, \ldots, A_j\} の相違度の最小値である。Dx,y (x<i,yj)D_{x,y} \ (x < i, y \leq j) を用いて Di,jD_{i,j} を表せ。

(5) 基準配列 {Bt}\{B_t\} に対する {At}\{A_t\} の相違度の最小値を計算するアルゴリズムを示し、その時間計算量を nn, mm, WW を用いて示せ。

题目描述

纳米孔测序仪以电流变化读取 DNA。某待测序列在时刻 t=1,,nt=1,\ldots,n 的电流为

{At},0At1,\{A_t\},\qquad0\le A_t\le1,

已知其中包含一段参考序列;单独读取参考序列时,在 t=1,,mt=1,\ldots,m 得到参考波形

{Bt},0Bt1.\{B_t\},\qquad0\le B_t\le1.

由于读取速度波动,需要允许时间轴错位。假设存在对应位置

1p1p2pmn,1\le p_1\le p_2\le\cdots\le p_m\le n,

且对相邻参考时刻 1t<m1\le t<m

pt+1ptW,p_{t+1}-p_t\le W,

其中 WW 为正整数。把参考波形与测序输出部分的差异度定义为

t=1m(BtApt)2,\sum_{t=1}^{m}(B_t-A_{p_t})^2,

并以使其最小的 p1,,pmp_1,\ldots,p_m 作为正确对应。结合上图回答:

  1. m=1m=1 时,给出求一组最优 p1p_1 的算法。
  2. m=2m=2 时,给出求一组最优 (p1,p2)(p_1,p_2) 的算法。
  3. 用一行说明参数 WW 对应何种物理限制。
  4. 定义 Di,jD_{i,j}:在 BiB_iAjA_j 对应的条件下,参考前缀 {B1,,Bi}\{B_1,\ldots,B_i\} 与输出前缀 {A1,,Aj}\{A_1,\ldots,A_j\} 的最小差异度。用满足 x<i,yjx<i,y\le j 的先前状态 Dx,yD_{x,y} 表示 Di,jD_{i,j},并体现单调对应与相邻位置差不超过 WW 的约束。
  5. 设计计算完整参考波形 {Bt}\{B_t\}{At}\{A_t\} 最小差异度的算法,并用 n,m,Wn,m,W 表示时间复杂度。

Kai

1. Finding p1p_1 for m=1m = 1

When m=1m = 1, the problem reduces to finding a single time point p1p_1 such that the dissimilarity t=11(BtApt)2\sum_{t=1}^1 (B_t - A_{p_t})^2 is minimized. The algorithm can be described as follows:

  1. Initialize p1p_1 to 1.
  2. For each i=1,2,,ni = 1, 2, \dots, n, compute the dissimilarity di=(B1Ai)2d_i = (B_1 - A_i)^2.
  3. Find the index ii that minimizes did_i.

The resulting p1p_1 will be the index that minimizes the dissimilarity.

Algorithm

Input: A sequence {A_t}, reference value B_1
Output: Index p_1 that minimizes dissimilarity

1. Initialize min_dissimilarity = infinity
2. Initialize p_1 = 1
3. For i = 1 to n do
d_i = (B_1 - A_i)^2
If d_i < min_dissimilarity then
min_dissimilarity = d_i
p_1 = i
4. Return p_1

2. Finding p1,p2p_1, p_2 for m=2m = 2

When m=2m = 2, the problem involves finding two indices p1p_1 and p2p_2 such that 1p1p2n1 \leq p_1 \leq p_2 \leq n and pt+1ptWp_{t+1} - p_t \leq W. The goal is to minimize the dissimilarity t=12(BtApt)2\sum_{t=1}^2 (B_t - A_{p_t})^2. The algorithm can be described as follows:

  1. Initialize minimum dissimilarity to infinity and p1,p2p_1, p_2 to 1.
  2. For each i=1,2,,ni = 1, 2, \dots, n, do:
    • For each j=i,i+1,,min(i+W,n)j = i, i+1, \dots, \min(i + W, n), do:
      • Compute the dissimilarity di,j=(B1Ai)2+(B2Aj)2d_{i,j} = (B_1 - A_i)^2 + (B_2 - A_j)^2.
      • If di,j<min_dissimilarityd_{i,j} < \text{min\_dissimilarity}, update p1=ip_1 = i, p2=jp_2 = j, and min_dissimilarity=di,j\text{min\_dissimilarity} = d_{i,j}.

Algorithm

Input: A sequence {A_t}, reference values {B_1, B_2}, window W
Output: Indices p_1, p_2 that minimize dissimilarity

1. Initialize min_dissimilarity = infinity
2. Initialize p_1, p_2 = 1
3. For i = 1 to n do
For j = i to min(i + W, n) do
d_ij = (B_1 - A_i)^2 + (B_2 - A_j)^2
If d_ij < min_dissimilarity then
min_dissimilarity = d_ij
p_1 = i
p_2 = j
4. Return p_1, p_2

3. Physical Meaning of WW

The parameter WW bounds local time stretching: at most WW output sampling intervals may elapse between two adjacent reference samples.

4. Recursive Formula for Di,jD_{i,j}

The minimum dissimilarity Di,jD_{i,j} can be computed using the following recurrence relation:

Di,j=(BiAj)2+minmax(1,jW)kjDi1,k(i2).\begin{aligned} D_{i,j} &=(B_i-A_j)^2+ \min_{\max(1,j-W)\le k\le j}D_{i-1,k} \qquad(i\ge2). \end{aligned}

5. Algorithm for Minimum Dissimilarity for m>2m > 2

To calculate the minimum dissimilarity between the sequence {At}\{A_t\} and the reference signal {Bt}\{B_t\}, we use a dynamic programming approach.

  1. Initialize a 2D array DD of size m×nm \times n with infinity, where Di,jD_{i,j} represents the minimum dissimilarity for the first ii elements of the reference sequence mapped to the first jj elements of the output sequence.
  2. Set D1,j=(B1Aj)2D_{1,j} = (B_1 - A_j)^2 for all j=1,2,,nj = 1, 2, \dots, n.
  3. For each i=2,3,,mi = 2, 3, \dots, m, do:
    • For each j=1,2,,nj = 1, 2, \dots, n, do:
      • Set Di,j=(BiAj)2+minx=max(1,jW)jDi1,xD_{i,j} = (B_i-A_j)^2+\min_{x = \max(1, j - W)}^{j}D_{i-1,x}.
  4. Return min1jnDm,j\min_{1\le j\le n}D_{m,j}.

Time Complexity

The time complexity of this algorithm is O(mnW)O(m \cdot n \cdot W), where:

  • mm is the length of the reference signal,
  • nn is the length of the sequence {At}\{A_t\},
  • WW is the maximum allowed shift between adjacent points.

Knowledge

难点思路

本题的主要难点在于第 4 和第 5 问,需要正确地推导出动态规划的递推关系,并设计出高效的算法。关键是要理解如何处理时间轴偏移的约束条件,以及如何在保证正确性的同时优化算法的时间复杂度。

解题技巧

对于序列对齐问题,动态规划是一种有效的解决方案。特别是在处理时间序列中的波动和对齐问题时,可以灵活调整对齐窗口 WW 来达到最优匹配。

重点词汇

  • Dissimilarity: 相异度
  • Reference Signal: 参考信号
  • Window: 窗口

参考资料

  1. Dynamic Time Warping Algorithm: Introduction to the dynamic time warping algorithm, Wikipedia.
  2. Time Series Analysis and Its Applications, Third Edition, Robert H. Shumway and David S. Stoffer.