changeset 0:e41ec5af7472 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/heinz commit b0b2c64a46bdd9beebdfb7fc5312f75346483763
author iuc
date Thu, 02 Aug 2018 11:57:44 -0400
parents
children 5f589c91566e
files bum.R bum.xml heinz.xml heinz_scoring.py heinz_scoring.xml test-data/BUM_input.txt test-data/BUM_output.txt test-data/EdgesPCST.txt test-data/Heinz_output.txt test-data/Heinz_score_using_BUM_output.txt test-data/Heinz_score_using_manual_BUM_params.txt test-data/NodesPCST.txt test-data/genes_with_a_p_value.csv test-data/heinz_graph.pdf visualization.py visualization.xml
diffstat 16 files changed, 1484 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bum.R	Thu Aug 02 11:57:44 2018 -0400
@@ -0,0 +1,34 @@
+# Author: Cico Zhang
+# Usage: Rscript bum.R --input p-values.txt --output result.txt --verbose TRUE
+
+# Set up R error handling to go to stderr
+options(show.error.messages=F, error=function(){cat(geterrmessage(),file=stderr());q("no",1,F)})
+
+# Avoid crashing Galaxy with an UTF8 error on German LC settings
+#loc <- Sys.setlocale("LC_MESSAGES", "en_US.UTF-8")
+
+# Import required libraries
+suppressPackageStartupMessages({
+  library('getopt')
+  library('BioNet')
+})
+
+# Take in trailing command line arguments
+args <- commandArgs(trailingOnly = TRUE)
+
+# Get options using the spec as defined by the enclosed list
+# Read the options from the default: commandArgs(TRUE)
+option_specification <- matrix(c(
+  'input', 'i', 2, 'character',
+  'output', 'o', 2, 'character'
+), byrow=TRUE, ncol=4);
+
+# Parse options
+options <- getopt(option_specification);
+
+pvals <- read.table(options$input)
+bum <- fitBumModel(pvals,plot=FALSE)
+mat <- c(bum$lambda, bum$a)
+#bumtablename <- paste(options$output,sep="\t")
+write.table(x=mat, file=options$output,quote=FALSE, row.names=FALSE, col.names=FALSE)
+message ("Parameters have been estimated successfully!")
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bum.xml	Thu Aug 02 11:57:44 2018 -0400
@@ -0,0 +1,41 @@
+<tool id="heinz_bum" name="Fit a BUM model" version="1.0">
+    <description>with p-values</description>
+    <requirements>
+        <requirement type="package" version="1.20.0">r-getopt</requirement>
+        <requirement type="package" version="1.34.0">bioconductor-bionet</requirement>
+    </requirements>
+    <command detect_errors="exit_code"><![CDATA[
+Rscript '$__tool_directory__/bum.R' --input '$p_values' --output '$dist_params'
+    ]]></command>
+    <inputs>
+        <param type="data" name="p_values" label="Input file" format="txt" help="
+        The input file should only contain p-values, one per line." />
+    </inputs>
+    <outputs>
+        <data name="dist_params" format="txt" label="${tool.name} on ${on_string}: BUM params"/>
+    </outputs>
+    <tests>
+      <!--Ensure the stochastic result is similar enough-->
+        <test>
+            <param name="p_values" value="BUM_input.txt" />
+            <output name="dist_params">
+                <assert_contents>
+                    <has_text text="0.684" />
+                    <has_text text="0.376" />
+                </assert_contents>
+            </output>
+        </test>
+    </tests>
+    <help><![CDATA[
+BUM is the abbreviation for "Beta-Uniform Mixture (BUM) distribution."
+
+This tool (part of the package "Bionet") is used for fitting Beta-Uniform
+mixture model to a P-value distribution, the output of which is two model
+parameters: lambda and alpha, kept in a text file, the first line is
+lambda; the second, alpha.
+    ]]></help>
+    <citations>
+        <citation type="doi">10.1093/bioinformatics/btq089</citation>
+        <citation type="doi">10.1093/bioinformatics/btn161</citation>
+    </citations>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/heinz.xml	Thu Aug 02 11:57:44 2018 -0400
@@ -0,0 +1,76 @@
+<tool id="heinz" name="Identify optimal scoring subnetwork" version="1.0">
+    <description>using Heinz</description>
+    <requirements>
+        <requirement type="package" version="2.0">heinz</requirement>
+    </requirements>
+    <command detect_errors="aggressive"><![CDATA[
+heinz -m \${GALAXY_SLOTS:-2} -n '$score' -e '$edge' 1> '$subnetwork'
+    ]]></command>
+    <inputs>
+        <param type="data" name="score" format="txt" label="File containing Heinz scores"
+        help="The file should contain two columns: the node identifier (e.g. gene) and the corresponding Heinz score" />
+        <param type="data" name="edge" format="txt" label="Edge file"
+        help="In this file, two nodes define one edge, one edge per line" />
+    </inputs>
+    <outputs>
+        <data name="subnetwork" format="txt" label="${tool.name} on ${on_string}: Optimal subgraph" />
+    </outputs>
+    <tests>
+        <test>
+            <param name="score" value="NodesPCST.txt" />
+            <param name="edge" value="EdgesPCST.txt" />
+            <output name="subnetwork">
+                <assert_contents>
+                    <has_text text='label="a\n5\n0\n0"' />
+                    <has_text text='label="b\n-4\n0\n1",shape=box' />
+                    <has_text text="Total weight: 36" />
+                    <has_text text="0 -- 1" />
+                    <has_text text="1 -- 3" />
+                    <has_text text="5 -- 7" />
+                </assert_contents>
+            </output>
+        </test>
+    </tests>
+    <help><![CDATA[
+**Note**: You are currently using a version of Heinz based on IBM CPLEX Community version,
+which is limiting the capacity of Heinz in handling big networks. For an unlimited version of Heinz,
+you need to get a license of IBM CPLEX and compile Heinz from scratch from here https://github.com/ls-cwi/heinz.
+We are currently looking for an alternative to IBM CPLEX in Heinz to make an unlimited version of Heinz available
+to the public as soon as possible.
+
+Score file --- the output file of the tool "Calculate Heinz scores": two columns delimited
+by a tab without headers, the first column is node identifier (e.g., genes, KEGG ORTHOLOGY (KO));
+the second, Heinz score.
+
+========= ===================
+BRCA2    -6.991782933819368
+--------- -------------------
+BRCA1    -5.206139799106934
+--------- -------------------
+AACS     -0.9299868303078357
+--------- -------------------
+ABCC11    -5.845009850430119
+========= ===================
+
+
+Edge file: the background network Heinz uses in the form of a list of edges; each line is made up of
+two node identifiers (e.g., genes, KEGG ORTHOLOGY (KO)) delimited by a tab. In practice, we could
+prepare this file using different pathway databases, such as Reactome, STRING and KEGG. Which database
+to choose depends on the question to solve.
+
+========= =========
+ACTR1B    ACVR2B
+--------- ---------
+ZSWIM9    FOXP3
+--------- ---------
+LGALS4    PRKX
+--------- ---------
+NPTX1     CIAO1
+========= =========
+
+
+    ]]></help>
+    <citations>
+        <citation type="doi">10.1093/bioinformatics/btn161</citation>
+    </citations>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/heinz_scoring.py	Thu Aug 02 11:57:44 2018 -0400
@@ -0,0 +1,94 @@
+#!/usr/bin/env python
+"""Calculate scores for Heinz.
+
+This script transform a p-value into a score:
+    1. Use alpha and lambda to calculate a threshold P-value.
+    2. Calculate a score based on each P-value by alpha and the threshold.
+
+For more details, please refer to the paper doi:10.1093/bioinformatics/btn161
+
+Input:
+    P-values from DESeq2 result: first column: names, second column P-values
+Output:
+    Scores, which will be used as the input of Heinz.
+    First column: names, second column: scores.
+
+Python 3 is required.
+"""
+# Implemented by: Chao (Cico) Zhang
+# Homepage: https://Hi-IT.org
+# Date: 14 Mar 2017
+# Last modified: 23 May 2018
+
+import argparse
+import sys
+
+import numpy as np
+import pandas as pd
+
+
+parser = argparse.ArgumentParser(description='Transform a P-value into a '
+                                 'score which can be used as the input of '
+                                 'Heinz')
+parser.add_argument('-n', '--node', required=True, dest='nodes',
+                    metavar='nodes_pvalue.txt', type=str,
+                    help='Input file of nodes with P-values')
+parser.add_argument('-f', '--fdr', required=True, dest='fdr',
+                    metavar='0.007', type=float, help='Choose a value of FDR')
+parser.add_argument('-m', '--model', required=False, dest='param_file',
+                    metavar='param.txt', type=str,
+                    help='A txt file contains model params as input')
+parser.add_argument('-a', '--alpha', required=False, dest='alpha',
+                    metavar='0.234', type=float, default=0.5,
+                    help='Single parameter alpha as input if txt input is '
+                    'not provided')
+parser.add_argument('-l', '--lambda', required=False, dest='lam',
+                    metavar='0.345', type=float, default=0.5,
+                    help='Single parameter lambda as input if txt input is '
+                    'not provided')
+parser.add_argument('-o', '--output', required=True, dest='output',
+                    metavar='scores.txt', type=str,
+                    help='The output file to store the calculated scores')
+args = parser.parse_args()
+
+# Check if the parameters are complete
+if args.output is None:
+    sys.exit('Output file is not designated.')
+
+if args.nodes is None:
+    sys.exit('Nodes with p-values must be provided.')
+
+if args.fdr is None:
+    sys.exit('FDR must be provided')
+
+if args.fdr >= 1 or args.fdr <= 0:
+    sys.exit('FDR must greater than 0 and smaller than 1')
+
+# run heinz-print according to the input type
+if args.param_file is not None:  # if BUM output is provided
+    with open(args.param_file) as p:
+        params = p.readlines()
+        lam = float(params[0])  # Maybe this is a bug
+        alpha = float(params[1])  # Maybe this is a bug
+# if BUM output is not provided
+elif args.alpha is not None and args.lam is not None:
+    lam = args.lam
+    alpha = args.alpha
+else:  # The input is not complete
+    sys.exit('The parameters of the model are incomplete.')
+
+# Calculate the threshold P-value
+pie = lam + (1 - lam) * alpha
+p_threshold = np.power((pie - lam * args.fdr) / (args.fdr - lam * args.fdr),
+                       1 / (alpha - 1))
+print(p_threshold)
+# Calculate the scores
+input_pvalues = pd.read_csv(args.nodes, sep='\t', names=['node', 'pvalue'])
+input_pvalues.loc[:, 'score'] = input_pvalues.pvalue.apply(lambda x:
+                                                           (alpha - 1) *
+                                                           (np.log(x) -
+                                                            np.log(
+                                                                p_threshold)))
+# print(input_pvalues.loc[:, ['node', 'score']])
+input_pvalues.loc[:, ['node', 'score']].to_csv(args.output, sep='\t',
+                                               index=False, header=False)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/heinz_scoring.xml	Thu Aug 02 11:57:44 2018 -0400
@@ -0,0 +1,90 @@
+<tool id="heinz_scoring" name="Calculate a Heinz score" version="1.0">
+    <description>for each node</description>
+    <requirements>
+        <requirement type="package" version="0.19.2">pandas</requirement>
+        <requirement type="package" version="1.12.0">numpy</requirement>
+    </requirements>
+    <command detect_errors="aggressive"><![CDATA[
+python '$__tool_directory__/heinz_scoring.py' -n '$node' -f '$FDR' -o '$score'
+#if str( $input_type.input_type_selector ) == "bum_type":
+    -l '$input_type.lambda' -a '$input_type.alpha'
+#else:
+    -m '$input_type.input_bum'
+#end if
+    ]]></command>
+    <inputs>
+        <param type="data" name="node" format="txt" label="A node file with p-values"
+        help="The file should contain two columns: the node identifier (e.g. gene) and the corresponding p-value" />
+        <param type="float" name="FDR" value="0.5" min="0" max="1" label="FDR value"
+        help="False Discovery Rate (FDR), e.g. 0.0001"/>
+        <conditional name="input_type">
+            <param name="input_type_selector" type="select" label="Choose your input type for BUM parameters">
+                <option value="bum_output" selected="True">The output file of BUM model</option>
+                <option value="bum_type">Manually type the parameters of BUM model.</option>
+            </param>
+            <when value="bum_type">
+                <param type="float" name="lambda" value="0.5" min="0" max="1" label="lambda" />
+                <param type="float" name="alpha" value="0.5" min="0" max="1" label="alpha" />
+            </when>
+            <when value="bum_output">
+                <param type="data" name="input_bum" format="txt" label="Output file of BUM model as input:
+                lambda on the first line and alpha, the second" />
+            </when>
+        </conditional>
+    </inputs>
+    <outputs>
+        <data name="score" format="txt" label="${tool.name} on ${on_string}: Heinz scores" />
+    </outputs>
+    <tests>
+        <!--Ensure the manual input of BUM parameters work-->
+        <test>
+            <param name="node" value="genes_with_a_p_value.csv" />
+            <param name="FDR" value="0.001" />
+            <param name="input_type_selector" value="bum_type" />
+            <param name="lambda" value="0.546" />
+            <param name="alpha" value="0.453" />
+            <output name="score" file="Heinz_score_using_manual_BUM_params.txt" />
+        </test>
+        <!--Ensure the use of BUM output file as input work-->
+        <test>
+            <param name="node" value="genes_with_a_p_value.csv" />
+            <param name="FDR" value="0.001" />
+            <param name="input_type_selector" value="bum_output" />
+            <param name="input_bum" value="BUM_output.txt" />
+            <output name="score" file="Heinz_score_using_BUM_output.txt" />
+        </test>
+    </tests>
+    <help><![CDATA[
+This tool is used to calculate a Heinz score for each node (e.g., a gene). This
+score further serves as the input of the tool "Identify optimal scoring subnetwork".
+
+The input "Node file with p-values" should be like this:
+
+========= ===================
+K10970    0.00278208628672861
+--------- -------------------
+K10780    0.0029566591795884
+--------- -------------------
+K01484    0.0157152504694443
+--------- -------------------
+K09055    0.0188894478579773
+========= ===================
+
+
+The first column is "node identifier" (e.g., a gene name); the second column, "p-value";
+The columns are delimited by a tab; no headers are needed.
+
+The section "Choose your input type for BUM parameters" requires two alternative types of input:
+
+1."The output of the BUM model" (The tool "Fit a BUM model"): the first line of the file
+is lambda; the second, alpha.
+
+2."Manually type the parameters of BUM model": lambda and alpha.
+
+
+    ]]></help>
+    <citations>
+        <citation type="doi">10.1093/bioinformatics/btn161</citation>
+        <citation type="doi">10.1093/bioinformatics/btg148</citation>
+    </citations>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/BUM_input.txt	Thu Aug 02 11:57:44 2018 -0400
@@ -0,0 +1,1000 @@
+0.49481751513521
+0.562753719976071
+0.744133012583812
+0.5820479466754
+0.277084259090565
+0.280005959376492
+0.341604323677893
+0.659077451445324
+0.0430231866782772
+0.710357423493805
+0.717040204365618
+0.369196736655045
+0.283710170519702
+0.463477113101571
+0.941146391172019
+0.413770914841299
+0.967537969882414
+0.519166646814472
+0.427899034185276
+0.461227232625961
+0.222858349291007
+0.734922697988863
+0.0456725302598508
+0.995767048547236
+0.0915756529362226
+0.00120685411681
+0.0388888773605078
+0.617726611493306
+0.133321251644567
+0.340636053697019
+0.177380444230216
+0.519984527417586
+0.105684937409975
+0.313368648950836
+0.0115096903747378
+0.570438880100494
+0.000738816572187191
+0.115181723593816
+0.117727355289624
+0.453773977765532
+0.599008069698606
+0.366714610297756
+0.865928280276381
+0.400688439878588
+0.686393883083386
+0.740246932407673
+0.0486511268243364
+0.887662695899543
+0.40508463598585
+0.78435569161742
+0.662970389774761
+0.928807915375191
+0.00369375258213678
+0.298961555472186
+0.272606894114562
+0.546820623366012
+0.706989923705387
+0.813316396014418
+0.0282992911886284
+0.114986698540584
+0.816452589210325
+0.274950800290431
+0.318057869290295
+0.913670986044854
+0.47795013386574
+0.360785944988818
+0.307989497298263
+0.61804501524227
+0.103922698756938
+0.350667613950193
+0.176078589945038
+0.745902041693146
+0.576994077008291
+0.170398155426894
+0.1541649879633
+0.0330017239563531
+0.0293608049078487
+7.21452342190644e-06
+0.630569403264635
+0.145024531215092
+0.436416429611253
+0.921961370972599
+0.825540806920698
+0.0882918508819074
+0.875958713997509
+0.0790585354887591
+0.254240017811673
+0.433229466752555
+0.527445597675559
+0.71518566406593
+0.140499969468555
+0.473917903374763
+0.66322630983507
+0.768523685569719
+0.212725261086578
+0.0047348819340012
+0.655266034514027
+0.140758830097346
+0.772624077145585
+0.45578365913374
+0.804811668130559
+0.581866229472084
+0.0241337990088429
+0.67809202044837
+0.345048005704991
+0.173998878964601
+0.628577274816718
+0.107469341348957
+0.34572034387723
+0.764191025138894
+0.76143595558573
+0.76350101736562
+0.989707001273934
+0.0449899053526661
+0.246247280173831
+0.591642206830146
+0.0896093879631843
+0.292297806019216
+0.0631665162037131
+0.540107781837766
+0.322265114010064
+0.597359423273375
+0.688117527008375
+0.934689315245155
+0.52632461594423
+0.708703724829695
+0.437356798262351
+0.275217000320249
+0.723663876816597
+0.21816301805726
+0.0586976705194264
+0.528343233507166
+0.348163027237861
+0.229228887118277
+0.291292808810915
+0.489382917859043
+0.0558177461351703
+0.959075580583519
+0.0564280030267507
+0.00684706763197022
+0.166539119395623
+0.0623267647059293
+0.850165292532509
+0.0420002036107131
+0.872891172295804
+0.65640002552188
+0.0841154525363908
+0.0115987570215684
+0.0866502473058187
+0.889258645071542
+0.00606343144327119
+0.789830938148316
+0.151573865534411
+0.848615361230869
+0.268380019696077
+0.0562373952671436
+0.870705565349727
+0.609301798198624
+0.688695241719027
+0.994671933998766
+0.0258695171412451
+0.245989125870314
+0.187081789023063
+0.976563535973874
+0.976301290173714
+0.299717964494201
+0.330547172633139
+0.384777166873804
+0.0868195309689014
+0.736284879950963
+0.0147202728959051
+0.983982519454288
+0.000130480134148907
+0.0144245966718382
+0.240468583450882
+0.0611488266290817
+0.00242371536502852
+0.669111915757483
+0.312254834231797
+0.38098047213934
+0.307995859589542
+0.662871507852625
+0.859659541352016
+0.23695614129232
+0.683217490884554
+0.00779918833128529
+0.426918928224668
+0.354163996706725
+0.382836204769902
+0.870772763366846
+0.159156204286861
+0.0525184125956388
+0.202158066741185
+0.681455570244015
+0.256191108370611
+0.752464432128511
+0.663168761117561
+0.867674095882039
+0.428497046474926
+0.275366414207152
+0.357019570660332
+0.118844869338568
+0.0184286807600588
+0.116761817795942
+0.980424233838723
+0.466070504913689
+0.141724443812031
+0.413926379552881
+0.0489313264533805
+0.247380692958525
+0.0625415963163892
+0.725623517627305
+0.578031081750289
+0.0193235772344487
+0.852533000752543
+0.744424740949977
+0.768812805871033
+0.180308348786791
+0.355094265542827
+0.280061160075797
+0.00040359211716482
+0.0308398026135854
+0.0864543950944498
+0.532337854876614
+0.602428059334535
+0.0538731209876855
+0.823332381490496
+0.142956322237201
+0.0907552171047412
+0.119519342427
+0.00117370215781921
+0.338570264081191
+0.361928423320229
+0.0169524863898431
+0.343643836499052
+0.218634840191117
+0.920961439887886
+0.0361914036584481
+0.215274136557889
+0.981137200976175
+0.433484109550117
+0.526779446427912
+0.434491779428824
+0.872140060052064
+0.915551216264322
+0.764246054885876
+0.441031366903507
+0.761156310183664
+0.860978340865955
+0.370188478937574
+0.52254586830895
+0.706134585936261
+0.468504343215153
+0.441903320285323
+0.610644166931984
+0.971625146950654
+0.775120523313189
+0.0231787340570543
+0.236995651853101
+0.329285418825665
+0.484891125217396
+0.378238264349151
+0.953841287863583
+0.193122351915659
+0.360376386537668
+0.915926191606754
+0.544940006823116
+0.0953858457500984
+0.44699934316125
+0.303441283544028
+0.848018118995411
+0.622807755794529
+0.176510005665726
+0.818083553560481
+0.914465373435682
+0.0263102842073269
+0.691961275736861
+0.393814802919831
+0.846810725065487
+0.335048268889685
+0.0122779914077377
+0.798614192264672
+0.37035230857243
+0.452095627455262
+0.165574032529068
+0.421737997983572
+0.39471620069815
+0.994648977339256
+0.385627143114784
+0.182105870438973
+0.611121992021021
+0.369401356963312
+0.286140040987425
+0.159621458504944
+0.471580621665012
+0.767441028404718
+0.270970351350891
+0.600066366293554
+0.0162810799755502
+0.426785822484825
+0.864993778354113
+0.092845653036974
+0.348809701986362
+0.463076021089572
+0.203690009980102
+0.148580864915364
+0.0781069106397667
+0.680974630043977
+0.147709801566236
+0.726242883912357
+0.0384029580997537
+0.128168320173795
+0.638315090655471
+0.129703949965769
+0.135036204567478
+0.241578588125023
+0.333604395489787
+0.790486531573133
+0.0767718473808909
+0.909704512565101
+0.0144534317364398
+0.00531696181745197
+0.304326633946659
+0.0122229268552443
+0.606618392201107
+0.793129964820405
+0.413601792431769
+0.371543311890087
+0.127487117444236
+0.366094834571139
+0.0442684666744018
+0.61698116176625
+0.797309663015051
+0.422970799526376
+0.71801927564807
+0.221971781266305
+0.236756885759996
+0.849581722369059
+0.148617896282234
+0.348578826600756
+0.879875628406735
+0.00182518414629315
+0.243563083498094
+0.596533537437462
+0.294459251854118
+0.05244898482575
+0.941625477022901
+0.0104817072843018
+0.216904592784848
+0.546228016613149
+0.331907498979764
+0.171725510932313
+0.849928752134878
+0.200392411701202
+0.0383910379143571
+0.121951780797415
+0.740035198771986
+0.212268633294479
+0.196154952478127
+0.410614129828918
+0.0027158149515165
+0.0445937568367791
+0.263671744126436
+0.78428249523894
+0.603361224169567
+0.191232497547465
+0.184563957394929
+0.581532735049777
+0.251704805419894
+0.440721014522468
+0.742811244846245
+0.634116908319677
+0.2623786322411
+0.990931756458447
+0.248525960658981
+0.00498888983215802
+0.180018147594759
+0.978277933799437
+0.735936724388207
+0.796458051063642
+0.641580840688077
+0.390453102731339
+0.764557315579405
+0.23250055591365
+0.131614392472835
+0.650738433699643
+0.397999541048629
+0.295584914018405
+0.681819539688556
+0.0183057276363247
+0.0301088899006286
+0.888089099633535
+0.861789836161393
+0.293399272400741
+0.101667618633828
+0.108172402004672
+0.946064806056915
+0.308471524666227
+0.70909378983362
+0.0328611836102733
+0.052524401876636
+0.107843526945692
+0.0882834730559603
+0.650424316706692
+0.17116768263518
+0.466754198969361
+0.773211771535486
+0.0459770758666747
+0.686638466912206
+0.722075790553771
+0.683038009443706
+0.53376634610952
+0.106020182226126
+0.741240663787093
+0.0125732359383863
+0.195842899076912
+0.0919163018731597
+0.122288043445286
+0.424269861720562
+0.00471565919756784
+0.266134888761874
+0.474096118167369
+0.751609971823164
+0.926243986074724
+0.474324699173931
+0.149456712538927
+0.154050984862256
+1.14373538078269e-06
+0.227173853585682
+0.474448943215051
+0.0214815198697004
+0.124171132574768
+0.502307660043723
+0.468134389657832
+0.536591469709877
+0.568543453614759
+0.562259304923104
+0.553629472689631
+0.00951692387372203
+0.288463879708572
+0.832394820176762
+0.0794022141191573
+0.474411541250019
+0.0648143253435369
+0.0840533825389188
+0.0223136771146295
+0.318092182197029
+0.0726631063725792
+0.991671313237084
+0.776713584487331
+0.732159908224176
+0.107019168587932
+0.292805314735699
+0.830025393040293
+0.384632524441826
+0.789011316163592
+0.43141621673742
+0.867276027167485
+0.0196238618166493
+0.672280360139683
+0.265954612060452
+0.952838572138722
+0.228890041386308
+0.722793390760672
+0.456732335101377
+0.292524450915224
+0.766204302481635
+0.8615165877872
+0.266985882723249
+0.856199913538691
+0.767422915059715
+0.0218153202289164
+0.139964616013949
+0.142609999152577
+0.762219172633019
+0.113867530515768
+0.454086484548216
+0.865349941921467
+0.193733668129218
+0.479739887473289
+0.783312407450468
+0.837400083025762
+0.730985688737534
+0.241950529077491
+0.1664476764538
+0.0633001076891302
+0.346588837967629
+0.0912879891137882
+0.32564831454571
+0.0054319872600426
+0.131334296812673
+0.26967600481052
+0.0962896557457078
+0.324513639569355
+0.0502848263180943
+0.479786447365521
+0.210453898499457
+0.948135065959331
+0.396180104859662
+0.539465837756628
+0.746096102909988
+0.0205544936030315
+0.959479024054394
+0.739945260797564
+0.578075093063656
+0.31128835561903
+0.910175591952132
+0.549334371964831
+0.110473434518479
+0.509695532739497
+0.379577160174688
+0.108380266581709
+0.488958986738621
+0.315912072106965
+0.479785178480871
+0.0151973311457834
+0.874831987622986
+0.385410179009141
+0.698305705309024
+0.233850661909132
+0.438204211081987
+0.965293688049615
+0.251744164924998
+0.644255536894719
+0.836048181864116
+0.189678728641656
+0.945811007161172
+0.797676282265487
+0.337252919940477
+0.191397188674144
+0.305443294713065
+0.791660400109933
+0.230107065614129
+0.652498145392862
+0.599032535608799
+0.67159329075984
+0.0845366990054148
+0.182143650666309
+0.0836058196176759
+0.326769958505795
+0.0814707583807793
+0.137425875489059
+0.533575818675816
+0.86327794331211
+0.9847877701229
+0.283999761636907
+0.680026399986656
+0.0143517208221065
+0.0685631148421028
+0.840777419972301
+0.278213715028648
+0.762029357297292
+0.705936244753316
+3.30477350290075e-05
+0.448773938177598
+0.00437237808480725
+0.218716100860631
+0.0705876069330893
+0.0781085624565431
+0.0406917797829202
+0.0977557976432564
+0.448914649638457
+0.618616956980909
+0.0604517023466142
+0.552194756113728
+0.984981246027485
+0.123085844276233
+0.149347406470648
+0.752137148320831
+0.116098002372251
+0.0864397756500592
+0.359058346046136
+0.666152837712734
+0.730202763127634
+0.991928053106173
+0.548826713067671
+0.140705323891538
+0.143453610080763
+0.993442666945304
+0.829023357899004
+0.0451593646397479
+0.722602958603891
+0.930392495673005
+0.212884729411798
+0.261556324249004
+0.328947817503066
+0.0178598762954132
+0.518143049228009
+0.290709648250634
+0.0315524274303103
+0.655721642728622
+0.850308527349682
+0.20593026791162
+0.647509180641442
+0.0172919544771653
+0.38692761807598
+0.299243590065055
+0.132068229429424
+0.00302367493133106
+0.210209651973165
+0.214331974084495
+0.461169692689924
+0.110235306450631
+0.308973407330029
+0.936773956173444
+0.86470494343108
+0.340202216825976
+0.000194200553489033
+0.0313114101291355
+0.0680256937999069
+0.217010532028014
+0.65417500361478
+0.885879841219966
+0.175966636399759
+0.268115167615585
+0.764541917353031
+0.0244691142503816
+0.128618143558002
+0.559179684439634
+0.715339466332467
+0.153116529484451
+0.000374827271838034
+0.969901854954864
+0.306599714538596
+0.26694200563435
+0.31469293560624
+0.376682644517032
+0.124522141890225
+0.112666776906447
+0.0676051343721677
+0.7992253842275
+0.0513441498273743
+0.722254517845638
+0.165105405612635
+0.474801769871718
+0.0232524187175565
+0.281521428851164
+0.00112557532275196
+0.00376693178360463
+0.812594990522474
+0.973530369034227
+0.168335642213711
+0.415309791541669
+0.0390449001625182
+0.0398181358892766
+0.00411646019645764
+0.0132446998005715
+0.724590726415101
+0.0864613118664701
+0.338940827685293
+0.629583351367622
+0.0900777953831062
+0.333668671011096
+0.295754982935556
+0.951479893354551
+0.798334274766682
+0.223773020806104
+0.387661431773596
+0.872731581812251
+0.177572190055674
+0.368165024428123
+0.0576235196118129
+0.803803934386324
+0.519297071746654
+0.0204421903917099
+0.633733355194265
+0.763645429556443
+0.230292475743453
+0.198709845371242
+0.500188845662167
+9.01899846392488e-07
+0.355918682264277
+3.62340355006853e-07
+0.869270504129402
+0.927473086164595
+3.17322144012075e-06
+0.366337932917321
+0.920691346797386
+0.356006504709996
+0.0410527900614432
+0.375352315950495
+0.0488461774841647
+0.654627814450361
+0.877404217485484
+0.38898366378129
+0.669979939495223
+0.20401164375087
+0.0828840788542692
+0.2322434215737
+0.197625139845495
+0.688314422052192
+0.370179909695805
+0.309122468079302
+0.0908408819966364
+0.205076088409016
+0.239284537004237
+0.0478728252924615
+0.217823327688126
+0.121342460758809
+0.141332349324288
+0.893804438805803
+0.737347083975408
+0.18373101921637
+7.16783970135995e-06
+0.585780190395735
+0.93900047243863
+0.386139802158688
+0.0388094046351711
+0.949569171025215
+0.139706175250433
+0.406112384317162
+0.514518332348725
+0.441535412018464
+0.306831625285308
+0.210209392089121
+0.043703886963038
+0.612577327669803
+0.0523060754941867
+0.652876174230415
+0.0185791020288128
+0.165795460879314
+0.157593930705988
+0.593175131927571
+0.165377222682257
+0.527456142354184
+0.904093373827719
+0.874401955882516
+0.344380119122314
+1.24281350914437e-05
+0.121419989364513
+0.343535907817664
+0.103332275048547
+0.854146261895332
+0.429947274027386
+0.827630647091727
+0.258955522976185
+0.0926114162787655
+0.486900135697211
+0.662453021233259
+0.605300485054234
+0.0201627510308488
+0.00645132284688267
+0.292348928030568
+0.745813659639035
+0.0599208848797051
+0.440012774047337
+0.659859298091109
+0.615775291094032
+0.530176835396601
+0.074535579858584
+0.634866068813283
+0.998980098190424
+0.697285860674683
+0.0555831644799422
+1.68104491077794e-05
+0.401237401199367
+0.432375343998035
+0.611327756100709
+0.604278269075472
+6.10620124430997e-06
+0.269632703637946
+0.535632728084271
+0.796874296682517
+0.839545455958959
+0.0330895660399143
+0.806352368090484
+0.369283873597871
+0.0127365109719608
+0.0080167070483234
+0.772807889001111
+0.410212810159482
+0.00611475312483016
+0.546619247571556
+0.936423551488025
+0.934799170094933
+0.67178536585878
+0.398277514102063
+0.860223600361563
+0.198704850416976
+0.211870549389917
+0.813389810175025
+0.220934926684225
+0.128615445468121
+0.458672551993142
+0.772649442328612
+0.552562149765981
+0.0836854534717488
+0.299883662642762
+0.103692454809166
+0.890378236053397
+0.509962436125902
+0.164796837213923
+0.873489350370018
+0.289251866673951
+0.0350966467432808
+0.938637332608205
+0.0232172571964305
+4.51644774651476e-07
+0.0897238418283346
+0.623809160088457
+4.91486550187763e-07
+0.311264551659959
+0.628376874978171
+0.854436760773822
+0.00118806629622962
+0.0834089925447356
+0.59521734901398
+0.00939024663496496
+0.0175299869385936
+0.723854408292602
+0.495821684674521
+0.0518378377215187
+0.526081804407129
+0.519457700997639
+0.905806501223034
+0.0254511811747993
+0.950370893370638
+0.453939930752726
+0.351127967455516
+0.565630489588527
+0.336226567263163
+0.745270194175886
+0.19022564072336
+0.61322683762087
+0.659268995185285
+0.399289237242576
+0.628469750044814
+0.920918867578836
+0.852106756459696
+0.424135482074893
+0.0713208064710028
+0.24871346894129
+0.0158892288450341
+0.0183479609923709
+0.247013895228423
+0.735143691953843
+0.896966030011141
+0.0362273182668588
+0.603563530653737
+0.960063741706101
+0.488603224454184
+0.316800864451958
+0.164537251066126
+0.844477662864338
+0.187679840805534
+0.146645678835831
+0.782156028528406
+0.852413751820361
+0.109149522242336
+0.0666954990923861
+0.417837947869313
+0.134458382645643
+0.00010263814404356
+0.606332345399193
+0.220520608869126
+0.902740791254412
+0.972769549348979
+0.786059198400105
+0.000257919193829843
+0.099728863201009
+0.48813400811968
+0.122115874340003
+0.691314984298683
+0.704248690968703
+0.356039379562619
+0.236340151893964
+0.21613241342977
+0.462814816913001
+0.147630829826267
+0.614006317396632
+0.0276123983701355
+0.0388067496785611
+0.798372213326457
+0.0356607587870191
+0.746565470671474
+0.179076610104685
+0.7067660683508
+0.327207461495618
+0.0699681593671749
+0.0589812855809452
+0.822298002610464
+0.0541609182688533
+0.0014645166208377
+0.414455507152768
+0.147278458237102
+0.855082340806644
+0.0973647799836709
+0.000466125250830992
+0.725913028083264
+0.418867202232968
+0.357621934557879
+0.592145135377933
+0.874710298556188
+0.251052174249483
+0.438160107924926
+0.445084708981774
+0.158346045041189
+0.521346950954502
+0.681873214968761
+0.529423633575557
+0.615822118249103
+0.838796012373514
+0.877471162594851
+0.589874394347028
+0.494195471524579
+0.693291252237846
+0.467819681135473
+0.81701823358668
+0.694319999525736
+0.121962823844595
+0.151703062046977
+0.417877280101387
+0.457444553241744
+0.400970256713384
+0.146620637420985
+0.212734754065417
+6.46130403127839e-05
+3.15313299235481e-06
+0.356138177556596
+0.910533507420001
+0.473334155506573
+0.295526798546519
+0.215910129059011
+0.817498688652582
+0.427745873300515
+0.589221380726825
+0.790977061704187
+0.232250506712447
+0.0130939697694528
+0.454884331603569
+0.0720679033612144
+0.198986466036537
+0.371388049910615
+0.0886681369094951
+0.943456029196158
+0.0115962709753868
+0.169147563289402
+0.95440970300256
+0.148186290334766
+0.79469864959776
+0.398061188204062
+0.775885906340456
+0.534580526179839
+0.525126819365943
+0.0636524244086398
+0.483695842136235
+0.550013297321542
+0.803957488923753
+0.0687732353561399
+0.0223467066851557
+0.194705380015316
+0.561004020062096
+0.675328722659393
+0.433019001895956
+0.705598921589213
+0.62012802890816
+0.815613485139828
+0.633137051349011
+0.963970390481642
+0.75867006742631
+0.822377585232521
+0.628374113266244
+0.420657899764137
+0.569966801742234
+0.865267703405176
+0.00337493056633076
+0.30400350300163
+0.514564453330559
+0.150859876840911
+0.528228602944177
+0.040236592014929
+0.140563657143996
+0.140426371242889
+0.758223225206527
+0.184407866286835
+0.237803827253682
+0.901539046853114
+0.333050038387453
+0.781529363473918
+0.194190412648925
+0.476659487150017
+0.953836884980725
+0.784592981944965
+0.583406195272662
+0.662890565822532
+0.83318628321259
+0.709236399906408
+0.729917970326033
+0.854039297563908
+0.224122140131679
+0.0892458988605694
+0.965188985280667
+0.608957726415198
+0.1545456981837
+0.00112303024929184
+0.493677809317058
+0.320267370941394
+0.957479463898128
+0.663938331651806
+0.421226891355979
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/BUM_output.txt	Thu Aug 02 11:57:44 2018 -0400
@@ -0,0 +1,2 @@
+0.546281463286217
+0.453175526745403
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/EdgesPCST.txt	Thu Aug 02 11:57:44 2018 -0400
@@ -0,0 +1,10 @@
+a	b
+b	c
+a	c
+c	d
+b	d
+d	f
+c	e
+f	h
+f	g
+e	f
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/Heinz_output.txt	Thu Aug 02 11:57:44 2018 -0400
@@ -0,0 +1,22 @@
+// Successfully parsed '/export/galaxy-central/database/files/000/dataset_183.dat': contains 8 nodes, 10 edges and 1 component(s)
+
+// Considering component 1/1: contains 8 nodes
+// Identified 4 dependent node pairs
+// Added 4 analyze constraints
+// Solution with weight 36 and 6 nodes found
+graph G {
+	overlap=scale
+	layout=neato
+	0 [label="a\n5\n0\n0"]
+	1 [label="b\n-4\n0\n1",shape=box]
+	3 [label="d\n30\n0\n3"]
+	5 [label="f\n-15\n0\n5",shape=box]
+	6 [label="g\n10\n0\n6"]
+	7 [label="h\n10\n0\n7"]
+	label="Total weight: 36"
+	0 -- 1
+	1 -- 3
+	3 -- 5
+	5 -- 6
+	5 -- 7
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/Heinz_score_using_BUM_output.txt	Thu Aug 02 11:57:44 2018 -0400
@@ -0,0 +1,3 @@
+GRHPR	-6.060224431226826
+B4GALT6	-7.230950844434514
+FGF17	-7.312812620557818
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/Heinz_score_using_manual_BUM_params.txt	Thu Aug 02 11:57:44 2018 -0400
@@ -0,0 +1,3 @@
+GRHPR	-6.058859736554457
+B4GALT6	-7.229961944568557
+FGF17	-7.3118499977365765
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/NodesPCST.txt	Thu Aug 02 11:57:44 2018 -0400
@@ -0,0 +1,8 @@
+a	5
+b	-4
+c	-5
+d	30
+e	-5
+f	-15
+g	10
+h	10
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/genes_with_a_p_value.csv	Thu Aug 02 11:57:44 2018 -0400
@@ -0,0 +1,3 @@
+GRHPR	0.0843889413906522
+B4GALT6	0.717943620714012
+FGF17	0.833884563412679
Binary file test-data/heinz_graph.pdf has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/visualization.py	Thu Aug 02 11:57:44 2018 -0400
@@ -0,0 +1,65 @@
+#!/usr/bin/env python
+"""Visualise the output of Heinz.
+
+This script is used to visualize the output of Heinz, which is in the form of
+DOT language:
+    1. Clear the output of Heinz, extract the DOT source code.
+    2. Visualize the DOT source code and save it into file.
+
+The function of this script is rather simple, for more advanced visualization,
+please adopt other solutions mentioned in the paper
+doi: 10.1093/bioinformatics/btv526
+
+This tool is only designed for visualizing the output of Heinz tool.
+"""
+
+# Author: Cico Zhang
+# Date: 2 Aug 2017
+# Version: 0.2
+
+import argparse
+import sys
+
+from graphviz import Source
+
+
+def get_args():
+    """Collect the inputs."""
+    parser = argparse.ArgumentParser(
+        description='Visualise the output of Heinz')
+    parser.add_argument('-i', '--input', required=True, dest='heinz',
+                        metavar='Heinz_output.txt', type=str,
+                        help='Output file of Heinz as the input')
+    parser.add_argument('-o', '--output', required=True, dest='output',
+                        metavar='graph.pdf', type=str,
+                        help='The output file that saves the visualisation')
+    args = parser.parse_args()
+
+    if args.heinz is None:
+        sys.exit('Input file must be designated.')
+
+    return args
+
+
+def main():
+    """Main function."""
+    args = get_args()
+    # Read the whole output file
+    with open(args.heinz) as r:
+        graph_dot = r.readlines()
+
+    # Remove the redundant lines
+    while not graph_dot[0].startswith('graph G {'):
+        graph_dot.pop(0)
+
+    src = Source(''.join(graph_dot))
+    data_pdf = src.pipe('pdf')
+    # Redirect the output (very important)
+    with open(args.output, 'wb') as w:
+        w.write(data_pdf)
+    print('The visualization is saved as PDF!')
+    sys.exit(0)
+
+
+if __name__ == "__main__":
+    main()
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/visualization.xml	Thu Aug 02 11:57:44 2018 -0400
@@ -0,0 +1,33 @@
+<tool id="heinz_visualization" name="Visualize" version="0.1.0">
+    <description>the optimal scoring subnetwork</description>
+    <requirements>
+        <requirement type="package" version="2.38.0">graphviz</requirement>
+        <requirement type="package" version="0.4.10">py-graphviz</requirement>
+    </requirements>
+    <command detect_errors="aggressive"><![CDATA[
+python '$__tool_directory__/visualization.py' -i '$subnetwork' -o $visualization
+    ]]></command>
+    <inputs>
+        <param type="data" name="subnetwork" format="txt" label="Heinz output file"
+        help='Output file of the tool "Identify optimal scoring subnetwork"'/>
+    </inputs>
+    <outputs>
+        <data name="visualization" format="pdf" label="${tool.name} on ${on_string}: Heinz visualization" />
+    </outputs>
+    <tests>
+      <test>
+        <param name="subnetwork" value="Heinz_output.txt" />
+        <output name="visualization" file="heinz_graph.pdf" compare="sim_size" delta="2000" />
+      </test>
+    </tests>
+    <help><![CDATA[
+This tool provides a simple visualisation of the raw output of the Heinz Galaxy tool
+and saves the output as PDF.
+
+Heinz output file: output file of the tool "Identify optimal scoring subnetwork".
+    ]]></help>
+    <citations>
+        <citation type="doi">10.1093/bioinformatics/btn161</citation>
+        <citation type="doi">10.1093/bioinformatics/btg148</citation>
+    </citations>
+</tool>