-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathgbs_query.php
executable file
·737 lines (606 loc) · 40.9 KB
/
gbs_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
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
<?php
$body_class = "right-sidebar"; // This page has 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">
<div class="row 150%">
<div class="8u 12u(narrower)">
<!-- Content -->
<article id="content">
<header>
<h2>One or more samples in your database are in the <strong>GBS</strong>.</h2>
<p>You can use the information in the GBS to determine if samples in your database are affected by various genomic events. This can be at specific coordinates, genes or gene lists. You can also determine whether any genomic events overlap for multiple samples.</p>
</header>
<!--<a class="image featured"><img src="images/family.jpg" alt="" /></a>-->
<?php
#############################################
# ERROR HANDLING
#############################################
if_set_display_error("gbs_query_insufficient_data", "No family or analysis type specified for analysis.");
if_set_display_error("gbs_query_cant_fetch_family_information", "Couldn't obtain information for the families in your database.");
if_set_display_error("gbs_query_invalid_family", "The family specified for analysis is not in the database selected.");
if_set_display_error("gbs_query_cant_fetch_overlapping_blocks", "There was a problem fetching overlapping blocks from the GBS.");
if_set_display_error("gbs_query_cant_fetch_rohmer_blocks", "There was a problem running your ROHmer query.");
if_set_display_error("gbs_query_cant_fetch_svfusions_blocks", "There was a problem running your SV Fusions query.");
if_set_display_error("gbs_query_cant_fetch_genomic_coordinates_blocks", "There was a problem running your GBS query for genomic coordinates.");
if_set_display_error("gbs_query_cant_fetch_gene_lists_blocks", "There was a problem running your GBS query for gene lists.");
if_set_display_error("gbs_query_cant_create_output_file", "There was a problem outputting the results from the GBS to an output file.");
if_set_display_error("gbs_query_no_regions_submitted", "You must specify genomic coordinates to filter on.");
if_set_display_error("gbs_query_invalid_search_regions", "The genomic coordinates you submitted are not in the correct format.");
if_set_display_error("gbs_query_no_genes_specified", "You must select one or more gene lists or specify one or more custom genes to search.");
if_set_display_error("gbs_query_cant_determine_gene_list", "There was a problem determining the gene list to search.");
if_set_display_error("gbs_query_cant_determine_missing_genes", "There was a problem determining whether your genes are mapped to coordinates in the GBS.");
if_set_display_error("gbs_query_no_genes_remaining_to_query", "None of the genes you submitted are mapped to coordinates to search in the GBS.");
#############################################
# PROCESS SUBMITTED DATABASE
#############################################
// If a query database was selected on the database page and it doesn't equal the previously queried database
if (isset($_GET["group"], $_GET["query_db"], $_GET["hasped"]) && ($_SESSION["query_group"] != $_GET["group"] || $_SESSION["query_db"] != $_GET["query_db"])) {
// Make sure the user is in the group specified
$user_in_group = is_user_in_group($_SESSION["logged_in"]["email"], $_GET["group"]);
// If the user is in the group, clear all session variables then set the query group, database and hasped status to the one selected on the database page
if ($user_in_group === true) {
session_update_db($_GET["group"], $_GET["query_db"], $_GET["hasped"]);
} else {
error("You do not have access to the group selected.");
}
} elseif ($_SESSION["query_db"] == "") { # If no database was selected
error("You need to select a database before querying the GBS.");
$requirements_failed_flag = 1;
}
#############################################
# EXTRACT GENE LISTS FROM THE DB
#############################################
$gene_lists = fetch_gene_lists();
// Extract GE PanelApp panels from the database
$ge_panelapp_panels = fetch_panel_counts_ge_panelapp();
if ($gene_lists === false || $ge_panelapp_panels === false) {
error("Could not fetch gene lists from the database.");
$requirements_failed_flag = 1;
}
#############################################
# EXTRACT FAMILIAL INFORMATION FOR THE DB
#############################################
if (isset($_SESSION["query_db"], $_SESSION["query_group"]) && $_SESSION["query_db"] != "" && $_SESSION["query_group"] != "") {
$family_info = extract_familial_information($_SESSION["query_group"]."/".$_SESSION["query_db"]);
if ($family_info === false) {
error("Problem extracting familial information for the database.");
$requirements_failed_flag = 1;
}
// Inject an "entiredatabase" family which contains all the samples from the other families - this is needed to print the correct options on the form below
foreach (array_keys($family_info) as $family_name) {
foreach (array_keys($family_info[$family_name]) as $sample_name) {
$family_info["entiredatabase"][$sample_name] = array_merge_recursive($family_info[$family_name][$sample_name]);
}
}
} else {
$requirements_failed_flag = 1;
}
#############################################
// If the correct information was fetched from the various databases
if (!isset($requirements_failed_flag)) {
#############################################
# FETCH GBS PRESENCE INFORMATION FOR THE SAMPLES IN THE DB
#############################################
$GBS_presence = fetch_gbs_samples_presence(array_keys($family_info["entiredatabase"]));
if ($GBS_presence === false) {
error("There was a problem determining whether the samples in the database are in the GBS.");
$requirements_failed_flag = 1;
} elseif (count($GBS_presence) == 0) {
error("None of the samples in your database are in the GBS.");
$requirements_failed_flag = 1;
}
}
#############################################
// If the correct information was fetched from the various databases
if (!isset($requirements_failed_flag)) {
#############################################
# DISPLAY SELECTED DB INFO
#############################################
echo "<h3 style=\"padding-top:10px;\">Database selected</h3>";
echo "<p>".$_SESSION["query_db"]."</p>";
echo "<form action=\"actions/action_gbs_analysis\" method=\"post\">";
echo "<h3 style=\"padding-bottom:10px;\">Select a family to analyse</h3>";
#############################################
# FAMILY SELECTION RADIOS
#############################################
// Print the Entire Dataset option first
// If there has been no family selected before or the entire dataset has already been selected, select the Entire Dataset option
echo "<input type=\"radio\" id=\"family_entiredatabase\" name=\"family\" value=\"entiredatabase\" onclick=\"showfamilygbs('entiredatabase');\"";
if ($_SESSION["gbs_family"] == "" || $_SESSION["gbs_family"] == "entiredatabase") {
echo " checked>";
} else {
echo ">";
}
echo "<label for=\"family_entiredatabase\">Entire Dataset</label>";
// If there is more than one family or there is one but it is not the missing family value of zero
if (count(array_keys($family_info)) > 1 || (count(array_keys($family_info)) == 1 && !isset($family_info[0]))) {
// Go through every family
foreach (array_keys($family_info) as $family_id) {
// Skip the entire database option as it was already printed above
if ((string) $family_id == "entiredatabase") {
continue;
}
echo "<input type=\"radio\" id=\"family_".$family_id."\" name=\"family\" value=\"".$family_id."\" onclick=\"showfamilygbs('$family_id');\"";
if ($_SESSION["gbs_family"] == (string) $family_id) { # If this is the family previously selected, mark the radio as checked to correspond with the family information below (the (string) forces the family name to be treated as a string which prevents "entiredatabase" being equal to int(0) and the wrong family being selected when one of the families is names zero
echo " checked>";
} else {
echo ">";
}
echo "<label for=\"family_".$family_id."\">";
if ($family_id == "None") {
echo "No Family Specified";
} else {
echo $family_id;
}
echo "</label>";
}
}
#############################################
# FAMILY COMPOSITION AND AFFECTED STATUS INFO
#############################################
echo "<h3 style=\"padding-top:20px; padding-bottom:10px;\">Family information</h3>";
// Go through every family
foreach (array_keys($family_info) as $family_id) {
$family_affected_status = family_affected_status($family_info[$family_id]); # Extract the affected and unaffected samples
#############################################
# PRINT FAMILY INFORMATION
#############################################
echo "<div class=\"families\" id=\"".$family_id."\"";
// If the current family is the entire database and either no family has been previously selected for analysis or no family has been selected at all, show this div
if ((string) $family_id == "entiredatabase" && ($_SESSION["gbs_family"] == "" || $_SESSION["gbs_family"] == "entiredatabase")) {
echo ">";
// If this family was previously selected, display its info immediately, otherwise hide it (the (string) forces the family name to be treated as a string which prevents "entiredatabase" being equal to int(0) and the wrong family being selected when one of the families is names zero
} elseif ($_SESSION["gbs_family"] == (string) $family_id) {
echo ">";
} else {
echo " style=\"display: none\">";
}
// Do not print family information for the entire database - this can be way too long
if ((string) $family_id == "entiredatabase") {
echo "Not applicable.";
// Do print family information for individual families
} else {
foreach (array_keys($family_info[$family_id]) as $sample_name) {
echo $sample_name;
// Print the gender of the sample
if ($family_info[$family_id][$sample_name]["sex"] == "1") {
echo " (Male)";
} elseif ($family_info[$family_id][$sample_name]["sex"] == "2") {
echo " (Female)";
} else {
echo " (Unknown Gender)";
}
// Print the affected status of the sample
if (is_affected($family_info[$family_id][$sample_name]["phenotype"])) {
echo " - Affected";
} elseif (is_unaffected($family_info[$family_id][$sample_name]["phenotype"])) {
echo " - Unaffected";
} elseif (is_unknown_phenotype($family_info[$family_id][$sample_name]["phenotype"])) {
echo " - Unknown";
}
// Print the GBS methods for the sample
if (isset($GBS_presence[$sample_name])) {
echo " - <span class=\"gbs_present\">".implode("</span> <span class=\"gbs_present\">", array_keys($GBS_presence[$sample_name]["methods"]))."</span><br>";
} else {
echo " - <span class=\"gbs_absent\">No GBS Method(s)</span><br>";
}
}
}
echo "<p style=\"padding-top:6px; font-style:italic;\"><strong>Please ensure this information is correct before proceeding.</strong></p>";
#############################################
# DEFINE ANALYSIS TYPES
#############################################
// Enable/disable each analysis type for the current family by default
$analysis_types["gene_lists"] = 1;
$analysis_types["sample_overlaps"] = 0;
$analysis_types["method_overlaps"] = 0;
$analysis_types["genomic_coordinates"] = 1;
$analysis_types["rohmer"] = 0;
$analysis_types["svfusions"] = 0;
// Note: when adding a new analysis type, make sure to add it to html_footer.php to correctly show descriptions and query options for selected analysis types
#############################################
# DETERMINE WHETHER ANALYSIS TYPES ARE APPROPRIATE FOR THE FAMILY
#############################################
// Conditions to enable the sample overlaps analysis - 2+ samples in the family with the same method
foreach (array_keys($family_info[$family_id]) as $sample_one) {
foreach (array_keys($family_info[$family_id]) as $sample_two) {
// Don't want to compare the same sample against itself
if ($sample_one == $sample_two) {
continue;
}
// If both samples are in the GBS and the sample overlaps analysis has not been enabled yet
if ($analysis_types["sample_overlaps"] == 0 && isset($GBS_presence[$sample_one]) && isset($GBS_presence[$sample_two])) {
// Go through the first sample's methods
foreach (array_keys($GBS_presence[$sample_one]["methods"]) as $sample_one_method) {
// Check if the method is also present for the second sample
if (in_array($sample_one_method, array_keys($GBS_presence[$sample_two]["methods"]))) {
$analysis_types["sample_overlaps"] = 1;
}
}
}
}
}
// Conditions to enable the method overlaps analysis - at least one sample has more than one method
foreach (array_keys($family_info[$family_id]) as $sample) {
if (isset($GBS_presence[$sample]) && count($GBS_presence[$sample]["methods"]) > 1) {
$analysis_types["method_overlaps"] = 1;
}
}
// Conditions to enable the ROHmer analysis
foreach ($family_affected_status["affected"] as $sample) {
if (isset($GBS_presence[$sample]) && in_array("ROHmer", array_keys($GBS_presence[$sample]["methods"]))) {
$analysis_types["rohmer"] = 1;
}
}
// Conditions to enable the SV fusions analysis - at least one sample had one or more BND/INV events
foreach (array_keys($family_info[$family_id]) as $sample) {
if (isset($GBS_presence[$sample]) && (in_array("BND", array_keys($GBS_presence[$sample]["event_types"])) || in_array("inversion", array_keys($GBS_presence[$sample]["event_types"])))) {
$analysis_types["svfusions"] = 1;
}
}
#############################################
# ANALYSIS TYPE RADIOS
#############################################
echo "<h3 style=\"padding-top:10px; padding-bottom:10px;\">Select an analysis type</h3>";
// Flag for whether each family has data in the GBS
$family_gbs_data_flag = 0;
// Go through each sample in the family and try to find at least one with data in the GBS
foreach (array_keys($family_info[$family_id]) as $sample_name) {
if (isset($GBS_presence[$sample_name])) {
$family_gbs_data_flag = 1;
// Stop the foreach loop as at least one sample in the family has data in the GBS
break;
}
}
// Go through each analysis type and print radio buttons for each one
foreach (array_keys($analysis_types) as $analysis_type) {
echo "<input type=\"radio\" id=\"".$family_id.$analysis_type."\" name=\"".$family_id."analysis_type\" value=\"".$analysis_type."\"";
// Disable all analysis type if no samples in the current family have data in the GBS
if ($family_gbs_data_flag == 0) {
echo " disabled=\"\"";
// Disable analysis types if they have been marked as disabled
} elseif ($analysis_type == "sample_overlaps" && $analysis_types["sample_overlaps"] == 0) {
echo " disabled=\"\"";
} elseif ($analysis_type == "rohmer" && $analysis_types["rohmer"] == 0) {
echo " disabled=\"\"";
} elseif ($analysis_type == "svfusions" && $analysis_types["svfusions"] == 0) {
echo " disabled=\"\"";
} elseif ($analysis_type == "method_overlaps" && $analysis_types["method_overlaps"] == 0) {
echo " disabled=\"\"";
}
// Add onclick javascript events to show analysis descriptions or options and hide/show the CN restriction section based on analysis type
if ($analysis_type == "gene_lists") {
echo " onclick=\"showdiv('lists'); document.getElementById('cnrestriction').style.display = 'block'; document.getElementById('failedvariantsrestriction').style.display = 'block'; document.getElementById('minblocksizerestriction').style.display = 'block'; document.getElementById('genelistrestriction').style.display = 'block';\"";
} elseif ($analysis_type == "sample_overlaps") {
echo " onclick=\"showdiv('sample_overlaps'); document.getElementById('cnrestriction').style.display = 'block'; document.getElementById('failedvariantsrestriction').style.display = 'block'; document.getElementById('minblocksizerestriction').style.display = 'block'; document.getElementById('genelistrestriction').style.display = 'none';\"";
} elseif ($analysis_type == "method_overlaps") {
echo " onclick=\"showdiv('method_overlaps'); document.getElementById('cnrestriction').style.display = 'block'; document.getElementById('failedvariantsrestriction').style.display = 'block'; document.getElementById('minblocksizerestriction').style.display = 'block'; document.getElementById('genelistrestriction').style.display = 'none';\"";
} elseif ($analysis_type == "genomic_coordinates") {
echo " onclick=\"showdiv('positions'); document.getElementById('cnrestriction').style.display = 'block'; document.getElementById('failedvariantsrestriction').style.display = 'block'; document.getElementById('minblocksizerestriction').style.display = 'block'; document.getElementById('genelistrestriction').style.display = 'none';\"";
} elseif ($analysis_type == "rohmer") {
echo " onclick=\"showdiv('rohmer'); document.getElementById('cnrestriction').style.display = 'none'; document.getElementById('failedvariantsrestriction').style.display = 'none'; document.getElementById('minblocksizerestriction').style.display = 'block'; document.getElementById('genelistrestriction').style.display = 'none';\"";
} elseif ($analysis_type == "svfusions") {
echo " onclick=\"showdiv('svfusions'); document.getElementById('cnrestriction').style.display = 'none'; document.getElementById('failedvariantsrestriction').style.display = 'block'; document.getElementById('minblocksizerestriction').style.display = 'none'; document.getElementById('genelistrestriction').style.display = 'block';\"";
}
// Select the current analysis type if it was previously selected or one has not been selected before
if (((string) $family_id == $_SESSION["gbs_family"] && $_SESSION["gbs_analysis_type"] == $analysis_type) || ($_SESSION["gbs_analysis_type"] == "" && $analysis_type == "gene_lists") || ((string) $family_id != $_SESSION["gbs_family"] && $analysis_type == "gene_lists")) {
echo " checked=\"\"";
}
echo ">";
echo "<label for=\"".$family_id.$analysis_type."\">"; // Radio label
if ($analysis_type == "gene_lists") {
echo "Gene List(s)";
} elseif ($analysis_type == "sample_overlaps") {
echo "Sample Overlaps";
} elseif ($analysis_type == "method_overlaps") {
echo "Method Overlaps";
} elseif ($analysis_type == "genomic_coordinates") {
echo "Genomic Coordinates";
} elseif ($analysis_type == "rohmer") {
echo "ROHmer";
} elseif ($analysis_type == "svfusions") {
echo "SV Fusions";
}
echo "</label>";
}
echo "</div>";
}
#############################################
# DESCRIPTIONS AND OPTIONS FOR ANALYSIS TYPES
#############################################
echo "<br>";
// The gene lists selection div
echo "<div class=\"selection\" id=\"lists\"";
// If the gene lists analysis type was previously used or nothing was previously used, display it
if ($_SESSION["gbs_analysis_type"] == "gene_lists" || $_SESSION["gbs_analysis_type"] == "") {
echo ">";
} else {
echo " style=\"display: none;\">";
}
echo "<h3>Description</h3>";
echo "<p>This analysis type lets you find all variants that overlap with your genes of interest by one or more bases. For example, if a variant caller identifies a deletion at coordinates 1:20,000-30,000 and one of your genes of interest is at 1:29,000-45,000, this represents a 1,000bp overlap at 1:29,000-30,000.</p>";
echo "</div>";
######################
// The sample overlapping blocks selection div
echo "<div class=\"selection\" id=\"sample_overlaps\"";
// If the overlapping blocks analysis type was not previously used, hide it
if ($_SESSION["gbs_analysis_type"] == "sample_overlaps") {
echo ">";
} else {
echo " style=\"display: none;\">";
}
echo "<h3>Description</h3>";
echo "<p>This analysis will help you discover locations in the genome where the same variant caller has identified variants that overlap between samples. Overlaps must be by at least 1 base to be returned. For example, if Sample1 has a deletion variant called by Method1 at coordinates 1:20,000-30,0000 and Sample2 has 2 duplication variants called by Method1 at 1:21,000-22,000 and 1:27,000-40,000, this means both of the variants in Sample2 overlap with the 1 variant in Sample1 and will be returned as two overlaps (at 1:21,000-22,000 and 1:27,000-30,000).</p>";
echo "</div>";
######################
// The method overlapping blocks selection div
echo "<div class=\"selection\" id=\"method_overlaps\"";
// If the overlapping blocks analysis type was not previously used, hide it
if ($_SESSION["gbs_analysis_type"] == "method_overlaps") {
echo ">";
} else {
echo " style=\"display: none;\">";
}
echo "<h3>Description</h3>";
echo "<p>This analysis will help you discover locations in the genome where multiple variant callers have independently found variants that overlap with one another in the same sample. Overlaps must be by at least 1 base to be returned. For example, if Sample1 has a deletion variant called by Method1 at coordinates 1:20,000-30,0000 and 2 deletion variants called by Method2 at 1:21,000-24,000 and 1:25,000-40,000, this represents 2 genomic locations where the methods have called overlapping variants (1:20,000-24,000 and 1:25,000-40,000).</p>";
echo "</div>";
######################
// The genomic coordinates blocks selection div
echo "<div class=\"selection\" id=\"positions\"";
// If the overlapping blocks analysis type was not previously used, hide it
if ($_SESSION["gbs_analysis_type"] == "genomic_coordinates") {
echo ">";
} else {
echo " style=\"display: none;\">";
}
echo "<h3>Description</h3>";
echo "<p>This analysis type lets you find all variants that overlap by one or more bases with lists of genomic coordinates that you would like to search.</p>";
echo "<h3>Genomic coordinates</h3>";
echo "<h4>Search region(s)</h4>";
$input_search_regions = "<input type=\"text\" name=\"regions\" "; # Start of the box
if ($_SESSION["gbs_regions"] != "") { # If the form has already been submitted, retain the values
$input_search_regions .= "value=\"".$_SESSION["gbs_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>.</p>";
echo "</div>";
######################
// The ROHmer selection div
echo "<div class=\"selection\" id=\"rohmer\"";
// If the ROHmer analysis type was not previously used, hide it
if ($_SESSION["gbs_analysis_type"] == "rohmer") {
echo ">";
} else {
echo " style=\"display: none;\">";
}
echo "<h3>Description</h3>";
echo "<p>This analysis lets you find regions of homozygosity in affected individuals that are more likely to harbour a pathogenic variant due to consanguinity. These regions are identified by first extracting all shared RoH blocks for all affected samples then subtracting any overlapping regions of homozygosity present in unaffected individuals. The remaining regions of interest are shared by affected individuals and not present in any unaffected individual.</p>";
echo "</div>";
######################
// The SV Fusions selection div
echo "<div class=\"selection\" id=\"svfusions\"";
// If the SV Fusions analysis type was not previously used, hide it
if ($_SESSION["gbs_analysis_type"] == "svfusions") {
echo ">";
} else {
echo " style=\"display: none;\">";
}
echo "<h3>Description</h3>";
echo "<p>This analysis will help you find all variants that have the potential to cause a fusion between a gene and either another gene or an intergenic region of the genome. Select a gene list or enter a manual gene list to restrict your search to specific genes, otherwise don't select anything to search the entire genome.</p>";
echo "</div>";
#############################################
echo "<div class=\"row\" id=\"genelistrestriction\"";
// Hide the gene list restriction if the analysis type used previously was ROHmer or SV Fusions
if (!in_array($_SESSION["gbs_analysis_type"], array("gene_lists", "svfusions", ""))) {
echo " style=\"display: none;\">";
} else {
echo ">";
}
echo "<section class=\"12u 12u(narrower)\">";
echo "<h3>Gene lists</h3>";
echo "<h4>Select one or more gene lists</h4>";
echo "<select name=\"gbs_gene_list_selection[]\" id=\"gbs_gene_list_selection\" style=\"display: inline;\" size=\"10\" multiple=\"multiple\">";
foreach (array_keys($gene_lists) as $gene_list_name) {
// If the current option was previously selected, make it selected
if (is_array($_SESSION["gbs_gene_list_selection"]) && in_array($gene_list_name, $_SESSION["gbs_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=\"$('#gbs_gene_list_selection option:selected').removeAttr('selected');\">Clear</p>";
echo "<h4>Genomics England PanelApp Panels</h4>";
echo "<select name=\"gbs_panelapp_panel_selection\" id=\"gbs_panelapp_panel_selection\">";
echo "<option value=\"None\"";
// If no panel has been previously selected, show the default value
if (!isset($_SESSION["gbs_panelapp_panel_selection"]) || $_SESSION["gbs_panelapp_panel_selection"] == "None" || $_SESSION["gbs_panelapp_panel_selection"] == "") {
echo " selected";
}
echo ">Click to select a panel</option>";
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["gbs_panelapp_panel_selection"]) && $_SESSION["gbs_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>";
echo "<p style=\"padding: 0em 0.5em 0em 0.5em;\" class=\"button\" onclick=\"$('#gbs_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["gbs_gene_list"] != "") { # If the form has already been submitted, retain the values
$input_search_genes .= "value=\"".$_SESSION["gbs_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.</p>";
echo "<br>";
echo "</section>";
echo "</div>";
#############################################
echo "<h3>Further filters</h3>";
#############################################
# GREATER THAN/LESS THAN COPY NUMBER FILTER
#############################################
// If the form has already been submitted, retain the value
if ($_SESSION["gbs_cnlessthan"] != "") {
$default_cn_less_than = $_SESSION["gbs_cnlessthan"];
// Otherwise determine the default value from the config file
} elseif (isset($GLOBALS["configuration_file"]["default_query_parameters"]["default_gbs_cnlessthan"]) && is_numeric($GLOBALS["configuration_file"]["default_query_parameters"]["default_gbs_cnlessthan"])) {
$default_cn_less_than = $GLOBALS["configuration_file"]["default_query_parameters"]["default_gbs_cnlessthan"];
// Or use a default value if not in config file
} else {
$default_cn_less_than = "1.5";
}
// If the form has already been submitted, retain the value
if ($_SESSION["gbs_cngreaterthan"] != "") {
$default_cn_greater_than = $_SESSION["gbs_cngreaterthan"];
// Otherwise determine the default value from the config file
} elseif (isset($GLOBALS["configuration_file"]["default_query_parameters"]["default_gbs_cngreaterthan"]) && is_numeric($GLOBALS["configuration_file"]["default_query_parameters"]["default_gbs_cngreaterthan"])) {
$default_cn_greater_than = $GLOBALS["configuration_file"]["default_query_parameters"]["default_gbs_cngreaterthan"];
// Or use a default value if not in config file
} else {
$default_cn_greater_than = "2.5";
}
echo "<div class=\"row\" id=\"cnrestriction\"";
// Hide the copy number restriction if the analysis type used previously was ROHmer or SV Fusions
if (in_array($_SESSION["gbs_analysis_type"], array("rohmer", "svfusions"))) {
echo " style=\"display: none;\">";
} else {
echo ">";
}
// Less than
echo "<section class=\"6u 12u(narrower)\">";
echo "<label for=\"cnlessthan\" style=\"display: inline;\">Deletion copy number</label><br>";
echo "<input type=\"range\" name=\"cnlessthan\" id=\"cnlessthan\" min=\"0\" max=\"2\" step=\"0.1\" value=\"".$default_cn_less_than."\" oninput=\"document.querySelector('#cnlessthanvalue').value = value;\">";
echo "<output for=\"cnlessthan\" id=\"cnlessthanvalue\">".$default_cn_less_than."</output>";
echo "<p class=\"query_label\">Return deletion variants with a copy number equal to or below this value. <strong>To return all deletion variants, set this value to 2.</strong> All variants with no copy number will be returned.</p>";
echo "</section>";
// Greater than
echo "<section class=\"6u 12u(narrower)\">";
echo "<label for=\"cngreaterthan\" style=\"display: inline;\">Gain copy number</label><br>";
echo "<input type=\"range\" name=\"cngreaterthan\" id=\"cngreaterthan\" min=\"2\" max=\"15\" step=\"0.5\" value=\"".$default_cn_greater_than."\" oninput=\"document.querySelector('#cngreaterthanvalue').value = value;\">";
echo "<output for=\"cngreaterthan\" id=\"cngreaterthanvalue\">".$default_cn_greater_than."</output>";
echo "<p class=\"query_label\">Return amplified variants with a copy number equal to or above this value. <strong>To return all amplified variants, set this value to 2.</strong> All variants with no copy number will be returned.</p>";
echo "</section>";
echo "</div>";
#############################################
# MINIMUM BLOCK SIZE FILTER
#############################################
// If the form has already been submitted, retain the value
if ($_SESSION["gbs_minblocksize"] != "") {
$default_min_block_size = $_SESSION["gbs_minblocksize"];
// Otherwise determine the default value from the config file
} elseif (isset($GLOBALS["configuration_file"]["default_query_parameters"]["default_gbs_minblocksize"]) && is_numeric($GLOBALS["configuration_file"]["default_query_parameters"]["default_gbs_minblocksize"])) {
$default_min_block_size = $GLOBALS["configuration_file"]["default_query_parameters"]["default_gbs_minblocksize"];
// Or use a default value if not in config file
} else {
$default_min_block_size = "0";
}
echo "<div class=\"row\" id=\"minblocksizerestriction\"";
// Hide the block size restriction if the analysis type used previously was SV Fusions
if ($_SESSION["gbs_analysis_type"] == "svfusions") {
echo " style=\"display: none;\">";
} else {
echo ">";
}
echo "<section class=\"6u 12u(narrower)\">";
echo "<label for=\"minblocksize\" style=\"display: inline;\">Minimum block size (bp)</label><br>";
echo "<input type=\"range\" name=\"minblocksize\" id=\"minblocksize\" min=\"0\" max=\"100000\" step=\"1000\" value=\"".$default_min_block_size."\" oninput=\"document.querySelector('#minblocksizevalue').value = value;\">";
echo "<output for=\"minblocksize\" id=\"minblocksizevalue\">".$default_min_block_size."</output>";
echo "<p class=\"query_label\">Perform queries on blocks this size or larger. <strong>To search all block sizes, set this value to 0.</strong></p>";
echo "</section>";
echo "</div>";
#############################################
# EXCLUDE FAILED VARIANTS FILTER
#############################################
// If the form has already been submitted, retain the value
if ($_SESSION["gbs_exclude_failed_variants"] != "") {
$default_exclude_failed_variants = $_SESSION["gbs_exclude_failed_variants"];
// Determine the default value from the config file
} elseif (isset($GLOBALS["configuration_file"]["default_query_parameters"]["default_gbs_exclude_failed_variants"]) && $GLOBALS["configuration_file"]["default_query_parameters"]["default_gbs_exclude_failed_variants"] == 1) {
$default_exclude_failed_variants = 1;
// Default value if not in config file
} else {
$default_exclude_failed_variants = 1;
}
echo "<div class=\"row\"id=\"failedvariantsrestriction\"";
// Hide the exclude failed variants filter if the analysis type used previously was ROHmer
if ($_SESSION["gbs_analysis_type"] == "rohmer") {
echo " style=\"display: none;\">";
} else {
echo ">";
}
echo "<section class=\"6u 12u(narrower)\">";
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>";
echo "</div>";
#############################################
echo "<br>";
echo "<input type=\"submit\" value=\"Launch query\">";
echo "</form>";
echo "<br /><a href=\"databases?restart=true\" style=\"padding: 0.4em 1em 0.4em 1em;\" class=\"button\">Start over</a>";
}
?>
</article>
</div>
<div class="4u 12u(narrower)">
<!-- Sidebar -->
<section id="sidebar">
<section>
<header>
<h3>GBS analyses</h3>
</header>
<p>You can query the GBS in one of three ways for all samples in your database, or for a subset grouped as a family. Ultimately, the goal of these queries is to obtain a list of genomic blocks that match specific criteria for a set of samples.</p>
</section>
<section>
<header>
<h3>Gene list(s)</h3>
</header>
<a class="image featured"><img src="images/GBS_gene_lists.png" style="width: 60%; margin-right: auto;" alt="" /></a>
<p>Querying gene lists will return all blocks for all selected samples that overlap with any of the genes in one or more gene lists specified.</p>
</section>
<section>
<header>
<h3>Overlapping blocks</h3>
</header>
<a class="image featured"><img src="images/GBS_overlapping_blocks.png" style="width: 60%; margin-right: auto;" alt="" /></a>
<p>Blocks will be returned for all selected samples that overlap by one or more bases.</p>
</section>
<section>
<header>
<h3>Genomic coordinates</h3>
</header>
<a class="image featured"><img src="images/GBS_genomic_coordinates.png" style="width: 60%; margin-right: auto;" alt="" /></a>
<p>Querying using coordinates will return blocks for all selected samples where a block overlaps with one or more samples at one or more bases.</p>
</section>
</section>
</div>
</div>
</div>
</div>
<?php
require 'html_footer.php';
?>