Skip to content
Permalink
Browse files

Bug fixes

  • Loading branch information
csw11004 committed Oct 11, 2015
1 parent c57eb45 commit e60598c5a9943dd75f3d95f51a57448ebda2d367
Showing with 41 additions and 57 deletions.
  1. +5 −19 VQI_GenomeBrowser.js
  2. +1 −1 VQI_GenomeBrowserDemo.html
  3. +35 −37 dynamic_loading.php
@@ -73,7 +73,7 @@ function VQI_GenomeBrowser(id, serviceURL) {
for (i in trackInfo){

if (trackInfo[i].name == track){
self.addTrack([] , track , trackInfo[i].type , trackInfo[i].args);
self.addTrack(track[i].name , trackInfo[i].type , trackInfo[i].args);
break;
}
}
@@ -227,7 +227,6 @@ function VQI_GenomeBrowser(id, serviceURL) {
},
async: true
}).success(function (data) {
console.log(data);
$("#pvalue_div").empty().append("p-value = " + data);
}).error(function (req, status, error) {
$("body").append(status + ": " + error);
@@ -711,7 +710,6 @@ function VQI_GenomeBrowser(id, serviceURL) {
selectBox.options.length = 0;
var optionIndex = 0;
for (var key in genomes) {
console.log(key)
var text = key;
var value = key;
selectBox.options[optionIndex++] = new Option(text, value);
@@ -751,7 +749,6 @@ function VQI_GenomeBrowser(id, serviceURL) {
for(var key in genomes[genome])
{
this.addTrack(genome+"_"+key, key, genomes[genome][key])
// console.log(genomes[genome][key]);
}
}
}
@@ -769,7 +766,6 @@ function VQI_GenomeBrowser(id, serviceURL) {
}

}).success(function (returnData) {
console.log(returnData);
}
).error(function (req, status, error) {
$("body").append(status + ": " + error);
@@ -1237,7 +1233,6 @@ function VQI_GenomeBrowser(id, serviceURL) {
}

}).success(function (returnData) {
// console.log(returnData);
drawTrack(returnData);
LoadingText.remove();
}
@@ -1290,7 +1285,7 @@ function VQI_GenomeBrowser(id, serviceURL) {
async : false,
data: {
"getRange": "",
"fileHandles": [fileHandle],
"fileHandle": fileHandle,
"type": "cpg",
"chrom": chrom_curr
}
@@ -1372,19 +1367,13 @@ function VQI_GenomeBrowser(id, serviceURL) {

if (exons)
{
trackGroup.selectAll("rect")
.data(data, function (d) {
return d;
})
.exit()
.remove();

trackGroup.selectAll("rect")
.data(exons, function (d) {
return d;
})
.enter()
.append("rect");

trackGroup.selectAll("rect")
.data(exons, function (d) {
return d;
@@ -1503,7 +1492,6 @@ function VQI_GenomeBrowser(id, serviceURL) {
}

}).success(function (returnData) {
// console.log(returnData);
if(returnData.length == 2) {//exons exist

drawTrack(returnData[0], returnData[1]);
@@ -1563,7 +1551,6 @@ function VQI_GenomeBrowser(id, serviceURL) {
}
}).success(function (returnData) {
data = returnData;
console.log(returnData);
data.unshift(["CHROM","CHROM_START","CHROM_END","GENESYMBOL","SCORE","STRAND"]);
}).error(function (req, status, error) {
$("body").append(status + ": " + error);
@@ -1581,7 +1568,7 @@ function VQI_GenomeBrowser(id, serviceURL) {
async : false,
data: {
"getRange": "",
"fileHandles": [fileHandle],
"fileHandle": fileHandle,
"type": "gene",
"chrom": chrom_curr
}
@@ -1815,7 +1802,6 @@ function VQI_GenomeBrowser(id, serviceURL) {
}
}).success(function (returnData) {
data = returnData;
console.log(returnData);
data.unshift(["CHROM","CHROM_START","CHROM_END","GENESYMBOL","SCORE","STRAND"]);
}).error(function (req, status, error) {
$("body").append(status + ": " + error);
@@ -1833,7 +1819,7 @@ function VQI_GenomeBrowser(id, serviceURL) {
async : false,
data: {
"getRange": "",
"fileHandles": [fileHandle],
"fileHandle": fileHandle,
"type": "custom",
"chrom": chrom_curr
}
@@ -49,7 +49,7 @@
genes: {file: "hg19_refgene.txt", table_name: "hg19_refgene"},
cpg: {file: "cpg_site_hg19.txt,shelve_hg19.txt,shoer_hg19.txt", table_name: "cpg_site_hg19,shelve_hg19,shoer_hg19"},
//custom: {file: "", table_name:'upload1436411775'}
},
}
// "MM9":{
// fasta: {fasta: "/Users/corywang/Downloads/mm9.fa.txt", index: "/Users/corywang/Downloads/mm9.fa.fai.txt"},
// //genes: {file: "../../genome/mm9/mm9_genes.txt", table_name:'mm9_gene_annotation'},
@@ -1,22 +1,22 @@
<?php
//set content type and xml tag
header("Content-type: text/xml");
/**************************/
// replace these information if needed
$db_name = "test";
$table_name = "";
$host_name = "localhost";
$user_name = "root";
$password = "";
header("Content-type: text/xml");
/**************************/
// replace these information if needed
$db_name = "test";
$table_name = "";
$host_name = "localhost";
$user_name = "root";
$password = "";
$DBlink = mysqli_connect($host_name, $user_name, $password);
$currentRow = 0;
/***************************/
/***************************/
if (isset($_POST["upload"])){
if (isset($_POST["upload"])){
$timestamp = (new DateTime())->getTimestamp();
$data = parseData($_POST["upload"]);
if(isset($_POST["tableName"])){
@@ -54,7 +54,7 @@
ajaxReturn($result);
}
else if (isset($_POST["getRange"])){
$result = getRange($_POST["fileHandles"], $_POST["type"], $_POST["chrom"]);
$result = getRange($_POST["fileHandle"], $_POST["type"], $_POST["chrom"]);
ajaxReturn($result);
}
else if (isset($_POST["loadTooltip"])){
@@ -305,8 +305,8 @@ function mergeExonsArray($exons, $scale){
}
function mergeExons($geneStart, $geneEnd, $Exstart, $Exend, $start,$end, $scale){
$ExStartArray = explode(",",substr($Exstart,0,-1));
$ExEndArray = explode(",",substr($Exend,0,-1));
$ExStartArray = explode(",",trim($Exstart, '"'));
$ExEndArray = explode(",",trim($Exend, '"'));
if ($geneEnd-$geneStart < 1/$scale){
@@ -587,7 +587,7 @@ function getFullTrackData($fileHandles){
return $returnArray;
}
function getRange($fileHandles,$type,$chrom){
function getRange($fileHandle,$type,$chrom){
$db_name = $GLOBALS['db_name'];
$link = $GLOBALS['DBlink'];
@@ -598,8 +598,6 @@ function getRange($fileHandles,$type,$chrom){
$sql .= " ORDER BY `CHROM_START` * 1 ASC";
# code...
$fileHandle = $value;
$minsql = "SELECT `CHROM`, `CHROM_START`, `CHROM_END`, `GENESYMBOL`, `SCORE` FROM {$db_name}.{$fileHandle} ORDER BY `CHROM_START` * 1 ASC LIMIT 1";
if ($type == "gene"){
$minsql = "SELECT `chrom`, `txStart`, `txEnd`, `name2`, `score` FROM {$db_name}.{$fileHandle} ORDER BY `txStart` * 1 ASC LIMIT 1";
@@ -923,7 +921,7 @@ function loadTable(){
$table_name = $_GET["tableRef"];
}
}
if(isset($_GET["posStart"]))
if(isset($_GET["posStart"]))
$posStart = $_GET['posStart'];
else
$posStart = 0;
@@ -932,35 +930,35 @@ function loadTable(){
else
$count = 100;
$currentRow = $posStart;
$totalCount = 0;
$currentRow = $posStart;
$totalCount = 0;
//connect to database
$link = mysqli_connect($host_name, $user_name, $password);
//$db = mysqli_select_db ("test");
//create query to products table
$sql = "SELECT * FROM {$db_name}.{$table_name}";
//if this is the first query - get total number of records in the query result
if($posStart==0){
//if this is the first query - get total number of records in the query result
if($posStart==0){
$sqlCount = "Select count(*) as cnt from ($sql) as tbl";
$resCount = mysqli_query ($link,$sqlCount);
$rowCount=mysqli_fetch_assoc($resCount);
$totalCount = $rowCount["cnt"];
}
if(isset($_GET["name_mask"]) && isset($_GET["filter_attribute"])){
$p = $_GET['filter_attribute'];
$sql.=" Where {$p} = '".$_GET["name_mask"]."'";
if(isset($_GET["name_mask"]) && isset($_GET["filter_attribute"])){
$p = $_GET['filter_attribute'];
$sql.=" Where {$p} = '".$_GET["name_mask"]."'";
$sqlCount = "Select count(*) as cnt from ($sql) as tbl";
$resCount = mysqli_query ($link,$sqlCount);
$rowCount=mysqli_fetch_assoc($resCount);
$totalCount = $rowCount["cnt"];
}
if (isset($_GET["order"]) && isset($_GET["sort_attribute"])){
$order = $_GET['order'];
$sort_attribute = $_GET['sort_attribute'];
}
if (isset($_GET["order"]) && isset($_GET["sort_attribute"])){
$order = $_GET['order'];
$sort_attribute = $_GET['sort_attribute'];
$ifNumeric = "SELECT `".$sort_attribute."` FROM {$db_name}.{$table_name} LIMIT 1";
$res = mysqli_query ($link, $ifNumeric);
$resArray = mysqli_fetch_row($res);
@@ -970,8 +968,8 @@ function loadTable(){
else {
$sql.=" ORDER BY $sort_attribute $order";
}
}
}
//add limits to query to get only rows necessary for the output
$sql.= " LIMIT ".$posStart.",".$count;
@@ -995,13 +993,13 @@ function loadTable(){
// print("<cell>");
// print($row[3]);
// print("</cell>");
// print("<cell>");
// print("<cell>");
// print($row[4]);
// print("</cell>");
// print("<cell>");
// print("<cell>");
// print($row[5]);
// print("</cell>");
// print("<cell>");
// print("<cell>");
// print($row[6]);
// print("</cell>");
foreach ($row as $key=>$title){
@@ -1013,5 +1011,5 @@ function loadTable(){
}
print("</rows>");
}
?>

0 comments on commit e60598c

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