Mercurial > repos > bgruening > numeric_clustering
comparison numeric_clustering.xml @ 4:7c1794e0f9c2 draft default tip
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/numeric_clustering commit adf077b912ddebd97b07b947b855cdd2862ed8ef-dirty
| author | bgruening |
|---|---|
| date | Fri, 01 Jan 2016 18:00:23 -0500 |
| parents | 6bfbaf81b8f4 |
| children |
comparison
equal
deleted
inserted
replaced
| 3:6bfbaf81b8f4 | 4:7c1794e0f9c2 |
|---|---|
| 74 import json | 74 import json |
| 75 import numpy as np | 75 import numpy as np |
| 76 import sklearn.cluster | 76 import sklearn.cluster |
| 77 import pandas | 77 import pandas |
| 78 | 78 |
| 79 data = pandas.read_csv("$infile", sep='\t', header=0, index_col=0, parse_dates=True, encoding=None, tupleize_cols=False ) | 79 data = pandas.read_csv("$infile", sep='\t', header=0, index_col=None, parse_dates=True, encoding=None, tupleize_cols=False ) |
| 80 my_class = getattr(sklearn.cluster, "$algorithm_options.selected_algorithm") | 80 my_class = getattr(sklearn.cluster, "$algorithm_options.selected_algorithm") |
| 81 cluster_object = my_class() | 81 cluster_object = my_class() |
| 82 | 82 |
| 83 params = json.loads( sys.argv[1] ) | 83 params = json.loads( sys.argv[1] ) |
| 84 cluster_object.set_params(**params) | 84 cluster_object.set_params(**params) |
| 91 | 91 |
| 92 #else: | 92 #else: |
| 93 data_matrix = data.values | 93 data_matrix = data.values |
| 94 #end if | 94 #end if |
| 95 prediction = cluster_object.fit_predict( data_matrix ) | 95 prediction = cluster_object.fit_predict( data_matrix ) |
| 96 data[len(data.columns)] = prediction | 96 prediction_df = pandas.DataFrame(prediction) |
| 97 data.to_csv(path_or_buf = "$outfile", sep="\t") | 97 res = pandas.concat([data, prediction_df], axis=1) |
| 98 res.to_csv(path_or_buf = "$outfile", sep="\t", index=False) | |
| 98 ]]> | 99 ]]> |
| 99 </configfile> | 100 </configfile> |
| 100 </configfiles> | 101 </configfiles> |
| 101 <inputs> | 102 <inputs> |
| 102 <param name="infile" type="data" format="tabular" label="Data file with numeric values" /> | 103 <param name="infile" type="data" format="tabular" label="Data file with numeric values" /> |
| 296 <param name="selected_algorithm" value="AgglomerativeClustering"/> | 297 <param name="selected_algorithm" value="AgglomerativeClustering"/> |
| 297 <param name="start_column" value="2" /> | 298 <param name="start_column" value="2" /> |
| 298 <param name="end_column" value="4" /> | 299 <param name="end_column" value="4" /> |
| 299 <param name="affinity" value="euclidean"/> | 300 <param name="affinity" value="euclidean"/> |
| 300 <param name="linkage" value="average"/> | 301 <param name="linkage" value="average"/> |
| 302 <param name="n_clusters" value="4"/> | |
| 301 <output name="outfile" file="cluster_result10.txt"/> | 303 <output name="outfile" file="cluster_result10.txt"/> |
| 302 </test> | 304 </test> |
| 303 <test> | 305 <test> |
| 304 <param name="infile" value="numeric_values.tabular" ftype="tabular"/> | 306 <param name="infile" value="numeric_values.tabular" ftype="tabular"/> |
| 305 <param name="selected_algorithm" value="AgglomerativeClustering"/> | 307 <param name="selected_algorithm" value="AgglomerativeClustering"/> |
