Mercurial > repos > iuc > biom_convert
changeset 0:501c21cce614 draft
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/biom_format commit 01bf97e10e5491ec878cca24495d8125449dfc1e
author | iuc |
---|---|
date | Tue, 07 Jun 2016 17:26:00 -0400 |
parents | |
children | 0de92f0b96ef |
files | biom_convert.xml macros.xml test-data/input_abundance_1.biom1 test-data/input_abundance_1.tabular test-data/input_abundance_taxonomy_1.tabular test-data/input_taxonomy_1.tabular test-data/output_1.biom1.re test-data/output_taxonomy_1.biom1.re |
diffstat | 8 files changed, 269 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/biom_convert.xml Tue Jun 07 17:26:00 2016 -0400 @@ -0,0 +1,182 @@ +<tool id="biom_convert" name="Convert BIOM" version="@VERSION@.0"> + <description>formats</description> + <macros> + <import>macros.xml</import> + </macros> + <expand macro="requirements" /> + <expand macro="stdio" /> + <expand macro="version_command" /> + <command> + <![CDATA[ + biom convert -i "${input_type.input_table}" -o "${output_table}" + #if str( $input_type.input_type_selector ) == "tsv": + #if $input_type.process_obs_metadata: + --process-obs-metadata "${input_type.process_obs_metadata}" + #end if + #end if + + #if str( $output_type.output_type_selector ) == "tsv": + --to-tsv + #if $output_type.header_key: + --header-key "${output_type.header_key}" + #if $output_type.output_metadata_id: + --output-metadata-id "${output_type.output_metadata_id}" + #end if + --tsv-metadata-formatter "${output_type.tsv_metadata_formatter}" + #end if + #else: + --table-type "${output_type.table_type}" + #if str( $output_type.biom_type.biom_type_selector ) == 'hdf5': + --to-hdf5 + ${output_type.biom_type.collapsed_samples} + ${output_type.biom_type.collapsed_observations} + #else: + --to-json + #end if + #if $output_type.sample_metadata_fp: + --sample-metadata-fp "${output_type.sample_metadata_fp}" + #end if + #if $output_type.observation_metadata_fp: + --observation-metadata-fp "${output_type.observation_metadata_fp}" + #end if + #end if + ]]> + </command> + <inputs> + <conditional name="input_type"> + <param name="input_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 name="input_table" type="data" format="tabular" label="Tabular File" argument="--input-fp"/> + <param name="process_obs_metadata" type="select" label="Process metadata associated with observations when converting" argument="--process-obs-metadata"> + <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 name="input_table" type="data" format="biom1" label="Tabular File" argument="--input-fp"/> + </when> + </conditional> + <conditional name="output_type"> + <param name="output_type_selector" type="select" label="Choose the output type" argument="--to-tsv"> + <option value="tsv">TSV-formatted (classic) table</option> + <option value="biom" selected="True">BIOM</option> + </param> + <when value="tsv"> + <param name="header_key" type="text" value="" label="observation metadata to include" help="Leave empty to ignore" argument="--header-key"/> + <param name="output_metadata_id" type="text" value="" label="name to be given to the observation metadata column" help="Leave empty to ignore" argument="--output-metadata-id"/> + <param name="tsv_metadata_formatter" type="select" label="Method for formatting the observation metadata" argumet="--tsv-metadata-formatter"> + <option value="naive" selected="True">naive</option> + <option value="sc_separated">Semi-colon separated</option> + </param> + </when> + <when value="biom"> + <param name="table_type" type="select" label="Table Type" argument="--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="biom_type_selector" type="select" label="BIOM format type" argument="--to-json / --to-hdf5"> + <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 name="collapsed_samples" type="boolean" truevalue="" falsevalue="--collapsed-samples" checked="False" label="Use collapsed samples" argument="--collapsed-observations"/> + <param name="collapsed_observations" type="boolean" truevalue="" falsevalue="--collapsed-samples" checked="False" label="Use collapsed observations"/> + </when> + </conditional> + <param name="sample_metadata_fp" type="data" format="tabular" optional="True" label="Add sample metadata from metadata mapping file" argument="--sample-metadata-fp"/> + <param name="observation_metadata_fp" type="data" format="tabular" optional="True" label="Add observation metadata from mapping file" argument="--observation-metadata-fp"/> + </when> + </conditional> + </inputs> + <outputs> + <data format="biom1" name="output_table"> + <change_format> + <when input="output_type.output_type_selector" value="tsv" format="tabular" /> + <when input="output_type.biom_type" value="hdf5" format="biom2" /> + </change_format> + </data> + </outputs> + <tests> + <test> + <conditional name="input_type"> + <param name="input_type_selector" value="tsv"/> + <param name="input_table" value="input_abundance_taxonomy_1.tabular" ftype="tabular"/> + <param name="process_obs_metadata" value="taxonomy"/> + </conditional> + <conditional name="output_type"> + <param name="output_type_selector" value="biom"/> + <param name="table_type" value="OTU table"/> + <conditional name="biom_type"> + <param name="biom_type_selector" value="json"/> + </conditional> + <param name="sample_metadata_fp"/> + <param name="observation_metadata_fp"/> + </conditional> + <output name="output_table" file="output_taxonomy_1.biom1.re" ftype="biom1" compare="re_match"/> + </test> + <test> + <conditional name="input_type"> + <param name="input_type_selector" value="tsv"/> + <param name="input_table" value="input_abundance_1.tabular" ftype="tabular"/> + <param name="process_obs_metadata" value=""/> + </conditional> + <conditional name="output_type"> + <param name="output_type_selector" value="biom"/> + <param name="table_type" value="OTU table"/> + <conditional name="biom_type"> + <param name="biom_type_selector" value="json"/> + </conditional> + <param name="sample_metadata_fp"/> + <param name="observation_metadata_fp"/> + </conditional> + <output name="output_table" file="output_1.biom1.re" ftype="biom1" compare="re_match"/> + </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>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/macros.xml Tue Jun 07 17:26:00 2016 -0400 @@ -0,0 +1,24 @@ +<macros> + <xml name="requirements"> + <requirements> + <requirement type="package" version="2.1.5">biom-format</requirement> + <yield/> + </requirements> + </xml> + <token name="@VERSION@">2.1.5</token> + <xml name="stdio"> + <stdio> + <exit_code range="1:" /> + <exit_code range=":-1" /> + </stdio> + </xml> + <xml name="version_command"> + <version_command>biom --version</version_command> + </xml> + <xml name="citations"> + <citations> + <citation type="doi">10.1186/2047-217X-1-7</citation> + <yield/> + </citations> + </xml> +</macros>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/input_abundance_1.biom1 Tue Jun 07 17:26:00 2016 -0400 @@ -0,0 +1,1 @@ +{"id": "None","format": "Biological Observation Matrix 1.0.0","format_url": "http://biom-format.org","matrix_type": "sparse","generated_by": "BIOM-Format 2.1.5","date": "2016-05-26T17:20:40.263567","type": "OTU table","matrix_element_type": "float","shape": [19, 2],"data": [[1,0,160.0],[1,1,242.0],[6,0,1.0],[6,1,1.0],[7,0,3.0],[7,1,4.0],[12,0,13.0],[12,1,36.0],[14,0,1.0],[14,1,5.0],[15,0,1.0],[16,0,1.0],[16,1,3.0]],"rows": [{"id": "2", "metadata": null},{"id": "3", "metadata": null},{"id": "4", "metadata": null},{"id": "5", "metadata": null},{"id": "8", "metadata": null},{"id": "9", "metadata": null},{"id": "10", "metadata": null},{"id": "11", "metadata": null},{"id": "12", "metadata": null},{"id": "14", "metadata": null},{"id": "15", "metadata": null},{"id": "16", "metadata": null},{"id": "17", "metadata": null},{"id": "18", "metadata": null},{"id": "22", "metadata": null},{"id": "23", "metadata": null},{"id": "25", "metadata": null},{"id": "28", "metadata": null},{"id": "29", "metadata": null}],"columns": [{"id": "SAMPLE_1", "metadata": null},{"id": "SAMPLE_2", "metadata": null}]} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/input_abundance_1.tabular Tue Jun 07 17:26:00 2016 -0400 @@ -0,0 +1,20 @@ +#ID SAMPLE_1 SAMPLE_2 +2 0 0 +3 160 242 +4 0 0 +5 0 0 +8 0 0 +9 0 0 +10 1 1 +11 3 4 +12 0 0 +14 0 0 +15 0 0 +16 0 0 +17 13 36 +18 0 0 +22 1 5 +23 1 0 +25 1 3 +28 0 0 +29 0 0
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/input_abundance_taxonomy_1.tabular Tue Jun 07 17:26:00 2016 -0400 @@ -0,0 +1,20 @@ +#ID SAMPLE_1 SAMPLE_2 taxonomy +2 0 0 d__Archaea +3 160 242 d__Bacteria +4 0 0 d__Archaea;p__Crenarchaeota +5 0 0 d__Archaea;p__Euryarchaeota +8 0 0 d__Bacteria;p__AC1 +9 0 0 d__Bacteria;p__AD3 +10 1 1 d__Bacteria;p__Acidobacteria +11 3 4 d__Bacteria;p__Actinobacteria +12 0 0 d__Bacteria;p__AncK6 +14 0 0 d__Bacteria;p__Armatimonadetes +15 0 0 d__Bacteria;p__BHI80-139 +16 0 0 d__Bacteria;p__BRC1 +17 13 36 d__Bacteria;p__Bacteroidetes +18 0 0 d__Bacteria;p__CD12 +22 1 5 d__Bacteria;p__Chlorobi +23 1 0 d__Bacteria;p__Chloroflexi +25 1 3 d__Bacteria;p__Cyanobacteria +28 0 0 d__Bacteria;p__EM19 +29 0 0 d__Bacteria;p__EM3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/input_taxonomy_1.tabular Tue Jun 07 17:26:00 2016 -0400 @@ -0,0 +1,20 @@ +#ID taxonomy +2 d__Archaea +3 d__Bacteria +4 d__Archaea;p__Crenarchaeota +5 d__Archaea;p__Euryarchaeota +8 d__Bacteria;p__AC1 +9 d__Bacteria;p__AD3 +10 d__Bacteria;p__Acidobacteria +11 d__Bacteria;p__Actinobacteria +12 d__Bacteria;p__AncK6 +14 d__Bacteria;p__Armatimonadetes +15 d__Bacteria;p__BHI80-139 +16 d__Bacteria;p__BRC1 +17 d__Bacteria;p__Bacteroidetes +18 d__Bacteria;p__CD12 +22 d__Bacteria;p__Chlorobi +23 d__Bacteria;p__Chloroflexi +25 d__Bacteria;p__Cyanobacteria +28 d__Bacteria;p__EM19 +29 d__Bacteria;p__EM3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/output_1.biom1.re Tue Jun 07 17:26:00 2016 -0400 @@ -0,0 +1,1 @@ +\{\"id\"\:\ \"None\"\,\"format\"\:\ \"Biological\ Observation\ Matrix\ 1\.0\.0\"\,\"format\_url\"\:\ \"http\:\/\/biom\-format\.org\"\,\"matrix\_type\"\:\ \"sparse\"\,\"generated\_by\"\:\ \"BIOM\-Format\ 2\.1\.5\"\,\"date\"\:\ \".*\"\,\"type\"\:\ \"OTU\ table\"\,\"matrix\_element\_type\"\:\ \"float\"\,\"shape\"\:\ \[19\,\ 2\]\,\"data\"\:\ \[\[1\,0\,160\.0\]\,\[1\,1\,242\.0\]\,\[6\,0\,1\.0\]\,\[6\,1\,1\.0\]\,\[7\,0\,3\.0\]\,\[7\,1\,4\.0\]\,\[12\,0\,13\.0\]\,\[12\,1\,36\.0\]\,\[14\,0\,1\.0\]\,\[14\,1\,5\.0\]\,\[15\,0\,1\.0\]\,\[16\,0\,1\.0\]\,\[16\,1\,3\.0\]\]\,\"rows\"\:\ \[\{\"id\"\:\ \"2\"\,\ \"metadata\"\:\ null\}\,\{\"id\"\:\ \"3\"\,\ \"metadata\"\:\ null\}\,\{\"id\"\:\ \"4\"\,\ \"metadata\"\:\ null\}\,\{\"id\"\:\ \"5\"\,\ \"metadata\"\:\ null\}\,\{\"id\"\:\ \"8\"\,\ \"metadata\"\:\ null\}\,\{\"id\"\:\ \"9\"\,\ \"metadata\"\:\ null\}\,\{\"id\"\:\ \"10\"\,\ \"metadata\"\:\ null\}\,\{\"id\"\:\ \"11\"\,\ \"metadata\"\:\ null\}\,\{\"id\"\:\ \"12\"\,\ \"metadata\"\:\ null\}\,\{\"id\"\:\ \"14\"\,\ \"metadata\"\:\ null\}\,\{\"id\"\:\ \"15\"\,\ \"metadata\"\:\ null\}\,\{\"id\"\:\ \"16\"\,\ \"metadata\"\:\ null\}\,\{\"id\"\:\ \"17\"\,\ \"metadata\"\:\ null\}\,\{\"id\"\:\ \"18\"\,\ \"metadata\"\:\ null\}\,\{\"id\"\:\ \"22\"\,\ \"metadata\"\:\ null\}\,\{\"id\"\:\ \"23\"\,\ \"metadata\"\:\ null\}\,\{\"id\"\:\ \"25\"\,\ \"metadata\"\:\ null\}\,\{\"id\"\:\ \"28\"\,\ \"metadata\"\:\ null\}\,\{\"id\"\:\ \"29\"\,\ \"metadata\"\:\ null\}\]\,\"columns\"\:\ \[\{\"id\"\:\ \"SAMPLE\_1\"\,\ \"metadata\"\:\ null\}\,\{\"id\"\:\ \"SAMPLE\_2\"\,\ \"metadata\"\:\ null\}\]\}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/output_taxonomy_1.biom1.re Tue Jun 07 17:26:00 2016 -0400 @@ -0,0 +1,1 @@ +\{\"id\"\:\ \"None\"\,\"format\"\:\ \"Biological\ Observation\ Matrix\ 1\.0\.0\"\,\"format\_url\"\:\ \"http\:\/\/biom\-format\.org\"\,\"matrix\_type\"\:\ \"sparse\"\,\"generated\_by\"\:\ \"BIOM\-Format\ 2\.1\.5\"\,\"date\"\:\ \".*\"\,\"type\"\:\ \"OTU\ table\"\,\"matrix\_element\_type\"\:\ \"float\"\,\"shape\"\:\ \[19\,\ 2\]\,\"data\"\:\ \[\[1\,0\,160\.0\]\,\[1\,1\,242\.0\]\,\[6\,0\,1\.0\]\,\[6\,1\,1\.0\]\,\[7\,0\,3\.0\]\,\[7\,1\,4\.0\]\,\[12\,0\,13\.0\]\,\[12\,1\,36\.0\]\,\[14\,0\,1\.0\]\,\[14\,1\,5\.0\]\,\[15\,0\,1\.0\]\,\[16\,0\,1\.0\]\,\[16\,1\,3\.0\]\]\,\"rows\"\:\ \[\{\"id\"\:\ \"2\"\,\ \"metadata\"\:\ \{\"taxonomy\"\:\ \[\"d\_\_Archaea\"\]\}\}\,\{\"id\"\:\ \"3\"\,\ \"metadata\"\:\ \{\"taxonomy\"\:\ \[\"d\_\_Bacteria\"\]\}\}\,\{\"id\"\:\ \"4\"\,\ \"metadata\"\:\ \{\"taxonomy\"\:\ \[\"d\_\_Archaea\"\,\ \"p\_\_Crenarchaeota\"\]\}\}\,\{\"id\"\:\ \"5\"\,\ \"metadata\"\:\ \{\"taxonomy\"\:\ \[\"d\_\_Archaea\"\,\ \"p\_\_Euryarchaeota\"\]\}\}\,\{\"id\"\:\ \"8\"\,\ \"metadata\"\:\ \{\"taxonomy\"\:\ \[\"d\_\_Bacteria\"\,\ \"p\_\_AC1\"\]\}\}\,\{\"id\"\:\ \"9\"\,\ \"metadata\"\:\ \{\"taxonomy\"\:\ \[\"d\_\_Bacteria\"\,\ \"p\_\_AD3\"\]\}\}\,\{\"id\"\:\ \"10\"\,\ \"metadata\"\:\ \{\"taxonomy\"\:\ \[\"d\_\_Bacteria\"\,\ \"p\_\_Acidobacteria\"\]\}\}\,\{\"id\"\:\ \"11\"\,\ \"metadata\"\:\ \{\"taxonomy\"\:\ \[\"d\_\_Bacteria\"\,\ \"p\_\_Actinobacteria\"\]\}\}\,\{\"id\"\:\ \"12\"\,\ \"metadata\"\:\ \{\"taxonomy\"\:\ \[\"d\_\_Bacteria\"\,\ \"p\_\_AncK6\"\]\}\}\,\{\"id\"\:\ \"14\"\,\ \"metadata\"\:\ \{\"taxonomy\"\:\ \[\"d\_\_Bacteria\"\,\ \"p\_\_Armatimonadetes\"\]\}\}\,\{\"id\"\:\ \"15\"\,\ \"metadata\"\:\ \{\"taxonomy\"\:\ \[\"d\_\_Bacteria\"\,\ \"p\_\_BHI80\-139\"\]\}\}\,\{\"id\"\:\ \"16\"\,\ \"metadata\"\:\ \{\"taxonomy\"\:\ \[\"d\_\_Bacteria\"\,\ \"p\_\_BRC1\"\]\}\}\,\{\"id\"\:\ \"17\"\,\ \"metadata\"\:\ \{\"taxonomy\"\:\ \[\"d\_\_Bacteria\"\,\ \"p\_\_Bacteroidetes\"\]\}\}\,\{\"id\"\:\ \"18\"\,\ \"metadata\"\:\ \{\"taxonomy\"\:\ \[\"d\_\_Bacteria\"\,\ \"p\_\_CD12\"\]\}\}\,\{\"id\"\:\ \"22\"\,\ \"metadata\"\:\ \{\"taxonomy\"\:\ \[\"d\_\_Bacteria\"\,\ \"p\_\_Chlorobi\"\]\}\}\,\{\"id\"\:\ \"23\"\,\ \"metadata\"\:\ \{\"taxonomy\"\:\ \[\"d\_\_Bacteria\"\,\ \"p\_\_Chloroflexi\"\]\}\}\,\{\"id\"\:\ \"25\"\,\ \"metadata\"\:\ \{\"taxonomy\"\:\ \[\"d\_\_Bacteria\"\,\ \"p\_\_Cyanobacteria\"\]\}\}\,\{\"id\"\:\ \"28\"\,\ \"metadata\"\:\ \{\"taxonomy\"\:\ \[\"d\_\_Bacteria\"\,\ \"p\_\_EM19\"\]\}\}\,\{\"id\"\:\ \"29\"\,\ \"metadata\"\:\ \{\"taxonomy\"\:\ \[\"d\_\_Bacteria\"\,\ \"p\_\_EM3\"\]\}\}\]\,\"columns\"\:\ \[\{\"id\"\:\ \"SAMPLE\_1\"\,\ \"metadata\"\:\ null\}\,\{\"id\"\:\ \"SAMPLE\_2\"\,\ \"metadata\"\:\ null\}\]\}