0
|
1 <tool id="tp_split_on_column" name="Split file" force_history_refresh="True" version="0.1.1">
|
|
2 <description>according to the values of a column</description>
|
|
3 <requirements>
|
|
4 <requirement type="package" version="4.1.0">gnu_awk</requirement>
|
|
5 </requirements>
|
|
6 <command>
|
1
|
7 awk -F'\t' '{print > "primary_${outfile.id}_" \$$column "_visible_${infile.ext}" }' $infile;
|
0
|
8 echo 'Created' `ls -l | wc -l` 'files:' > $outfile;
|
|
9 ls -1 --hide="*_stdout" --hide="*_stderr" >> $outfile;
|
|
10 </command>
|
|
11
|
|
12 <inputs>
|
|
13 <param format="txt" name="infile" type="data" label="File to select" />
|
|
14 <param name="column" label="on column" type="data_column" data_ref="infile" accept_default="true" />
|
|
15 </inputs>
|
|
16
|
|
17 <outputs>
|
|
18 <data format="input" name="outfile" metadata_source="infile" label="${tool.name} on ${on_string}"/>
|
|
19 </outputs>
|
|
20 <tests>
|
|
21 <test>
|
|
22 </test>
|
|
23 </tests>
|
|
24 <help>
|
|
25
|
|
26 **What it does**
|
|
27
|
|
28 This tool splits a file into different smaller files using a specific column.
|
|
29 It will work like the group tool, but every group is saved to its own file.
|
|
30
|
|
31 -----
|
|
32
|
|
33 **Example**
|
|
34
|
|
35 Splitting on column 4 from this::
|
|
36
|
|
37 chr7 56632 56652 cluster 1
|
|
38 chr7 56736 56756 cluster 1
|
|
39 chr7 56761 56781 cluster 2
|
|
40 chr7 56772 56792 cluster 2
|
|
41 chr7 56775 56795 cluster 2
|
|
42
|
|
43 will produce 2 files with different clusters::
|
|
44
|
|
45 chr7 56632 56652 cluster 1
|
|
46 chr7 56736 56756 cluster 1
|
|
47
|
|
48
|
|
49 chr7 56761 56781 cluster 2
|
|
50 chr7 56772 56792 cluster 2
|
|
51 chr7 56775 56795 cluster 2
|
|
52
|
|
53
|
|
54 </help>
|
|
55 </tool>
|