%inherit file="base.html.mako"/>
<%def name="bits(x)">
${'%.2fb'%(-x)}
%def>
<%!
import numpy
AMINO_ACIDS= 'ARNDCQEGHILKMFPSTWYVX'
%>
<%
def count_occ(target, specific):
instruction = annotated.plan.instructions[target]
if instruction.action.type in ('Node', 'Combine'):
return sum(count_occ(value, specific) for value in instruction.values)
elif instruction.action.type == 'Sequence':
return int(position.sequences[int(instruction.action.value)] == AMINO_ACIDS[specific])
%>
<%def name="state(target, specific)">
% if specific is not None:
${bits(executed_values[target][specific])}
%else:
%for index, value in enumerate(AMINO_ACIDS):
${value} |
%endfor
%for index, value in enumerate(executed_values[target]):
${bits(value)} |
%endfor
%for index, value in enumerate(executed_values[target]):
${count_occ(target, index)} |
%endfor
%endif
%def>
<%def name="show(target, path, specific)">
<% instruction = annotated.plan.instructions[target] %>
%if instruction.action.type == 'Node':
Node ${instruction.action.value}
Open
${state(target, specific)}
%for value in instruction.values:
${show(value, path + 'v' + str(value) + 'v', None)}
%endfor
%elif instruction.action.type == 'Combine':
Combine
Open
${state(target, specific)}
%for value in instruction.values:
${show(value, path + 'v' + str(value) + 'v', None)}
%endfor
%elif instruction.action.type == 'Sequence':
Sequence ${annotated.sequences[int(instruction.action.value)].id} (${instruction.action.value})
${state(target, specific)}
%endif
%def>
<%
reference_index = 'ARNDCQEGHILKMFPSTWYVX'.index(position.reference)
%>
${show(annotated.plan.target, '' + str(annotated.plan.target) , None)}