Esempio n. 1
0
def process_cluster(cluster):
    network = get_network_from_cluster(cluster)
    hard = cluster_hard(network)
    subtrees = cluster_networks.potential_number_of_calls(network)
    soft_too_expensive = subtrees > MAX_SUBTREES
    async = not DEBUG
    q = Queue(connection=Redis(), default_timeout=60*15, async=async)
Esempio n. 2
0
def download_hard(cluster):
    g = get_network_from_cluster(cluster)
    hard = cluster_hard(g)
    s = str(hard)
    r = Response(body=s, status=200)
    r.set_header('Content-Type', 'text/txt')
    r.set_header('Content-Disposition', 'attachment; filename="phylonetwork_soft.txt"')
    return r
Esempio n. 3
0
def process_enewick(phrase):
    try:
        g = enewick.enewick_to_phylonet(phrase)
    except enewick.MalformedNewickException:
        redirect("/?error=enewick")
    trans = {}
    for node in g.nodes():
        if "#" in node:
            new_node = node.replace("#", "")
            trans[node] = new_node
    nx.relabel_nodes(g, trans, copy=False)
    clusters = re.sub("\s+", "", str(cluster_hard(g)))
    quoted = urllib.quote_plus(clusters)
    redirect("/cluster/"+quoted)