visualization_views.py 959 Bytes
Newer Older
Anze Vavpetic's avatar
Anze Vavpetic committed
1 2 3 4 5 6
'''
Segmine visualization viewes.

@author: Anze Vavpetic <anze.vavpetic@ijs.si>
'''
from django.shortcuts import render
7
import os
8
import json
Anze Vavpetic's avatar
Anze Vavpetic committed
9

vpodpecan's avatar
vpodpecan committed
10

11 12 13 14 15 16 17 18 19 20
def segmine_biomine_visualizer(request, input_dict, output_dict, widget):
    from mothra.settings import MEDIA_ROOT
    from workflows.helpers import ensure_dir
    filename = os.path.join(str(request.user.id), str(widget.id) + '.bmg')
    destination = os.path.join(MEDIA_ROOT, filename)
    ensure_dir(destination)
    f = open(destination,'w')
    f.write(str(input_dict['graph']))
    f.close()
    return render(request, 'visualizations/segmine_biomine_visualizer.html', 
21 22
                  {'widget':widget, 'filename' : filename})

vpodpecan's avatar
vpodpecan committed
23

24 25 26 27
def segmine_rank_plotter(request, input_dict, output_dict, widget):
    scores = input_dict['ranks']
    scores = zip(*scores)[1]
    return render(request, 'visualizations/segmine_rank_plotter.html', 
vpodpecan's avatar
vpodpecan committed
28
                  {'widget': widget, 'gene_ranks': json.dumps(scores)})