Skip to content
Permalink
Browse files

Adding capability to fetch PanelApp panel names and the number of gen…

…es for each confidence level from the DB. Displaying this as a filter option on the short variant and GBS query pages.
  • Loading branch information...
VelNZ committed Mar 27, 2018
1 parent dbbfad0 commit f6a196535732e7b72b15e37736489b461c0934cc
Showing with 218 additions and 73 deletions.
  1. +6 −6 actions/action_gbs_analysis.php
  2. +2 −0 config.ini
  3. +40 −5 functions/gene_list_functions.php
  4. +1 −2 functions/session_variable_functions.php
  5. +88 −60 gbs_query.php
  6. +81 −0 query.php
@@ -221,11 +221,11 @@
} elseif ($_SESSION["gbs_analysis_type"] == "svfusions") {
// Store the lists selected in the multi-select box so they can be restored on the query page (only used for this)
if (isset($_POST["svfusions_gene_list_selection"])) {
$_SESSION["gbs_svfusions_gene_list_selection"] = $_POST["svfusions_gene_list_selection"];
if (isset($_POST["gbs_gene_list_selection"])) {
$_SESSION["gbs_gbs_gene_list_selection"] = $_POST["gbs_gene_list_selection"];
// If no list was selected reset to nothing (in case some were selected before)
} else {
$_SESSION["gbs_svfusions_gene_list_selection"] = "";
$_SESSION["gbs_gbs_gene_list_selection"] = "";
}
// Store the manual entry gene list submitted
@@ -236,14 +236,14 @@
}
// If no gene list was selected and no genes were typed into the manual entry box
if ($_SESSION["gbs_svfusions_gene_list_selection"] == "" && $_SESSION["gbs_svfusions_gene_list"] == "") {
if ($_SESSION["gbs_gbs_gene_list_selection"] == "" && $_SESSION["gbs_svfusions_gene_list"] == "") {
// Empty array of genes to search (means all will be searched)
$gene_list_to_search = array();
// If at least one gene list was selected or genes were typed into the manual entry box
} else {
// If at least one gene list was selected
if (isset($_POST["svfusions_gene_list_selection"])) {
$gene_list_to_search = determine_gene_list($_POST["svfusions_gene_list_selection"], $_SESSION["gbs_svfusions_gene_list"]);
if (isset($_POST["gbs_gene_list_selection"])) {
$gene_list_to_search = determine_gene_list($_POST["gbs_gene_list_selection"], $_SESSION["gbs_svfusions_gene_list"]);
// Otherwise just parse the manual entry list
} else {
$gene_list_to_search = determine_gene_list("", $_SESSION["gbs_svfusions_gene_list"]);
@@ -32,6 +32,8 @@ default_minimum_variant_quality=0
default_exclude_failed_variants=true
default_gbs_cnlessthan=1.5
default_gbs_cngreaterthan=2.5
default_gbs_minblocksize=0
default_gbs_exclude_failed_variants=true

[query_databases]
; Setting any option below to true implies you adhere to the terms of use of the respective data source (e.g. for research use only)
@@ -11,7 +11,8 @@ function fetch_gene_lists() {
$sql .= "list_name, ";
$sql .= "(SELECT COUNT(*) FROM KCCG_GENE_LISTS.genes_in_lists WHERE list_id = gene_lists.list_id) AS num_genes ";
$sql .= "FROM ";
$sql .= "KCCG_GENE_LISTS.gene_lists";
$sql .= "KCCG_GENE_LISTS.gene_lists ";
$sql .= "ORDER BY list_name";
$sql .= ";";
$statement = $GLOBALS["mysql_connection"]->prepare($sql);
@@ -22,12 +23,46 @@ function fetch_gene_lists() {
$gene_list[$list["list_name"]] = $list["num_genes"];
}
// If more than 1 gene list was found, sort them naturally
if (count($gene_list) > 1) {
array_multisort(array_keys($gene_list), SORT_NATURAL, $gene_list); // Natural sort by gene list name
return $gene_list;
}
#############################################
# FETCH GENOMICS ENGLAND PANELAPP GENE COUNTS
#############################################
function fetch_panel_counts_ge_panelapp() {
$ge_panelapp_panels = array();
$sql = "SELECT ";
$sql .= "panels.name, ";
$sql .= "genes_in_panels.confidence_level, ";
$sql .= "COUNT(*) AS num_genes ";
$sql .= "FROM ";
$sql .= "GEPANELAPP.genes_in_panels ";
$sql .= "LEFT JOIN GEPANELAPP.panels ON GEPANELAPP.genes_in_panels.panel_id = GEPANELAPP.panels.id ";
$sql .= "GROUP BY panels.name, genes_in_panels.confidence_level ";
$sql .= "ORDER BY panels.name";
$sql .= ";";
$statement = $GLOBALS["mysql_connection"]->prepare($sql);
$statement->execute();
while ($panels = $statement->fetch()) {
$ge_panelapp_panels[$panels["name"]][$panels["confidence_level"]] = $panels["num_genes"];
}
// Format: $ge_panelapp_panels[<panel name>][<confidence level>] = number of genes
// Go through each panel
foreach (array_keys($ge_panelapp_panels) as $ge_panelapp_panel) {
// If the current panel has both high and moderate evidence genes
if (isset($ge_panelapp_panels[$ge_panelapp_panel]["HighEvidence"], $ge_panelapp_panels[$ge_panelapp_panel]["ModerateEvidence"])) {
// Inject in a new evidence level which combines the high and moderate counts
$ge_panelapp_panels[$ge_panelapp_panel]["HighModerateEvidence"] = $ge_panelapp_panels[$ge_panelapp_panel]["HighEvidence"] + $ge_panelapp_panels[$ge_panelapp_panel]["ModerateEvidence"];
}
}
return $gene_list;
return $ge_panelapp_panels;
}
#############################################
@@ -20,9 +20,8 @@ function clean_session($logout = NULL) {
$_SESSION["gbs_family"] = "";
$_SESSION["gbs_analysis_type"] = "";
$_SESSION["gbs_regions"] = ""; // For the genomic coordinates analysis type
$_SESSION["gbs_gene_list_selection"] = ""; // For the gene list(s) analysis type
$_SESSION["gbs_gene_list_selection"] = ""; // For the GBS gene list selection (regardless of analysis type)
$_SESSION["gbs_gene_list"] = ""; // For the gene list(s) analysis type
$_SESSION["gbs_svfusions_gene_list_selection"] = ""; // For the SV Fusions analysis type
$_SESSION["gbs_svfusions_gene_list"] = ""; // For the SV Fusions analysis type
$_SESSION["gbs_cnlessthan"] = ""; // For most the the analysis types
$_SESSION["gbs_cngreaterthan"] = ""; // For most the the analysis types
Oops, something went wrong.

0 comments on commit f6a1965

Please sign in to comment.
You can’t perform that action at this time.