diff --git a/VQI_GenomeBrowser.js b/VQI_GenomeBrowser.js
old mode 100644
new mode 100755
index b44b4ac..b11f823
--- a/VQI_GenomeBrowser.js
+++ b/VQI_GenomeBrowser.js
@@ -7,6 +7,7 @@ function VQI_GenomeBrowser(id) {
var margin = 50;
var trackList = [];
+ var trackSelections = [];
var genomeData = [];
@@ -18,40 +19,95 @@ function VQI_GenomeBrowser(id) {
// $("#" + id).append("
CPG:Shore:Shelve:
");
- d3.select("#" + id).append("div").text("Chromosome: ")
- var chromosomeSelect = d3.select("#" + id)
- .append("div")
- .append("select")
- .on("change", function (d) {
- graph(chromosomeSelect.property("value"));
- });
+// d3.select("#" + id).append("div").text("Chromosome: ")
+// var select = d3.select("#" + id)
+// .append("div")
+// .append("select")
+// .on("change", function (d) {
+// graph(select.property("value"));
+// });
+//
+// d3.select("#" + id).append("div").text("Start: ")
+// var minNumber = d3.select("#" + id)
+// .append("input")
+// .attr("type", "number")
+// .property("value", 0);
+//
+// d3.select("#" + id).append("div").text("End: ")
+// var maxNumber = d3.select("#" + id)
+// .append("input")
+// .attr("type", "number")
+// .property("value", 0);
+// var graphButton = d3.select("#" + id)
+// .append("input")
+// .attr("type", "button")
+// .attr("value", "Graph")
+// .on("click", function () {
+// graph(select.property("value"), minNumber.property("value"), maxNumber.property("value"))
+// });
+
+ var navigateToRegion = function () {
+ var chrom = $("#" + divId + " #chrom").val();
+ var chrom_start = $("#" + divId + " #chrom_start").val();
+ var chrom_end = $("#" + divId + " #chrom_end").val();
+ graph(chrom, chrom_start, chrom_end);
+ };
+ this.makeNavigationForm = function () {
+ var chromSelectBox = "";
+ var chromStartBox = "";
+ var chromEndBox = "";
+ var navigateButton = "";
+ var form = "";
+ $("#" + divId).append(form);
+ $("#" + divId + " #navigatebutton").on("click", navigateToRegion.bind(this));
+ };
+ this.makeNavigationForm();
- d3.select("#" + id).append("div").text("Start: ")
- var minNumber = d3.select("#" + id)
- .append("input")
- .attr("type", "number")
- .property("value", 0)
- .on("change", function () {
- setBounds(minNumber.property("value"), maxNumber.property("value"))
- });
+ var browseToGene = function () {
+ var geneName = $("#" + divId + " #geneName").val();
- d3.select("#" + id).append("div").text("End: ")
- var maxNumber = d3.select("#" + id)
- .append("input")
- .attr("type", "number")
- .property("value", 0)
- .on("change", function () {
- setBounds(minNumber.property("value"), maxNumber.property("value"))
- });
+ var genes = [geneName];
+ dataToPost = JSON.stringify(genes);
+
+ $.ajax({
+ url: vqi_url + 'serverside/web/VQService.php?service=gene-info-for-gene-symbol',
+ type: 'POST',
+ dataType: "json",
+ data: {
+ "genes": dataToPost
+ },
+ async: false
+ }).success(function (data) {
+ var thisGene = data.slice(1)[0];
+ var gene_chrom = thisGene[2];
+ var gene_start = thisGene[3];
+ var gene_end = thisGene[4];
+ thisObj.navigate(gene_chrom, gene_start, gene_end);
+// objVQIResult.parseSNPAndSNP(data, true);
+ }).error(function (req, status, error) {
+ $("body").append(status + ": " + error);
+ });
+ };
+
+ this.makeFormForGeneSearch = function () {
+ var geneText = "Gene: ";
+ var geneSearchButton = "";
+ var form = "";
+ $("#" + divId).append(form);
+ $("#" + divId + " #genesearchbutton").on("click", browseToGene.bind(this));
+ };
+ this.makeFormForGeneSearch();
var colocalize = function () {
var track1Name = $("#" + divId + " #track1").val();
var track2Name = $("#" + divId + " #track2").val();
+ var coloc_dist = $("#" + divId + " #coloc_dist").val();
var data1 = this.getTrackByName(track1Name);
var data2 = this.getTrackByName(track2Name);
+
var dataToPost1 = [], dataToPost2 = [];
dataToPost1 = JSON.stringify(data1);
dataToPost2 = JSON.stringify(data2);
@@ -62,7 +118,8 @@ function VQI_GenomeBrowser(id) {
dataType: "json",
data: {
"bed1": dataToPost1,
- "bed2": dataToPost2
+ "bed2": dataToPost2,
+ "coloc_dist": coloc_dist
},
async: false
}).success(function (data) {
@@ -70,8 +127,8 @@ function VQI_GenomeBrowser(id) {
var data2 = []
data = data.slice(1);
for (var i in data) {
- data1.push(data[i].slice(0, 3));
- data2.push(data[i].slice(3));
+ data1.push(data[i].slice(0, 6));
+ data2.push(data[i].slice(6));
}
thisObj.addTrack(data1);
thisObj.addTrack(data2);
@@ -82,8 +139,10 @@ function VQI_GenomeBrowser(id) {
});
};
+
+
this.makeFormForColocalization = function () {
- var track1Select = "
track1