Пример #1
0
def network_as_gml(request):
    if request.GET.has_key("biclusters"):
        bicluster_ids = re.split(r"[\s,;]+", request.GET["biclusters"])
        biclusters = Bicluster.objects.filter(id__in=bicluster_ids)
    elif request.GET.has_key("gene"):
        biclusters = Bicluster.objects.filter(genes__name=request.GET["gene"])

    expand = request.GET.has_key("expand") and request.GET["expand"] == "true"

    graph = get_nx_graph_for_biclusters(biclusters, expand)

    # write graphml to response
    response = HttpResponse(content_type="application/xml")
    nx.write_gml(graph, response)

    return response
Пример #2
0
def network_as_gml(request):
    if request.GET.has_key('biclusters'):
        bicluster_ids = re.split(r'[\s,;]+', request.GET['biclusters'])
        biclusters = Bicluster.objects.filter(id__in=bicluster_ids)
    elif request.GET.has_key('gene'):
        biclusters = Bicluster.objects.filter(genes__name=request.GET['gene'])

    expand = request.GET.has_key('expand') and request.GET['expand'] == 'true'

    graph = get_nx_graph_for_biclusters(biclusters, expand)

    # write graphml to response
    response = HttpResponse(content_type='application/xml')
    nx.write_gml(graph, response)

    return response
Пример #3
0
def network_as_graphml(request):
    if request.GET.has_key("biclusters"):
        bicluster_ids = re.split(r"[\s,;]+", request.GET["biclusters"])
        biclusters = Bicluster.objects.filter(id__in=bicluster_ids)
    elif request.GET.has_key("gene"):
        biclusters = Bicluster.objects.filter(genes__name=request.GET["gene"])

    expand = request.GET.has_key("expand") and request.GET["expand"] == "true"

    graph = get_nx_graph_for_biclusters(biclusters, expand)

    # write graphml to response
    writer = nx.readwrite.graphml.GraphMLWriter(encoding="utf-8", prettyprint=True)
    writer.add_graph_element(graph)
    response = HttpResponse(content_type="application/xml")
    writer.dump(response)

    return response
Пример #4
0
def network_as_graphml(request):
    if request.GET.has_key('biclusters'):
        bicluster_ids = re.split(r'[\s,;]+', request.GET['biclusters'])
        biclusters = Bicluster.objects.filter(id__in=bicluster_ids)
    elif request.GET.has_key('gene'):
        biclusters = Bicluster.objects.filter(genes__name=request.GET['gene'])

    expand = request.GET.has_key('expand') and request.GET['expand'] == 'true'

    graph = get_nx_graph_for_biclusters(biclusters, expand)

    # write graphml to response
    writer = nx.readwrite.graphml.GraphMLWriter(encoding='utf-8',
                                                prettyprint=True)
    writer.add_graph_element(graph)
    response = HttpResponse(content_type='application/xml')
    writer.dump(response)

    return response