Пример #1
0
def phog_tree(request, phog_accession, leftid1=None, leftid2=None):
  tree_id = int(phog_accession[4:11])
  phog_left_id = int(phog_accession[12:])
  phog = TreeNode.objects.get(tree__id = tree_id, left_id = phog_left_id)
  if phog == None:
    return render_to_response('404.html')
  else:
    t = loader.get_template('phyloscope/phyloscope.html')
    highlightLeftIds = ""
    if leftid1 or leftid2:
      if not leftid2:
        highlightLeftIds = leftid1
      elif not leftid1:
        highlightLeftIds = leftid2
      else:
        highlightLeftIds = "%s %s" % (leftid1, leftid2)
    colorLeftIds = ''
    c = RequestContext(request, {
                    'json_tree': annotatedTree(phog.tree.family.__unicode__(),
                    tree_method=phog.tree.method),
                    'superorthologous_nodes': "",
                    'family_accession': phog.tree.family.__unicode__(),
                    'phog_accession': phog_accession,
                    'subtree_left_id': phog.left_id,
                    'highlight_left_ids': highlightLeftIds,
                    'color_left_ids': colorLeftIds,
                    'hide_subfam_controls': True,
                    'hide_ortho_controls': True,
                    'show_full_tree_download': False})
#    add_download_form_to_context(c)
    return HttpResponse(t.render(c))
Пример #2
0
def orthoscope_get(request):
    t = loader.get_template('phyloscope/phyloscope.html')
    subtreeLeftId = get_parameter_from_GET('subtreeLeftId', request)
    highlightLeftIds = get_parameter_from_GET('highlightLeftIds', request)
    colorLeftIds = get_parameter_from_GET('colorLeftIds', request)
    phog_accession =  get_parameter_from_GET('phog', request)
    family_accession =  get_parameter_from_GET('family', request)
    url_tree_method = get_parameter_from_GET('treeMethod', request)
    if url_tree_method == '':
      url_tree_method = 'ml'
    if phog_accession != "":
      phog_id = int(phog_accession[4:])
      phog = TreeNode.objects.get(id = phog_id)
      if phog == None:
        return render_to_response('404.html')
      else:
        c = RequestContext(request, {
            'json_tree': annotatedTree(phog.tree.family.__unicode__(), 
                            tree_method = url_tree_method),
            'superorthologous_nodes': "",
            'family_accession': phog.tree.alignment.family.__unicode__(),
            'subtree_left_id': phog.left_id,
            'highlight_left_ids': highlightLeftIds,
            'color_left_ids': colorLeftIds,
            'hide_subfam_controls': True,
            'tree_method': url_tree_method,
            'do_color_ortho': True})
        return HttpResponse(t.render(c))
    elif family_accession != "":  
      c = RequestContext(request, {
            'json_tree': annotatedTree(request.GET['family'],
                            tree_method = url_tree_method),
            'superorthologous_nodes': superorthologousNodes(
                      request.GET['family'], tree_method = url_tree_method),
            'family_accession': request.GET['family'],
            'subtree_left_id': subtreeLeftId,
            'highlight_left_ids': highlightLeftIds,
            'color_left_ids': colorLeftIds,
            'hide_subfam_controls': True,
            'do_color_ortho': True,
            'tree_method': url_tree_method,
            'show_family_download': False,
            'show_tree_download': False})
#      add_download_form_to_context(c)
      return HttpResponse(t.render(c))
    else:
      return render_to_response('404.html')
Пример #3
0
def orthoscope(request, family_accession):
    t = loader.get_template('phyloscope/phyloscope.html')
    c = RequestContext(request, {'json_tree': annotatedTree(family_accession),
                                 'family_accession': family_accession,
                                 'superorthologous_nodes': superorthologousNodes(family_accession),
                                 'hide_subfam_controls': True,
                                 'do_color_ortho': True})
    return HttpResponse(t.render(c))
Пример #4
0
def phyloscope(request, family_accession):
    t = loader.get_template('phyloscope/phyloscope.html')
    c = RequestContext(
        request, {
            'json_tree': annotatedTree(family_accession),
            'family_accession': family_accession,
            'hide_ortho_controls': True
        })
    return HttpResponse(t.render(c))
Пример #5
0
def phog_tree_json(request, phog_accession):
  tree_id = int(phog_accession[4:11])
  phog_left_id = int(phog_accession[12:])
  phog = TreeNode.objects.get(tree__id = tree_id, left_id = phog_left_id)
  if phog == None:
    return render_to_response('404.html')
  response = HttpResponse(mimetype='application/json')
  response['Content-Disposition'] = 'inline; filename=%s.json' % phog_accession
  response.write(annotatedTree(phog.tree.family.__unicode__(), 
                  tree_method=phog.tree.method))
  return response
Пример #6
0
def phyloscope_get(request):
    t = loader.get_template('phyloscope/phyloscope.html')
    mode = get_parameter_from_GET('mode', request)
    subtreeLeftId = get_parameter_from_GET('subtreeLeftId', request)
    highlightLeftIds = get_parameter_from_GET('highlightLeftIds', request)
    colorLeftIds = get_parameter_from_GET('colorLeftIds', request)
    phog_accession = get_parameter_from_GET('phog', request)
    family_accession = get_parameter_from_GET('family', request)
    preferred_name = get_parameter_from_GET('preferredName', request)
    url_tree_method = get_parameter_from_GET('treeMethod', request)
    c = RequestContext(
        request, {
            'json_tree': annotatedTree(family_accession, url_tree_method),
            'family_accession': family_accession,
            'preferred_name': preferred_name,
            'url_tree_method': url_tree_method,
            'hide_ortho_controls': True
        })
    return HttpResponse(t.render(c))