Mercurial > repos > bgruening > scipy_sparse
view sparse.xml @ 38:f49aad8f79ea draft
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 8850f42c2c3763e614f7454c9c006f3d2ff572c0
author | bgruening |
---|---|
date | Fri, 27 May 2022 11:56:29 +0000 |
parents | 4efd73be98bb |
children |
line wrap: on
line source
<tool id="scipy_sparse" name="Sparse Matrix Functions" version="@VERSION@" profile="20.05"> <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] with open(input_json_path, "r") as param_handler: params = json.load(param_handler) sparse_iter = [] #for $i, $s in enumerate( $sparse_functions.sparse_inputs ) sparse_index=$i sparse_path="${s.input.file_name}" sparse_iter.append(mmread(sparse_path)) #end for my_function = getattr(sparse, params["sparse_functions"]["selected_function"]) my_sparse = my_function(sparse_iter) with open("$outfile", "wb") as out_handler: mmwrite(out_handler, 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>