Skip to content
Permalink
Browse files

fixed add recent track

  • Loading branch information
yuj12001 committed Oct 11, 2015
1 parent e60598c commit a7c854743951fc6da24d2e4d35e3f525db970ffc
Showing with 51 additions and 36 deletions.
  1. +46 −35 VQI_GenomeBrowser.js
  2. +4 −1 VQI_GenomeBrowserDemo.html
  3. +1 −0 dynamic_loading.php
@@ -73,7 +73,8 @@ function VQI_GenomeBrowser(id, serviceURL) {
for (i in trackInfo){

if (trackInfo[i].name == track){
self.addTrack(track[i].name , trackInfo[i].type , trackInfo[i].args);
console.log([trackInfo[i].name,trackInfo[i].type , trackInfo[i].args]);
self.addTrack(trackInfo[i].name , trackInfo[i].type , trackInfo[i].args);
break;
}
}
@@ -539,6 +540,7 @@ function VQI_GenomeBrowser(id, serviceURL) {
};

var uploadFile = function(data,name,genome){
//console.log(data);
headerArray = ["CHROM","CHROM_START","CHROM_END","GENESYMBOL","SCORE","STRAND"];

for (i in headerArray) {
@@ -559,9 +561,9 @@ function VQI_GenomeBrowser(id, serviceURL) {
var CurrentFileHandle = data;
var trackName = CurrentFileHandle;
if(name !== undefined){
var trackName = name+" "+genome;
var trackName = name;
}
trackInfo.push({name: trackName, type: "custom", args: {fileHandle: CurrentFileHandle, exportable: true}});
trackInfo.push({name: trackName, type: "custom", args: {table_name: CurrentFileHandle, exportable: true}});
updateRecentTrackDropDown();
self.addTrack(trackName , "custom" , {table_name: CurrentFileHandle});
}).error(function (req, status, error) {
@@ -772,42 +774,51 @@ function VQI_GenomeBrowser(id, serviceURL) {
});
}

this.addTrack = function (name, type, args) {

var trackIndex = trackList.length;
this.addTrack = function (name, type, args, fromServer) {
if(fromServer){
var temp = [];
for (i in args) {
temp.push(args[i].join('\t'));
}
trackData = temp.join('\n');
uploadFile(trackData,name);
}
else{
var trackIndex = trackList.length;

var trackCount = trackIndex + 1;
//name of track
name = name || "track-" + (trackIndex + 1);
var trackCount = trackIndex + 1;
//name of track
name = name || "track-" + (trackIndex + 1);

if(type == "cpg")
{
trackList.push(new CpgTrack(name, graphRegion.append("g"), args));
}
else if(type == "genes")
{
trackList.push(new BedTrack(name, graphRegion.append("g"), args));
}
else if(type == "fasta")
{
trackList.push(new FastaTrack(name, graphRegion.append("g"), args));
}
else
{
args.exportable = true;
trackList.push(new CustomTrack(name, graphRegion.append("g"), args));
}
if(type == "cpg")
{
trackList.push(new CpgTrack(name, graphRegion.append("g"), args));
}
else if(type == "genes")
{
trackList.push(new BedTrack(name, graphRegion.append("g"), args));
}
else if(type == "fasta")
{
trackList.push(new FastaTrack(name, graphRegion.append("g"), args));
}
else
{
args.exportable = true;
trackList.push(new CustomTrack(name, graphRegion.append("g"), args));
}

setPanExtent();
graph(chrom_curr);
setPanExtent();
graph(chrom_curr);

clipPath.attr("height", Number(svg.attr("height")));
zoomOnly = true;
zoomed();
zoomOnly = false;

reorderTracks();
updateAllTracksSelectBoxes();
clipPath.attr("height", Number(svg.attr("height")));
zoomOnly = true;
zoomed();
zoomOnly = false;

reorderTracks();
updateAllTracksSelectBoxes();
}

}

@@ -46,6 +46,7 @@
genes: {file: "../../genome/hg19_genes.txt", table_name:'hg19_gene_annotation'},
cpg: {file: "../../genome/hg19_genes.txt", table_name:'hg19_cpg'},*/
//fasta: {fasta: "/Users/corywang/Downloads/hg19.fa.txt", index : "/Users/corywang/Downloads/hg19.fa.fai.txt"},
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'}
@@ -59,10 +60,12 @@
};
obj.loadGenomes(genomes); //loads the genomes based on the datastructure described above
setTimeout(function(){ hs()}, 3000);
setTimeout(function(){ hs()}, 1000);
function hs (){
obj.setGenome("HG19");
}
// obj.addTrack("HG19_Custom","Custom",[["CHROM", "CHROM_START" ,"CHROM_END" , "GENESYMBOL", "SCORE", "STRAND"],["chr1" , "896004" , "896005" , "." , "0" , "+"]],true);
//obj.setGenome("HG19");
// obj.setGenome("MM9"); //should set hg19 genome in dropdown and display fasta, cpg and genes tracks.
@@ -18,6 +18,7 @@
if (isset($_POST["upload"])){
$timestamp = (new DateTime())->getTimestamp();
$timestamp = "upload".$timestamp;
$data = parseData($_POST["upload"]);
if(isset($_POST["tableName"])){
$result = insertToDb($_POST["tableName"], $_POST["header"],$data);

0 comments on commit a7c8547

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