annotate regex_tabular.xml @ 0:9ea374bb0350 draft default tip

Uploaded
author jjohnson
date Sat, 29 Mar 2014 13:41:51 -0400
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
1 <tool id="regexColumn1" name="Column Regex Find And Replace" version="0.1.0">
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
2 <description></description>
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
3 <command interpreter="python">regex.py --input $input --output $out_file1 --column $field
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
4 #for $check in $checks:
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
5 --pattern='$check.pattern' --replacement='$check.replacement'
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
6 #end for
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
7 </command>
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
8 <inputs>
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
9 <param format="tabular" name="input" type="data" label="Select cells from"/>
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
10 <param name="field" label="using column" type="data_column" data_ref="input" />
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
11 <repeat name="checks" title="Check">
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
12 <param name="pattern" size="40" type="text" value="chr([0-9A-Za-z])+" label="Find Regex" help="here you can enter text or regular expression (for syntax check lower part of this frame)">
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
13 <sanitizer>
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
14 <valid>
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
15 <add preset="string.printable"/>
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
16 <remove value="&#92;" />
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
17 <remove value="&apos;" />
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
18 </valid>
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
19 <mapping initial="none">
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
20 <add source="&#92;" target="__backslash__" />
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
21 <add source="&apos;" target="__sq__"/>
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
22 </mapping>
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
23 </sanitizer>
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
24 </param>
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
25 <param name="replacement" size="40" type="text" value="newchr\1" label="Replacement">
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
26 <sanitizer>
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
27 <valid>
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
28 <add preset="string.printable"/>
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
29 <remove value="&#92;" />
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
30 <remove value="&apos;" />
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
31 </valid>
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
32 <mapping initial="none">
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
33 <add source="&#92;" target="__backslash__" />
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
34 <add source="&apos;" target="__sq__"/>
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
35 </mapping>
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
36 </sanitizer>
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
37 </param>
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
38 </repeat>
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
39 </inputs>
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
40 <outputs>
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
41 <data format="input" name="out_file1" metadata_source="input" />
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
42 </outputs>
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
43 <tests>
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
44 <test>
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
45 <param name="input" value="find_tabular_1.txt" ftype="tabular" />
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
46 <param name="field" value="1" />
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
47 <param name="pattern" value="moo"/>
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
48 <param name="replacement" value="cow" />
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
49 <output name="out_file1" file="replace_tabular_1.txt"/>
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
50 </test>
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
51 </tests>
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
52 <help>
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
53
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
54 .. class:: warningmark
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
55
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
56 **This tool will attempt to reuse the metadata from your first input.** To change metadata assignments click on the "edit attributes" link of the history item generated by this tool.
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
57
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
58 .. class:: infomark
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
59
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
60 **TIP:** If your data is not TAB delimited, use *Text Manipulation-&gt;Convert*
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
61
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
62 -----
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
63
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
64 This tool goes line by line through the specified input file and
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
65 if the text in the selected column matches a specified regular expression pattern
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
66 replaces the text with the corresponding specified replacement.
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
67
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
68 This tool can be used to change between the chromosome naming conventions of UCSC and Ensembl.
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
69
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
70 For example to remove the **chr** part of the reference sequence name in the first column of this GFF file::
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
71
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
72 ##gff-version 2
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
73 ##Date: Thu Mar 23 11:21:17 2006
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
74 ##bed2gff.pl $Rev: 601 $
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
75 ##Input file: ./database/files/61c6c604e0ef50b280e2fd9f1aa7da61.dat
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
76 chr1 bed2gff CCDS1000.1_cds_0_0_chr1_148325916_f 148325916 148325975 . + . score "0";
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
77 chr21 bed2gff CCDS13614.1_cds_0_0_chr21_32707033_f 32707033 32707192 . + . score "0";
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
78 chrX bed2gff CCDS14606.1_cds_0_0_chrX_122745048_f 122745048 122745924 . + . score "0";
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
79
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
80 Setting::
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
81
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
82 using column: c1
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
83 Find Regex: chr([0-9]+|X|Y|M[Tt]?)
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
84 Replacement: \1
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
85
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
86 produces::
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
87
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
88 ##gff-version 2
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
89 ##Date: Thu Mar 23 11:21:17 2006
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
90 ##bed2gff.pl $Rev: 601 $
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
91 ##Input file: ./database/files/61c6c604e0ef50b280e2fd9f1aa7da61.dat
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
92 1 bed2gff CCDS1000.1_cds_0_0_chr1_148325916_f 148325916 148325975 . + . score "0";
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
93 21 bed2gff CCDS13614.1_cds_0_0_chr21_32707033_f 32707033 32707192 . + . score "0";
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
94 X bed2gff CCDS14606.1_cds_0_0_chrX_122745048_f 122745048 122745924 . + . score "0";
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
95
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
96
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
97 This tool uses Python regular expressions with the **re.sub()** function.
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
98 More information about Python regular expressions can be found here:
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
99 http://docs.python.org/library/re.html.
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
100
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
101 The regex **chr([0-9]+|X|Y|M)** means start with text **chr** followed by either: one or more digits, or the letter X, or the letter Y, or the letter M (optionally followed by a single letter T or t).
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
102 Note that the parentheses **()** capture patterns in the text that can be used in the replacement text by using a backslash-number reference: **\\1**
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
103
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
104
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
105
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
106 Galaxy aggressively escapes input supplied to tools, so if something
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
107 is not working please let us know and we can look into whether this is
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
108 the cause. Also if you would like help constructing regular
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
109 expressions for your inputs, please let us know at help@msi.umn.edu.
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
110
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
111 </help>
9ea374bb0350 Uploaded
jjohnson
parents:
diff changeset
112 </tool>