view table-union.xml @ 0:402b58f45844 draft default tip

planemo upload commit 9cc4dc1db55299bf92ec6bd359161ece4592bd16-dirty
author jpayne
date Mon, 08 Dec 2025 15:03:06 +0000
parents
children
line wrap: on
line source

<tool id="table-union" name="Table Union: Merge tabular datasets" version="0.1.0">
    <description>by combining their rows and unionizing columns</description>
    <requirements>
        <container type="docker">cfsanbiostatistics/tableops:latest</container>
    </requirements>
    <command detect_errors="exit_code"><![CDATA[
    	#if $input_type.source_select == 'two'
    	#set tables=($table_1, $table_2)
    	#else
    	#set tables=$input_type.tables
    	#end if
        python $__tool_directory__/table-union.py $adv.union $adv.tuple_mode
        #for $table in $tables
            $table
        #end for
        > $combined_table
    ]]></command>
    <inputs>
    	<conditional name="input_type">
    		<param name="source_select" type="select" label="Mode">
    			<option value="two">Combine two tables</option>
    			<option value="collection">Combine a collection of tables</option>
    		</param>
    		<when value="collection">
       			<param name="tables" type="data_collection" format="tabular,tsv" collection_type="list" optional="true" />
       		</when>
       		<when value="two">
       			<param name="table_1" type="data" format="tabular,tsv" optional="true" />
       			<param name="table_2" type="data" format="tabular,tsv" optional="true"/>
       		</when>
        </conditional>
        <!-- Advanced options, click to show -->
        <section name="adv" title="Advanced options">
            <param name="union" type="boolean" label="Attempt to unionize on an autodetected key column" checked="false" truevalue="--unionize" falsevalue="" />
            <param name="tuple_mode" type="boolean" label="For tables with inconsistent headers - unionize by column order instead of column " checked="false" truevalue="--tuple" falsevalue="" />
        </section>
    </inputs>
    <outputs>
        <data name="combined_table" format="tsv" label="Combined table" />
    </outputs>

    <tests>
        <test>
        	<conditional name="input_type">
        		<param name="source_select" value="collection" />
            
            <param name="tables">
                <collection type="list">
                    <element name="table_1" value="dingbat.tsv" />
                    <element name="table_2" value="loki.tsv" />
                </collection>
            </param>
            </conditional>
            <section name="adv">
            <param name="union" value="true" />
            </section>
            <output name="combined_table" value="combined.tsv" />
        </test>
        <test>
        	<conditional name="input_type">
        		<param name="source_select" value="two" />
            
        	<param name="table_1" value="dingbat.tsv" />
        	<param name="table_2" value="loki.tsv" />
            </conditional>
            <section name="adv">
            <param name="union" value="false" />
            </section>
        	<output name="combined_table" value="no_union.tsv" />
        </test>
        <test>
        	<conditional name="input_type">
        		<param name="source_select" value="two" />
            
        	<param name="table_1" value="dingbat.tsv" />
        	<param name="table_2" value="loki.tsv" />
            </conditional>
            <section name="adv">
            <param name="tuple_mode" value="true" />
            </section>  
        	<output name="combined_table" value="tuple.tsv" />
        </test>
    </tests>
    <help><![CDATA[
        Concatenate a collection of TSV files wile preserving and unionizing headers.
    ]]></help>

    <citations>
            <citation type="bibtex">
@misc{githubsometool,
  author = {Payne, Justin},
  year = {2022},
  title = {tableops},
  publisher = {GitHub},
  journal = {GitHub repository},
  url = {https://github.com/CFSAN-Biostatistics/table-ops},
}</citation>
    </citations>
</tool>