Mercurial > repos > bgruening > scipy_sparse
annotate sparse.xml @ 7:0c19936d39f3 draft
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 641ac64ded23fbb6fe85d5f13926da12dcce4e76
author | bgruening |
---|---|
date | Tue, 13 Mar 2018 04:53:17 -0400 |
parents | 1191a102a5c1 |
children | 01c0f1b60556 |
rev | line source |
---|---|
0
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
1 <tool id="scipy_sparse" name="Sparse Matrix Functions" version="@VERSION@"> |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
2 <description>for manipulating 2-D Scipy sparse numeric data</description> |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
3 <macros> |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
4 <import>main_macros.xml</import> |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
5 </macros> |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
6 <expand macro="python_requirements"/> |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
7 <expand macro="macro_stdio"/> |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
8 <version_command>echo "@VERSION@"</version_command> |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
9 <command> |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
10 <![CDATA[ |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
11 python "$sparse_script" '$inputs' |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
12 ]]> |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
13 </command> |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
14 <configfiles> |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
15 <inputs name="inputs" /> |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
16 <configfile name="sparse_script"> |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
17 <![CDATA[ |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
18 import sys |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
19 import json |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
20 import pandas |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
21 import numpy as np |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
22 from scipy import sparse |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
23 from scipy.io import mmread |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
24 from scipy.io import mmwrite |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
25 |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
26 input_json_path = sys.argv[1] |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
27 params = json.load(open(input_json_path, "r")) |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
28 |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
29 sparse_iter = [] |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
30 #for $i, $s in enumerate( $sparse_functions.sparse_inputs ) |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
31 sparse_index=$i |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
32 sparse_path="${s.input.file_name}" |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
33 sparse_iter.append(mmread(open(sparse_path, 'r'))) |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
34 #end for |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
35 |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
36 my_function = getattr(sparse, params["sparse_functions"]["selected_function"]) |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
37 my_sparse = my_function(sparse_iter) |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
38 mmwrite(open("$outfile", 'w+'), my_sparse) |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
39 ]]> |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
40 </configfile> |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
41 </configfiles> |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
42 <inputs> |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
43 <conditional name="sparse_functions"> |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
44 <param name="selected_function" type="select" label="Select a task:"> |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
45 <option value="vstack" selected="true">Stack sparse matrices vertically (vstack)</option> |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
46 <option value="hstack">Stack sparse matrices horizontally (hstack)</option> |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
47 </param> |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
48 <when value="vstack"> |
1
1191a102a5c1
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 620159e95d2fae693b5f25d591528be159130f25
bgruening
parents:
0
diff
changeset
|
49 <expand macro="multiple_input" name="sparse_inputs"/> |
0
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
50 </when> |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
51 <when value="hstack"> |
1
1191a102a5c1
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 620159e95d2fae693b5f25d591528be159130f25
bgruening
parents:
0
diff
changeset
|
52 <expand macro="multiple_input" name="sparse_inputs"/> |
0
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
53 </when> |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
54 </conditional> |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
55 </inputs> |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
56 <outputs> |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
57 <data format="txt" name="outfile"/> |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
58 </outputs> |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
59 <tests> |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
60 <test> |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
61 <param name="selected_function" value="vstack"/> |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
62 <param name="sparse_inputs_0|input" value="csr_sparse1.mtx" ftype="txt"/> |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
63 <param name="sparse_inputs_1|input" value="csr_sparse2.mtx" ftype="txt"/> |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
64 <output name="outfile" file="csr_stack_result01.mtx"/> |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
65 </test> |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
66 <test> |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
67 <param name="selected_function" value="hstack"/> |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
68 <param name="sparse_inputs_0|input" value="csc_sparse1.mtx" ftype="txt"/> |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
69 <param name="sparse_inputs_1|input" value="csc_sparse2.mtx" ftype="txt"/> |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
70 <output name="outfile" file="csc_stack_result01.mtx"/> |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
71 </test> |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
72 </tests> |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
73 <help> |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
74 <![CDATA[ |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
75 **What it does** |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
76 |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
77 This tool stacks sparse matrices horizontally (column wise) or vertically (row wise). |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
78 It can handle two different formats: |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
79 |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
80 * Compressed Sparse Column matrix (csc_matrix) |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
81 |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
82 * Compressed Sparse Row matrix (csr_matrix) |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
83 |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
84 Sparse matrices in column format should be stacked horizontally (hstack) , while matrices in row format are stacked vertically (vstack). This tool outputs a single resulting sparse matrix which is compatible with the inputs in format. |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
85 |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
86 **Parameters:** blocks sequence of sparse matrices with compatible shapes format. |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
87 |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
88 For more information please refer to DOI:10.1109/MCSE.2011.37. |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
89 ]]> |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
90 </help> |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
91 <expand macro="scipy_citation"/> |
25b93d50158f
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit a6e80305ed0892c8163d690a2d376d6b454824de-dirty
bgruening
parents:
diff
changeset
|
92 </tool> |