Mercurial > repos > recetox > table_pandas_rename_columns_regex
diff table_pandas_rename_columns_regex.xml @ 0:505a8e975968 draft default tip
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/tables commit d0ff40eb2b536fec6c973c3a9ea8e7f31cd9a0d6
author | recetox |
---|---|
date | Wed, 29 Jan 2025 15:35:08 +0000 (3 months ago) |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/table_pandas_rename_columns_regex.xml Wed Jan 29 15:35:08 2025 +0000 @@ -0,0 +1,82 @@ +<tool id="table_pandas_rename_columns_regex" name="table rename columns via regex" version="@PANDAS_VERSION@+galaxy@VERSION_SUFFIX@" profile="20.01" license="MIT"> + <description>rename columns in a table using regex</description> + <macros> + <import>macros.xml</import> + <token name="@VERSION_SUFFIX@">0</token> + </macros> + + <requirements> + <expand macro="requirement_pandas_pyarrow"/> + </requirements> + + <required_files> + <include path="table_pandas_rename_columns_regex.py" /> + <include path="utils.py" /> + </required_files> + + <expand macro="creator" /> + + <command detect_errors="exit_code"><![CDATA[ + python3 '$__tool_directory__/table_pandas_rename_columns_regex.py' + --input_dataset '$input_dataset' '$input_dataset.ext' + --columns '$columns' + --regex_check '$regex_check' + --regex_replace '$regex_replace' + --output_dataset '$output_dataset' '$output_dataset.ext' + ]]></command> + + <inputs> + <param name="input_dataset" type="data" format="csv,tsv,tabular,parquet" label="Input Dataset" help="The input dataset in CSV, TSV, tabular, or Parquet format."/> + <param name="columns" type="data_column" data_ref="input_dataset" multiple="true" use_header_names="true" min="1" label="Columns to Rename" help="Select one or more columns from the dataset to rename. You can select columns by their header names."/> + <param name="regex_check" type="text" label="Regex to Check For" help="The regular expression pattern to search for in the column names. This pattern will be used to identify parts of the column names to be replaced."> + <expand macro="regex_sanitizer"/> + </param> + <param name="regex_replace" type="text" label="Regex to Replace With" optional="true" help="The regular expression pattern to replace the matched parts of the column names with. This pattern will be used to rename the columns."> + <expand macro="regex_sanitizer"/> + </param> + </inputs> + + <outputs> + <data name="output_dataset" format_source="input_dataset" label="${tool.name} on ${on_string}"> + <change_format> + <when input="input_dataset.ext" value="tsv" format="tabular" /> + </change_format> + </data> + </outputs> + + <tests> + <test expect_num_outputs="1"> + <param name="input_dataset" value="rename/reference_both_renamed.tabular" ftype="tabular"/> + <param name="columns" value="1,2"/> + <param name="regex_check" value="retention_"/> + <param name="regex_replace" value=""/> + <output name="output_dataset" ftype="tabular"> + <assert_contents> + <has_text text="retention" negate="true"/> + </assert_contents> + </output> + </test> + </tests> + + <help><![CDATA[ +This tool renames columns in a table using the specified regex patterns. + +Inputs +------ + +- **Input Dataset**: The input dataset in CSV, TSV, tabular, or Parquet format. +- **Columns to Rename**: Select one or more columns from the dataset to rename. You can select columns by their header names. +- **Regex to Check For**: The regular expression pattern to search for in the column names. This pattern will be used to identify parts of the column names to be replaced. +- **Regex to Replace With**: The regular expression pattern to replace the matched parts of the column names with. This pattern will be used to rename the columns. + +Outputs +------- + +- **Output Dataset**: The output dataset with the renamed columns. + ]]></help> + + <citations> + <citation type="doi">10.5281/zenodo.3509134</citation> + <citation type="doi">10.25080/Majora-92bf1922-00a</citation> + </citations> +</tool> \ No newline at end of file