From d0911a04958a04042da02a334ccc528dae79cc17 Mon Sep 17 00:00:00 2001 From: zsloan Date: Fri, 27 Mar 2015 20:28:51 +0000 Subject: Removed everything from 'web' directory except genofiles and renamed the directory to 'genotype_files' --- web/webqtl/networkGraph/networkGraphPageBody.py | 697 ------------------------ 1 file changed, 697 deletions(-) delete mode 100644 web/webqtl/networkGraph/networkGraphPageBody.py (limited to 'web/webqtl/networkGraph/networkGraphPageBody.py') diff --git a/web/webqtl/networkGraph/networkGraphPageBody.py b/web/webqtl/networkGraph/networkGraphPageBody.py deleted file mode 100644 index 22b49ccd..00000000 --- a/web/webqtl/networkGraph/networkGraphPageBody.py +++ /dev/null @@ -1,697 +0,0 @@ -# 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 = ''' - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - ''' % (webqtlConfig.CGIDIR, - webqtlConfig.SCRIPTFILE, - p["filename"], - graphName, - p["riset"], - p["session"], - p["searchResult"], - symbolList, - optimalNode) - - body += formParams - - #Adds the html generated by graphviz that displays the graph itself - body += graphcode - - #Initializes all form values - - selected = ["","","",""] - selected[p["whichValue"]] = "CHECKED" - - selected3 = ["",""] - if p["splines"] == "yes": - selected3[0] = "CHECKED" - else: - selected3[1] = "CHECKED" - - selected5 = ["",""] - if p["nodeshape"] == "yes": - selected5[0] = "CHECKED" - else: - selected5[1] = "CHECKED" - - selected7 = ["",""] - if p["nodelabel"] == "yes": - selected7[0] = "CHECKED" - else: - selected7[1] = "CHECKED" - - selected6 = ["",""] - if p["dispcorr"] == "yes": - selected6[0] = "CHECKED" - else: - selected6[1] = "CHECKED" - - selected4 = ["", ""] - selected4[p["printIslands"]] = "CHECKED" - - selectedExportFormat = ["",""] - if p["exportFormat"] == "xgmml": - selectedExportFormat[0] = "selected='selected'" - elif p["exportFormat"] == "plain": - selectedExportFormat[1] = "selected='selected'" - - selectedTraitType = ["",""] - if p["traitType"] == "symbol": - selectedTraitType[0] = "selected='selected'" - elif p["traitType"] == "name": - selectedTraitType[1] = "selected='selected'" - - selectedgType = ["","","","",""] - if p["gType"] == "none": - selectedgType[0] = "selected='selected'" - elif p["gType"] == "neato": - selectedgType[1] = "selected='selected'" - elif p["gType"] == "fdp": - selectedgType[2] = "selected='selected'" - elif p["gType"] == "circular": - selectedgType[3] = "selected='selected'" - elif p["gType"] == "radial": - selectedgType[4] = "selected='selected'" - - - selectedLock = ["",""] - if p["lock"] == "no": - selectedLock[0] = "selected='selected'" - elif p["lock"] == "yes": - selectedLock[1] = "selected='selected'" - - # line 1~6 - - selectedL1style = ["","","","",""] - if p["L1style"] == "": - selectedL1style[0] = "selected='selected'" - elif p["L1style"] == "bold": - selectedL1style[1] = "selected='selected'" - elif p["L1style"] == "dotted": - selectedL1style[2] = "selected='selected'" - elif p["L1style"] == "dashed": - selectedL1style[3] = "selected='selected'" - else: - selectedL1style[4] = "selected='selected'" - - selectedL2style = ["","","","",""] - if p["L2style"] == "": - selectedL2style[0] = "selected='selected'" - elif p["L2style"] == "bold": - selectedL2style[1] = "selected='selected'" - elif p["L2style"] == "dotted": - selectedL2style[2] = "selected='selected'" - elif p["L2style"] == "dashed": - selectedL2style[3] = "selected='selected'" - else: - selectedL2style[4] = "selected='selected'" - - selectedL3style = ["","","","",""] - if p["L3style"] == "": - selectedL3style[0] = "selected='selected'" - elif p["L3style"] == "bold": - selectedL3style[1] = "selected='selected'" - elif p["L3style"] == "dotted": - selectedL3style[2] = "selected='selected'" - elif p["L3style"] == "dashed": - selectedL3style[3] = "selected='selected'" - else: - selectedL3style[4] = "selected='selected'" - - selectedL4style = ["","","","",""] - if p["L4style"] == "": - selectedL4style[0] = "selected='selected'" - elif p["L4style"] == "bold": - selectedL4style[1] = "selected='selected'" - elif p["L4style"] == "dotted": - selectedL4style[2] = "selected='selected'" - elif p["L4style"] == "dashed": - selectedL4style[3] = "selected='selected'" - else: - selectedL4style[4] = "selected='selected'" - - selectedL5style = ["","","","",""] - if p["L5style"] == "": - selectedL5style[0] = "selected='selected'" - elif p["L5style"] == "bold": - selectedL5style[1] = "selected='selected'" - elif p["L5style"] == "dotted": - selectedL5style[2] = "selected='selected'" - elif p["L5style"] == "dashed": - selectedL5style[3] = "selected='selected'" - else: - selectedL5style[4] = "selected='selected'" - - selectedL6style = ["","","","",""] - if p["L6style"] == "": - selectedL6style[0] = "selected='selected'" - elif p["L6style"] == "bold": - selectedL6style[1] = "selected='selected'" - elif p["L6style"] == "dotted": - selectedL6style[2] = "selected='selected'" - elif p["L6style"] == "dashed": - selectedL6style[3] = "selected='selected'" - else: - selectedL6style[4] = "selected='selected'" - - nfontSelected = ["", "", ""] - if p["nfont"] == "arial": - nfontSelected[0] = "selected='selected'" - elif p["nfont"] == "verdana": - nfontSelected[1] = "selected='selected'" - elif p["nfont"] == "times": - nfontSelected[2] = "selected='selected'" - - cfontSelected = ["", "", ""] - if p["cfont"] == "arial": - cfontSelected[0] = "selected='selected'" - elif p["cfont"] == "verdana": - cfontSelected[1] = "selected='selected'" - elif p["cfont"] == "times": - cfontSelected[2] = "selected='selected'" - - #Writes the form part of the body - - body += '''

- - -
- - - - - - - - - - - - - - - - - ''' % (selectedgType[0], selectedgType[1], selectedgType[2], selectedgType[3], selectedgType[4], - selectedLock[0], selectedLock[1], - p["cL1Color"], - selectedL1style[0], selectedL1style[1], selectedL1style[2], selectedL1style[3], selectedL1style[4], - p["cL2Color"], - selectedL2style[0], selectedL2style[1], selectedL2style[2], selectedL2style[3], selectedL2style[4], - p["cL3Color"], - selectedL3style[0], selectedL3style[1], selectedL3style[2], selectedL3style[3], selectedL3style[4], - p["cL4Color"], - selectedL4style[0], selectedL4style[1], selectedL4style[2], selectedL4style[3], selectedL4style[4], - p["cL5Color"], - selectedL5style[0], selectedL5style[1], selectedL5style[2], selectedL5style[3], selectedL5style[4], - p["cL6Color"], - selectedL6style[0], selectedL6style[1], selectedL6style[2], selectedL6style[3], selectedL6style[4], - selected[0], selected[1], selected[2], selected[3], - p["kValue"], - selected4[1], selected4[0], - selected5[0], selected5[1], - selected7[0], selected7[1], - nfontSelected[0], nfontSelected[1], nfontSelected[2], - p["nfontsize"], - selected3[0], selected3[1], - selected6[1], selected6[0], - cfontSelected[0], cfontSelected[1], cfontSelected[2], - p["cfontsize"], - p["cPubName"], p["cMicName"], p["cGenName"], - p["cPubColor"], p["cMicColor"], p["cGenColor"], - p["cL1Name"], p["cL2Name"], p["cL3Name"], p["cL4Name"], p["cL5Name"], p["cL6Name"], - p["cL1Color"], p["cL2Color"], p["cL3Color"], p["cL4Color"], p["cL5Color"], p["cL6Color"], - p["cPubColor"], p["cMicColor"], p["cGenColor"]) - - #updated by NL 09-03-2010 function changeFormat() has been moved to webqtl.js and be changed to changeFormat(graphName) - #Javascript that selects the correct graph export file given what the user selects - #from the two drop-down menus - - body += ''' - -
-
-       -       -       - -       -       - -
-

-   -
-

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Lock Graph Structure
- Locking the graph structure allows the user to hold the position of
- all nodes and the length of all edges constant, letting him/her easily
- compare between different correlation types. Changing the value to "yes"
- requires the line threshold to be set to 0 in order to lock the structure.
-

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Line Type 1:-1to-0.7
Line Type 2:-0.7to-0.5
Line Type 3:-0.5to0
Line Type 4:0to0.5
Line Type 5:0.5to0.7
Line Type 6:0.7to1
-
To change colors, select Line Type then select Color below.

Correlation Type: - - - - - - - - - - -
PearsonSpearman
LiteratureTissue
-
Line Threshold:Absolute values greater than

Draw Nodes : - all - connected only -
Node Shape: - rectangle - ellipse -
Node Label: - trait name
- gene symbol / marker name -
Node Font: - -
Node Font Size: point

Draw Lines: - curved - straight -
Display Correlations: - no - yes -
Line Font: - -
Line Font Size: point

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Publish Microarray Genotype
- -

- colorPanel -

-
 

Right-click or control-click on the following - links to download this graph as a GIF file or - a PDF file.

''' % (imageName, pdfName) - - body += '''

Initial edge lengths were computed by applying an r-to-Z transform to the correlation coefficents - and then inverting the results. The graph drawing algorithm - found a configuration that minimizes the total stretching of the edges.

''' - - body += '''

This graph took %s seconds to generate with the - GraphViz visualization toolkit from AT&T Research.

''' % (round(totalTime, 2)) - - #Form to export graph file as either XGMML (standardized graphing format) or a - #plain text file with trait names/symbols and correlations - - body += ''' -
-

Export Graph File:

-

-       -

- -

- -

-
- ''' % (graphName, selectedExportFormat[0], selectedExportFormat[1], - graphName, selectedTraitType[0], selectedTraitType[1]) - - body += '''
-
- - - The Web - GeneNetwork
-
- ''' - - - self.dict["body"] = body - - def writeToFile(self, filename): - """ - Output the contents of this HTML page to a file. - """ - handle = open(filename, "w") - handle.write(str(self)) - handle.close() -- cgit 1.4.1