comparison gemini_annotate.xml @ 0:685b3408c181 draft

planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/gemini commit 4bbfca6f0e9cae9a8f263aad4eab7304c96358c4
author iuc
date Thu, 18 Feb 2016 08:56:22 -0500
parents
children 8da05bf2b1d1
comparison
equal deleted inserted replaced
-1:000000000000 0:685b3408c181
1 <tool id="gemini_@BINARY@" name="GEMINI @BINARY@" version="@VERSION@.0">
2 <description>adding your own custom annotations</description>
3 <macros>
4 <import>gemini_macros.xml</import>
5 <token name="@BINARY@">annotate</token>
6 </macros>
7 <expand macro="requirements" />
8 <expand macro="stdio" />
9 <expand macro="version_command" />
10 <command>
11 <![CDATA[
12
13 bgzip -c "$annotate_source" > tabixed.gz &&
14 tabix -p bed tabixed.gz &&
15
16 gemini @BINARY@
17 -f tabixed.gz
18 -c $column_name
19 -a $a.a_selector
20 #if $a.a_selector == 'extract':
21 -t $a.column_type
22 -e $a.column_extracts
23 -o $a.operation
24 #end if
25 $region_only
26 "${ infile }"
27 > "${ outfile }"
28 ]]>
29
30 </command>
31 <inputs>
32 <expand macro="infile" />
33 <param name="annotate_source" type="data" format="bed" label="File containing the annotations in BED format" help="(-f)"/>
34
35 <param name="column_name" type="text" value=""
36 label="The name of the column to be added to the variant table"
37 help=" If the input file is a VCF, then this is the name of the info field to pull. (-c)">
38 <sanitizer invalid_char=" ">
39 <valid initial="string.letters,string.digits">
40 <add value="_" />
41 </valid>
42 </sanitizer>
43 </param>
44 <conditional name="a">
45 <param name="a_selector" type="select" label="How should the annotation file be used?" help="(-a)">
46 <option value="boolean">Did a variant overlap a region or not? (boolean)</option>
47 <option value="count">How many regions did a variant overlap? (count)</option>
48 <option value="extract" selected="True">Extract specific values from a BED file. (extract)</option>
49 </param>
50 <when value="extract">
51
52 <param name="column_extracts" label="Column to extract information from for list annotations"
53 type="data_column" data_ref="annotate_source" force_select="true" help="(-e)"/>
54
55
56 <param name="column_type" type="select" label="What data type(s) should be used to represent the new values in the database?"
57 help="(-t)">
58 <option value="float">Decimal precision number (float)</option>
59 <option value="integer">Integer number (integer)</option>
60 <option value="text">Text columns such as “valid”, “yes” (text)</option>
61 </param>
62
63 <param name="operation" type="select" label="Operation to apply to the extract column values ..."
64 help="in the event that a variant overlaps multiple annotations in your annotation file. (-o)">
65 <option value="mean">Compute the average of the (numeric) values</option>
66 <option value="sum">Compute the sum of the (numeric) values</option>
67 <option value="median">Compute the median of the (numeric) values</option>
68 <option value="min">Compute the minimum of the (numeric) values</option>
69 <option value="max">Compute the maximum of the (numeric) values</option>
70 <option value="mode">Compute the maximum of the (numeric) values</option>
71 <option value="first">Use the value from the first record in the annotation file</option>
72 <option value="last">Use the value from the last record in the annotation file</option>
73 <option value="list">Create a comma-separated list of the observed (text) values</option>
74 <option value="uniq_list">Create a comma-separated list of non-redundant observed (text) values</option>
75 </param>
76
77 </when>
78 <when value="boolean"/>
79 <when value="count"/>
80 </conditional>
81 <param name="region_only" argument="--region-only" type="boolean" checked="false"
82 truevalue="--region-only" falsevalue=""
83 label="If set, only region coordinates will be considered when annotating variants."
84 help="The default is to annotate using region coordinates as well as REF and ALT
85 variant values. This option is only valid if annotation is a VCF file"/>
86 </inputs>
87 <outputs>
88 <data name="outfile" format="tabular" />
89 </outputs>
90 <tests>
91 <test>
92 <param name="infile" value="gemini_annotate_input.db" ftype="gemini.sqlite" />
93 <param name="annotate_source" value="anno.bed" />
94 <param name="a_selector" value="count" />
95 <param name="column_name" value="anno5" />
96 <output name="outfile" file="gemini_annotate_result.tabular" />
97 </test>
98 </tests>
99 <help><![CDATA[
100 **What it does**
101
102 It is inevitable that researchers will want to enhance the GEMINI framework with their own, custom annotations. GEMINI provides a sub-command called annotate for exactly this purpose.
103
104 **Details**
105
106 It is inevitable that researchers will want to enhance the GEMINI framework with their own, custom annotations. GEMINI provides a sub-command called annotate for exactly this purpose. As long as you provide a tabix‘ed annotation file in BED or VCF format, the annotate tool will, for each variant in the variants table, screen for overlaps in your annotation file and update a one or more new column in the variants table that you may specify on the command line. This is best illustrated by a following **example**.
107
108 **Input files**
109
110 Let’s assume you have already created a GEMINI database of a **VCF file** using the *load module*.
111
112 Now, let’s imagine you have an annotated file in **BED format** (important.bed) that describes regions of the genome that are particularly relevant to your lab’s research. You would like to annotate in the GEMINI database which variants overlap these crucial regions. We want to store this knowledge in a new column in the variants table called important_variant that tracks whether a given variant overlapped (1) or did not overlap (0) intervals in your annotation file.
113
114 *To do this, you must first TABIX your BED file*
115
116 **-a boolean - Did a variant overlap a region or not?**
117
118 Now, you can use this *TABIX*’ed file to annotate which variants overlap your important regions. In the example below, the results will be stored in a new column called “important”. The **-t boolean** option says that you just want to track whether (1) or not (0) the variant overlapped one or more of your regions.
119
120 Since a new columns has been created in the database, we can now directly query the new column. In the example results below, the first and third variants overlapped a crucial region while the second did not::
121
122 chr22 100 101 1 1
123 chr22 200 201 2 0
124 chr22 300 500 3 1
125
126 **-a count - How many regions did a variant overlap?**
127
128 Instead of a simple yes or no, we can use the **-t count** option to count how many important regions a variant overlapped. It turns out that the 3rd variant actually overlapped two important regions::
129
130 chr22 100 101 1 1
131 chr22 200 201 2 0
132 chr22 300 500 3 2
133
134 **-a extract - Extract specific values from a BED file**
135
136 Lastly, we may also extract values from specific fields in a BED file (or from the INFO field in a VCF) and populate one or more new columns in the database based on overlaps with the annotation file and the values of the fields therein. To do this, we use the **-a extract** option.
137
138 This is best described with an example. To set this up, let’s imagine that we have a VCF file from a different experiment and we want to annotate the variants in our GEMINI database with the allele frequency and depth tags from the INFO fields for the same variants in this other VCF file.
139
140 Now that we have a proper *TABIX*’ed VCF file, we can use the **-a extract** option to populate new columns in the GEMINI database. In order to do so, we must specify:
141
142 1) its type (e.g., text, int, float,) (**-t**)
143 2) the field in the INFO column of the VCF file that we should use to extract data with which to populate the new column (**-e**)
144 3) what operation should be used to summarize the data in the event of multiple overlaps in the annotation file (**-o**)
145 4) (optionally) the name of the column we want to add (**-c**), if this is not specified, it will use the value from **-e**.
146
147 For example, let’s imagine we want to create a new column called “other_allele_freq” (**-c**) using the AF field in our VCF file to populate it.
148
149 This create a new column in my.db called other_allele_freq and this new column will be a FLOAT (**-t float**). In the event of multiple records in the VCF file overlapping a variant in the database, the average (**-o mean**) of the allele frequencies values from the VCF file will be used.
150
151 At this point, one can query the database based on the values of the new other_allele_freq column (using **GEMINI query**).
152
153 **-t TYPE - Specifying the column type(s) when using -a extract**
154
155 The annotate tool will create three different types of columns via the **-t** option:
156
157 1) Floating point columns for annotations with decimal precision as above (-t float)
158 2) Integer columns for integral annotations (-t integer)
159 3) Text columns for string columns such as “valid”, “yes”, etc. (-t text)
160
161 *The -t option is only valid when using the -a extract option.*
162
163 **-o OPERATION - Specifying the summary operations when using -a extract**
164
165 In the event of multiple overlaps between a variant and records in the annotation file, the annotate tool can summarize the values observed with multiple options:
166
167 - -o mean Compute the average of the values. They must be numeric.
168 - -o median Compute the median of the values. They must be numeric.
169 - -o min Compute the minimum of the values. They must be numeric.
170 - -o max Compute the maximum of the values. They must be numeric.
171 - -o mode Compute the maximum of the values. They must be numeric.
172 - -o first Use the value from the first record in the annotation file.
173 - -o last Use the value from the last record in the annotation file.
174 - -o list Create a comma-separated list of the observed values.
175 - -o uniq_list Create a comma-separated list of the distinct observed values.
176 - -o sum Compute the sum of the values. They must be numeric.
177
178 The -o option is only valid when using the -a extract option.
179
180 **Annotating with VCF**
181
182 Most of the examples to this point have pulled a column from a tabix indexed bed file. It is likewise possible to pull from the INFO field of a tabix index VCF. The syntax is identical but the **-e** operation will specify the names of fields in the INFO column to pull. By default, those names will be used, but that can still be specified with the **-c column**.
183
184 To put a DP column in the db, set:
185
186 -o list, -e DP, -t integer
187
188 ... and name it 'depth', set:
189
190 -o list, -e DP, -c depth, -t integer
191
192
193 Missing values are allowed since we expect that in some cases an annotation VCF will not have all INFO fields specified for all variants.
194
195 *We recommend decomposing and normalizing variants before annotating. See Step 1. split, left-align, and trim variants for a detailed explanation of how to do this. To do that see the GEMINI* preprocessing_ *website.*
196
197 **Extracting and populating multiple columns at once**
198
199 One can also extract and populate multiple columns at once by providing comma-separated lists (no spaces) of column names (**-c**), types (**-t**), numbers (**-e**), and summary operations (**-o**). For example, recall that in the VCF example above, we created a *TABIX*’ed BED file containg the allele frequency and depth values from the INFO field as the 4th and 5th columns in the BED, respectively.
200
201 Instead of running the annotate tool twice (once for each column), we can run the tool once and load both columns in the same run. For example with settings:
202
203 - -a extract
204 - -c other_allele_freq,other_depth
205 - -t float,integer
206 - -e 4,5
207 - -o mean,max
208
209 We can then use each of the new columns to filter variants with a *GEMINI query*:
210
211 .. _preprocessing: https://gemini.readthedocs.org/en/latest/content/preprocessing.html#preprocess
212
213 ]]></help>
214 <expand macro="citations"/>
215 </tool>