# Copyright (C) University of Tennessee Health Science Center, Memphis, TN. # # This program is free software: you can redistribute it and/or modify it # under the terms of the GNU Affero General Public License # as published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the GNU Affero General Public License for more details. # # This program is available from Source Forge: at GeneNetwork Project # (sourceforge.net/projects/genenetwork/). # # Contact Drs. Robert W. Williams and Xiaodong Zhou (2010) # at rwilliams@uthsc.edu and xzhou15@uthsc.edu # # # # This module is used by GeneNetwork project (www.genenetwork.org) # # Created by GeneNetwork Core Team 2010/08/10 # # Last updated by GeneNetwork Core Team 2010/10/20 from base.templatePage import templatePage import networkGraphUtils from base import webqtlConfig # our output representation is fairly complicated # because we use an iframe to represent the image and the image has # an associated image map, our output is actually three files # 1) a networkGraphPage instance -- the URL we pass to the user # 2) a GraphPage with the image map and the graph -- this page has to be # there to pass the imagemap data to the browser # 3) a PNG graph file itself class networkGraphPageBody(templatePage): """ Using the templatePage class, we build an HTML shell for the graph that displays the parameters used to generate it and allows the user to redraw the graph with different parameters. The way templatePage works, we build the page in pieces in the __init__ method and later on use the inherited write method to render the page. """ def __init__(self, fd, matrix, traits, imageHtmlName, imageName, pdfName, nodes, edges, rawEdges, totalTime, p, graphcode, graphName, optimalNode): templatePage.__init__(self, fd) if p["printIslands"] == 0: island = "Only nodes with edges" else: island = "All nodes" body = """
Network Graph
The %s nodes in the graph below show the selected traits. %s are displayed. The %s edges between the nodes, filtered from the %s total edges and drawn as %s, show %s correlation coefficients greater than %s or less than -%s. The graph\'s canvas is %s by %s cm, and the node labels are drawn with a %s point font, and the edge labels are drawn with a %s point font. Right-click or control-click on the graph to save it to disk for further manipulation. See below for the trait key, and graph options.
""" % (nodes, island, edges, rawEdges, p["splineName"], p["correlationName"], p["kValue"], p["kValue"], p["width"], p["height"], p["nfontsize"], p["cfontsize"]) #Generate a list of symbols for the central node selection drop-down menu symbolList = networkGraphUtils.generateSymbolList(traits) #Some of these hidden variables (CellID, CellID2, ProbesetID2, etc) exist #to be used by the javascript functions called when a user clicks on an edge or node formParams = '''