changeset 1:7b21a9b5922f draft

planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit 7ba5d8f0e920dccbc82588e4f4a7b9039dc3ea36
author bgruening
date Wed, 10 Oct 2018 02:29:28 -0400
parents 7b2455348edf
children 9958188c6195
files paracords_plot.py paracords_plot.xml
diffstat 2 files changed, 10 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/paracords_plot.py	Sun Sep 23 07:52:27 2018 -0400
+++ b/paracords_plot.py	Wed Oct 10 02:29:28 2018 -0400
@@ -4,7 +4,7 @@
 import plotly.graph_objs as go
 import pandas as pd
 
-def main(infile, col_dimensions, col_color):
+def main(infile, col_dimensions, categorized, col_color):
     """
     Produce an interactive paracords plotting html
     Args:
@@ -18,13 +18,13 @@
     col_dimensions = [int(x)-1 for x in col_dimensions.split(',')]
     for col in col_dimensions:
         values = df[df.columns[col]]
-        if all(type(e) is int for e in values ):
+        if categorized == 'boolfalse' and all(type(e) is int for e in values ):
             dimensions.append(
                 dict(   values = values,
                         tickformat = ",.2r",
                         label = df.columns[col])
             )
-        elif all(type(e) is float for e in values ):
+        elif categorized == 'boolfalse' and all(type(e) is float for e in values ):
             dimensions.append(
                 dict(   values = values,
                         tickformat = "g",
@@ -32,6 +32,7 @@
             )
         else:
             unique_values = list(set(values))
+            unique_values.sort()
             dimensions.append(
                 dict(   range = [0, len(unique_values)-1],
                         tickvals = list(range(len(unique_values))),
@@ -77,7 +78,8 @@
     aparser = argparse.ArgumentParser()
     aparser.add_argument( "-i", "--input", dest="infile", required=True)
     aparser.add_argument( "-d", "--col_dimensions", dest="col_dimensions")
+    aparser.add_argument( "-t", "--categorized_datatype", dest="categorized")
     aparser.add_argument( "-c", "--col_color", dest="col_color")
     args = aparser.parse_args()
 
-    main(args.infile, args.col_dimensions, args.col_color)
\ No newline at end of file
+    main(args.infile, args.col_dimensions, args.categorized, args.col_color)
\ No newline at end of file
--- a/paracords_plot.xml	Sun Sep 23 07:52:27 2018 -0400
+++ b/paracords_plot.xml	Wed Oct 10 02:29:28 2018 -0400
@@ -10,12 +10,14 @@
     python '$__tool_directory__/paracords_plot.py'
         -i '$infile'
         -d '$col_dimensions'
+        -t '$categorized_datatype'
         -c '$col_color'
 ]]>
     </command>
     <inputs>
         <param name="infile" type="data" format="tabular" label="Select data file :"/>
         <param name="col_dimensions" multiple="true" type="data_column" data_ref="infile" use_header_names="true" display="checkboxes" label="Select the columns for dimentions:"/>
+        <param name="categorized_datatype" type="boolean" optional="true" truevalue="booltrue" falsevalue="boolfalse" checked="true" label="All the dimensions in categorized datatype:"/>
         <param name="col_color" type="data_column" data_ref="infile" use_header_names="true" label="Select a column containg the values for coloring:" help="e.g. mean_test_score"/>
     </inputs>
 
@@ -26,12 +28,14 @@
         <test>
             <param name="infile" value="parcoords01.tabular" ftype="tabular"/>
             <param name="col_dimensions" value="4,5"/>
+            <param name="categorized_datatype" value="false"/>
             <param name="col_color" value="3"/>
             <output name="output" file="parcoords_plot01.html" compare="sim_size"/>
         </test>
         <test>
             <param name="infile" value="parcoords02.tabular" ftype="tabular"/>
             <param name="col_dimensions" value="4,5"/>
+            <param name="categorized_datatype" value="false"/>
             <param name="col_color" value="3"/>
             <output name="output" file="parcoords_plot02.html" compare="sim_size"/>
         </test>