Mercurial > repos > devteam > column_maker
comparison column_maker.xml @ 7:e7c273e8d4d6 draft
"planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/column_maker commit 35c79ccee143e8d178ebd24f6317888de3ca0187"
author | devteam |
---|---|
date | Mon, 25 Jan 2021 09:59:49 +0000 |
parents | 0aeda7a81b46 |
children | 227e82286a0e |
comparison
equal
deleted
inserted
replaced
6:0aeda7a81b46 | 7:e7c273e8d4d6 |
---|---|
1 <tool id="Add_a_column1" name="Compute" version="1.4"> | 1 <tool id="Add_a_column1" name="Compute" version="1.5"> |
2 <description>an expression on every row</description> | 2 <description>an expression on every row</description> |
3 <requirements> | 3 <requirements> |
4 <requirement type="package" version="3.8">python</requirement> | 4 <requirement type="package" version="3.8">python</requirement> |
5 <requirement type="package" version="4.4">sed</requirement> | |
6 <requirement type="package" version="1.19.1">numpy</requirement> | 5 <requirement type="package" version="1.19.1">numpy</requirement> |
7 </requirements> | 6 </requirements> |
8 <command detect_errors="aggressive"><![CDATA[ | 7 <command detect_errors="aggressive"><![CDATA[ |
9 #if $header_lines_conditional.header_lines_select == "yes": | 8 ln -s '$input' data && |
10 (sed -n '1,1p' '$input' | sed "s|$|%${header_lines_conditional.header_new_column_name}|" | tr "%" "\t") > header && | |
11 sed '1,1d' '$input' > data && | |
12 #else: | |
13 touch header && | |
14 ln -s '$input' data && | |
15 #end if | |
16 | 9 |
17 ## inject colums and column_types metadata into inputs json | 10 ## inject colums and column_types metadata into inputs json |
18 #import json | 11 #import json |
19 #set inputs_dict = json.load(open($inputs)) | 12 #set inputs_dict = json.load(open($inputs)) |
20 #set inputs_dict['columns'] = $input.metadata.columns | 13 #set inputs_dict['columns'] = $input.metadata.columns |
21 #set inputs_dict['column_types'] = $input.metadata.column_types | 14 #set inputs_dict['column_types'] = $input.metadata.column_types |
15 ## flatten conditional | |
16 #if $header_lines_conditional.header_lines_select == "yes": | |
17 #set inputs_dict['header_new_column_name'] = str($header_lines_conditional.header_new_column_name) | |
18 #end if | |
22 #set x = json.dump($inputs_dict, open($inputs, 'w')) | 19 #set x = json.dump($inputs_dict, open($inputs, 'w')) |
23 | 20 |
24 python '$__tool_directory__/column_maker.py' | 21 python '$__tool_directory__/column_maker.py' |
25 data column_maker_output | 22 data '$out_file1' |
26 --load_json '$inputs' | 23 --load_json '$inputs' |
27 && cat header column_maker_output > '$out_file1' | |
28 ]]></command> | 24 ]]></command> |
29 <configfiles> | 25 <configfiles> |
30 <inputs name="inputs"/> | 26 <inputs name="inputs"/> |
31 </configfiles> | 27 </configfiles> |
32 <inputs> | 28 <inputs> |
33 <param name="cond" type="text" value="c3-c2" label="Add expression"/> | 29 <param name="cond" type="text" value="c3-c2" label="Add expression"> |
30 <sanitizer> | |
31 <valid initial="default"> | |
32 <add value="<" /> | |
33 <add value=">" /> | |
34 <add value=""" /> | |
35 <add value="'" /> | |
36 </valid> | |
37 </sanitizer> | |
38 </param> | |
34 <param format="tabular" name="input" type="data" label="as a new column to" help="Dataset missing? See TIP below"/> | 39 <param format="tabular" name="input" type="data" label="as a new column to" help="Dataset missing? See TIP below"/> |
35 <param name="round" type="select" label="Round result?"> | 40 <param name="round" type="boolean" truevalue="yes" falsevalue="no" label="Round result?" /> |
36 <option value="no">NO</option> | 41 <param name="avoid_scientific_notation" type="boolean" truevalue="yes" falsevalue="no" |
37 <option value="yes">YES</option> | 42 label="Avoid scientific notation" |
38 </param> | 43 help="If yes, use fully expanded decimal representation when writing new columns (use only if expression produces decimal numbers)." /> |
39 <conditional name="header_lines_conditional"> | 44 <conditional name="header_lines_conditional"> |
40 <param name="header_lines_select" type="select" label="Skip a header line" help="# characters are already considered as comments and kept" > | 45 <param name="header_lines_select" type="select" |
41 <option value="no" >no</option> | 46 label="Input has a header line with column names?" |
42 <option value="yes" >yes</option> | 47 help="Select Yes to be able to specify a name for the new column and have it added to the header line. If you select No, the first line will be treated as a regular line: If it is empty or starts with a # character it will be skipped, otherwise the tool will attempt to compute the specified expression on it." > |
48 <option value="no" >No</option> | |
49 <option value="yes" >Yes</option> | |
43 </param> | 50 </param> |
44 <when value="no"> | 51 <when value="no"> |
45 </when> | 52 </when> |
46 <when value="yes"> | 53 <when value="yes"> |
47 <param name="header_new_column_name" type="text" value="New Column" label="The new column name" /> | 54 <param name="header_new_column_name" type="text" value="New Column" label="The new column name" /> |
48 </when> | 55 </when> |
49 </conditional> | 56 </conditional> |
50 <param name="avoid_scientific_notation" type="select" label="Avoid scientific notation" help="If yes, use fully expanded decimal representation when writing new columns (use only if expression produces decimal numbers)."> | |
51 <option value="no">no</option> | |
52 <option value="yes">yes</option> | |
53 </param> | |
54 </inputs> | 57 </inputs> |
55 <outputs> | 58 <outputs> |
56 <data format_source="input" name="out_file1" metadata_source="input"/> | 59 <data format_source="input" name="out_file1" metadata_source="input"/> |
57 </outputs> | 60 </outputs> |
58 <tests> | 61 <tests> |
59 <test> | 62 <test> |
60 <param name="cond" value="c3-c2"/> | 63 <param name="cond" value="c3-c2"/> |
61 <param name="input" value="1.bed"/> | 64 <param name="input" value="1.bed"/> |
62 <param name="round" value="no"/> | 65 <param name="round" value="false"/> |
63 <output name="out_file1" file="column_maker_out1.interval"/> | 66 <output name="out_file1" file="column_maker_out1.interval"/> |
64 </test> | 67 </test> |
65 <test> | 68 <test> |
66 <param name="cond" value="c4*1"/> | 69 <param name="cond" value="c4*1"/> |
67 <param name="input" value="1.interval"/> | 70 <param name="input" value="1.interval"/> |
68 <param name="round" value="no"/> | 71 <param name="round" value="false"/> |
69 <output name="out_file1" file="column_maker_out2.interval"/> | 72 <output name="out_file1" file="column_maker_out2.interval"/> |
70 </test> | 73 </test> |
71 <test> | 74 <test> |
72 <param name="cond" value="c4*1"/> | 75 <param name="cond" value="c4*1"/> |
73 <param name="input" value="1.header.tsv"/> | 76 <param name="input" value="1.header.tsv"/> |
74 <param name="round" value="no"/> | 77 <param name="round" value="false"/> |
75 <conditional name="header_lines_conditional"> | 78 <conditional name="header_lines_conditional"> |
76 <param name="header_lines_select" value="yes" /> | 79 <param name="header_lines_select" value="yes" /> |
77 <param name="header_new_column_name" value="value1_again" /> | 80 <param name="header_new_column_name" value="value1_again" /> |
78 </conditional> | 81 </conditional> |
79 <output name="out_file1" file="column_maker_out2.header.tsv"/> | 82 <output name="out_file1" file="column_maker_out2.header.tsv"/> |
80 </test> | 83 </test> |
81 <test> | 84 <test> |
82 <param name="cond" value="c4*1"/> | 85 <param name="cond" value="c4*1"/> |
83 <param name="input" value="1.interval"/> | 86 <param name="input" value="1.interval"/> |
84 <param name="round" value="yes"/> | 87 <param name="round" value="true"/> |
85 <output name="out_file1" file="column_maker_out3.interval"/> | 88 <output name="out_file1" file="column_maker_out3.interval"/> |
86 </test> | 89 </test> |
87 <test> | 90 <test> |
88 <param name="cond" value="float(.0000000000001)"/> | 91 <param name="cond" value="float(.0000000000001)"/> |
89 <param name="input" value="1.bed"/> | 92 <param name="input" value="1.bed"/> |
90 <param name="round" value="no"/> | 93 <param name="round" value="false"/> |
91 <output name="out_file1"> | 94 <output name="out_file1"> |
92 <assert_contents> | 95 <assert_contents> |
93 <has_text text="CCDS10397" /> | 96 <has_text text="CCDS10397" /> |
94 <has_text text="1e-13" /> | 97 <has_text text="1e-13" /> |
95 </assert_contents> | 98 </assert_contents> |
96 </output> | 99 </output> |
97 </test> | 100 </test> |
98 <test> | 101 <test> |
99 <param name="cond" value="float(.0000000000001)"/> | 102 <param name="cond" value="float(.0000000000001)"/> |
100 <param name="input" value="1.bed"/> | 103 <param name="input" value="1.bed"/> |
101 <param name="round" value="no"/> | 104 <param name="round" value="false"/> |
102 <param name="avoid_scientific_notation" value="yes"/> | 105 <param name="avoid_scientific_notation" value="true"/> |
103 <output name="out_file1"> | 106 <output name="out_file1"> |
104 <assert_contents> | 107 <assert_contents> |
105 <has_text text="CCDS10397" /> | 108 <has_text text="CCDS10397" /> |
106 <has_text text=".0000000000001" /> | 109 <has_text text=".0000000000001" /> |
107 <not_has_text text="1e-13" /> | 110 <not_has_text text="1e-13" /> |