view rearrange_columns/editColumnHeadings.xml @ 0:d2cdffd27293 draft

Uploaded
author immport-devteam
date Mon, 27 Feb 2017 13:05:18 -0500
parents
children
line wrap: on
line source

<tool id="edit_rearrange_columns" name="Remove, rearrange and/or rename columns" version="1.1">
  <description>in txt-converted FCS files.</description>
  <stdio>
    <exit_code range="2" level="fatal" description="Please provide a comma separated list of integers for columns you want to keep." />
    <exit_code range="3" level="fatal" description="Please provide integers for columns you want to keep." />
    <exit_code range="4" level="fatal" description="List of column headings and list of selected columns must match. For instance for columns 1,3,4: Marker1,,Marker3." />
  </stdio>
  <command><![CDATA[
    python $__tool_directory__/editColumnHeadings.py -o "${output_file}" -i "${input}"
 #if $columns
    -c "${columns}"
 #end if
 #if $colnames
    -n "${colnames}"
 #end if
  ]]>
  </command>
  <inputs>
    <param format="flowtext" name="input" type="data" label="Text file"/>
    <param name="columns" type="text" label="Column order:" value="i.e.:1,5,2" optional="true" help="By default, will keep all columns in the same order."/>
    <param name="colnames" type="text" label="New column headings:" value="i.e.:Marker1,,Marker4" optional="true" help="By default, will not change the column headings. Check below for more details.">
    </param>
  </inputs>
  <outputs>
    <data format="flowtext" name="output_file" label="Rearranged ${input.name}"/>
  </outputs>
  <tests>
    <test>
      <param name="input" value="input1.txt"/>
      <param name="columns" value="3,4,5,6"/>
      <param name="colnames" value="CD4,CCR3,CD8,CCR7"/>
      <output name="output_file" file="output1.flowtext"/>
    </test>
    <test>
      <param name="input" value="input2.txt"/>
      <param name="columns" value="2,3,6,1"/>
      <param name="colnames" value="i.e.:Marker1,,Marker4"/>
      <output name="output_file" file="output2.flowtext"/>
    </test>
    <test>
      <param name="input" value="input3.txt"/>
      <param name="columns" value="i.e.:1,5,2"/>
      <param name="colnames" value="M1,M2,M3,M4,M5,M6"/>
      <output name="output_file" file="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 order**

Please indicate columns to keep in the order in which they should be (comma-separated list).
This field is optional.

**Column names**

Please indicate the new columns headings in the order in which they should appear in the ouptut file (comma-separated list). The number of headings should match the number of columns in the output.
This field is optional.

.. class: warningmark

When providing column order AND new column headings the column count for each must match. See below for an example.

**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>