view biom_convert.xml @ 12:d4d4e9febf5c draft default tip

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/biom_format commit 950bc3657a7bd6975337324bd0f1d0e5c0afc0f4
author iuc
date Fri, 15 Mar 2024 15:26:20 +0000
parents 091bb5922a82
children
line wrap: on
line source

<tool id="biom_convert" name="Convert" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@">
    <description>between BIOM table formats</description>
    <macros>
        <import>macros.xml</import>
    </macros>
    <expand macro="bio_tools"/>
    <expand macro="requirements" />
    <expand macro="version_command" />
    <command detect_errors="exit_code">
        <![CDATA[
            ## biom convert requires the header to start with a #
            ## so we just add one if its missing
            #if $input.type_selector == "tsv"
                sed '1s/^\([^#].*\)/#\1/' '$input.input_fp' > input &&
            #else
                ln -s '$input.input_fp' input &&
            #end if
            biom convert 
                --input-fp input
                --output-fp '$output_fp'
                #if str( $input.type_selector ) == "tsv"
                    #if $input.process_obs_metadata:
                        --process-obs-metadata '$input.process_obs_metadata'
                    #end if
                #end if
                #if str( $output.type_selector ) == "tsv"
                    --to-tsv
                    #if $output.header_key
                        --header-key '$output.header_key'
                        #if $output.output_metadata_id
                            --output-metadata-id '$output.output_metadata_id'
                        #end if
                        --tsv-metadata-formatter '$output.tsv_metadata_formatter'
                    #end if
                #else:
                    --table-type '$output.table_type'
                    #if str( $output.biom_type.selector ) == 'hdf5':
                        --to-hdf5
                        $output.biom_type.collapsed_samples
                        $output.biom_type.collapsed_observations
                    #else:
                        --to-json
                    #end if
                    #if $output.sample_metadata_fp
                        --sample-metadata-fp '$output.sample_metadata_fp'
                    #end if
                    #if $output.observation_metadata_fp
                        --observation-metadata-fp '$output.observation_metadata_fp'
                    #end if
                #end if   
        ]]>
    </command>
    <inputs>
        <conditional name="input">
            <param name="type_selector" type="select" label="Choose the source BIOM format">
                <option value="tsv" selected="True">Tabular File</option>
                <option value="biom">BIOM File</option>
            </param>
            <when value="tsv">
                <param argument="--input-fp" type="data" format="tabular" label="Input table" />
                <param argument="--process-obs-metadata" type="select" label="Process metadata associated with observations when converting">
                    <option value="" selected="True">Do Not process metadata</option>
                    <option value="taxonomy">taxonomy</option>
                    <option value="naive">naive</option>
                    <option value="sc_separated">sc_separated</option>
                </param>
            </when>
            <when value="biom">
                <param argument="--input-fp" type="data" format="biom1" label="Input BIOM table"/>
            </when>
        </conditional>
        <conditional name="output">
            <param name="type_selector" type="select" label="Choose the output type">
                <option value="tsv">TSV-formatted (classic) table</option>
                <option value="biom" selected="True">BIOM</option>
            </param>
            <when value="tsv">
                <param argument="--header-key" type="text" value="" label="observation metadata to include" help="Leave empty to ignore" />
                <param argument="--output-metadata-id" type="text" value="" label="name to be given to the observation metadata column" help="Leave empty to ignore" />
                <param argument="--tsv-metadata-formatter" type="select" label="Method for formatting the observation metadata" >
                    <option value="naive" selected="True">naive</option>
                    <option value="sc_separated">Semi-colon separated</option>
                </param>
            </when>
            <when value="biom">
                <param argument="--table-type" type="select" label="Table Type" >
                    <option value="OTU table">OTU table</option>
                    <option value="Pathway table">Pathway table</option>
                    <option value="Function table">Function table</option>
                    <option value="Ortholog table">Ortholog table</option>
                    <option value="Gene table">Gene table</option>
                    <option value="Metabolite table">Metabolite table</option>
                    <option value="Taxon table">Taxon table</option>
                    <option value="Table" selected="True">Table</option>
                </param>
                <conditional name="biom_type">
                    <param name="selector" type="select" label="BIOM format type">
                        <option value="json" selected="True">JSON-formatted table (BIOM1)</option>
                        <option value="hdf5">HDF5-formatted table (BIOM2)</option>
                    </param>
                    <when value="json">
                    </when>
                    <when value="hdf5">
                        <param argument="--collapsed-observations" type="boolean" truevalue="--collapsed-observations" falsevalue="" checked="False" label="Use collapsed observations"/>
                        <param argument="--collapsed-samples" type="boolean" truevalue="--collapsed-samples" falsevalue="" checked="False" label="Use collapsed samples"/>
                    </when>
                </conditional>
                <param argument="--sample-metadata-fp" type="data" format="tabular" optional="True" label="Add sample metadata from metadata mapping file" />
                <param argument="--observation-metadata-fp" type="data" format="tabular" optional="True" label="Add observation metadata from mapping file" />
            </when>
        </conditional>
    </inputs>
    <outputs>
        <data format="biom1" name="output_fp">
            <change_format>
                <when input="output.type_selector" value="tsv" format="tabular" />
                <when input="output.biom_type.selector" value="json" format="biom1" />
                <when input="output.biom_type.selector" value="hdf5" format="biom2" />
            </change_format>
        </data>
    </outputs>
    <tests>
        <test>
            <conditional name="input">
                <param name="type_selector" value="tsv"/>
                <param name="input_fp" value="input_abundance_taxonomy_1.tabular" ftype="tabular"/>
                <param name="process_obs_metadata" value="taxonomy"/>
            </conditional>
            <conditional name="output">
                <param name="type_selector" value="biom"/>
                <param name="table_type" value="OTU table"/>
                <conditional name="biom_type">
                    <param name="selector" value="json"/>
                </conditional>
            </conditional>
            <output name="output_fp" file="output_taxonomy_1.biom1.re" ftype="biom1" compare="re_match"/>
        </test>
        <test>
            <conditional name="input">
                <param name="type_selector" value="tsv"/>
                <param name="input_fp" value="input_abundance_taxonomy_1.tabular" ftype="tabular"/>
                <param name="process_obs_metadata" value="taxonomy"/>
            </conditional>
            <conditional name="output">
                <param name="type_selector" value="biom"/>
                <param name="table_type" value="OTU table"/>
                <conditional name="biom_type">
                    <param name="selector" value="hdf5"/>
                </conditional>
            </conditional>
            <output name="output_fp" ftype="biom2">
                <assert_contents>
                    <has_size value="37k" delta="10k"/>
                </assert_contents>
            </output>
        </test>
        <test>
            <conditional name="input">
                <param name="type_selector" value="tsv"/>
                <param name="input_fp" value="input_abundance_1.tabular" ftype="tabular"/>
                <param name="process_obs_metadata" value=""/>
            </conditional>
            <conditional name="output">
                <param name="type_selector" value="biom"/>
                <param name="table_type" value="OTU table"/>
                <conditional name="biom_type">
                    <param name="selector" value="json"/>
                </conditional>
                <param name="sample_metadata_fp"/>
                <param name="observation_metadata_fp"/>
            </conditional>
            <output name="output_fp" file="output_1.biom1.re" ftype="biom1" compare="re_match"/>
        </test>
        <test>
            <conditional name="input">
                <param name="type_selector" value="biom"/>
                <param name="input_fp" value="input_abundance_1.biom1" ftype="biom1"/>
            </conditional>
            <conditional name="output">
                <param name="type_selector" value="tsv"/>
                <param name="header_key"/>
                <param name="output_metadata_id"/>
                <param name="tsv_metadata_formatter" value="naive"/>
            </conditional>
            <output name="output_fp" file="output_abundance_1.tabular" ftype="tabular" />
        </test>
    </tests>
    <help><![CDATA[

Usage: biom convert [OPTIONS]::

  Convert to/from the BIOM table format.

  Convert between BIOM table formats. See examples here: http://biom-format.org/documentation/biom_conversion.html

  Example usage:

  Convert a "classic" BIOM file (tab-separated text) to an HDF5 BIOM formatted OTU table:

  $ biom convert -i table.txt -o table.biom --to-hdf5


Options:
  -i, --input-fp PATH             The input BIOM table  [required]
  -o, --output-fp PATH            The output BIOM table  [required]
  -m, --sample-metadata-fp PATH   The sample metadata mapping file (will add sample metadata to the input BIOM table, if provided).
  --observation-metadata-fp PATH  The observation metadata mapping file (will add observation metadata to the input BIOM table, if provided).
  --to-json                       Output as JSON-formatted table.
  --to-hdf5                       Output as HDF5-formatted table.
  --to-tsv                        Output as TSV-formatted (classic) table. table is a BIOM table with collapsed samples, this will update the sample metadata of the table to the supported HDF5 collapsed format.
  --collapsed-observations        If --to_hdf5 is passed and the original table is a BIOM table with collapsed observations, this will update the  supported HDF5 collapsed format.
  --header-key TEXT               The observation metadata to include from the input BIOM table file when creating a tsv table file. By default no observation metadata will be included.
  --output-metadata-id TEXT       The name to be given to the observation metadata column when creating a tsv table file if the column should be renamed.
  --table-type                    OTU table,Pathway table,Function table,Ortholog table,Gene table,Metabolite table,Taxon table,Table The type of the table.
  --process-obs-metadata          taxonomy,naive,sc_separated Process metadata associated with observations when converting from a classic table.
  --tsv-metadata-formatter        naive,sc_separated Method for formatting the observation 
  --help                          Show this message and exit.

    ]]></help>
    <expand macro="citations" />
</tool>