Skip to content

Commit

Permalink
Adding capability to fetch PanelApp panel names and the number of gen…
Browse files Browse the repository at this point in the history
…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 f6a1965
Show file tree
Hide file tree
Showing 6 changed files with 218 additions and 73 deletions.
12 changes: 6 additions & 6 deletions actions/action_gbs_analysis.php
Expand Up @@ -221,11 +221,11 @@


} elseif ($_SESSION["gbs_analysis_type"] == "svfusions") { } 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) // 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"])) { if (isset($_POST["gbs_gene_list_selection"])) {
$_SESSION["gbs_svfusions_gene_list_selection"] = $_POST["svfusions_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) // If no list was selected reset to nothing (in case some were selected before)
} else { } else {
$_SESSION["gbs_svfusions_gene_list_selection"] = ""; $_SESSION["gbs_gbs_gene_list_selection"] = "";
} }


// Store the manual entry gene list submitted // Store the manual entry gene list submitted
Expand All @@ -236,14 +236,14 @@
} }


// If no gene list was selected and no genes were typed into the manual entry box // 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) // Empty array of genes to search (means all will be searched)
$gene_list_to_search = array(); $gene_list_to_search = array();
// If at least one gene list was selected or genes were typed into the manual entry box // If at least one gene list was selected or genes were typed into the manual entry box
} else { } else {
// If at least one gene list was selected // If at least one gene list was selected
if (isset($_POST["svfusions_gene_list_selection"])) { if (isset($_POST["gbs_gene_list_selection"])) {
$gene_list_to_search = determine_gene_list($_POST["svfusions_gene_list_selection"], $_SESSION["gbs_svfusions_gene_list"]); $gene_list_to_search = determine_gene_list($_POST["gbs_gene_list_selection"], $_SESSION["gbs_svfusions_gene_list"]);
// Otherwise just parse the manual entry list // Otherwise just parse the manual entry list
} else { } else {
$gene_list_to_search = determine_gene_list("", $_SESSION["gbs_svfusions_gene_list"]); $gene_list_to_search = determine_gene_list("", $_SESSION["gbs_svfusions_gene_list"]);
Expand Down
2 changes: 2 additions & 0 deletions config.ini
Expand Up @@ -32,6 +32,8 @@ default_minimum_variant_quality=0
default_exclude_failed_variants=true default_exclude_failed_variants=true
default_gbs_cnlessthan=1.5 default_gbs_cnlessthan=1.5
default_gbs_cngreaterthan=2.5 default_gbs_cngreaterthan=2.5
default_gbs_minblocksize=0
default_gbs_exclude_failed_variants=true


[query_databases] [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) ; 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)
Expand Down
45 changes: 40 additions & 5 deletions functions/gene_list_functions.php
Expand Up @@ -11,7 +11,8 @@ function fetch_gene_lists() {
$sql .= "list_name, "; $sql .= "list_name, ";
$sql .= "(SELECT COUNT(*) FROM KCCG_GENE_LISTS.genes_in_lists WHERE list_id = gene_lists.list_id) AS num_genes "; $sql .= "(SELECT COUNT(*) FROM KCCG_GENE_LISTS.genes_in_lists WHERE list_id = gene_lists.list_id) AS num_genes ";
$sql .= "FROM "; $sql .= "FROM ";
$sql .= "KCCG_GENE_LISTS.gene_lists"; $sql .= "KCCG_GENE_LISTS.gene_lists ";
$sql .= "ORDER BY list_name";
$sql .= ";"; $sql .= ";";


$statement = $GLOBALS["mysql_connection"]->prepare($sql); $statement = $GLOBALS["mysql_connection"]->prepare($sql);
Expand All @@ -22,12 +23,46 @@ function fetch_gene_lists() {
$gene_list[$list["list_name"]] = $list["num_genes"]; $gene_list[$list["list_name"]] = $list["num_genes"];
} }


// If more than 1 gene list was found, sort them naturally return $gene_list;
if (count($gene_list) > 1) { }
array_multisort(array_keys($gene_list), SORT_NATURAL, $gene_list); // Natural sort by gene list name
#############################################
# 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;
} }


############################################# #############################################
Expand Down
3 changes: 1 addition & 2 deletions functions/session_variable_functions.php
Expand Up @@ -20,9 +20,8 @@ function clean_session($logout = NULL) {
$_SESSION["gbs_family"] = ""; $_SESSION["gbs_family"] = "";
$_SESSION["gbs_analysis_type"] = ""; $_SESSION["gbs_analysis_type"] = "";
$_SESSION["gbs_regions"] = ""; // For the genomic coordinates 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_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_svfusions_gene_list"] = ""; // For the SV Fusions analysis type
$_SESSION["gbs_cnlessthan"] = ""; // For most the the analysis types $_SESSION["gbs_cnlessthan"] = ""; // For most the the analysis types
$_SESSION["gbs_cngreaterthan"] = ""; // For most the the analysis types $_SESSION["gbs_cngreaterthan"] = ""; // For most the the analysis types
Expand Down

0 comments on commit f6a1965

Please sign in to comment.