-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathquery.php
executable file
·630 lines (497 loc) · 33.3 KB
/
query.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
<?php
$body_class = "right-sidebar"; // This is a page with a right sidebar
require 'php_header.php'; // Require the PHP header housing required PHP functions
require 'html_header.php'; // Require the HTML header housing the HTML structure of the page
?>
</div>
<!-- Main -->
<div class="wrapper">
<div class="container" id="main">
<!-- Content -->
<article id="content">
<header>
<h2><strong>OK</strong>, you have some data. Now <strong>filter it</strong>.</h2>
<p>Select from the filtration options below.</p>
</header>
<a class="image featured"><img src="images/query.jpg" alt="" /></a>
<?php
#############################################
# ERROR HANDLING
#############################################
// If no database was selected, the query form should not be displayed
if ($_SESSION["query_db"] == "" || $_SESSION["query_group"] == "") {
error("No database and group was selected for query. Your session may have expired, please go back and select a database to analyse.");
echo "<br><a href=\"databases?restart=true\" class=\"button\">Start over</a>";
// If no family or analysis type were selected but pedigree information exists
} elseif (if_set_display_error("query_no_family_or_analysis_type", "No family or analysis type was supplied but your database has pedigree information.")) {
// If the user submitted a group they don't have access to
} elseif (if_set_display_error("query_no_access_to_group", "You don't have access to the group specified.")) {
// If a database to analyze exists, go on with showing the form
} else {
#############################################
# TEST FOR THE PRESENCE OF CUSTOM COLUMNS BEFORE DISPLAYING THE QUERY FORM
#############################################
// Test for dbsnp columns
if (are_custom_columns_present($_SESSION["query_group"], $_SESSION["query_db"], "is_dbsnp_common, is_dbsnp_flagged")) {
$_SESSION["dbsnp_columns_exist"] = 1;
}
#############################################
# DATABASE SELECTED
#############################################
echo "<div class=\"row\">";
echo "<section class=\"6u 12u(narrower)\">";
echo "<h3>Database selected</h3>";
echo "<p>".$_SESSION["query_db"]."</p>";
echo "</section>";
#############################################
# FAMILY SELECTED
#############################################
echo "<section class=\"6u 12u(narrower)\">";
echo "<h3>Family selected</h3>";
if ($_SESSION["family"] == "entiredatabase" || $_SESSION["family"] == "") { // If the "Entire Database" option has been selected on the family page or nothing was selected because the database doesn't include a pedigree, print this
echo "<p>Entire Database</p>";
} elseif ($_SESSION["family"] != "entiredatabase" && $_SESSION["family"] != "") { // If there a family has been selected, print it's name
echo "<p>".$_SESSION["family"]."</p>";
}
echo "</section>";
echo "</div>";
echo "<form action=\"actions/action_run_query\" method=\"post\">";
echo "<div class=\"row\">";
// Extract gene lists from the database
$gene_lists = fetch_gene_lists();
// Extract GE PanelApp panels from the database
$ge_panelapp_panels = fetch_panel_counts_ge_panelapp();
#############################################
# ONLY SEARCH GENOMIC LOCATIONS
#############################################
echo "<section class=\"6u 12u(narrower)\">";
echo "<h3>Inclusion genomic location(s)</h3>";
######################
echo "<h4>Search region(s)</h4>";
$input_search_regions = "<input type=\"text\" name=\"regions\" "; # Start of the box
if ($_SESSION["regions"] != "") { # If the form has already been submitted, retain the values
$input_search_regions .= "value=\"".$_SESSION["regions"]."\">";
} else {
$input_search_regions .= "placeholder=\"e.g. chr2:15483-25583;chr1:37211-67824;chr5;MT\">";
}
echo $input_search_regions; # Print the box
echo "<p class=\"query_label\">Separate multiple regions to search with a <strong>semicolon</strong>. To search all regions, leave this box blank. Any genes specified will be restricted to these coordinates.</p>";
######################
echo "<h4>Search gene list(s)</h4>";
echo "<select name=\"gene_list_selection[]\" id=\"gene_list_selection\" style=\"display: inline;\" size=\"5\" multiple=\"multiple\">";
// If gene lists were fetched from the DB
if ($gene_lists !== false) {
foreach (array_keys($gene_lists) as $gene_list_name) {
// If the current option was previously selected, make it selected
if (is_array($_SESSION["gene_list_selection"]) && in_array($gene_list_name, $_SESSION["gene_list_selection"])) {
echo "<option value=\"".$gene_list_name."\" selected>".$gene_list_name." (".$gene_lists[$gene_list_name].")</option>";
} else {
echo "<option value=\"".$gene_list_name."\">".$gene_list_name." (".$gene_lists[$gene_list_name].")</option>";
}
}
echo "</select>";
echo "<p style=\"padding: 0em 0.5em 0em 0.5em;\" class=\"button\" onclick=\"$('#gene_list_selection option:selected').removeAttr('selected');\">Clear</p>";
} else {
echo "</select>"; // Need to close select in order to print error
error("Could not extract gene lists from the database.");
}
######################
echo "<h4>Genomics England PanelApp Panels</h4>";
echo "<select name=\"panelapp_panel_selection\" id=\"panelapp_panel_selection\">";
echo "<option value=\"None\"";
// If no panel has been previously selected, show the default value
if (!isset($_SESSION["panelapp_panel_selection"]) || $_SESSION["panelapp_panel_selection"] == "None" || $_SESSION["panelapp_panel_selection"] == "") {
echo " selected";
}
echo ">Click to select a panel</option>";
// If PanelApp panels were fetched from the DB
if ($ge_panelapp_panels !== false) {
foreach (array_keys($ge_panelapp_panels) as $ge_panelapp_panel_name) {
foreach (array_keys($ge_panelapp_panels[$ge_panelapp_panel_name]) as $ge_panelapp_confidence) {
// Only interested in high and highmoderate evidence levels
if (!in_array($ge_panelapp_confidence, array("HighEvidence", "HighModerateEvidence"))) {
continue;
}
echo "<option value=\"".$ge_panelapp_panel_name."-".$ge_panelapp_confidence."\"";
if (isset($_SESSION["panelapp_panel_selection"]) && $_SESSION["panelapp_panel_selection"] == $ge_panelapp_panel_name."-".$ge_panelapp_confidence) {
echo " selected";
}
echo ">".$ge_panelapp_panel_name." - ".$ge_panelapp_confidence." (".$ge_panelapp_panels[$ge_panelapp_panel_name][$ge_panelapp_confidence].")</option>";
}
}
echo "</select>";
} else {
echo "</select>"; // Need to close select in order to print error
error("Could not extract GE PanelApp panels from the database.");
}
echo "<p style=\"padding: 0em 0.5em 0em 0.5em;\" class=\"button\" onclick=\"$('#panelapp_panel_selection option:selected').removeAttr('selected');\">Clear</p>";
######################
echo "<h4>Search custom gene list</h4>";
$input_search_genes = "<input type=\"text\" name=\"genes\" ";
if ($_SESSION["gene_list"] != "") { # If the form has already been submitted, retain the values
$input_search_genes .= "value=\"".$_SESSION["gene_list"]."\">";
} else {
$input_search_genes .= "placeholder=\"e.g. BRCA1;PIK3CA;TP53\">";
}
echo $input_search_genes; # Print the box
echo "<p class=\"query_label\">Separate multiple genes with a semicolon, comma or space. To search all genes, leave this box blank.</p>";
echo "</section>";
#############################################
# EXCLUDE GENOMIC LOCATIONS
#############################################
echo "<section class=\"6u 12u(narrower)\">";
echo "<h3>Exclusion genomic location(s)</h3>";
######################
echo "<h4>Exclude region(s)</h4>";
$input_exclude_regions = "<input type=\"text\" name=\"exclude_regions\" "; # Start of the box
if ($_SESSION["exclude_regions"] != "") { # If the form has already been submitted, retain the values
$input_exclude_regions .= "value=\"".$_SESSION["exclude_regions"]."\">";
} else {
$input_exclude_regions .= "placeholder=\"e.g. chr2:15483-25583;chr1:37211-67824;chr5;MT\">";
}
echo $input_exclude_regions; # Print the box
echo "<p class=\"query_label\">Separate multiple regions to exclude with a <strong>semicolon</strong>. To search all regions, leave this box blank. Any genes specified will be restricted to these coordinates.</p>";
######################
echo "<h4>Exclude gene list(s)</h4>";
echo "<select name=\"gene_list_exclusion_selection[]\" id=\"gene_list_exclusion_selection\" style=\"display: inline;\" size=\"5\" multiple=\"multiple\">";
// If gene lists were fetched from the DB
if ($gene_lists !== false) {
foreach (array_keys($gene_lists) as $gene_list_name) {
// If the current option was previously selected, make it selected
if (is_array($_SESSION["gene_list_exclusion_selection"]) && in_array($gene_list_name, $_SESSION["gene_list_exclusion_selection"])) {;
echo "<option value=\"".$gene_list_name."\" selected>".$gene_list_name." (".$gene_lists[$gene_list_name].")</option>";
} else {
echo "<option value=\"".$gene_list_name."\">".$gene_list_name." (".$gene_lists[$gene_list_name].")</option>";
}
}
echo "</select>";
echo "<p style=\"padding: 0em 0.5em 0em 0.5em;\" class=\"button\" onclick=\"$('#gene_list_exclusion_selection option:selected').removeAttr('selected');\">Clear</p>";
} else {
echo "</select>"; // Need to close select in order to print error
error("Could not extract gene lists from the database.");
}
######################
echo "<h4>Genomics England PanelApp Panels</h4>";
echo "<select name=\"panelapp_panel_exclusion_selection\" id=\"panelapp_panel_exclusion_selection\">";
echo "<option value=\"None\"";
// If no panel has been previously selected, show the default value
if (!isset($_SESSION["panelapp_panel_exclusion_selection"]) || $_SESSION["panelapp_panel_exclusion_selection"] == "None" || $_SESSION["panelapp_panel_exclusion_selection"] == "") {
echo " selected";
}
echo ">Click to select a panel</option>";
// If PanelApp panels were fetched from the DB
if ($ge_panelapp_panels !== false) {
foreach (array_keys($ge_panelapp_panels) as $ge_panelapp_panel_name) {
foreach (array_keys($ge_panelapp_panels[$ge_panelapp_panel_name]) as $ge_panelapp_confidence) {
// Only interested in high and highmoderate evidence levels
if (!in_array($ge_panelapp_confidence, array("HighEvidence", "HighModerateEvidence"))) {
continue;
}
echo "<option value=\"".$ge_panelapp_panel_name."-".$ge_panelapp_confidence."\"";
if (isset($_SESSION["panelapp_panel_exclusion_selection"]) && $_SESSION["panelapp_panel_exclusion_selection"] == $ge_panelapp_panel_name."-".$ge_panelapp_confidence) {
echo " selected";
}
echo ">".$ge_panelapp_panel_name." - ".$ge_panelapp_confidence." (".$ge_panelapp_panels[$ge_panelapp_panel_name][$ge_panelapp_confidence].")</option>";
}
}
echo "</select>";
} else {
echo "</select>"; // Need to close select in order to print error
error("Could not extract GE PanelApp panels from the database.");
}
echo "<p style=\"padding: 0em 0.5em 0em 0.5em;\" class=\"button\" onclick=\"$('#panelapp_panel_exclusion_selection option:selected').removeAttr('selected');\">Clear</p>";
######################
echo "<h4>Exclude custom gene list</h4>";
$input_exclude_genes = "<input type=\"text\" name=\"exclude_genes\" ";
if ($_SESSION["exclusion_gene_list"] != "") { # If the form has already been submitted, retain the values
$input_exclude_genes .= "value=\"".$_SESSION["exclusion_gene_list"]."\">";
} else {
$input_exclude_genes .= "placeholder=\"e.g. BRCA1;PIK3CA;TP53\">";
}
echo $input_exclude_genes; # Print the box
echo "<p class=\"query_label\">Separate multiple genes with a semicolon, comma or space. To not exclude any genes, leave this box blank.</p>";
echo "</section>";
echo "</div>";
echo "<div class=\"row\">";
#############################################
# VARIANT IMPACT
#############################################
echo "<section class=\"6u 12u(narrower)\">";
echo "<h3>Impact</h3>";
######################
echo "<h4>Restrict variants by impact</h4>";
// Loss of function variants only
echo "<input type=\"radio\" id=\"radiolofimpact\" name=\"variant_impact\" value=\"lof\"";
if ($_SESSION["search_impact"] == "lof") {
echo " checked=\"\">";
} else {
echo ">";
}
echo "<label for=\"radiolofimpact\">Loss of Function</label>";
// High impact variants only
echo "<input type=\"radio\" id=\"radiohighimpact\" name=\"variant_impact\" value=\"high\"";
if ($_SESSION["search_impact"] == "high") {
echo " checked=\"\">";
} else {
echo ">";
}
echo "<label for=\"radiohighimpact\">High Impact</label>";
// Note on disabling "coding" and "all impacts" when an analysis type is selected:
// GEMINI stores genotypes as encoded blobs in the SQLite database, in order to check whether a specific sample is HET/HOM_ALT/HOM_REF, it needs to unpack this field
// Under the right (read: wrong) circumstances, this unpacking has to be carried out on almost every variant in the database which freezes Seave for a long time for the user performing the query
// Examples of where this happens:
// Running an "All Impacts" comp het query with max variants at 1000 which returns all variant across the whole DB and pipes this into the Perl script (100% CPU usage for 20+ minutes, mostly by the Perl script so this could be reduced)
// Running an "All Impacts" dominant query with max variants at 1000 where there are many members in the family (5+) so most of the variants in the database have to be unpacked to find 1000 that match the inheritance pattern (~6 minutes/query)
// Basically, enabling "All Impacts" and "Coding Only" leads to unpredictable behaviour where most queries will still be quick, but some will completely freeze the session and stress the server which makes Seave look bad
// Medium and high impact variants only
echo "<input type=\"radio\" id=\"radiomedhighimpact\" name=\"variant_impact\" value=\"medhigh\"";
// If the impact previously selected is medhigh or no impact has been selected but an analysis type has been selected (this becomes the default option)
if ($_SESSION["search_impact"] == "medhigh" || (($_SESSION["search_impact"] == "" || $_SESSION["search_impact"] == "coding" || $_SESSION["search_impact"] == "all") && $_SESSION["analysis_type"] != "analysis_none")) {
echo " checked=\"\">";
} else {
echo ">";
}
echo "<label for=\"radiomedhighimpact\">High & Medium Impact</label>";
// Coding variants only
echo "<input type=\"radio\" id=\"radiocodingimpact\" name=\"variant_impact\" value=\"coding\"";
// Only check the box if the search impact type has been previously selected and the analysis type is empty
if ($_SESSION["search_impact"] == "coding" && ($_SESSION["analysis_type"] == "analysis_none" || $_SESSION["analysis_type"] == "")) {
echo " checked=\"\">";
// Disable if an analysis type has been selected
} elseif ($_SESSION["analysis_type"] != "analysis_none" && $_SESSION["analysis_type"] != "") {
echo " disabled=\"\">";
} else {
echo ">";
}
echo "<label for=\"radiocodingimpact\">Coding</label>";
// All impacts
echo "<input type=\"radio\" id=\"radioallimpacts\" name=\"variant_impact\" value=\"all\"";
// Only check the box if the search impact has not been previously set, or has been set to all, and no analysis type has been supplied
if (($_SESSION["search_impact"] == "" || $_SESSION["search_impact"] == "all") && ($_SESSION["analysis_type"] == "analysis_none" || $_SESSION["analysis_type"] == "")) {
echo " checked=\"\">";
// Disable if an analysis type has been selected
} elseif ($_SESSION["analysis_type"] != "analysis_none" && $_SESSION["analysis_type"] != "") {
echo " disabled=\"\">";
} else {
echo ">";
}
echo "<label for=\"radioallimpacts\">All Impacts</label>";
######################
// If the form has already been submitted, retain the value
if ($_SESSION["min_cadd"] != "") {
$default_scaled_cadd_score = $_SESSION["min_cadd"];
// Determine the default value from the config file
} elseif (isset($GLOBALS["configuration_file"]["default_query_parameters"]["default_scaled_cadd_score"]) && is_numeric($GLOBALS["configuration_file"]["default_query_parameters"]["default_scaled_cadd_score"])) {
$default_scaled_cadd_score = $GLOBALS["configuration_file"]["default_query_parameters"]["default_scaled_cadd_score"];
// Default value if not in config file
} else {
$default_scaled_cadd_score = "0";
}
echo "<h4 style=\"padding-top:20px;\">Minimum scaled CADD score</h4>";
echo "<input type=\"range\" name=\"min_cadd\" id=\"min_cadd\" min=\"0\" max=\"30\" step=\"1\" value=\"".$default_scaled_cadd_score."\" oninput=\"outputUpdateMinCADD(value)\">";
echo "<output for=\"min_cadd\" id=\"mincaddvalue\">".$default_scaled_cadd_score."</output><br />";
echo "<p class=\"query_label\"><strong>All variants without CADD scores are returned.</strong> For no minimum scaled CADD score, set this value to 0.</p>";
echo "<script>"; # Function for updating the real-time slider values
echo "function outputUpdateMinCADD(val) {";
echo "document.querySelector('#mincaddvalue').value = val;";
echo "}";
echo "</script>";
echo "</section>";
echo "<section class=\"6u 12u(narrower)\">";
echo "<h3>Prevalence</h3>";
######################
// If the form has already been submitted, retain the value
if ($_SESSION["1000gmaf"] != "") {
$default_1000g_frequency = $_SESSION["1000gmaf"];
// Determine the default value for 1000G from the config file
} elseif (isset($GLOBALS["configuration_file"]["default_query_parameters"]["default_1000g_frequency"]) && is_numeric($GLOBALS["configuration_file"]["default_query_parameters"]["default_1000g_frequency"])) {
$default_1000g_frequency = $GLOBALS["configuration_file"]["default_query_parameters"]["default_1000g_frequency"];
// Default value if not in config file
} else {
$default_1000g_frequency = "1";
}
// If the form has already been submitted, retain the value
if ($_SESSION["espmaf"] != "") {
$default_esp_frequency = $_SESSION["espmaf"];
// Determine the default value for ESP from the config file
} elseif (isset($GLOBALS["configuration_file"]["default_query_parameters"]["default_esp_frequency"]) && is_numeric($GLOBALS["configuration_file"]["default_query_parameters"]["default_esp_frequency"])) {
$default_esp_frequency = $GLOBALS["configuration_file"]["default_query_parameters"]["default_esp_frequency"];
// Default value if not in config file
} else {
$default_esp_frequency = "1";
}
// If the form has already been submitted, retain the value
if ($_SESSION["exacmaf"] != "") {
$default_exac_frequency = $_SESSION["exacmaf"];
// Determine the default value for ExAC from the config file
} elseif (isset($GLOBALS["configuration_file"]["default_query_parameters"]["default_exac_frequency"]) && is_numeric($GLOBALS["configuration_file"]["default_query_parameters"]["default_exac_frequency"])) {
$default_exac_frequency = $GLOBALS["configuration_file"]["default_query_parameters"]["default_exac_frequency"];
// Default value if not in config file
} else {
$default_exac_frequency = "1";
}
echo "<h4>Frequency in control databases</h4>";
echo "<label for=\"1000gmaf\" style=\"display: inline;\">1000 Genomes</label><br />";
echo "<input type=\"range\" name=\"1000gmaf\" id=\"1000gmaf\" min=\"0\" max=\"10\" step=\"0.1\" value=\"".$default_1000g_frequency."\" oninput=\"document.querySelector('#thousandgenomesmafvalue').value = value;\">";
echo "<output for=\"1000gmaf\" id=\"thousandgenomesmafvalue\">".$default_1000g_frequency."</output>%<br />";
echo "<label for=\"espmaf\" style=\"display: inline;\">ESP</label><br />";
echo "<input type=\"range\" name=\"espmaf\" id=\"espmaf\" min=\"0\" max=\"10\" step=\"0.1\" value=\"".$default_esp_frequency."\" oninput=\"document.querySelector('#espmafvalue').value = value;\">";
echo "<output for=\"espmaf\" id=\"espmafvalue\">".$default_esp_frequency."</output>%<br>";
echo "<label for=\"exacmaf\" style=\"display: inline;\">ExAC</label><br />";
echo "<input type=\"range\" name=\"exacmaf\" id=\"exacmaf\" min=\"0\" max=\"10\" step=\"0.1\" value=\"".$default_exac_frequency."\" oninput=\"document.querySelector('#exacmafvalue').value = value;\">";
echo "<output for=\"exacmaf\" id=\"exacmafvalue\">".$default_exac_frequency."</output>%";
echo "<p class=\"query_label\">Variants will be returned that are either below the allele frequency set or not present in the database. <strong>For no minimum allele frequency, set the value to 0%.</strong></p>";
// Custom dbsnp columns
if ($_SESSION["dbsnp_columns_exist"] == 1) {
if ($_SESSION["exclude_dbsnp_common"] == 1) {
echo "<input type=\"checkbox\" id=\"is_dbsnp_common\" name=\"is_dbsnp_common\" value=\"true\" checked=\"\">";
} else {
echo "<input type=\"checkbox\" id=\"is_dbsnp_common\" name=\"is_dbsnp_common\" value=\"true\">";
}
echo "<label for=\"is_dbsnp_common\">Exclude dbSNP Common</label>";
if ($_SESSION["exclude_dbsnp_flagged"] == 1) {
echo "<input type=\"checkbox\" id=\"is_dbsnp_flagged\" name=\"is_dbsnp_flagged\" value=\"true\" checked=\"\">";
} else {
echo "<input type=\"checkbox\" id=\"is_dbsnp_flagged\" name=\"is_dbsnp_flagged\" value=\"true\">";
}
echo "<label for=\"is_dbsnp_flagged\">Exclude dbSNP Flagged</label>";
}
echo "</section>";
echo "</div>";
echo "<div class=\"row\">";
#############################################
# VARIANT QUALITY
#############################################
echo "<section class=\"6u 12u(narrower)\">";
echo "<h3>Quality</h3>";
######################
// If the form has already been submitted, retain the value
if ($_SESSION["min_seq_depth"] != "") {
$default_sequencing_depth = $_SESSION["min_seq_depth"];
// Determine the default value from the config file
} elseif (isset($GLOBALS["configuration_file"]["default_query_parameters"]["default_sequencing_depth"]) && is_numeric($GLOBALS["configuration_file"]["default_query_parameters"]["default_sequencing_depth"])) {
$default_sequencing_depth = $GLOBALS["configuration_file"]["default_query_parameters"]["default_sequencing_depth"];
// Default value if not in config file
} else {
$default_sequencing_depth = "0";
}
echo "<h4>Minimum sequencing depth in all samples selected</h4>";
echo "<input type=\"range\" name=\"min_seq_depth\" id=\"min_seq_depth\" min=\"0\" max=\"100\" step=\"10\" value=\"".$default_sequencing_depth."\" oninput=\"outputUpdateNumSeqDepth(value)\">";
echo "<output for=\"min_seq_depth\" id=\"numminseqdepthvalue\">".$default_sequencing_depth."</output><br />";
echo "<p class=\"query_label\">For no minimum sequencing depth, set this value to 0.</p>";
echo "<script>"; # Function for updating the real-time slider values
echo "function outputUpdateNumSeqDepth(val) {";
echo "document.querySelector('#numminseqdepthvalue').value = val;";
echo "}";
echo "</script>";
######################
// If the form has already been submitted, retain the value
if ($_SESSION["min_qual"] != "") {
$default_minimum_variant_quality = $_SESSION["min_qual"];
// Determine the default value from the config file
} elseif (isset($GLOBALS["configuration_file"]["default_query_parameters"]["default_minimum_variant_quality"]) && is_numeric($GLOBALS["configuration_file"]["default_query_parameters"]["default_minimum_variant_quality"])) {
$default_minimum_variant_quality = $GLOBALS["configuration_file"]["default_query_parameters"]["default_minimum_variant_quality"];
// Default value if not in config file
} else {
$default_minimum_variant_quality = "0";
}
echo "<h4>Minimum variant quality</h4>";
echo "<input type=\"range\" name=\"min_qual\" id=\"min_qual\" min=\"0\" max=\"1000\" step=\"20\" value=\"".$default_minimum_variant_quality."\" oninput=\"outputUpdateMinQual(value)\">";
echo "<output for=\"min_qual\" id=\"minqualvalue\">".$default_minimum_variant_quality."</output><br />";
echo "<p class=\"query_label\">For no minimum variant quality, set this value to 0.</p>";
echo "<script>"; # Function for updating the real-time slider values
echo "function outputUpdateMinQual(val) {";
echo "document.querySelector('#minqualvalue').value = val;";
echo "}";
echo "</script>";
######################
// If the form has already been submitted, retain the value
if ($_SESSION["exclude_failed_variants"] != "") {
$default_exclude_failed_variants = $_SESSION["exclude_failed_variants"];
// Determine the default value from the config file
} elseif (isset($GLOBALS["configuration_file"]["default_query_parameters"]["default_exclude_failed_variants"]) && $GLOBALS["configuration_file"]["default_query_parameters"]["default_exclude_failed_variants"] == 1) {
$default_exclude_failed_variants = 1;
// Default value if not in config file
} else {
$default_exclude_failed_variants = 0;
}
echo "<input type=\"checkbox\" id=\"exclude_failed_variants\" name=\"exclude_failed_variants\" value=\"true\"";
// If the form has not been submitted yet, has been submitted as true or is in the config file as true
if ($default_exclude_failed_variants == 1) {
echo " checked=\"\">";
} else {
echo ">";
}
echo "<label for=\"exclude_failed_variants\">Exclude Failed Variants</label>";
######################
echo "</section>";
#############################################
# VARIANT TYPES
#############################################
echo "<section class=\"6u 12u(narrower)\">";
echo "<h3>Variant type(s)</h3>";
if ($_SESSION["search_variant_type"] == "snp") {
echo "<input type=\"radio\" id=\"radiosnp\" name=\"variant_type\" value=\"snp\" checked=\"\">";
echo "<label for=\"radiosnp\">SNPs</label>";
} else {
echo "<input type=\"radio\" id=\"radiosnp\" name=\"variant_type\" value=\"snp\">";
echo "<label for=\"radiosnp\">SNPs</label>";
}
if ($_SESSION["search_variant_type"] == "indel") {
echo "<input type=\"radio\" id=\"radioindel\" name=\"variant_type\" value=\"indel\" checked=\"\">";
echo "<label for=\"radioindel\">INDELs</label>";
} else {
echo "<input type=\"radio\" id=\"radioindel\" name=\"variant_type\" value=\"indel\">";
echo "<label for=\"radioindel\">INDELs</label>";
}
if ($_SESSION["search_variant_type"] == "" || $_SESSION["search_variant_type"] == "both") {
echo "<input type=\"radio\" id=\"radioboth\" name=\"variant_type\" value=\"both\" checked=\"\">";
echo "<label for=\"radioboth\">Both</label>";
} else {
echo "<input type=\"radio\" id=\"radioboth\" name=\"variant_type\" value=\"both\">";
echo "<label for=\"radioboth\">Both</label>";
}
######################
// Determine the maximum value from the config file
if (isset($GLOBALS["configuration_file"]["default_query_parameters"]["max_short_variants_to_return"]) && is_numeric($GLOBALS["configuration_file"]["default_query_parameters"]["max_short_variants_to_return"])) {
$max_short_variants_to_return = $GLOBALS["configuration_file"]["default_query_parameters"]["max_short_variants_to_return"];
// Default value
} else {
$max_short_variants_to_return = "1000";
}
// If the form has already been submitted, retain the value
if ($_SESSION["return_num_variants"] != "") {
$default_short_variants_to_return = $_SESSION["return_num_variants"];
// Determine the default value from the config file
} elseif (isset($GLOBALS["configuration_file"]["default_query_parameters"]["default_short_variants_to_return"]) && is_numeric($GLOBALS["configuration_file"]["default_query_parameters"]["default_short_variants_to_return"])) {
$default_short_variants_to_return = $GLOBALS["configuration_file"]["default_query_parameters"]["default_short_variants_to_return"];
// Default value if not in config file
} else {
$default_short_variants_to_return = "200";
}
echo "<h3 style=\"padding-top:20px;\">Maximum number of variants to return</h3>";
echo "<input type=\"range\" name=\"num_variants\" id=\"num_variants\" min=\"25\" max=\"".$max_short_variants_to_return."\" step=\"25\" value=\"".$default_short_variants_to_return."\" oninput=\"outputUpdateNumVariants(value)\">";
echo "<output for=\"num_variants\" id=\"numvariantsvalue\">".$default_short_variants_to_return."</output>";
echo "<script>"; # Function for updating the real-time slider values
echo "function outputUpdateNumVariants(val) {";
echo "document.querySelector('#numvariantsvalue').value = val;";
echo "}";
echo "</script>";
echo "</section>";
echo "</div>";
######################
echo "<br><input type=\"submit\" value=\"Launch query\">";
######################
echo "</form>";
if ($_SESSION["hasped"] == "Yes") { // Only display the back button (to the analysis selection page) when pedigree information is present
echo "<br><a href=\"analysis_selection\" class=\"button\" style=\"padding: 0.4em 1em 0.4em 1em;\">Back to family and analysis selection</a><br>";
}
echo "<br><a href=\"databases?restart=true\" class=\"button\" style=\"padding: 0.4em 1em 0.4em 1em;\">Start over</a>";
}
?>
</article>
</div>
</div>
<?php
require 'html_footer.php';
?>