comparison gemini_query.xml @ 7:da74170c55c7 draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/gemini commit 5ea789e5342c3ad1afd2e0068c88f2b6dc4f7246"
author iuc
date Tue, 10 Mar 2020 06:14:55 -0400
parents cd00221d67cb
children 77a1e60fd1de
comparison
equal deleted inserted replaced
6:840fb4850be3 7:da74170c55c7
1 <tool id="gemini_@BINARY@" name="GEMINI @BINARY@" version="@VERSION@"> 1 <tool id="gemini_@BINARY@" name="GEMINI @BINARY@" version="@VERSION@+galaxy1">
2 <description>Querying the GEMINI database</description> 2 <description>Querying the GEMINI database</description>
3 <macros> 3 <macros>
4 <import>gemini_macros.xml</import> 4 <import>gemini_macros.xml</import>
5 <token name="@BINARY@">query</token> 5 <token name="@BINARY@">query</token>
6 6
25 </xml> 25 </xml>
26 <xml name="dgidb_query"> 26 <xml name="dgidb_query">
27 <param argument="--dgidb" name="dgidb" type="boolean" truevalue="--dgidb" falsevalue="" checked="False" 27 <param argument="--dgidb" name="dgidb" type="boolean" truevalue="--dgidb" falsevalue="" checked="False"
28 label="Request drug-gene interaction info from DGIdb" help="" /> 28 label="Request drug-gene interaction info from DGIdb" help="" />
29 </xml> 29 </xml>
30 <xml name="maf_extra_info">
31 <param name="tumor_sample_name" type="text"
32 label="Name of the tumor sample in the (multi-sample) GEMINI database"
33 help="Specify only if the tumor sample is not the only sample in the database." />
34 <param name="normal_sample_name" type="text"
35 label="Name of the normal sample in the GEMINI database (for matched tumor/normal sample pair analyses only)" />
36 </xml>
30 </macros> 37 </macros>
31 <expand macro="requirements" /> 38 <expand macro="requirements" />
32 <expand macro="stdio" /> 39 <expand macro="stdio" />
33 <expand macro="version_command" /> 40 <expand macro="version_command" />
34 <command> 41 <command>
67 #if str($query.oformat.report.phenotype).strip(): 74 #if str($query.oformat.report.phenotype).strip():
68 '${query.oformat.report.phenotype}' 75 '${query.oformat.report.phenotype}'
69 #else: 76 #else:
70 affected 77 affected
71 #end if 78 #end if
72 #else: 79 #elif str($query.oformat.report.format) != 'maf':
73 --format ${query.oformat.report.format} 80 --format ${query.oformat.report.format}
74 #end if 81 #end if
75 82
76 #if str($query.interface) == 'basic': 83 #if str($query.interface) == 'basic':
77 ## build the SQL query string from its components 84 ## build the SQL query string from its components
78 #if str($query.oformat.report.format) in ('vcf', 'tped'): 85 #if str($query.oformat.report.format) in ('vcf', 'tped'):
79 #set $cols = "*" 86 #set $cols = "*"
87 #elif str($query.oformat.report.format) == 'maf':
88 #if str($query.oformat.report.tumor_sample_name):
89 #set $gt_string = 'gt_alt_depths.{0}, gt_ref_depths.{0}, gts.{0}'.format(str($query.oformat.report.tumor_sample_name))
90 #if str($query.oformat.report.normal_sample_name):
91 #set $gt_string = $gt_string + ', gt_alt_depths.{0}, gt_ref_depths.{0}, gts.{0}'.format(str($query.oformat.report.normal_sample_name))
92 #end if
93 #else:
94 #set $gt_string = '(gt_alt_depths).(*), (gt_ref_depths).(*), (gts).(*)'
95 #end if
96 #if str($query.oformat.report.mutation_status.status_select) == 'custom':
97 ## Need to quote the user-specified mutation status for the SQL query
98 #set $mutation_status = '"%s"' % str($query.oformat.report.mutation_status.status_custom)
99 #elif str($query.oformat.report.mutation_status.status_select) == 'expression':
100 ## For custom expressions, it is up to the user to ensure valid syntax
101 #set $mutation_status = str($query.oformat.report.mutation_status.status_expression)
102 #else:
103 ## The user selected a fixed value from the list, but
104 ## it still needs quoting.
105 #set $mutation_status = '"%s"' % str($query.oformat.report.mutation_status.status_select)
106 #end if
107 #set $cols = 'ifnull(g1.gene, "unknown") AS Hugo_Symbol, ifnull(ifnull(g2.entrez_id, g1.entrez_id), "") AS Entrez_Gene_Id, "" AS Center, "37" AS NCBI_Build, replace(v.chrom, "chr", "") AS Chromosome, v.start + 1 AS Start_Position, v.end AS End_Position, "" as Strand, v.impact_so AS Variant_Classification, ifnull(nullif(v.type, "indel"), v.sub_type) AS Variant_Type, v.ref AS Reference_Allele, "${tumor_seq_allele1}" AS Tumor_Seq_Allele1, "${tumor_seq_allele2}" AS Tumor_Seq_Allele2, ifnull(v.rs_ids, ifnull(nullif(ifnull(nullif(v.in_omim = 0 AND v.cosmic_ids IS NULL AND v.max_aaf_all = -1, 1), "novel"), 0), "")) AS dbSNP_RS, "" AS dbSNP_Val_Status, printf("%s", "' + str($query.oformat.report.tumor_sample_id) + '") AS Tumor_Sample_Barcode, printf("%s", "' + str($query.oformat.report.norm_sample_id) + '") AS Matched_Norm_Sample_Barcode, "${match_norm_seq_allele1}" AS Match_Norm_Seq_Allele1, "${match_norm_seq_allele2}" AS Match_Norm_Seq_Allele2, "" AS Tumor_Validation_Allele1, "" AS Tumor_Validation_Allele2, "" AS Match_Norm_Validation_Allele1, "" AS Match_Norm_Validation_Allele2, "" AS Verification_Status, "" AS Validation_Status, ' + $mutation_status + ' AS Mutation_Status, "" AS Sequencing_Phase, "" AS Sequence_Source, "" AS Validation_Method, "" AS Score, "" AS BAM_File, "" AS Sequencer, ifnull(nullif(v.aa_change, ""), "p.=") AS HGVSp_Short, "${t_alt_count}" AS t_alt_count, "${t_ref_count}" AS t_ref_count, "${n_alt_count}" AS n_alt_count, "${n_ref_count}" AS n_ref_count, v.alt, ' + $gt_string
80 #else: 108 #else:
81 #set $report = $query.oformat.report.report 109 #set $report = $query.oformat.report.report
82 @SET_COLS@ 110 @SET_COLS@
83 #end if 111 #end if
84 #set $q = "SELECT %s FROM variants" % $cols 112 #set $q = "SELECT %s FROM variants" % $cols
113 #if str($query.oformat.report.format) == 'maf':
114 #set $q = $q + ' v LEFT JOIN (SELECT DISTINCT gene, is_hgnc, hgnc_id, entrez_id, chrom FROM gene_detailed) g1 ON v.gene = g1.gene AND v.chrom = g1.chrom LEFT JOIN (SELECT DISTINCT gene, is_hgnc, hgnc_id, entrez_id, transcript, chrom, ensembl_gene_id FROM gene_detailed) g2 ON g1.gene = g2.gene AND (v.transcript = g2.transcript OR v.transcript=g2.ensembl_gene_id)'
115 #end if
116
85 #set $where_clause_elements = [] 117 #set $where_clause_elements = []
86 #if str($query.filter).strip(): 118 #if str($query.filter).strip():
87 #silent $where_clause_elements.append(str($query.filter).strip()) 119 #silent $where_clause_elements.append(str($query.filter).strip())
88 #end if 120 #end if
89 121
93 #silent $where_clause_elements.append(" OR ".join($region_elements)) 125 #silent $where_clause_elements.append(" OR ".join($region_elements))
94 #end if 126 #end if
95 #if $where_clause_elements: 127 #if $where_clause_elements:
96 #set $q = $q + " WHERE " + " AND ".join($where_clause_elements) 128 #set $q = $q + " WHERE " + " AND ".join($where_clause_elements)
97 #end if 129 #end if
130 #if str($query.oformat.report.format) == 'maf':
131 #set $q = $q + " GROUP BY v.variant_id"
132 #end if
98 #if str($query.oformat.report.order_by).strip(): 133 #if str($query.oformat.report.order_by).strip():
99 #set $q = $q + " ORDER BY " + str($query.oformat.report.order_by).strip() + str($query.oformat.report.sort_order) 134 #set $q = $q + " ORDER BY " + str($query.oformat.report.order_by).strip() + str($query.oformat.report.sort_order)
100 #end if 135 #end if
101 #else 136 #else
102 ## The user entered the SQL query string directly. 137 ## The user entered the SQL query string directly.
106 #set $multiline_sql_expr = $q 141 #set $multiline_sql_expr = $q
107 #set $cmdln_param = "-q" 142 #set $cmdln_param = "-q"
108 @MULTILN_SQL_EXPR_TO_CMDLN@ 143 @MULTILN_SQL_EXPR_TO_CMDLN@
109 144
110 '$infile' 145 '$infile'
146 #if str($query.oformat.report.format) == 'maf':
147 > temp.txt && python '$__tool_directory__/gemini_mafify.py' temp.txt '${query.oformat.report.tumor_sample_name}' '${query.oformat.report.normal_sample_name}'
148 #end if
111 > '$outfile' 149 > '$outfile'
112 ]]> 150 ]]>
113 </command> 151 </command>
114 <inputs> 152 <inputs>
115 <expand macro="infile" /> 153 <expand macro="infile" />
134 <option value="with_samples_flattened">tabular with affected samples flattened</option> 172 <option value="with_samples_flattened">tabular with affected samples flattened</option>
135 <option value="with_families">tabular with affected families</option> 173 <option value="with_families">tabular with affected families</option>
136 <option value="carrier_summary">tabular with carrier summary</option> 174 <option value="carrier_summary">tabular with carrier summary</option>
137 <option value="vcf">VCF (simplified)</option> 175 <option value="vcf">VCF (simplified)</option>
138 <option value="json">JSON</option> 176 <option value="json">JSON</option>
177 <option value="maf">MAF (cBioportal-compatible)</option>
139 <option value="tped">TPED</option> 178 <option value="tped">TPED</option>
140 </param> 179 </param>
141 <when value="default"> 180 <when value="default">
142 <expand macro="add_header_column" /> 181 <expand macro="add_header_column" />
143 <expand macro="column_filter" 182 <expand macro="column_filter"
190 <param name="header" type="hidden" value="" /> 229 <param name="header" type="hidden" value="" />
191 <expand macro="column_filter" 230 <expand macro="column_filter"
192 minimalset="chrom, start, end, ref, alt, gene, impact" 231 minimalset="chrom, start, end, ref, alt, gene, impact"
193 help=""/> 232 help=""/>
194 <param name="dgidb" type="hidden" value="" /> 233 <param name="dgidb" type="hidden" value="" />
234 <expand macro="sorting" />
235 </when>
236 <when value="maf">
237 <param name="header" type="hidden" value="--header" />
238 <param name="dgidb" type="hidden" value="" />
239 <expand macro="maf_extra_info" />
240 <param name="tumor_sample_id" type="text"
241 label="Tumor sample ID">
242 <validator type="expression" message="A tumor sample identifier is required">value.strip()</validator>
243 </param>
244 <param name="norm_sample_id" type="text"
245 label="Normal sample ID (for matched tumor/normal sample pair analyses only)" />
246 <conditional name="mutation_status">
247 <param name="status_select" type="select"
248 label="Mutation status to be recorded for variants reported with this query"
249 help="'Somatic', 'Germline', 'LOH', 'Wildtype' and 'None' are fixed values that are treated explicitly by cBioportal. In particular, 'Somatic' and 'Germline' are supported by the cBioportal user interface in the Mutations tab, while 'LOH', 'Wildtype' and 'None' will not be loaded. Any other values will cause the variants to be loaded into cBioPortal and will be displayed as text in the Mutations tab.">
250 <option value="expression">Calculate per variant</option>
251 <option value="custom">Other fixed value</option>
252 <option value="Somatic" selected="true">Somatic</option>
253 <option value="Germline">Germline</option>
254 <option value="LOH">LOH</option>
255 <option value="Wildtype">Wildtype</option>
256 <option value="None">None</option>
257 </param>
258 <when value="Somatic" />
259 <when value="Germline" />
260 <when value="LOH" />
261 <when value="Wildtype" />
262 <when value="None" />
263 <when value="custom">
264 <param name="status_custom" type="text"
265 label="Mutation status (custom value)">
266 <validator type="expression" message="Need a value for Mutation status">value.strip()</validator>
267 </param>
268 </when>
269 <when value="expression">
270 <param name="status_expression" type="text"
271 label="SQL expression used to compute per-variant status"
272 help="Enter a valid SQL result column expression to compute the mutation status from columns of the variants table in the GEMINI database. As one example, the expression ifnull(nullif(ifnull(nullif(ifnull(nullif(somatic_status, 3), 'LOH'), 2), 'Somatic'), 1), 'Germline') assumes that you have a column somatic_status added to the variants table of your database, and will record 'Germline', 'Somatic', or 'LOH' for variants with a value of 1, 2, or 3 in that column, respectively.">
273 <expand macro="sanitize_query" />
274 <validator type="expression" message="Mutation status expression cannot be empty">value.strip()</validator>
275 </param>
276 </when>
277 </conditional>
195 <expand macro="sorting" /> 278 <expand macro="sorting" />
196 </when> 279 </when>
197 <when value="tped"> 280 <when value="tped">
198 <param name="header" type="hidden" value="" /> 281 <param name="header" type="hidden" value="" />
199 <param name="dgidb" type="hidden" value="" /> 282 <param name="dgidb" type="hidden" value="" />
220 <option value="with_samples_flattened">tabular with affected samples flattened</option> 303 <option value="with_samples_flattened">tabular with affected samples flattened</option>
221 <option value="with_families">tabular with affected families</option> 304 <option value="with_families">tabular with affected families</option>
222 <option value="carrier_summary">tabular with carrier summary</option> 305 <option value="carrier_summary">tabular with carrier summary</option>
223 <option value="vcf">VCF (simplified)</option> 306 <option value="vcf">VCF (simplified)</option>
224 <option value="json">JSON</option> 307 <option value="json">JSON</option>
308 <option value="maf">MAF (cBioportal-compatible)</option>
225 <option value="tped">TPED</option> 309 <option value="tped">TPED</option>
226 </param> 310 </param>
227 <when value="default"> 311 <when value="default">
228 <expand macro="add_header_column" /> 312 <expand macro="add_header_column" />
229 <expand macro="dgidb_query" /> 313 <expand macro="dgidb_query" />
252 <param name="dgidb" type="hidden" value="" /> 336 <param name="dgidb" type="hidden" value="" />
253 </when> 337 </when>
254 <when value="json"> 338 <when value="json">
255 <param name="header" type="hidden" value="" /> 339 <param name="header" type="hidden" value="" />
256 <param name="dgidb" type="hidden" value="" /> 340 <param name="dgidb" type="hidden" value="" />
341 </when>
342 <when value="maf">
343 <param name="header" type="hidden" value="--header" />
344 <param name="dgidb" type="hidden" value="" />
345 <expand macro="maf_extra_info" />
257 </when> 346 </when>
258 <when value="tped"> 347 <when value="tped">
259 <param name="header" type="hidden" value="" /> 348 <param name="header" type="hidden" value="" />
260 <param name="dgidb" type="hidden" value="" /> 349 <param name="dgidb" type="hidden" value="" />
261 </when> 350 </when>
283 <assert_contents> 372 <assert_contents>
284 <has_line_matching expression="chrom&#009;start" /> 373 <has_line_matching expression="chrom&#009;start" />
285 </assert_contents> 374 </assert_contents>
286 </output> 375 </output>
287 </test> 376 </test>
377 <test>
378 <param name="infile" value="gemini_load_result1.db" ftype="gemini.sqlite" />
379 <conditional name="query">
380 <param name="interface" value="basic" />
381 </conditional>
382 <section name="oformat">
383 <conditional name="report">
384 <param name="format" value="maf" />
385 <param name="tumor_sample_id" value="test" />
386 </conditional>
387 </section>
388 <output name="outfile" file="gemini_query_as_maf_result.tabular" />
389 </test>
288 </tests> 390 </tests>
289 <help> 391 <help>
290 <![CDATA[ 392 <![CDATA[
291 **What it does** 393 **What it does**
292 394