Mercurial > repos > jjohnson > find_in_reference
annotate find_in_reference.xml @ 3:fe044d480b3a default tip
Validate and sanitize separator parameters for annotation fields
| author | Jim Johnson <jj@umn.edu> |
|---|---|
| date | Thu, 23 Jan 2014 16:30:21 -0600 |
| parents | 30975b3ff0dc |
| children |
| rev | line source |
|---|---|
| 0 | 1 <?xml version="1.0"?> |
| 2 <tool id="find_in_reference" name="find in reference" version="0.0.1"> | |
| 3 <description>filter peptides that are present in proteins</description> | |
| 4 <command interpreter="python">find_in_reference.py --input "$input" | |
| 5 --reference "$reference" | |
| 6 #if $column.set == 'yes': | |
| 7 --input_column $column.input_column | |
| 8 --reference_column $column.reference_column | |
| 9 #end if | |
| 1 | 10 $case_insensitive |
| 0 | 11 #if 'novel' in $outputs.__str__ or not 'found' in $outputs.__str__: |
| 12 --output "$novel" | |
| 13 #end if | |
| 14 #if 'found' in $outputs.__str__: | |
| 15 --filtered "$found" | |
|
2
30975b3ff0dc
Allow user to add annotation columns from reference to found input entries
Jim Johnson <jj@umn.edu>
parents:
1
diff
changeset
|
16 #if $annotate.from_ref == 'yes' and str($annotate.annotation_columns) != 'None': |
|
30975b3ff0dc
Allow user to add annotation columns from reference to found input entries
Jim Johnson <jj@umn.edu>
parents:
1
diff
changeset
|
17 --annotation_columns $annotate.annotation_columns |
|
30975b3ff0dc
Allow user to add annotation columns from reference to found input entries
Jim Johnson <jj@umn.edu>
parents:
1
diff
changeset
|
18 #if $annotate.annotation_separator != '': |
|
30975b3ff0dc
Allow user to add annotation columns from reference to found input entries
Jim Johnson <jj@umn.edu>
parents:
1
diff
changeset
|
19 --annotation_separator '$annotate.annotation_separator' |
|
30975b3ff0dc
Allow user to add annotation columns from reference to found input entries
Jim Johnson <jj@umn.edu>
parents:
1
diff
changeset
|
20 #end if |
|
30975b3ff0dc
Allow user to add annotation columns from reference to found input entries
Jim Johnson <jj@umn.edu>
parents:
1
diff
changeset
|
21 #if $annotate.annotation_col_sep != '': |
|
30975b3ff0dc
Allow user to add annotation columns from reference to found input entries
Jim Johnson <jj@umn.edu>
parents:
1
diff
changeset
|
22 --annotation_col_sep '$annotate.annotation_col_sep' |
|
30975b3ff0dc
Allow user to add annotation columns from reference to found input entries
Jim Johnson <jj@umn.edu>
parents:
1
diff
changeset
|
23 #end if |
|
30975b3ff0dc
Allow user to add annotation columns from reference to found input entries
Jim Johnson <jj@umn.edu>
parents:
1
diff
changeset
|
24 #end if |
| 0 | 25 #end if |
| 26 </command> | |
| 27 <inputs> | |
| 28 <param name="input" type="data" format="tabular" label="Input file to be filtered" | |
| 1 | 29 help="e.g. a peptide fasta converted to tabular"/> |
| 0 | 30 <param name="reference" type="data" format="tabular" label="reference file to search" |
| 1 | 31 help="e.g. a protein fasta converted to tabular"/> |
| 0 | 32 <conditional name="column"> |
| 33 <param name="set" type="select" label="select columns to compare"> | |
| 34 <option value="no" selected="true">Use last column of input and reference</option> | |
| 35 <option value="yes">Choose the column of input and reference to compare</option> | |
| 36 </param> | |
| 37 <when value="no"/> | |
| 38 <when value="yes"> | |
| 39 <param name="input_column" type="data_column" data_ref="input" label="column in input (defaults to last column)" | |
| 40 help=""/> | |
| 41 <param name="reference_column" type="data_column" data_ref="reference" label="column in reference (defaults to last column)" | |
| 42 help=""/> | |
| 43 </when> | |
| 44 </conditional> | |
| 1 | 45 <param name="case_insensitive" type="boolean" truevalue="--case_insensitive" falsevalue="" checked="false" label="Ignore case when comparing"/> |
| 0 | 46 <param name="outputs" type="select" multiple="true" display="checkboxes" label="Choose outputs"> |
| 47 <option value="novel" selected="true">lines with no match in reference</option> | |
| 48 <option value="found">lines with match in reference</option> | |
| 49 </param> | |
|
2
30975b3ff0dc
Allow user to add annotation columns from reference to found input entries
Jim Johnson <jj@umn.edu>
parents:
1
diff
changeset
|
50 <conditional name="annotate"> |
|
30975b3ff0dc
Allow user to add annotation columns from reference to found input entries
Jim Johnson <jj@umn.edu>
parents:
1
diff
changeset
|
51 <param name="from_ref" type="select" label="Annotate found input entries with columns from reference"> |
|
30975b3ff0dc
Allow user to add annotation columns from reference to found input entries
Jim Johnson <jj@umn.edu>
parents:
1
diff
changeset
|
52 <option value="no" selected="true">No</option> |
|
30975b3ff0dc
Allow user to add annotation columns from reference to found input entries
Jim Johnson <jj@umn.edu>
parents:
1
diff
changeset
|
53 <option value="yes">Yes</option> |
|
30975b3ff0dc
Allow user to add annotation columns from reference to found input entries
Jim Johnson <jj@umn.edu>
parents:
1
diff
changeset
|
54 </param> |
|
30975b3ff0dc
Allow user to add annotation columns from reference to found input entries
Jim Johnson <jj@umn.edu>
parents:
1
diff
changeset
|
55 <when value="no"/> |
|
30975b3ff0dc
Allow user to add annotation columns from reference to found input entries
Jim Johnson <jj@umn.edu>
parents:
1
diff
changeset
|
56 <when value="yes"> |
|
30975b3ff0dc
Allow user to add annotation columns from reference to found input entries
Jim Johnson <jj@umn.edu>
parents:
1
diff
changeset
|
57 <param name="annotation_columns" type="data_column" data_ref="reference" multiple="true" label="columns from reference to append to found input lines" |
|
30975b3ff0dc
Allow user to add annotation columns from reference to found input entries
Jim Johnson <jj@umn.edu>
parents:
1
diff
changeset
|
58 help=""/> |
|
3
fe044d480b3a
Validate and sanitize separator parameters for annotation fields
Jim Johnson <jj@umn.edu>
parents:
2
diff
changeset
|
59 <param name="annotation_separator" type="text" value=";" optional="true" label="separator to place between annotations from different reference lines" |
|
fe044d480b3a
Validate and sanitize separator parameters for annotation fields
Jim Johnson <jj@umn.edu>
parents:
2
diff
changeset
|
60 help="defaults to ;"> |
|
fe044d480b3a
Validate and sanitize separator parameters for annotation fields
Jim Johnson <jj@umn.edu>
parents:
2
diff
changeset
|
61 <validator type="regex" message="Single quote character is not allowed">^[^']*$</validator> |
|
fe044d480b3a
Validate and sanitize separator parameters for annotation fields
Jim Johnson <jj@umn.edu>
parents:
2
diff
changeset
|
62 <sanitizer> |
|
fe044d480b3a
Validate and sanitize separator parameters for annotation fields
Jim Johnson <jj@umn.edu>
parents:
2
diff
changeset
|
63 <valid initial="string.printable"> |
|
fe044d480b3a
Validate and sanitize separator parameters for annotation fields
Jim Johnson <jj@umn.edu>
parents:
2
diff
changeset
|
64 <remove value="'"/> |
|
fe044d480b3a
Validate and sanitize separator parameters for annotation fields
Jim Johnson <jj@umn.edu>
parents:
2
diff
changeset
|
65 </valid> |
|
fe044d480b3a
Validate and sanitize separator parameters for annotation fields
Jim Johnson <jj@umn.edu>
parents:
2
diff
changeset
|
66 <mapping initial="none"> |
|
fe044d480b3a
Validate and sanitize separator parameters for annotation fields
Jim Johnson <jj@umn.edu>
parents:
2
diff
changeset
|
67 <add source="'" target=""/> |
|
fe044d480b3a
Validate and sanitize separator parameters for annotation fields
Jim Johnson <jj@umn.edu>
parents:
2
diff
changeset
|
68 </mapping> |
|
fe044d480b3a
Validate and sanitize separator parameters for annotation fields
Jim Johnson <jj@umn.edu>
parents:
2
diff
changeset
|
69 </sanitizer> |
|
fe044d480b3a
Validate and sanitize separator parameters for annotation fields
Jim Johnson <jj@umn.edu>
parents:
2
diff
changeset
|
70 </param> |
|
fe044d480b3a
Validate and sanitize separator parameters for annotation fields
Jim Johnson <jj@umn.edu>
parents:
2
diff
changeset
|
71 <param name="annotation_col_sep" type="text" value="," optional="true" label="separator to place between annotation columns from the same reference line" |
|
fe044d480b3a
Validate and sanitize separator parameters for annotation fields
Jim Johnson <jj@umn.edu>
parents:
2
diff
changeset
|
72 help="defaults to ,"> |
|
fe044d480b3a
Validate and sanitize separator parameters for annotation fields
Jim Johnson <jj@umn.edu>
parents:
2
diff
changeset
|
73 <validator type="regex" message="Single quote character is not allowed">^[^']*$</validator> |
|
fe044d480b3a
Validate and sanitize separator parameters for annotation fields
Jim Johnson <jj@umn.edu>
parents:
2
diff
changeset
|
74 <sanitizer> |
|
fe044d480b3a
Validate and sanitize separator parameters for annotation fields
Jim Johnson <jj@umn.edu>
parents:
2
diff
changeset
|
75 <valid initial="string.printable"> |
|
fe044d480b3a
Validate and sanitize separator parameters for annotation fields
Jim Johnson <jj@umn.edu>
parents:
2
diff
changeset
|
76 <remove value="'"/> |
|
fe044d480b3a
Validate and sanitize separator parameters for annotation fields
Jim Johnson <jj@umn.edu>
parents:
2
diff
changeset
|
77 </valid> |
|
fe044d480b3a
Validate and sanitize separator parameters for annotation fields
Jim Johnson <jj@umn.edu>
parents:
2
diff
changeset
|
78 <mapping initial="none"> |
|
fe044d480b3a
Validate and sanitize separator parameters for annotation fields
Jim Johnson <jj@umn.edu>
parents:
2
diff
changeset
|
79 <add source="'" target=""/> |
|
fe044d480b3a
Validate and sanitize separator parameters for annotation fields
Jim Johnson <jj@umn.edu>
parents:
2
diff
changeset
|
80 </mapping> |
|
fe044d480b3a
Validate and sanitize separator parameters for annotation fields
Jim Johnson <jj@umn.edu>
parents:
2
diff
changeset
|
81 </sanitizer> |
|
fe044d480b3a
Validate and sanitize separator parameters for annotation fields
Jim Johnson <jj@umn.edu>
parents:
2
diff
changeset
|
82 </param> |
|
2
30975b3ff0dc
Allow user to add annotation columns from reference to found input entries
Jim Johnson <jj@umn.edu>
parents:
1
diff
changeset
|
83 </when> |
|
30975b3ff0dc
Allow user to add annotation columns from reference to found input entries
Jim Johnson <jj@umn.edu>
parents:
1
diff
changeset
|
84 </conditional> |
| 0 | 85 </inputs> |
| 86 <stdio> | |
| 87 <exit_code range="1:" level="fatal" description="Error" /> | |
| 88 </stdio> | |
| 89 <outputs> | |
| 90 <data name="found" metadata_source="input" format_source="input" label="${tool.name} on ${on_string}: found"> | |
| 91 <filter>'found' in str(outputs)</filter> | |
| 92 </data> | |
| 93 <data name="novel" metadata_source="input" format_source="input" label="${tool.name} on ${on_string}: novel"> | |
| 94 <filter>'novel' in str(outputs) or not 'found' in str(outputs)</filter> | |
| 95 </data> | |
| 96 </outputs> | |
| 97 <tests> | |
| 98 <test> | |
| 99 <param name="input" value="human_peptides.tabular" ftype="tabular" dbkey="hg19"/> | |
| 100 <param name="reference" value="human_proteins.tabular" ftype="tabular" dbkey="hg19"/> | |
| 101 <output name="novel" file="novel_peptides.tabular"/> | |
| 102 </test> | |
| 103 </tests> | |
| 104 <help> | |
| 105 **Find in Reference** | |
| 106 | |
| 1 | 107 Filters lines of a tabular input file by checking if the selected input column value |
| 0 | 108 is a substring of the selected column of any line in the reference file. |
| 109 | |
| 110 This can be used to check if peptides sequences are present in a set of reference proteins, | |
| 111 as a means of filtering out uninteresting peptide sequences. | |
| 112 | |
| 1 | 113 For Example with:: |
| 114 | |
| 115 Input | |
| 116 >pep1 LIL | |
| 117 >pep2 WTF | |
| 118 >pep3 ISK | |
| 119 | |
| 120 Reference | |
| 121 >prot1 RLET | |
| 122 >prot2 LLIL | |
| 123 >prot3 LAPSE | |
| 124 >prot3 RISKY | |
| 125 | |
| 126 The outputs | |
| 127 | |
| 128 Not found in reference | |
| 129 >pep2 WTF | |
| 130 | |
| 131 Found in reference | |
| 132 >pep1 LIL | |
| 133 >pep3 ISK | |
| 134 | |
| 135 | |
| 0 | 136 </help> |
| 137 </tool> |
