diff --git a/VQI_GenomeBrowser.js b/VQI_GenomeBrowser.js index b10d18b..cd3ddca 100755 --- a/VQI_GenomeBrowser.js +++ b/VQI_GenomeBrowser.js @@ -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 } diff --git a/VQI_GenomeBrowserDemo.html b/VQI_GenomeBrowserDemo.html index fe51f76..718d021 100644 --- a/VQI_GenomeBrowserDemo.html +++ b/VQI_GenomeBrowserDemo.html @@ -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'}, diff --git a/dynamic_loading.php b/dynamic_loading.php index cc4c9e2..de38178 100644 --- a/dynamic_loading.php +++ b/dynamic_loading.php @@ -1,22 +1,22 @@ 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 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 @@ return $returnArray; } - function getRange($fileHandles,$type,$chrom){ + function getRange($fileHandle,$type,$chrom){ $db_name = $GLOBALS['db_name']; $link = $GLOBALS['DBlink']; @@ -598,8 +598,6 @@ $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 @@ $table_name = $_GET["tableRef"]; } } - if(isset($_GET["posStart"])) + if(isset($_GET["posStart"])) $posStart = $_GET['posStart']; else $posStart = 0; @@ -932,35 +930,35 @@ 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 @@ 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 @@ // print(""); // print($row[3]); // print(""); - // print(""); + // print(""); // print($row[4]); // print(""); - // print(""); + // print(""); // print($row[5]); // print(""); - // print(""); + // print(""); // print($row[6]); // print(""); foreach ($row as $key=>$title){ @@ -1013,5 +1011,5 @@ } print(""); } - + ?> \ No newline at end of file