Пример #1
0
 def buildEdges(self):
     for node2 in self.nodes.values():
         for node1 in self.nodes.values():
             s = getSymbol(node2.value - node1.value)
             if s:
                 GraphEdge(node1, node2, s)
                 if node2 in self.roots: self.roots.remove(node2)
Пример #2
0
from python.util import getSymbol

__author__ = "ekarpov"

specter = []
while True:
    s = input()
    if not s:
        break
    specter.append(float(s))

specter = specter[::-1]
protein = ""

prev_w = specter[0]
for w in specter[1:]:
    weight = prev_w - w
    prev_w = w
    protein = getSymbol(weight) + protein

print(protein)
Пример #3
0
    L.append(float(s))

P = L[0]
L = L[1:]
n = (len(L) >> 1) - 1

graph = {key(x): GraphNode(x) for x in L}
starts = set(graph.keys())
ends = set(graph.keys())
for i in range(0, len(L)):
    w1 = L[i]
    for j in range(0, len(L)):
        w2 = L[j]

        if w2 > w1:
            s = util.getSymbol(w2 - w1)
            if not s is None:
                key1 = key(w1)
                key2 = key(w2)
                GraphEdge(graph[key1], graph[key2], s)
                if key2 in starts: starts.remove(key2)
                if key1 in ends: ends.remove(key1)

prefixes = set()
suffixes = set()

for node in starts:
    traverseForward(graph[node], '')
for node in ends:
    traverseBackward(graph[node], '')