Skip to content
Permalink
Browse files

Tooltip update

  • Loading branch information
csw11004 committed Aug 14, 2015
1 parent 6da2578 commit fc9e4cce20e358e408c5b8b6193349dfdb8ba400
Showing with 22 additions and 25 deletions.
  1. +14 −5 VQI_GenomeBrowser.js
  2. +8 −20 dynamic_loading.php
@@ -995,7 +995,17 @@ function VQI_GenomeBrowser(id, serviceURL) {
selection.qtip({
content: {
text: function(event, api) {
$.ajax({
var min,max;
if(type === "exon"){
min = $( this ).prop("__data__")[0];
max = $( this ).prop("__data__")[1];
}
else
{
min = $( this ).prop("__data__")[indexArray.start];
max = $( this ).prop("__data__")[indexArray.end];
}
return $.ajax({
url: serviceURL,
type: 'POST',
dataType: "json",
@@ -1004,20 +1014,19 @@ function VQI_GenomeBrowser(id, serviceURL) {
"chrom": chrom_curr,
"trackName" : name,
"type" : type,
"xCoordinate" : event.pageX - 60,
"scale": scale,
"min" : min,
"max": max,
'fileHandle': fileHandle
}
})
.then(function(content) {
// Set the tooltip content upon successful retrieval
api.set('content.text', content);
return content;
}, function(xhr, status, error) {
// Upon failure... set the tooltip content to the status and error value
api.set('content.text', status + ': ' + error);
});

return 'Loading...'; // Set some initial text
}
},
position: {
@@ -51,7 +51,7 @@
ajaxReturn($result);
}
else if (isset($_POST["loadTooltip"])){
$result = loadTooltip($_POST["chrom"],$_POST["trackName"], $_POST["type"], $_POST["xCoordinate"],$_POST["scale"],$_POST["fileHandle"]);
$result = loadTooltip($_POST["chrom"],$_POST["trackName"], $_POST["type"], $_POST["min"],$_POST["max"],$_POST["fileHandle"]);
ajaxReturn($result);
}
else {
@@ -499,27 +499,23 @@ function getStartEndTrackData($fileHandles,$name,$chrom){
return $returnArray;
}
function loadTooltip($chrom,$trackName, $type, $xCoordinate, $scale, $fileHandle){
function loadTooltip($chrom,$trackName, $type, $min, $max, $fileHandle){
//return $chrom.$trackName.$type.$xCoordinate.$scale.$fileHandle;
if($trackName == "cpg"){
return loadCPGTooltip($chrom,$type, $xCoordinate,$scale,$fileHandle);
return loadCPGTooltip($chrom,$type, $min,$max,$fileHandle);
}
else if($trackName == 'HG19'){
return loadHG19Tooltip($chrom,$type, $xCoordinate,$scale,$fileHandle);
return loadHG19Tooltip($chrom,$type, $min,$max,$fileHandle);
}
else{
return loadBEDTooltip($chrom,$type, $xCoordinate,$scale,$fileHandle);
return loadBEDTooltip($chrom,$type, $min,$max,$fileHandle);
}
}
function loadCPGTooltip($chrom,$type, $xCoordinate,$scale,$fileHandle){
function loadCPGTooltip($chrom,$type, $min,$max,$fileHandle){
$db_name = $GLOBALS['db_name'];
$link = $GLOBALS['DBlink'];
$min = $xCoordinate*$scale - $scale/2;
$max = $xCoordinate*$scale + $scale/2;
$sql = "SELECT `START`, `END` FROM {$db_name}.{$fileHandle}";
$sql .= " WHERE `CHROM` = '".$chrom."'";
@@ -541,13 +537,9 @@ function loadCPGTooltip($chrom,$type, $xCoordinate,$scale,$fileHandle){
return $type.": ".$compString;
}
function loadHG19Tooltip($chrom,$type, $xCoordinate,$scale,$fileHandle){
function loadHG19Tooltip($chrom,$type, $min,$max,$fileHandle){
$db_name = $GLOBALS['db_name'];
$link = $GLOBALS['DBlink'];
$min = $xCoordinate*$scale - $scale/2;
$max = $xCoordinate*$scale + $scale/2;
$sql = "SELECT `txStart`, `txEnd`, `name2`, `exonStarts`, `exonEnds` FROM {$db_name}.{$fileHandle}";
$sql .= " WHERE `chrom` = '".$chrom."'";
@@ -579,13 +571,9 @@ function loadHG19Tooltip($chrom,$type, $xCoordinate,$scale,$fileHandle){
return $type.": ".$compString;
}
function loadBEDTooltip($chrom,$type, $xCoordinate,$scale,$fileHandle){
function loadBEDTooltip($chrom,$type, $min,$max,$fileHandle){
$db_name = $GLOBALS['db_name'];
$link = $GLOBALS['DBlink'];
$min = $xCoordinate*$scale - $scale/2;
$max = $xCoordinate*$scale + $scale/2;
$sql = "SELECT `CHROM_START`, `CHROM_END`, `GENESYMBOL` FROM {$db_name}.{$fileHandle}";
$sql .= " WHERE `CHROM` = '".$chrom."'";

0 comments on commit fc9e4cc

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