root/galaxy-central/tools/stats/filtering.xml

リビジョン 2, 3.3 KB (コミッタ: hatakeyama, 14 年 前)

import galaxy-central

行番号 
1<tool id="Filter1" name="Filter" version="1.0.1">
2  <description>data on any column using simple expressions</description>
3  <command interpreter="python">
4    filtering.py $input $out_file1 "$cond" ${input.metadata.columns} "${input.metadata.column_types}"
5  </command>
6  <inputs>
7    <param format="tabular" name="input" type="data" label="Filter" help="Query missing? See TIP below."/>
8    <param name="cond" size="40" type="text" value="c1=='chr22'" label="With following condition" help="Double equal signs, ==, must be used as shown above. To filter for an arbitrary string, use the Select tool.">
9      <validator type="empty_field" message="Enter a valid filtering condition, see syntax and examples below."/>
10    </param>
11  </inputs>
12  <outputs>
13    <data format="input" name="out_file1" metadata_source="input"/>
14  </outputs>
15  <tests>
16    <test>
17      <param name="input" value="1.bed"/>
18      <param name="cond" value="c1=='chr22'"/>
19      <output name="out_file1" file="filter1_test1.bed"/>
20    </test>
21    <test>
22      <param name="input" value="7.bed"/>
23      <param name="cond" value="c1=='chr1' and c3-c2>=2000 and c6=='+'"/>
24      <output name="out_file1" file="filter1_test2.bed"/>
25    </test>
26  </tests>
27  <help>
28
29.. class:: warningmark
30
31Double equal signs, ==, must be used as *"equal to"* (e.g., **c1 == 'chr22'**)
32
33.. class:: infomark
34
35**TIP:** Attempting to apply a filtering condition may throw exceptions if the data type (e.g., string, integer) in every line of the columns being filtered is not appropriate for the condition (e.g., attempting certain numerical calculations on strings).  If an exception is thrown when applying the condition to a line, that line is skipped as invalid for the filter condition.  The number of invalid skipped lines is documented in the resulting history item as a "Condition/data issue".
36
37.. class:: infomark
38
39**TIP:** If your data is not TAB delimited, use *Text Manipulation-&gt;Convert*
40
41-----
42
43**Syntax**
44
45The filter tool allows you to restrict the dataset using simple conditional statements.
46
47- Columns are referenced with **c** and a **number**. For example, **c1** refers to the first column of a tab-delimited file
48- Make sure that multi-character operators contain no white space ( e.g., **&lt;=** is valid while **&lt; =** is not valid )
49- When using 'equal-to' operator **double equal sign '==' must be used** ( e.g., **c1=='chr1'** )
50- Non-numerical values must be included in single or double quotes ( e.g., **c6=='+'** )
51- Filtering condition can include logical operators, but **make sure operators are all lower case** ( e.g., **(c1!='chrX' and c1!='chrY') or not c6=='+'** )
52
53-----
54
55**Example**
56
57- **c1=='chr1'** selects lines in which the first column is chr1
58- **c3-c2&lt;100*c4** selects lines where subtracting column 3 from column 2 is less than the value of column 4 times 100
59- **len(c2.split(',')) &lt; 4** will select lines where the second column has less than four comma separated elements
60- **c2>=1** selects lines in which the value of column 2 is greater than or equal to 1
61- Numbers should not contain commas - **c2&lt;=44,554,350** will not work, but **c2&lt;=44554350** will
62- Some words in the data can be used, but must be single or double quoted ( e.g., **c3=='exon'** )
63
64</help>
65</tool>
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。