【发布时间】:2014-05-15 20:12:58
【问题描述】:
[不确定我是否应该在这里发帖,如果没有请告诉我!]
问题在于method of Zucker's 的回溯过程,该过程使用动态编程来最小化二级 RNA 结构中的能量。
所以,我有上三角矩阵W,里面填满了这个公式:
W(i, j) = min([W(i,j-1),
W(i+1,j),
V(i,j),
min_k // I will use an example, where this argument is NOT used
]);
同时我也用这个逻辑填充回溯表B:
if(min was the first option)
B(i, j) = 10;
elseif(min was the 2nd option)
B(i, j) = 11;
elseif(min was the 3rd option)
B(i, j) = 12;
else
// doesn't matter now
我不确定是否必须显示V 的填充方式。
我确信这些矩阵的创建是正确的。
问题是我必须显示通向最小值W 的所有回溯路径。
请注意,这个问题不是关于给我代码。这是为了通过一个示例来了解如何执行回溯。我猜伪代码也应该可以解决问题。
例子:
x = CACGGUUAG // input
W =
Inf Inf Inf 8 8 8 5 5 5
Inf Inf Inf Inf 8 8 5 5 5
Inf Inf Inf Inf Inf 8 8 8 6
Inf Inf Inf Inf Inf Inf 8 8 8
Inf Inf Inf Inf Inf Inf Inf 8 8
Inf Inf Inf Inf Inf Inf Inf Inf 8
Inf Inf Inf Inf Inf Inf Inf Inf Inf
Inf Inf Inf Inf Inf Inf Inf Inf Inf
Inf Inf Inf Inf Inf Inf Inf Inf Inf
B =
C A C G G U U A G
----------------------------------------------------------------------------
C 0 0 0 12 10 10 11 10 10
A 0 0 0 0 12 10 12 10 10
C 0 0 0 0 0 12 10 10 12
G 0 0 0 0 0 0 12 10 10
G 0 0 0 0 0 0 0 12 10
U 0 0 0 0 0 0 0 0 12
U 0 0 0 0 0 0 0 0 0
A 0 0 0 0 0 0 0 0 0
G 0 0 0 0 0 0 0 0 0
据我所知,因为我找不到关于填充矩阵后如何进行的信息,所以我即兴创作。
我只知道回溯是从右上角开始的。 所以,我说:
if(B(i, j) == 10)
go left
elseif(B(i, j) == 11)
go down
else
go left and down
在这个例子中产生
<- GC // left
<- AC
|
v UA // down
/
V UC // left and down
/
v UG
这似乎可行,因为如果您从数组W 中的 UG 出发,您会发现自己位于 W 的右上角,我认为这就是我们正在寻找的东西。
我提出的这个逻辑的问题是如何获得所有最优路径,而不仅仅是一个!
【问题讨论】:
标签: algorithm matlab dynamic-programming bioinformatics backtracking