Mercurial > repos > bgruening > scipy_sparse
view sparse.xml @ 7:41716aaf0cb2 draft
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
author | bgruening |
---|---|
date | Sat, 28 Apr 2018 18:10:49 -0400 |
parents | 58812a9f83ed |
children | bf3a5f8a66a2 |
line wrap: on
line source
<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>