view editColumnHeadings.xml @ 1:ce206587d42f draft default tip

"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/rearrange_columns commit 3289c1f97444f45f946ff92d47c490c9d58f3d94"
author azomics
date Thu, 16 Jul 2020 07:22:06 -0400
parents
children
line wrap: on
line source

<tool id="edit_rearrange_columns" name="Remove, rearrange and/or rename columns" version="2.0+galaxy0" profile="18.01">
  <description>in txt-converted FCS files</description>
  <requirements>
    <requirement type="package" version="1.0.5">pandas</requirement>
  </requirements>
  <stdio>
    <exit_code range="1" level="fatal" description="Please pick something for the tool to do =)" />
    <exit_code range="2" level="fatal" description="Please provide column headers to replace." />
    <exit_code range="3" level="fatal" description="Please provide column headers to use as replacement." />
    <exit_code range="4" level="fatal" description="Column headers provided were not found in the input file." />
    <exit_code range="5" level="fatal" description="More headers provided than columns in the input file." />
    <exit_code range="6" level="fatal" description="New column headings and column headings must be provided together." />
    <exit_code range="7" level="fatal" description="Please provide a new column order or subset." />
    <exit_code range="8" level="fatal" description="Columns provided for subsetting/re-ordering are not in the input file" />
    <exit_code range="9:" level="fatal"/>
  </stdio>
  <command><![CDATA[
	  python3 '$__tool_directory__/editColumnHeadings.py' -o '${output_file}' -i '${input}'
  #if $rename.nn:
    #for $add in $rename.more_replacements:
      -r '${add.to_rep}' -w '${add.replace_with}'
    #end for
  #end if
  #if $reorder.order_col:
    -n '${reorder.order}'
  #end if
  ]]>
  </command>
  <inputs>
    <param format="flowtext" name="input" type="data" label="Text file"/>

    <conditional name="rename">
      <param name="nn" type="boolean" label="Edit column headings?" help="By default, column headings are not changed." checked="false" truevalue="TRUE" falsevalue="FALSE">
      </param>
      <when value="TRUE">
        <repeat name="more_replacements" title="Column to edit">
          <param name="to_rep" type="text" label="Column headings to replace:" value="i.e.:TLR 6, TLR6PE" help="Please indicate which column heading to replace. If there are more than one heading to replace with the SAME replacement, enter a comma-separated list. See below for examples."/>
          <param name="replace_with" type="text" label="Replace with:" value="i.e.:TLR6" help="Please indicate what to use for replacement." />
        </repeat>
      </when>
    </conditional>

    <conditional name="reorder">
      <param name="order_col" type="boolean" label="Re-order or select column?" help="By default, column order is not changed." checked="false" truevalue="TRUE" falsevalue="FALSE">
      </param>
      <when value="TRUE">
        <param name="order" type="text" label="New order:" value="i.e.:1,2,5 or CD3,CD4,CCR3" help="Please indicate columns to keep in the order they should be in. This operation happens after renaming. If subsetting/re-ordering and renaming columns, indicate new column heading names or numerical order."/>
      </when>
    </conditional>
  </inputs>
  <outputs>
    <data format="flowtext" name="output_file" label="Rearranged ${input.name} on ${on_string}"/>
  </outputs>
  <tests>
    <test>
      <param name="input" value="input1.txt"/>
      <conditional name="reorder">
        <param name="order_col" value="True"/>
        <param name="order" value="CD4,CCR3,CD8,CCR7"/>
      </conditional>
      <conditional name="rename">
        <param name="nn" value="True"/>
        <repeat name="more_replacements">
          <param name="to_rep" value="FITC CD4"/>
          <param name="replace_with" value="CD4"/>
        </repeat>
        <repeat name="more_replacements">
          <param name="to_rep" value="PE CCR3"/>
          <param name="replace_with" value="CCR3"/>
        </repeat>
        <repeat name="more_replacements">
          <param name="to_rep" value="PP CD8"/>
          <param name="replace_with" value="CD8"/>
        </repeat>
        <repeat name="more_replacements">
          <param name="to_rep" value="APC CCR4"/>
          <param name="replace_with" value="CCR7"/>
        </repeat>
      </conditional>
      <output name="output_file" value="output1.flowtext"/>
    </test>
    <test>
      <param name="input" value="input2.txt"/>
      <conditional name="reorder">
        <param name="order_col" value="True"/>
        <param name="order" value="Side Scatter,FITC CD4,APC CCR5,Forward Scatter"/>
      </conditional>
      <output name="output_file" value="output2.flowtext"/>
    </test>
    <test>
      <param name="input" value="input3.txt"/>
      <conditional name="rename">
        <param name="nn" value="True"/>
        <repeat name="more_replacements">
          <param name="to_rep" value="Forward Scatter"/>
          <param name="replace_with" value="M1"/>
        </repeat>
        <repeat name="more_replacements">
          <param name="to_rep" value="Side Scatter"/>
          <param name="replace_with" value="M2"/>
        </repeat>
        <repeat name="more_replacements">
          <param name="to_rep" value="FITC CD4"/>
          <param name="replace_with" value="M3"/>
        </repeat>
        <repeat name="more_replacements">
          <param name="to_rep" value="PE CD25"/>
          <param name="replace_with" value="M4"/>
        </repeat>
        <repeat name="more_replacements">
          <param name="to_rep" value="PP CD3"/>
          <param name="replace_with" value="M5"/>
        </repeat>
        <repeat name="more_replacements">
          <param name="to_rep" value="APC CD45RA"/>
          <param name="replace_with" value="M6"/>
        </repeat>
      </conditional>
      <output name="output_file" value="output3.flowtext"/>
    </test>
  </tests>
  <help><![CDATA[
   This tool enables the removal, rearrangement and/or renaming of text file columns.
-----
**Input files**
This tool requires txt, flowtext or tabular files as input.
**Column headings**
This field is optional. Please indicate the column headers that need to be replaced. If one marker exists under several names in different files, run the tool in batch mode and include all names to harmonize as a comma-separated list.
.. class:: warningmark
Column headings provided have to match file content.
.. class:: infomark
Tip: One of the tools in the Text File Tools section can help check headers in the files to edit:
- Check headers of any set of flowtext files.
**Replace with**
Please indicate what to replace the headers indicated in the previous field with. If the previous field contains a comma-separated list, each of these items will be replaced.
..class:: infomark
Tip: Add more headings to modify by clicking on 'Insert Column to edit'
**New order**
This field is optional. Please indicate which subset of columns (or all) in which order should be output.
**Output file**
The output flowtext file is a copy of the input file with rearranged and/or renamed columns.
-----
**Examples**
**Input file**::
   Marker1 Marker2 Marker3 Marker4 Marker5
   4       45      123     1956    62534
   3       65      104     1254    36576
   7       26      767     4124    42235
   4       56      323     7623    74634
   5       83      532     6256    34763
   4       15      877     9312    21265
   ...     ...     ...     ...     ...
*Example 1*
- Column order: 5,3,2,4
- Column names: Default
*Output1*::
   Marker5 Marker3 Marker2 Marker4
   62534   123     45      1956
   36576   104     65      1254
   42235   767     26      4124
   74634   323     56      7623
   34763   532     83      6256
   21265   877     15      9312
   ...     ...     ...     ...
*Example 2*
- Column order: 5,3,2,4
- Column names: Mar34,,Mar7,
*Output2*::
   Mar34 Marker3 Mar7 Marker4
   62534 123     45   1956
   36576 104     65   1254
   42235 767     26   4124
   74634 323     56   7623
   34763 532     83   6256
   21265 877     15   9312
   ...   ...     ...  ...
*Example 3*
- Column order: Default
- Column names: Mar23,,,Mar7,Mar8
*Output3*::
   Mar23 Marker2 Marker3 Mar7 Mar8
   4     45      123     1956 62534
   3     65      104     1254 36576
   7     26      767     4124 42235
   4     56      323     7623 74634
   5     83      532     6256 34763
   4     15      877     9312 21265
   ...   ...     ...     ...  ...
  ]]>
  </help>
</tool>