diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sparse.xml	Fri Feb 16 09:20:16 2018 -0500
@@ -0,0 +1,92 @@
+<tool id="scipy_sparse" name="Sparse Matrix Functions" version="@VERSION@">
+    <description>for manipulating 2-D Scipy sparse numeric data</description>
+    <macros>
+        <import>main_macros.xml</import>
+    </macros>
+    <expand macro="python_requirements"/>
+    <expand macro="macro_stdio"/>
+    <version_command>echo "@VERSION@"</version_command>
+    <command>
+        <![CDATA[
+        python "$sparse_script" '$inputs'
+        ]]>
+    </command>
+    <configfiles>
+        <inputs name="inputs" />
+        <configfile name="sparse_script">
+            <![CDATA[
+import sys
+import json
+import pandas
+import numpy as np
+from scipy import sparse
+from scipy.io import mmread
+from scipy.io import mmwrite
+
+input_json_path = sys.argv[1]
+params = json.load(open(input_json_path, "r"))
+
+sparse_iter = []
+#for $i, $s in enumerate( $sparse_functions.sparse_inputs )
+sparse_index=$i
+sparse_path="${s.input.file_name}"
+sparse_iter.append(mmread(open(sparse_path, 'r')))
+#end for
+
+my_function = getattr(sparse, params["sparse_functions"]["selected_function"])
+my_sparse = my_function(sparse_iter)
+mmwrite(open("$outfile", 'w+'), my_sparse) 
+            ]]>
+        </configfile>
+    </configfiles>
+    <inputs>
+        <conditional name="sparse_functions">
+            <param name="selected_function" type="select" label="Select a task:">
+                <option value="vstack" selected="true">Stack sparse matrices vertically (vstack)</option>
+                <option value="hstack">Stack sparse matrices horizontally (hstack)</option>
+            </param>
+            <when value="vstack">
+                <expand macro="multiple_input" name="sparse_inputs"/>
+            </when>
+            <when value="hstack">
+                <expand macro="multiple_input" name="sparse_inputs"/>
+            </when>
+        </conditional>
+    </inputs>
+    <outputs>
+        <data format="txt" name="outfile"/>
+    </outputs>
+    <tests>
+        <test>
+            <param name="selected_function" value="vstack"/>
+            <param name="sparse_inputs_0|input" value="csr_sparse1.mtx" ftype="txt"/>
+            <param name="sparse_inputs_1|input" value="csr_sparse2.mtx" ftype="txt"/>
+            <output name="outfile" file="csr_stack_result01.mtx"/>
+        </test>
+        <test>
+            <param name="selected_function" value="hstack"/>
+            <param name="sparse_inputs_0|input" value="csc_sparse1.mtx" ftype="txt"/>
+            <param name="sparse_inputs_1|input" value="csc_sparse2.mtx" ftype="txt"/>
+            <output name="outfile" file="csc_stack_result01.mtx"/>
+        </test>
+    </tests>
+    <help>
+        <![CDATA[
+**What it does**
+
+This tool stacks sparse matrices horizontally (column wise) or vertically (row wise).
+It can handle two different formats:
+
+ * Compressed Sparse Column matrix (csc_matrix)
+
+ * Compressed Sparse Row matrix (csr_matrix)
+
+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.    
+
+**Parameters:** blocks sequence of sparse matrices with compatible shapes format. 
+
+For more information please refer to  DOI:10.1109/MCSE.2011.37.
+        ]]>
+    </help>
+    <expand macro="scipy_citation"/>
+</tool>
\ No newline at end of file