annotate datamash-transpose.xml @ 5:374cb875d38a draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 9edd054251bc74685d627360bb0fbe8ea60fa6a2
author iuc
date Thu, 23 Mar 2023 20:47:02 +0000
parents ba0c40780ecf
children a513e3fbb4c5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3
ba0c40780ecf "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 206ac70388ea11b168366f1e30bb44157e371c6e"
iuc
parents: 2
diff changeset
1 <tool id="datamash_transpose" name="Transpose" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@">
0
60e287a6d17d planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 8a7a779896ce1b9b296557a2c31bd93f5fbb5462
iuc
parents:
diff changeset
2 <description>rows/columns in a tabular file</description>
60e287a6d17d planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 8a7a779896ce1b9b296557a2c31bd93f5fbb5462
iuc
parents:
diff changeset
3 <macros>
60e287a6d17d planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 8a7a779896ce1b9b296557a2c31bd93f5fbb5462
iuc
parents:
diff changeset
4 <import>macros.xml</import>
60e287a6d17d planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 8a7a779896ce1b9b296557a2c31bd93f5fbb5462
iuc
parents:
diff changeset
5 </macros>
5
374cb875d38a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 9edd054251bc74685d627360bb0fbe8ea60fa6a2
iuc
parents: 3
diff changeset
6 <edam_topics>
374cb875d38a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 9edd054251bc74685d627360bb0fbe8ea60fa6a2
iuc
parents: 3
diff changeset
7 <edam_topic>topic_3570</edam_topic> <!-- Pure math / linear algebra -->
374cb875d38a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 9edd054251bc74685d627360bb0fbe8ea60fa6a2
iuc
parents: 3
diff changeset
8 </edam_topics>
374cb875d38a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 9edd054251bc74685d627360bb0fbe8ea60fa6a2
iuc
parents: 3
diff changeset
9 <edam_operations>
374cb875d38a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 9edd054251bc74685d627360bb0fbe8ea60fa6a2
iuc
parents: 3
diff changeset
10 <!-- <edam_operation>operation_1234</edam_operation> -->
374cb875d38a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 9edd054251bc74685d627360bb0fbe8ea60fa6a2
iuc
parents: 3
diff changeset
11 </edam_operations>
374cb875d38a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 9edd054251bc74685d627360bb0fbe8ea60fa6a2
iuc
parents: 3
diff changeset
12 <expand macro="requirements"/>
374cb875d38a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 9edd054251bc74685d627360bb0fbe8ea60fa6a2
iuc
parents: 3
diff changeset
13 <expand macro="stdio"/>
3
ba0c40780ecf "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 206ac70388ea11b168366f1e30bb44157e371c6e"
iuc
parents: 2
diff changeset
14 <command><![CDATA[
5
374cb875d38a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 9edd054251bc74685d627360bb0fbe8ea60fa6a2
iuc
parents: 3
diff changeset
15 #import os
374cb875d38a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 9edd054251bc74685d627360bb0fbe8ea60fa6a2
iuc
parents: 3
diff changeset
16 #set file_size_MB = os.path.getsize(str($in_file)) / (1024 * 1024)
374cb875d38a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 9edd054251bc74685d627360bb0fbe8ea60fa6a2
iuc
parents: 3
diff changeset
17 #set size_threshold_MB = 1024
374cb875d38a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 9edd054251bc74685d627360bb0fbe8ea60fa6a2
iuc
parents: 3
diff changeset
18 #if $file_size_MB <= $size_threshold_MB:
374cb875d38a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 9edd054251bc74685d627360bb0fbe8ea60fa6a2
iuc
parents: 3
diff changeset
19 datamash transpose @FIELD_SEPARATOR@ < $in_file > $out_file
374cb875d38a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 9edd054251bc74685d627360bb0fbe8ea60fa6a2
iuc
parents: 3
diff changeset
20 #else:
374cb875d38a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 9edd054251bc74685d627360bb0fbe8ea60fa6a2
iuc
parents: 3
diff changeset
21 ## Input matrix is very big: divide and conquer
374cb875d38a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 9edd054251bc74685d627360bb0fbe8ea60fa6a2
iuc
parents: 3
diff changeset
22 ## If the input file is very big, datamash runs out of memory (much earlier than file size ~ available RAM.
374cb875d38a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 9edd054251bc74685d627360bb0fbe8ea60fa6a2
iuc
parents: 3
diff changeset
23 ## Split into managable chunks of row vectors, transpose the chunks and juxtapose column vector chunks.
374cb875d38a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 9edd054251bc74685d627360bb0fbe8ea60fa6a2
iuc
parents: 3
diff changeset
24 #set num_chunks = 1 + int(file_size_MB/size_threshold_MB)
374cb875d38a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 9edd054251bc74685d627360bb0fbe8ea60fa6a2
iuc
parents: 3
diff changeset
25 echo Huge matrix detected, processing in $num_chunks chunks. &&
374cb875d38a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 9edd054251bc74685d627360bb0fbe8ea60fa6a2
iuc
parents: 3
diff changeset
26 split -n l/$num_chunks $in_file split_input_ &&
374cb875d38a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 9edd054251bc74685d627360bb0fbe8ea60fa6a2
iuc
parents: 3
diff changeset
27 for chunk in \$(ls split_input*); do
374cb875d38a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 9edd054251bc74685d627360bb0fbe8ea60fa6a2
iuc
parents: 3
diff changeset
28 datamash transpose @FIELD_SEPARATOR@ < \$chunk > \${chunk}_transposed;
374cb875d38a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 9edd054251bc74685d627360bb0fbe8ea60fa6a2
iuc
parents: 3
diff changeset
29 done &&
374cb875d38a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 9edd054251bc74685d627360bb0fbe8ea60fa6a2
iuc
parents: 3
diff changeset
30 paste split_input_*_transposed > $out_file
374cb875d38a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 9edd054251bc74685d627360bb0fbe8ea60fa6a2
iuc
parents: 3
diff changeset
31 #end if
3
ba0c40780ecf "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 206ac70388ea11b168366f1e30bb44157e371c6e"
iuc
parents: 2
diff changeset
32 ]]></command>
5
374cb875d38a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 9edd054251bc74685d627360bb0fbe8ea60fa6a2
iuc
parents: 3
diff changeset
33 <expand macro="inputs_outputs"/>
0
60e287a6d17d planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 8a7a779896ce1b9b296557a2c31bd93f5fbb5462
iuc
parents:
diff changeset
34 <tests>
5
374cb875d38a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 9edd054251bc74685d627360bb0fbe8ea60fa6a2
iuc
parents: 3
diff changeset
35 <test expect_num_outputs="1">
374cb875d38a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 9edd054251bc74685d627360bb0fbe8ea60fa6a2
iuc
parents: 3
diff changeset
36 <param name="in_file" value="datamash_transpose_input.txt"/>
374cb875d38a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 9edd054251bc74685d627360bb0fbe8ea60fa6a2
iuc
parents: 3
diff changeset
37 <output file="datamash_transpose_output.txt" name="out_file"/>
374cb875d38a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 9edd054251bc74685d627360bb0fbe8ea60fa6a2
iuc
parents: 3
diff changeset
38 </test>
374cb875d38a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 9edd054251bc74685d627360bb0fbe8ea60fa6a2
iuc
parents: 3
diff changeset
39 <!-- Test for transposing an extremely big input matrix
374cb875d38a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 9edd054251bc74685d627360bb0fbe8ea60fa6a2
iuc
parents: 3
diff changeset
40 Disabled to keep the repository size reasonable.
374cb875d38a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 9edd054251bc74685d627360bb0fbe8ea60fa6a2
iuc
parents: 3
diff changeset
41 For testing, manually download a pathological in- and output from:
374cb875d38a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 9edd054251bc74685d627360bb0fbe8ea60fa6a2
iuc
parents: 3
diff changeset
42 https://usegalaxy.eu/u/tunc/h/very-big-scrna-matrix
374cb875d38a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 9edd054251bc74685d627360bb0fbe8ea60fa6a2
iuc
parents: 3
diff changeset
43 -->
374cb875d38a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 9edd054251bc74685d627360bb0fbe8ea60fa6a2
iuc
parents: 3
diff changeset
44 <!--
0
60e287a6d17d planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 8a7a779896ce1b9b296557a2c31bd93f5fbb5462
iuc
parents:
diff changeset
45 <test>
5
374cb875d38a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 9edd054251bc74685d627360bb0fbe8ea60fa6a2
iuc
parents: 3
diff changeset
46 <param name="in_file" value="big.tabular"/>
374cb875d38a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 9edd054251bc74685d627360bb0fbe8ea60fa6a2
iuc
parents: 3
diff changeset
47 <output file="transposed_big.tabular" name="out_file"/>
0
60e287a6d17d planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 8a7a779896ce1b9b296557a2c31bd93f5fbb5462
iuc
parents:
diff changeset
48 </test>
5
374cb875d38a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 9edd054251bc74685d627360bb0fbe8ea60fa6a2
iuc
parents: 3
diff changeset
49 -->
374cb875d38a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 9edd054251bc74685d627360bb0fbe8ea60fa6a2
iuc
parents: 3
diff changeset
50 <!-- transpose(transpose(A)) = A -->
374cb875d38a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 9edd054251bc74685d627360bb0fbe8ea60fa6a2
iuc
parents: 3
diff changeset
51 <!--
374cb875d38a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 9edd054251bc74685d627360bb0fbe8ea60fa6a2
iuc
parents: 3
diff changeset
52 <test>
374cb875d38a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 9edd054251bc74685d627360bb0fbe8ea60fa6a2
iuc
parents: 3
diff changeset
53 <param name="in_file" value="transposed_big.tabular"/>
374cb875d38a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 9edd054251bc74685d627360bb0fbe8ea60fa6a2
iuc
parents: 3
diff changeset
54 <output file="big.tabular" name="out_file"/>
374cb875d38a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 9edd054251bc74685d627360bb0fbe8ea60fa6a2
iuc
parents: 3
diff changeset
55 </test>
374cb875d38a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 9edd054251bc74685d627360bb0fbe8ea60fa6a2
iuc
parents: 3
diff changeset
56 -->
0
60e287a6d17d planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 8a7a779896ce1b9b296557a2c31bd93f5fbb5462
iuc
parents:
diff changeset
57 </tests>
60e287a6d17d planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 8a7a779896ce1b9b296557a2c31bd93f5fbb5462
iuc
parents:
diff changeset
58 <help>
60e287a6d17d planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 8a7a779896ce1b9b296557a2c31bd93f5fbb5462
iuc
parents:
diff changeset
59 <![CDATA[
60e287a6d17d planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 8a7a779896ce1b9b296557a2c31bd93f5fbb5462
iuc
parents:
diff changeset
60 @HELP_HEADER@
60e287a6d17d planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 8a7a779896ce1b9b296557a2c31bd93f5fbb5462
iuc
parents:
diff changeset
61
60e287a6d17d planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 8a7a779896ce1b9b296557a2c31bd93f5fbb5462
iuc
parents:
diff changeset
62 **Syntax**
60e287a6d17d planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 8a7a779896ce1b9b296557a2c31bd93f5fbb5462
iuc
parents:
diff changeset
63
60e287a6d17d planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 8a7a779896ce1b9b296557a2c31bd93f5fbb5462
iuc
parents:
diff changeset
64 This tools transposes (swaps) rows/columns in a tabular input file.
60e287a6d17d planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 8a7a779896ce1b9b296557a2c31bd93f5fbb5462
iuc
parents:
diff changeset
65
60e287a6d17d planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 8a7a779896ce1b9b296557a2c31bd93f5fbb5462
iuc
parents:
diff changeset
66 -----
60e287a6d17d planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 8a7a779896ce1b9b296557a2c31bd93f5fbb5462
iuc
parents:
diff changeset
67
60e287a6d17d planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 8a7a779896ce1b9b296557a2c31bd93f5fbb5462
iuc
parents:
diff changeset
68 **Example**
60e287a6d17d planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 8a7a779896ce1b9b296557a2c31bd93f5fbb5462
iuc
parents:
diff changeset
69
60e287a6d17d planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 8a7a779896ce1b9b296557a2c31bd93f5fbb5462
iuc
parents:
diff changeset
70 Input file::
60e287a6d17d planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 8a7a779896ce1b9b296557a2c31bd93f5fbb5462
iuc
parents:
diff changeset
71
60e287a6d17d planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 8a7a779896ce1b9b296557a2c31bd93f5fbb5462
iuc
parents:
diff changeset
72 Genes NOX1 DcP HH
60e287a6d17d planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 8a7a779896ce1b9b296557a2c31bd93f5fbb5462
iuc
parents:
diff changeset
73 Sample A1 A2 B3
60e287a6d17d planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 8a7a779896ce1b9b296557a2c31bd93f5fbb5462
iuc
parents:
diff changeset
74 Counts 514 542 490
60e287a6d17d planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 8a7a779896ce1b9b296557a2c31bd93f5fbb5462
iuc
parents:
diff changeset
75
60e287a6d17d planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 8a7a779896ce1b9b296557a2c31bd93f5fbb5462
iuc
parents:
diff changeset
76 Output file::
60e287a6d17d planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 8a7a779896ce1b9b296557a2c31bd93f5fbb5462
iuc
parents:
diff changeset
77
60e287a6d17d planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 8a7a779896ce1b9b296557a2c31bd93f5fbb5462
iuc
parents:
diff changeset
78 Genes Sample Counts
60e287a6d17d planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 8a7a779896ce1b9b296557a2c31bd93f5fbb5462
iuc
parents:
diff changeset
79 NOX1 A1 514
60e287a6d17d planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 8a7a779896ce1b9b296557a2c31bd93f5fbb5462
iuc
parents:
diff changeset
80 DcP A2 542
60e287a6d17d planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 8a7a779896ce1b9b296557a2c31bd93f5fbb5462
iuc
parents:
diff changeset
81 HH B3 490
60e287a6d17d planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 8a7a779896ce1b9b296557a2c31bd93f5fbb5462
iuc
parents:
diff changeset
82
60e287a6d17d planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 8a7a779896ce1b9b296557a2c31bd93f5fbb5462
iuc
parents:
diff changeset
83 @HELP_FOOTER@
60e287a6d17d planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 8a7a779896ce1b9b296557a2c31bd93f5fbb5462
iuc
parents:
diff changeset
84 ]]>
60e287a6d17d planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 8a7a779896ce1b9b296557a2c31bd93f5fbb5462
iuc
parents:
diff changeset
85 </help>
5
374cb875d38a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 9edd054251bc74685d627360bb0fbe8ea60fa6a2
iuc
parents: 3
diff changeset
86 <expand macro="citation"/>
0
60e287a6d17d planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/datamash commit 8a7a779896ce1b9b296557a2c31bd93f5fbb5462
iuc
parents:
diff changeset
87 </tool>