annotate paracords_plot.py @ 2:6f6de7fe36a9 draft default tip

"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit b26c6ec671ec63cce1f86c70e928673ed2c82f82"
author bgruening
date Mon, 04 Nov 2019 12:20:16 -0500
parents c1d07a528382
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
2da0fddf2bdb planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit 93fcfe0fa6a64246d13e0fb7e35a357985b02465
bgruening
parents:
diff changeset
1 import sys
2da0fddf2bdb planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit 93fcfe0fa6a64246d13e0fb7e35a357985b02465
bgruening
parents:
diff changeset
2 import argparse
2da0fddf2bdb planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit 93fcfe0fa6a64246d13e0fb7e35a357985b02465
bgruening
parents:
diff changeset
3 import plotly
2da0fddf2bdb planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit 93fcfe0fa6a64246d13e0fb7e35a357985b02465
bgruening
parents:
diff changeset
4 import plotly.graph_objs as go
2da0fddf2bdb planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit 93fcfe0fa6a64246d13e0fb7e35a357985b02465
bgruening
parents:
diff changeset
5 import pandas as pd
2
6f6de7fe36a9 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit b26c6ec671ec63cce1f86c70e928673ed2c82f82"
bgruening
parents: 1
diff changeset
6 import re
0
2da0fddf2bdb planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit 93fcfe0fa6a64246d13e0fb7e35a357985b02465
bgruening
parents:
diff changeset
7
2
6f6de7fe36a9 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit b26c6ec671ec63cce1f86c70e928673ed2c82f82"
bgruening
parents: 1
diff changeset
8
6f6de7fe36a9 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit b26c6ec671ec63cce1f86c70e928673ed2c82f82"
bgruening
parents: 1
diff changeset
9 def main(infile, col_dimensions, categorized, col_color,
6f6de7fe36a9 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit b26c6ec671ec63cce1f86c70e928673ed2c82f82"
bgruening
parents: 1
diff changeset
10 dimension_mode='by_index'):
0
2da0fddf2bdb planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit 93fcfe0fa6a64246d13e0fb7e35a357985b02465
bgruening
parents:
diff changeset
11 """
2da0fddf2bdb planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit 93fcfe0fa6a64246d13e0fb7e35a357985b02465
bgruening
parents:
diff changeset
12 Produce an interactive paracords plotting html
2da0fddf2bdb planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit 93fcfe0fa6a64246d13e0fb7e35a357985b02465
bgruening
parents:
diff changeset
13 Args:
2da0fddf2bdb planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit 93fcfe0fa6a64246d13e0fb7e35a357985b02465
bgruening
parents:
diff changeset
14 infile: str, tabular file
2da0fddf2bdb planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit 93fcfe0fa6a64246d13e0fb7e35a357985b02465
bgruening
parents:
diff changeset
15 col_dimensions: str, comma separated index numbers. For example: "3,4,5"
2da0fddf2bdb planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit 93fcfe0fa6a64246d13e0fb7e35a357985b02465
bgruening
parents:
diff changeset
16 col_color: str, index number
2
6f6de7fe36a9 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit b26c6ec671ec63cce1f86c70e928673ed2c82f82"
bgruening
parents: 1
diff changeset
17 dimension_mode: str, one ['by_index', 'by_name']
0
2da0fddf2bdb planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit 93fcfe0fa6a64246d13e0fb7e35a357985b02465
bgruening
parents:
diff changeset
18 """
2da0fddf2bdb planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit 93fcfe0fa6a64246d13e0fb7e35a357985b02465
bgruening
parents:
diff changeset
19 df = pd.read_csv(infile, sep='\t', parse_dates=True)
2da0fddf2bdb planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit 93fcfe0fa6a64246d13e0fb7e35a357985b02465
bgruening
parents:
diff changeset
20
2da0fddf2bdb planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit 93fcfe0fa6a64246d13e0fb7e35a357985b02465
bgruening
parents:
diff changeset
21 dimensions = []
2
6f6de7fe36a9 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit b26c6ec671ec63cce1f86c70e928673ed2c82f82"
bgruening
parents: 1
diff changeset
22
6f6de7fe36a9 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit b26c6ec671ec63cce1f86c70e928673ed2c82f82"
bgruening
parents: 1
diff changeset
23 if dimension_mode not in ['by_index', 'by_name']:
6f6de7fe36a9 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit b26c6ec671ec63cce1f86c70e928673ed2c82f82"
bgruening
parents: 1
diff changeset
24 raise ValueError("Select dimensions `{}` is not supported!"\
6f6de7fe36a9 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit b26c6ec671ec63cce1f86c70e928673ed2c82f82"
bgruening
parents: 1
diff changeset
25 .format(dimension_mode))
6f6de7fe36a9 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit b26c6ec671ec63cce1f86c70e928673ed2c82f82"
bgruening
parents: 1
diff changeset
26 if dimension_mode == 'by_index':
6f6de7fe36a9 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit b26c6ec671ec63cce1f86c70e928673ed2c82f82"
bgruening
parents: 1
diff changeset
27 col_dimensions = [int(x)-1 for x in col_dimensions.split(',')]
6f6de7fe36a9 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit b26c6ec671ec63cce1f86c70e928673ed2c82f82"
bgruening
parents: 1
diff changeset
28 col_dimensions = df.columns[col_dimensions]
6f6de7fe36a9 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit b26c6ec671ec63cce1f86c70e928673ed2c82f82"
bgruening
parents: 1
diff changeset
29 else:
6f6de7fe36a9 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit b26c6ec671ec63cce1f86c70e928673ed2c82f82"
bgruening
parents: 1
diff changeset
30 if '*' not in col_dimensions:
6f6de7fe36a9 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit b26c6ec671ec63cce1f86c70e928673ed2c82f82"
bgruening
parents: 1
diff changeset
31 col_dimensions = [header.strip() for header in col_dimensions.split(',')]
6f6de7fe36a9 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit b26c6ec671ec63cce1f86c70e928673ed2c82f82"
bgruening
parents: 1
diff changeset
32 else:
6f6de7fe36a9 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit b26c6ec671ec63cce1f86c70e928673ed2c82f82"
bgruening
parents: 1
diff changeset
33 pattern = col_dimensions.strip()
6f6de7fe36a9 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit b26c6ec671ec63cce1f86c70e928673ed2c82f82"
bgruening
parents: 1
diff changeset
34 col_dimensions = [header for header in df.columns
6f6de7fe36a9 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit b26c6ec671ec63cce1f86c70e928673ed2c82f82"
bgruening
parents: 1
diff changeset
35 if re.search(pattern, header)]
6f6de7fe36a9 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit b26c6ec671ec63cce1f86c70e928673ed2c82f82"
bgruening
parents: 1
diff changeset
36
6f6de7fe36a9 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit b26c6ec671ec63cce1f86c70e928673ed2c82f82"
bgruening
parents: 1
diff changeset
37 for col_name in col_dimensions:
6f6de7fe36a9 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit b26c6ec671ec63cce1f86c70e928673ed2c82f82"
bgruening
parents: 1
diff changeset
38 values = df[col_name]
1
c1d07a528382 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit 7ba5d8f0e920dccbc82588e4f4a7b9039dc3ea36
bgruening
parents: 0
diff changeset
39 if categorized == 'boolfalse' and all(type(e) is int for e in values ):
0
2da0fddf2bdb planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit 93fcfe0fa6a64246d13e0fb7e35a357985b02465
bgruening
parents:
diff changeset
40 dimensions.append(
2da0fddf2bdb planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit 93fcfe0fa6a64246d13e0fb7e35a357985b02465
bgruening
parents:
diff changeset
41 dict( values = values,
2da0fddf2bdb planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit 93fcfe0fa6a64246d13e0fb7e35a357985b02465
bgruening
parents:
diff changeset
42 tickformat = ",.2r",
2
6f6de7fe36a9 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit b26c6ec671ec63cce1f86c70e928673ed2c82f82"
bgruening
parents: 1
diff changeset
43 label = col_name)
0
2da0fddf2bdb planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit 93fcfe0fa6a64246d13e0fb7e35a357985b02465
bgruening
parents:
diff changeset
44 )
1
c1d07a528382 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit 7ba5d8f0e920dccbc82588e4f4a7b9039dc3ea36
bgruening
parents: 0
diff changeset
45 elif categorized == 'boolfalse' and all(type(e) is float for e in values ):
0
2da0fddf2bdb planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit 93fcfe0fa6a64246d13e0fb7e35a357985b02465
bgruening
parents:
diff changeset
46 dimensions.append(
2da0fddf2bdb planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit 93fcfe0fa6a64246d13e0fb7e35a357985b02465
bgruening
parents:
diff changeset
47 dict( values = values,
2da0fddf2bdb planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit 93fcfe0fa6a64246d13e0fb7e35a357985b02465
bgruening
parents:
diff changeset
48 tickformat = "g",
2
6f6de7fe36a9 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit b26c6ec671ec63cce1f86c70e928673ed2c82f82"
bgruening
parents: 1
diff changeset
49 label = col_name)
0
2da0fddf2bdb planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit 93fcfe0fa6a64246d13e0fb7e35a357985b02465
bgruening
parents:
diff changeset
50 )
2da0fddf2bdb planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit 93fcfe0fa6a64246d13e0fb7e35a357985b02465
bgruening
parents:
diff changeset
51 else:
2da0fddf2bdb planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit 93fcfe0fa6a64246d13e0fb7e35a357985b02465
bgruening
parents:
diff changeset
52 unique_values = list(set(values))
1
c1d07a528382 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit 7ba5d8f0e920dccbc82588e4f4a7b9039dc3ea36
bgruening
parents: 0
diff changeset
53 unique_values.sort()
2
6f6de7fe36a9 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit b26c6ec671ec63cce1f86c70e928673ed2c82f82"
bgruening
parents: 1
diff changeset
54 # cast to str, fix object indexing
6f6de7fe36a9 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit b26c6ec671ec63cce1f86c70e928673ed2c82f82"
bgruening
parents: 1
diff changeset
55 unique_values = [repr(e) for e in unique_values]
0
2da0fddf2bdb planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit 93fcfe0fa6a64246d13e0fb7e35a357985b02465
bgruening
parents:
diff changeset
56 dimensions.append(
2da0fddf2bdb planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit 93fcfe0fa6a64246d13e0fb7e35a357985b02465
bgruening
parents:
diff changeset
57 dict( range = [0, len(unique_values)-1],
2da0fddf2bdb planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit 93fcfe0fa6a64246d13e0fb7e35a357985b02465
bgruening
parents:
diff changeset
58 tickvals = list(range(len(unique_values))),
2
6f6de7fe36a9 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit b26c6ec671ec63cce1f86c70e928673ed2c82f82"
bgruening
parents: 1
diff changeset
59 ticktext = unique_values,
6f6de7fe36a9 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit b26c6ec671ec63cce1f86c70e928673ed2c82f82"
bgruening
parents: 1
diff changeset
60 values = list(map(lambda e: unique_values.index(repr(e)), values )),
6f6de7fe36a9 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit b26c6ec671ec63cce1f86c70e928673ed2c82f82"
bgruening
parents: 1
diff changeset
61 label = col_name)
0
2da0fddf2bdb planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit 93fcfe0fa6a64246d13e0fb7e35a357985b02465
bgruening
parents:
diff changeset
62 )
2da0fddf2bdb planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit 93fcfe0fa6a64246d13e0fb7e35a357985b02465
bgruening
parents:
diff changeset
63
2da0fddf2bdb planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit 93fcfe0fa6a64246d13e0fb7e35a357985b02465
bgruening
parents:
diff changeset
64 col_color = int(col_color) - 1
2da0fddf2bdb planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit 93fcfe0fa6a64246d13e0fb7e35a357985b02465
bgruening
parents:
diff changeset
65 colors = df[df.columns[col_color]]
2da0fddf2bdb planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit 93fcfe0fa6a64246d13e0fb7e35a357985b02465
bgruening
parents:
diff changeset
66 if all(type(e) is int for e in colors ):
2da0fddf2bdb planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit 93fcfe0fa6a64246d13e0fb7e35a357985b02465
bgruening
parents:
diff changeset
67 tickformat = ",.2r"
2da0fddf2bdb planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit 93fcfe0fa6a64246d13e0fb7e35a357985b02465
bgruening
parents:
diff changeset
68 elif all(type(e) is float for e in colors ):
2da0fddf2bdb planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit 93fcfe0fa6a64246d13e0fb7e35a357985b02465
bgruening
parents:
diff changeset
69 tickformat = "g"
2da0fddf2bdb planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit 93fcfe0fa6a64246d13e0fb7e35a357985b02465
bgruening
parents:
diff changeset
70 else:
2da0fddf2bdb planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit 93fcfe0fa6a64246d13e0fb7e35a357985b02465
bgruening
parents:
diff changeset
71 sys.exit("Error: the column for coloring must contain all numerical values!")
2da0fddf2bdb planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit 93fcfe0fa6a64246d13e0fb7e35a357985b02465
bgruening
parents:
diff changeset
72
2da0fddf2bdb planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit 93fcfe0fa6a64246d13e0fb7e35a357985b02465
bgruening
parents:
diff changeset
73 dimensions.append(
2da0fddf2bdb planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit 93fcfe0fa6a64246d13e0fb7e35a357985b02465
bgruening
parents:
diff changeset
74 dict(
2da0fddf2bdb planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit 93fcfe0fa6a64246d13e0fb7e35a357985b02465
bgruening
parents:
diff changeset
75 values = colors,
2da0fddf2bdb planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit 93fcfe0fa6a64246d13e0fb7e35a357985b02465
bgruening
parents:
diff changeset
76 tickformat = tickformat,
2da0fddf2bdb planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit 93fcfe0fa6a64246d13e0fb7e35a357985b02465
bgruening
parents:
diff changeset
77 label = df.columns[col_color]
2da0fddf2bdb planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit 93fcfe0fa6a64246d13e0fb7e35a357985b02465
bgruening
parents:
diff changeset
78 )
2da0fddf2bdb planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit 93fcfe0fa6a64246d13e0fb7e35a357985b02465
bgruening
parents:
diff changeset
79 )
2da0fddf2bdb planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit 93fcfe0fa6a64246d13e0fb7e35a357985b02465
bgruening
parents:
diff changeset
80
2da0fddf2bdb planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit 93fcfe0fa6a64246d13e0fb7e35a357985b02465
bgruening
parents:
diff changeset
81 line = dict(
2da0fddf2bdb planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit 93fcfe0fa6a64246d13e0fb7e35a357985b02465
bgruening
parents:
diff changeset
82 color = colors,
2da0fddf2bdb planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit 93fcfe0fa6a64246d13e0fb7e35a357985b02465
bgruening
parents:
diff changeset
83 colorscale = 'Jet',
2da0fddf2bdb planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit 93fcfe0fa6a64246d13e0fb7e35a357985b02465
bgruening
parents:
diff changeset
84 showscale = True,
2da0fddf2bdb planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit 93fcfe0fa6a64246d13e0fb7e35a357985b02465
bgruening
parents:
diff changeset
85 reversescale = True
2da0fddf2bdb planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit 93fcfe0fa6a64246d13e0fb7e35a357985b02465
bgruening
parents:
diff changeset
86 )
2da0fddf2bdb planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit 93fcfe0fa6a64246d13e0fb7e35a357985b02465
bgruening
parents:
diff changeset
87
2da0fddf2bdb planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit 93fcfe0fa6a64246d13e0fb7e35a357985b02465
bgruening
parents:
diff changeset
88 data = [
2da0fddf2bdb planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit 93fcfe0fa6a64246d13e0fb7e35a357985b02465
bgruening
parents:
diff changeset
89 go.Parcoords(
2da0fddf2bdb planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit 93fcfe0fa6a64246d13e0fb7e35a357985b02465
bgruening
parents:
diff changeset
90 line = line,
2da0fddf2bdb planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit 93fcfe0fa6a64246d13e0fb7e35a357985b02465
bgruening
parents:
diff changeset
91 dimensions = dimensions
2da0fddf2bdb planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit 93fcfe0fa6a64246d13e0fb7e35a357985b02465
bgruening
parents:
diff changeset
92 )
2da0fddf2bdb planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit 93fcfe0fa6a64246d13e0fb7e35a357985b02465
bgruening
parents:
diff changeset
93 ]
2da0fddf2bdb planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit 93fcfe0fa6a64246d13e0fb7e35a357985b02465
bgruening
parents:
diff changeset
94
2da0fddf2bdb planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit 93fcfe0fa6a64246d13e0fb7e35a357985b02465
bgruening
parents:
diff changeset
95 plotly.offline.plot(data, filename = "output.html", auto_open=False)
2da0fddf2bdb planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit 93fcfe0fa6a64246d13e0fb7e35a357985b02465
bgruening
parents:
diff changeset
96
2da0fddf2bdb planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit 93fcfe0fa6a64246d13e0fb7e35a357985b02465
bgruening
parents:
diff changeset
97 if __name__ == "__main__":
2da0fddf2bdb planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit 93fcfe0fa6a64246d13e0fb7e35a357985b02465
bgruening
parents:
diff changeset
98 aparser = argparse.ArgumentParser()
2da0fddf2bdb planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit 93fcfe0fa6a64246d13e0fb7e35a357985b02465
bgruening
parents:
diff changeset
99 aparser.add_argument( "-i", "--input", dest="infile", required=True)
2da0fddf2bdb planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit 93fcfe0fa6a64246d13e0fb7e35a357985b02465
bgruening
parents:
diff changeset
100 aparser.add_argument( "-d", "--col_dimensions", dest="col_dimensions")
1
c1d07a528382 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit 7ba5d8f0e920dccbc82588e4f4a7b9039dc3ea36
bgruening
parents: 0
diff changeset
101 aparser.add_argument( "-t", "--categorized_datatype", dest="categorized")
0
2da0fddf2bdb planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit 93fcfe0fa6a64246d13e0fb7e35a357985b02465
bgruening
parents:
diff changeset
102 aparser.add_argument( "-c", "--col_color", dest="col_color")
2
6f6de7fe36a9 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit b26c6ec671ec63cce1f86c70e928673ed2c82f82"
bgruening
parents: 1
diff changeset
103 aparser.add_argument( "-m", "--dimension_mode", dest="dimension_mode")
0
2da0fddf2bdb planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit 93fcfe0fa6a64246d13e0fb7e35a357985b02465
bgruening
parents:
diff changeset
104 args = aparser.parse_args()
2da0fddf2bdb planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit 93fcfe0fa6a64246d13e0fb7e35a357985b02465
bgruening
parents:
diff changeset
105
2
6f6de7fe36a9 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit b26c6ec671ec63cce1f86c70e928673ed2c82f82"
bgruening
parents: 1
diff changeset
106 main(args.infile, args.col_dimensions, args.categorized, args.col_color,
6f6de7fe36a9 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/plotly_parallel_coordinates_plot commit b26c6ec671ec63cce1f86c70e928673ed2c82f82"
bgruening
parents: 1
diff changeset
107 args.dimension_mode)