Repository 'covenntree'
hg clone https://toolshed.g2.bx.psu.edu/repos/steffen/covenntree

Changeset 0:745aede829e9 (2015-01-30)
Commit message:
Imported from capsule None
added:
coVennTree/._.DS_Store
coVennTree/coVennTree.pl
coVennTree/coVennTree.xml
coVennTree/static/._.DS_Store
coVennTree/static/images/._example1.png
coVennTree/static/images/._venn-graph-off.png
coVennTree/static/images/._venn-graph-on.png
coVennTree/static/images/example1.png
coVennTree/static/images/venn-graph-off.png
coVennTree/static/images/venn-graph-on.png
coVennTree/tool_dependencies.xml
b
diff -r 000000000000 -r 745aede829e9 coVennTree/._.DS_Store
b
Binary file coVennTree/._.DS_Store has changed
b
diff -r 000000000000 -r 745aede829e9 coVennTree/coVennTree.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/coVennTree/coVennTree.pl Fri Jan 30 09:55:45 2015 -0500
[
b'@@ -0,0 +1,833 @@\n+#!/usr/bin/perl\n+use strict;\n+use File::Basename;\n+use List::MoreUtils qw( minmax );\n+\n+# --------------------------------------------------------------------------------------------------\n+# author:\tsteffen lott\n+# mail: \tsteffen.lott@uni-freiburg.de\n+# date: \t06-10-2014\n+# version: \t1.6\n+# \n+# description:\n+# \tThe tool converts an output from MEGAN in a special network which can visuallized with\n+#\tcytoscape. Gaper produces two files, the first one contains the network and the second one\n+#\tdescribes the attributes of the network. \n+# --------------------------------------------------------------------------------------------------\n+\n+# return version number\n+if (@ARGV == 0) {\n+\tprint "CoVennTree-Version 1.6\\n";\n+\tprint "COMMAND\\n";\n+\tprint "coventree argv0 argv1 argv2 argv3 argv4\\n";\n+\tprint "--------------\\n";\n+\tprint "argv0 = input file\\n";\n+\tprint "argv1 = color mode [1,4]\\n";\n+\tprint "argv2 = transformation function [1,7]\\n";\n+\tprint "argv3 = only leaf information => 0 ; all information => 1\\n";\n+\tprint "argv4 = output file name network\\n";\n+\tprint "argv5 = output file name attributes\\n";\n+\texit;\n+}\n+\n+\n+\n+\n+# container to represent the network\n+my @network = ();\n+\n+\n+\n+# 0 PARAMETER_______________\n+# read argument from command-line\n+# important: DSV -> taxon-path, count(s) -> assigned -> tab\n+my $megan_file = $ARGV[0];\n+\n+\n+# 1 PARAMETER_______________\n+my $colorMode;   \n+# color mode for venn-diagrams 0,1,2,3,4\n+if(defined $ARGV[1]){\n+\t$colorMode = $ARGV[1];\n+}else{\n+\t$colorMode = 3;\n+}\n+\n+\n+# 2 PARAMETER_______________\n+# 2 different transformations functions\n+my $transFnc = "";\n+if(defined $ARGV[2]){          # small datasets\n+   \t$transFnc = $ARGV[2];\n+}else{\n+\t$transFnc = 1;\n+}\n+\n+\n+# 3 PARAMETER_______________\n+# the user can switch between "only leaf information" \n+# or the complete tree information. the last one takes also the not assigned reads\n+# and creates artificial nodes to keep this number\n+my $onlyLeafs;\n+if(defined $ARGV[3]){\n+\tif($ARGV[3] == 0){\n+\t\t$onlyLeafs = "on";\n+\t}elsif($ARGV[3] == 1){\n+\t\t$onlyLeafs = "off";\n+\t}\n+}else{ # all information will be used! not assigned and assigned\n+\t$onlyLeafs     = "off";\n+}\n+\n+# 4 PARAMETER_______________\n+# output -> network\n+my $out_network    = $ARGV[4];\n+\n+# 5 PARAMETER_______________\n+# output -> attributes\n+my $out_attributes = $ARGV[5];\n+\n+\n+\n+# check the input format of the file. only a file with exactly three datasets are excepted. the other one will fill up with zeros\n+\n+\n+# read-in MEGAN-file\n+# if #{data-sets} = 1 -> no heade line\n+# if #{data-sets} > 1 -> heade line " #Datasets\t\tset1\tset2\t..."\n+open(inFile , "<$megan_file")  || die "File not found - \\"Path-File\\"!\\n";\n+my @pairIds = ();\n+my $header  = "";\n+my @input_file   = ();\n+my @numberOfSets = ();\n+\n+while(<inFile>){\n+\tchomp($_);\n+  \tif($_ =~ /^#/){\n+  \t\t$header = $_;\n+  \t\t@numberOfSets = split("\\t", $_);\n+  \t}else{\n+  \t\t#print @numberOfSets . "\\n";\n+  \t\t# check the number of datasets are included\n+  \t\tif(@numberOfSets == 0 || @numberOfSets == 1 || @numberOfSets > 4){\t\t\t# no set is in the file\n+  \t\t\tprint "Error: File doesn\'t contain any dataset or contain more than three!";\n+  \t\t\texit;\n+  \t\t}elsif(@numberOfSets == 2){\t\t# only one set is in the file -> add 2x zeros\n+  \t\t\t$_ .= "\\t" . 0 . "\\t" . 0;\n+  \t\t}elsif(@numberOfSets == 3){\t\t# only two sets are in the file -> add 1x zeros\n+  \t\t\t$_ .= "\\t" . 0;\n+  \t\t}\n+  \t\t\n+  \t\taddToNetwork($_);\n+  \t\tpush(@input_file, $_);\n+  \t}\n+}\n+close(inFile);\n+\n+\n+# --------------------------------------------------------------------------------------------------------------\n+# --------------------------------------------------------------------------------------------------------------\n+# (1) PREPROCESSING: detect all leaf nodes\n+my $modifiedInput  = detectNonLeafs();\n+\n+# (2) MAIN COMPUTATION: compute deep by deep (path deep ex. root;Viruses; => deep 2)\n+my ($vennClusterOut, $specialNumberOut) = clusterVennBottomUp();\n+\n+# (3) VENN-END-PREPERATION'..b'n \\@modifiedFile;\n+}\n+\n+\n+# helper function for detectNonLeafs \n+sub getPathDeep{\n+\tmy $inPath = $_[0];\n+\tmy @deep = split(\';\', $inPath);\n+\tmy $size = $#deep;\n+\treturn $size;\n+}\n+\n+sub convertPath{\n+\tmy $inString = $_[0];\n+\t$inString =~ s/"//g;\n+\t$inString =~ s/\\s+/_/g;\n+\treturn $inString;\n+}\n+\n+sub getId{\n+\tmy $lineToParse = $_[0];\n+\tmy $idPos       = $_[1];\n+\tmy $stringId = "";\n+\tmy @path     = ();\n+\t\n+\t$lineToParse =~ s/"//g;\n+\t$lineToParse =~ s/\\s+/_/g;\n+\t@path = split(\';\',$lineToParse);\n+\tmy $num = @path;\n+\t\n+\tif(($num + $idPos) < 0){\n+\t\treturn -1;\n+\t}else{\n+\t\treturn $path[$idPos];\t\n+\t}\n+}\n+\n+sub computeLeafValues{\n+\tmy $meganValues = $_[0];\n+\tmy @rawValues   = split(\'\\t\', $meganValues);\n+\tmy @nodeRelVal  = ();\n+\t\n+\tmy $outValues   = $rawValues[0] . " " . $rawValues[1] . " " . $rawValues[2]; \n+\n+\tif($rawValues[0] <= $rawValues[1]){\n+\t\t$outValues .= " " . $rawValues[0];\n+\t}else{\n+\t\t$outValues .= " " . $rawValues[1];\n+\t}\n+\tif($rawValues[0] <= $rawValues[2]){\n+\t\t$outValues .= " " . $rawValues[0];\n+\t}else{\n+\t\t$outValues .= " " . $rawValues[2];\n+\t}\n+\tif($rawValues[1] <= $rawValues[2]){\n+\t\t$outValues .= " " . $rawValues[1];\n+\t}else{\n+\t\t$outValues .= " " . $rawValues[2];\n+\t}\n+\t#my ($min, $max) = minmax @rawValues;\n+\tmy $min = 0;\n+\t$outValues .= " " . $min;\n+\t\n+\treturn $outValues;\n+}\n+# -----------------------------------------------------------------------------\n+\n+\n+# compute network (.sif)\n+sub addToNetwork{\n+\tmy $inLine = $_[0];\n+\tmy @splitInLine = split(\'\\t\',$inLine);\n+\t# remove \' " \' from line\n+\t$splitInLine[0] =~ s/"//g;\n+\t$splitInLine[0] =~ s/\\s+/_/g;\n+\tmy @elements    = split(\';\' ,$splitInLine[0]); \n+\t\t\n+\tif(@elements > 1){\n+\t\tmy $outString = $elements[-2] . " pp " . $elements[-1];\n+\t\tpush(@network, $outString);\n+\t}\n+}\n+\n+\n+# store network in .sif file\n+sub storeNetwork{\n+\t# test\n+\tmy $tmpFileName = $out_network;\n+\t\n+\t#my $tmpFileName = "./network.sif";\n+\topen(FILE , ">$tmpFileName")  || die "File can\'t be written - \\"sif - File\\"!\\n";\n+\t\tprint FILE join("\\n", @network) . "\\n";\n+\tclose(FILE);\n+}\n+\n+\n+# ---------------------------------------------------------------------------------------------\n+# two different lookup-tables are available!\n+# lookupPixel() => static ; lookupPixelSQRT() => dynamic\n+#\n+# lookup absolute node-size to pixel (frame-size for venn-diagram)\n+sub lookupPixel{\n+\tmy $query = $_[0];\n+\t\n+\tif($query < 10){\n+\t\treturn 30;\n+\t}elsif($query < 100){\n+\t\treturn 40;\n+\t}elsif($query < 1000){\n+\t\treturn 50;\n+\t}elsif($query < 10000){\n+\t\treturn 60;\n+\t}elsif($query < 100000){\n+\t\treturn 80;\n+\t}elsif($query < 1000000){\n+\t\treturn 100;\n+\t}elsif($query < 10000000){\n+\t\treturn 140;\n+\t}elsif($query < 20000000){\n+\t\treturn 180;\n+\t}elsif($query < 30000000){\n+\t\treturn 220;\n+\t}else{\n+\t\treturn 250;\t\n+\t}\n+}\n+\n+# lookup absolute node-size to pixel (frame-size for venn-diagram) <- this is currently used!\n+sub lookupPixelSQRT{\n+\t\n+\tif ($transFnc == 0) {\n+\t\treturn int(($_[0] ** (1/(1.6))) * 1.8 + 8);  # 3,000 datapoints in sum\n+\t}elsif($transFnc == 1){\n+\t\treturn int(($_[0] ** (1/(2.1))) * 1.8 + 8);  # 30,000 datapoints in sum\n+\t}elsif($transFnc == 2){\n+\t\treturn int(($_[0] ** (1/(2.6))) * 1.8 + 8);  # 300,000 datapoints in sum\n+\t}elsif($transFnc == 3){\n+\t\treturn int(($_[0] ** (1/(3.1))) * 1.8 + 8);  # 3,000,000 datapoints in sum\n+\t}elsif($transFnc == 4){\n+\t\treturn int(($_[0] ** (1/(3.7))) * 1.8 + 8);  # 30,000,000 datapoints in sum\n+\t}elsif($transFnc == 5){\n+\t\treturn int(($_[0] ** (1/(4))) * 1.8 + 8);    # 300,000,000 datapoints in sum\n+\t}elsif($transFnc == 6){\n+\t\treturn int(($_[0] ** (1/(4.7))) * 1.8 + 8);  # 3,000,000,000 datapoints in sum\n+\t}\n+\t\n+\t#return int(($_[0] ** (1/(3.3))) * 1.8 + 30);\t# test version for small and large datasets?\n+\t#return int(($_[0] ** (1/(3.3))) * 1.8 + 5);\t# test version for small and large datasets?\n+\t#return int(($_[0] ** (1/(4))) * 1.8 + 8);\t    # test version for small and large datasets?\n+\t#return int(($_[0] ** (1/6)) * 12);\t\t\t\t# old version this version is good for large datasets\n+}\n+\n+\n+\n+\n+\n+\n+\n+\n'
b
diff -r 000000000000 -r 745aede829e9 coVennTree/coVennTree.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/coVennTree/coVennTree.xml Fri Jan 30 09:55:45 2015 -0500
[
@@ -0,0 +1,143 @@
+<tool id="coVennTree" name="CoVennTree (Comparative weighted Venn Tree) - Rooted Tree" version="1.6.0">
+    <description>Comparative rooted tree analysis for files in dsv format</description>
+    <requirements>
+        <requirement type="package" version="1.6">coVennTree</requirement>
+        <requirement type="package" version="5.18.1">perl</requirement>
+    </requirements>
+    <command interpreter="perl">
+        coVennTree.pl
+        $infile
+        $color_mode
+        $trans_func
+        $leafs_allInformation
+        $outfile_network
+        $outfile_attribute
+    </command>
+    
+    <inputs>
+        <param name="infile" type="data" format="tabular" label="Path File" help="Tabular file containing the paths and values"/>
+        
+      
+        <param name="color_mode" multiple="false" type="select" label="Select color mode for Venn diagrams">
+                <option value="0">(1) Set1: blue       Set2: red       Set3: yellow</option>
+                <option value="1">(2) Set1: red        Set2: green     Set3: blue</option>
+                <option value="2">(3) Set1: green      Set2: magenta   Set3: blue</option>
+                <option value="3">(4) Set1: green      Set2: purple    Set3: red</option>
+                <option value="4">(5) Set1: dark gray  Set2: mid-grey  Set3: light gray</option>
+        </param>
+        
+             
+        <param name="trans_func" multiple="false" type="select" label="Select transformation function">
+                <option value="0">(1) datasets max: 3,000 data points in sum</option>
+                <option value="1">(2) datasets max: 30,000 data points in sum</option>
+                <option value="2">(3) datasets max: 300,000 data points in sum</option>
+                <option value="3">(4) datasets max: 3,000,000 data points in sum</option>
+                <option value="4">(5) datasets max: 30,000,000 data points in sum</option>
+                <option value="5">(6) datasets max: 300,000,000 data points in sum</option>
+                <option value="6">(7) datasets max: 3,000,000,000 data points in sum</option>
+        </param>
+       
+        
+        <param name="leafs_allInformation" multiple="false" type="select" label="Select tree analyzes function">
+                <option value="1">(1) leaf + inner nodes informations</option>
+                <option value="0">(2) only leaf information</option>
+        </param>
+        
+    </inputs>
+    
+    <outputs>
+        <data format="tabular" name="outfile_network" label="Network" />
+        <data format="tabular" name="outfile_attribute" label="Attributes" />
+    </outputs>
+    
+    <tests>
+        <test>
+        </test>
+    </tests>
+    
+    <help>
+.. class:: infomark
+
+CoVennTree compares up to three rooted trees at the same time.
+
+CoVennTree (Comparative weighted Venn Tree) is a software to analyze and compare up to three datasets. Unlike other
+methods, CoVennTree correlates data on the leaf level and transfers this information to the root node. CoVennTree works with numbers to compute weighted
+Venn diagrams for each node in the graph (rooted tree). Therefore any kind of input data can be processed as long as the data structure will be taken into account.
+
+
+
+**Input**
+
+*Input example*
+
+
+.. image:: $PATH_TO_IMAGES/example1.png 
+  :height: 430 
+  :width: 600
+
+
+*dsv-format: The following table represents the graph.*
+
+
+===========  ======  ======  ======
+#Datasets    set1    set2    set3
+===========  ======  ======  ======
+"root;"      0       0       0
+"root;A;"    10000   0       0
+"root;A;C;"  600000  300000  500000
+"root;A;D;"  0       100000  200000
+"root;A;E;"  800000  0       100000
+"root;B;"    10000   20000   50000
+===========  ======  ======  ======
+
+
+-------
+
+
+**Results**
+
+A specific color is assigned to each dataset in five optional color schemes (see parameter "Select color mode for weighted Venn diagrams").
+In this example set1 corresponds to color blue, set2 to red and set3 to yellow.
+In order to cover a wide numerical range a non linear transformation function is used.
+
+
+*Data format \*.sif*
+
+[parent_node]   [connected_with]    [child_node]
+
+
+*Data format \*.venn*
+
+[id]    [google_url]    [id_vds]    [Venn_abs_values]
+
+
+*Output example "leaf information and not assigned information"*
+
+By selecting "leaf information + not assigned information" artificial nodes can be inserted.
+Artificial nodes will be inserted if inner nodes have values larger than zero.
+
+.. image:: $PATH_TO_IMAGES/venn-graph-off.png 
+  :height: 358 
+  :width: 425
+  
+  
+-------
+
+
+*Output example "only leaf information"*
+
+By selecting "only leaf information" only leaf nodes are considered for the computation of weighted Venn diagrams.
+
+.. image:: $PATH_TO_IMAGES/venn-graph-on.png 
+  :height: 358
+  :width: 400
+
+
+
+    </help>
+    <citations>
+        <citation type="doi">
+        
+        </citation>>
+    </citations>
+</tool>
b
diff -r 000000000000 -r 745aede829e9 coVennTree/static/._.DS_Store
b
Binary file coVennTree/static/._.DS_Store has changed
b
diff -r 000000000000 -r 745aede829e9 coVennTree/static/images/._example1.png
b
Binary file coVennTree/static/images/._example1.png has changed
b
diff -r 000000000000 -r 745aede829e9 coVennTree/static/images/._venn-graph-off.png
b
Binary file coVennTree/static/images/._venn-graph-off.png has changed
b
diff -r 000000000000 -r 745aede829e9 coVennTree/static/images/._venn-graph-on.png
b
Binary file coVennTree/static/images/._venn-graph-on.png has changed
b
diff -r 000000000000 -r 745aede829e9 coVennTree/static/images/example1.png
b
Binary file coVennTree/static/images/example1.png has changed
b
diff -r 000000000000 -r 745aede829e9 coVennTree/static/images/venn-graph-off.png
b
Binary file coVennTree/static/images/venn-graph-off.png has changed
b
diff -r 000000000000 -r 745aede829e9 coVennTree/static/images/venn-graph-on.png
b
Binary file coVennTree/static/images/venn-graph-on.png has changed
b
diff -r 000000000000 -r 745aede829e9 coVennTree/tool_dependencies.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/coVennTree/tool_dependencies.xml Fri Jan 30 09:55:45 2015 -0500
b
@@ -0,0 +1,21 @@
+<?xml version="1.0"?>
+<tool_dependency>
+  <package name="perl" version="5.18.1">
+      <repository changeset_revision="114b6af405fa" name="package_perl_5_18" owner="iuc" prior_installation_required="True" toolshed="https://toolshed.g2.bx.psu.edu" />
+    </package>
+    <package name="coVennTree" version="1.6">
+      <install version="1.0">
+          <actions>
+              <action type="setup_perl_environment">
+                  <repository changeset_revision="114b6af405fa" name="package_perl_5_18" owner="iuc" toolshed="https://toolshed.g2.bx.psu.edu">
+                      <package name="perl" version="5.18.1" />
+                    </repository>
+                    <!-- allow downloading and installing an Perl package from cpan.org-->
+                    <package>http://search.cpan.org/CPAN/authors/id/A/AD/ADAMK/List-MoreUtils-0.33.tar.gz</package>
+                </action>
+            </actions>
+        </install>
+        <readme>
+        </readme>
+    </package>
+</tool_dependency>