Skip to content
Permalink
Browse files

Implemented copy number restriction for all GBS queries except for RO…

…Hmer.
  • Loading branch information...
VelNZ committed Mar 6, 2018
1 parent f821a64 commit 6e332375ab2fcdab9ce68d1b93039be815939783
@@ -19,13 +19,21 @@
}
#############################################
# CAPTURE THE ANALYSIS TYPE AND FAMILY NAME
# CAPTURE THE SUBMITTED VALUES
#############################################
$_SESSION["gbs_analysis_type"] = htmlspecialchars($_POST[preg_replace("/\s/", "_", $_POST["family"])."analysis_type"], ENT_QUOTES, 'UTF-8');
$_SESSION["gbs_family"] = htmlspecialchars($_POST["family"], ENT_QUOTES, 'UTF-8');
if (isset($_POST["cngreaterthan"]) && is_numeric($_POST["cngreaterthan"])) {
$_SESSION["gbs_cngreaterthan"] = htmlspecialchars($_POST["cngreaterthan"], ENT_QUOTES, 'UTF-8');
}
if (isset($_POST["cnlessthan"]) && is_numeric($_POST["cnlessthan"])) {
$_SESSION["gbs_cnlessthan"] = htmlspecialchars($_POST["cnlessthan"], ENT_QUOTES, 'UTF-8');
}
#############################################
# EXTRACT FAMILIAL INFORMATION FOR THE DB
#############################################
@@ -55,7 +55,7 @@
#############################################
// 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=\"javascript:showfamily('family_info_entiredatabase');\"";
echo "<input type=\"radio\" id=\"family_entiredatabase\" name=\"family\" value=\"entiredatabase\" onclick=\"showfamily('family_info_entiredatabase');\"";
if ($_SESSION["family"] == "" || $_SESSION["family"] == "entiredatabase") {
echo " checked>";
} elseif ($_SESSION["family"] != "") {
@@ -67,7 +67,7 @@
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) {
echo "<input type=\"radio\" id=\"family_".$family_id."\" name=\"family\" value=\"".$family_id."\" onclick=\"javascript:showfamily('family_info_$family_id');\"";
echo "<input type=\"radio\" id=\"family_".$family_id."\" name=\"family\" value=\"".$family_id."\" onclick=\"showfamily('family_info_$family_id');\"";
if ($_SESSION["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 {
@@ -30,6 +30,8 @@ default_esp_frequency=1
default_sequencing_depth=0
default_minimum_variant_quality=0
default_exclude_failed_variants=true
default_gbs_cnlessthan=1.5
default_gbs_cngreaterthan=2.5

[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)
@@ -1016,7 +1016,7 @@ function mysql_integration($result) {
######################
// Create the SQL to query the GBS for all blocks overlapping with the temporary query coordinates table
$sql_GBS = query_blocks_by_position_gbs(count($samples_to_query), "all");
$sql_GBS = query_blocks_by_position_gbs(count($samples_to_query), "all", "do_not_restrict_cn");
// Populate the GBS query parameters
foreach ($samples_to_query as $sample) {
@@ -108,7 +108,7 @@ function analysis_type_method_overlaps_gbs($samples_to_query) {
$sql_GBS_temporary = create_temporary_query_coordinates_table_gbs($total_block_count_to_search);
// Create the SQL to query the GBS for all blocks overlapping with the temporary query coordinates table
$sql_GBS = query_blocks_by_position_gbs(1, "all");
$sql_GBS = query_blocks_by_position_gbs(1, "all", "do_not_restrict_cn"); // CN already restricted by write_samples_methods_to_beds()
// Populate the GBS query parameters (only 1 sample)
$query_parameters_GBS[] = $sample_name;
@@ -342,7 +342,7 @@ function analysis_type_sample_overlaps_gbs($samples_to_query, $methods_to_query)
$sql_GBS_temporary = create_temporary_query_coordinates_table_gbs($total_block_count_to_search);
// Create the SQL to query the GBS for all blocks overlapping with the temporary query coordinates table
$sql_GBS = query_blocks_by_position_gbs(count($samples_to_query), $method_name);
$sql_GBS = query_blocks_by_position_gbs(count($samples_to_query), $method_name, "do_not_restrict_cn"); // CN already restricted by write_samples_methods_to_beds()
// Populate the GBS query parameters
foreach ($samples_to_query as $sample) {
@@ -958,7 +958,7 @@ function analysis_type_rohmer_gbs(array $affected_samples_to_query, array $unaff
$sql_GBS_temporary = create_temporary_query_coordinates_table_gbs($total_block_count_to_search);
// Create the SQL to query the GBS for all blocks overlapping with the temporary query coordinates table
$sql_GBS = query_blocks_by_position_gbs(count($affected_samples_to_query), "ROHmer");
$sql_GBS = query_blocks_by_position_gbs(count($affected_samples_to_query), "ROHmer", "do_not_restrict_cn"); // No CN for this data so no need to restrict
// Populate the GBS query parameters
foreach ($affected_samples_to_query as $sample) {
@@ -1102,13 +1102,21 @@ function analysis_type_genomic_coordinates_gbs(array $samples_to_query) {
// Create the SQL to create a temporary table containing all GBS query coordinates
$sql_GBS_temporary = create_temporary_query_coordinates_table_gbs($total_block_count_to_search);
// Create the SQL to query the GBS for all blocks overlapping with the temporary query coordinates table
$sql_GBS = query_blocks_by_position_gbs(count($samples_to_query), "all");
// Populate the GBS query parameters
foreach ($samples_to_query as $sample) {
$query_parameters_GBS[] = $sample;
}
// Create the SQL to query the GBS for all blocks overlapping with the temporary query coordinates table
// If the user specified a numeric copy number restriction
if (is_numeric($_SESSION["gbs_cngreaterthan"]) && is_numeric($_SESSION["gbs_cnlessthan"])) {
$sql_GBS = query_blocks_by_position_gbs(count($samples_to_query), "all", "restrict_cn");
// Add in the copy number restriction parameters
array_push($query_parameters_GBS, $_SESSION["gbs_cnlessthan"], $_SESSION["gbs_cngreaterthan"]);
} else {
$sql_GBS = query_blocks_by_position_gbs(count($samples_to_query), "all", "do_not_restrict_cn"); // CN not specified in a way it can be restricted
}
######################
@@ -1339,7 +1347,7 @@ function analysis_type_gene_lists_gbs(array $gene_list, array $samples_to_query)
$sql_GBS_temporary = create_temporary_query_coordinates_table_gbs($total_block_count_to_search);
// Create the SQL to query the GBS for all blocks overlapping with the temporary query coordinates table
$sql_GBS = query_blocks_by_position_gbs(1, $merged_intersect_bed_paths[$sample_method_intersect]["method"]);
$sql_GBS = query_blocks_by_position_gbs(1, $merged_intersect_bed_paths[$sample_method_intersect]["method"], "do_not_restrict_cn"); // CN already restricted by write_samples_methods_to_beds()
// Populate the GBS query parameters (only 1 sample and method)
array_push($query_parameters_GBS, $merged_intersect_bed_paths[$sample_method_intersect]["sample"], $merged_intersect_bed_paths[$sample_method_intersect]["method"]);
@@ -6,7 +6,7 @@
# CREATE SQL QUERY STRING TO QUERY THE GBS FOR A GIVEN METHOD AND NUMBER OF SAMPLES
#############################################
function query_blocks_by_position_gbs($num_samples, $method) {
function query_blocks_by_position_gbs($num_samples, $method, $cn_restriction_flag) {
$sql = "SELECT ";
$sql .= "GBS.samples.sample_name, ";
$sql .= "GBS.event_types.event_type, ";
@@ -90,6 +90,23 @@ function query_blocks_by_position_gbs($num_samples, $method) {
$sql .= "GBS.methods.method_name = ?"; // Query method
}
// If a copy number restriction is to be performed
if ($cn_restriction_flag == "restrict_cn") {
$sql .= " AND ";
$sql .= "(";
$sql .= "GBS.block_store.event_cn <= ? ";
$sql .= "OR ";
$sql .= "GBS.block_store.event_cn >= ? ";
$sql .= "OR ";
$sql .= "GBS.block_store.event_cn IS NULL";
$sql .= ")";
}
$sql .= ";";
return $sql;
@@ -181,10 +198,33 @@ function fetch_blocks_for_samples_methods_events_gbs(array $sample_names, array
$sql = substr($sql, 0, -2); // Remove the last ", " that was added above
$sql .= ") ";
}
// If a copy number restriction has been specified
if (is_numeric($_SESSION["gbs_cngreaterthan"]) && is_numeric($_SESSION["gbs_cnlessthan"])) {
$sql .= "AND ";
$sql .= "(";
$sql .= "GBS.block_store.event_cn <= ? ";
$sql .= "OR ";
$sql .= "GBS.block_store.event_cn >= ? ";
$sql .= "OR ";
$sql .= "GBS.block_store.event_cn IS NULL";
$sql .= ") ";
}
$sql .= ";";
$parameter_values = array_merge($sample_names, $method_names, $event_types);
// If a copy number restriction has been specified add the SQL parameters
if (is_numeric($_SESSION["gbs_cngreaterthan"]) && is_numeric($_SESSION["gbs_cnlessthan"])) {
array_push($parameter_values, $_SESSION["gbs_cnlessthan"], $_SESSION["gbs_cngreaterthan"]);
}
$statement = $GLOBALS["mysql_connection"]->prepare($sql);
$statement->execute($parameter_values);
@@ -23,7 +23,9 @@ function clean_session($logout = NULL) {
$_SESSION["gbs_gene_list_selection"] = ""; // 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_cngreaterthan"] = ""; // For most the the analysis types
// Regions for inclusion/exclusion manually entered
$_SESSION["regions"] = "";
@@ -150,21 +150,21 @@
echo "<form action=\"actions/action_import_genome_blocks\" method=\"post\" enctype=\"multipart/form-data\">";
echo "<h4>Select an importation method</h4>";
echo "<input type=\"radio\" id=\"label_cnvnator\" name=\"method\" value=\"CNVnator\" onclick=\"javascript:showdiv('cnvnator');\" checked>";
echo "<input type=\"radio\" id=\"label_cnvnator\" name=\"method\" value=\"CNVnator\" onclick=\"showdiv('cnvnator');\" checked>";
echo "<label for=\"label_cnvnator\">CNVnator</label>";
echo "<input type=\"radio\" id=\"label_lumpy\" name=\"method\" value=\"LUMPY\" onclick=\"javascript:showdiv('lumpy');\">";
echo "<input type=\"radio\" id=\"label_lumpy\" name=\"method\" value=\"LUMPY\" onclick=\"showdiv('lumpy');\">";
echo "<label for=\"label_lumpy\">LUMPY</label>";
echo "<input type=\"radio\" id=\"label_sequenza\" name=\"method\" value=\"Sequenza\" onclick=\"javascript:showdiv('sequenza');\">";
echo "<input type=\"radio\" id=\"label_sequenza\" name=\"method\" value=\"Sequenza\" onclick=\"showdiv('sequenza');\">";
echo "<label for=\"label_sequenza\">Sequenza</label>";
echo "<input type=\"radio\" id=\"label_purple\" name=\"method\" value=\"PURPLE\" onclick=\"javascript:showdiv('purple');\">";
echo "<input type=\"radio\" id=\"label_purple\" name=\"method\" value=\"PURPLE\" onclick=\"showdiv('purple');\">";
echo "<label for=\"label_purple\">PURPLE</label>";
echo "<input type=\"radio\" id=\"label_rohmer\" name=\"method\" value=\"ROHmer\" onclick=\"javascript:showdiv('rohmer');\">";
echo "<input type=\"radio\" id=\"label_rohmer\" name=\"method\" value=\"ROHmer\" onclick=\"showdiv('rohmer');\">";
echo "<label for=\"label_rohmer\">ROHmer</label>";
echo "<input type=\"radio\" id=\"label_varpipesv\" name=\"method\" value=\"VarpipeSV\" onclick=\"javascript:showdiv('varpipesv');\">";
echo "<input type=\"radio\" id=\"label_varpipesv\" name=\"method\" value=\"VarpipeSV\" onclick=\"showdiv('varpipesv');\">";
echo "<label for=\"label_varpipesv\">VarpipeSV</label>";
echo "<input type=\"radio\" id=\"label_manta\" name=\"method\" value=\"Manta\" onclick=\"javascript:showdiv('manta');\">";
echo "<input type=\"radio\" id=\"label_manta\" name=\"method\" value=\"Manta\" onclick=\"showdiv('manta');\">";
echo "<label for=\"label_manta\">Manta</label>";
echo "<input type=\"radio\" id=\"label_cnvkit\" name=\"method\" value=\"CNVkit\" onclick=\"javascript:showdiv('cnvkit');\">";
echo "<input type=\"radio\" id=\"label_cnvkit\" name=\"method\" value=\"CNVkit\" onclick=\"showdiv('cnvkit');\">";
echo "<label for=\"label_cnvkit\">CNVkit</label>";
echo "<br><br>";
Oops, something went wrong.

0 comments on commit 6e33237

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