comparison sparse.xml @ 0:58812a9f83ed draft

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