Skip to content

Commit

Permalink
Fix some cursed regex buried in JSON string to find assembly name
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinlul committed Jun 2, 2022
1 parent 6999d56 commit a30b411
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
22 changes: 11 additions & 11 deletions jbrowse/plugins/ExportSequence/js/ExportSequence.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,30 @@ define( ["dojo/_base/declare", 'dojo/_base/array','dojo/_base/lang','dojo/aspect
endCoord = endCoord.replace(/\.\d+$/,'');
//var coordStr = visibleRegion.ref+":"+visibleRegion.start+"-"+visibleRegion.end;
var current_url = window.location.href;
var genome_regex = /data\=data\.(.+?)\&/;
var genome_regex = /data\=data%2F(.+?)\&/;
var genome_regex_matches = current_url.match(genome_regex);
var coordStr = "searchInput=" + visibleRegion.ref+":"+startCoord+"-"+endCoord;
//console.log(genome_regex_matches[1]);
//console.log(genome_regex_matches[1]);
if (genome_regex_matches!== null && genome_regex_matches[1].length >0){

coordStr +="&genome="+genome_regex_matches[1];

}
var opts=this.inherited(arguments); //call the parent classes function
opts.push( // add an extra menu item to the array returned from parent class function
{
{
label: "Search for Guides",
type: 'dijit/LinkPane',
onClick: function() {

window.open("http://"+location.hostname+"/src/guide-finder/GuideInitialize.py?action=initialize&"+coordStr);
},

},
iconClass: "dijitIconPackage"
}
);
}
);
return opts;
}
});
}
}
});
}
);
8 changes: 4 additions & 4 deletions src/setup/trackList.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"modify" : "function( track, feature, div ) { setColor='green'; if(feature.get('type') == 'ncRNA_gene'){ setColor='#8F6F8B';} else if(feature.get('type') == 'pseudogene'){setColor='#575256';} div.style.backgroundColor = setColor; }"
},
"onClick" : {
"url" : "function(){ var genome_match = location.href.match(/data=data\.(.+?)\&/); return location.protocol+'//'+location.hostname+'/src/primer-design/web/geneFeatures.html?gene={Name}&ensid={gene_id}&org='+genome_match[1] }",
"url" : "function(){ var genome_match = location.href.match(/data=data%2F(.+?)\&/); return location.protocol+'//'+location.hostname+'/src/primer-design/web/geneFeatures.html?gene={Name}&ensid={gene_id}&org='+genome_match[1] }",
"action" : "iframeDialog",
"label" : "{Name} Info, Guides, and Primers"
},
Expand Down Expand Up @@ -76,7 +76,7 @@
"onClick" : {
"action" : "iframeDialog",
"iconClass" : "dijitIconDatabase",
"url" : "function(){ var genome_match = location.href.match(/data=data\.(.+?)\&/); return location.protocol+'//'+location.hostname+'/src/primer-design/web/geneFeatures.html?gene={batchName}&ensid={ensid}&org='+genome_match[1] }",
"url" : "function(){ var genome_match = location.href.match(/data=data%2F(.+?)\&/); return location.protocol+'//'+location.hostname+'/src/primer-design/web/geneFeatures.html?gene={batchName}&ensid={ensid}&org='+genome_match[1] }",
"title" : "{batchName} Info, Guides and Primers",
"label": "<b>{label}</b><ul><li>Specificity Score: <b>{guideScore}</b></li><li>Off-targets for 0-1-2-3-4 mismatches:<b> {otDesc}</b>&nbsp&nbsp</li><p><b>{Notes}</b></p></ul>"
}
Expand All @@ -97,10 +97,10 @@
"onClick" : {
"action" : "iframeDialog",
"iconClass" : "dijitIconDatabase",
"url" : "function(){ var genome_match = location.href.match(/data=data\.(.+?)\&/); return location.protocol+'//'+location.hostname+'/src/primer-design/web/geneFeatures.html?gene={batchName}&ensid={ensid}&org='+genome_match[1] }",
"url" : "function(){ var genome_match = location.href.match(/data=data%2F(.+?)\&/); return location.protocol+'//'+location.hostname+'/src/primer-design/web/geneFeatures.html?gene={batchName}&ensid={ensid}&org='+genome_match[1] }",
"title" : "{batchName} Info, Guides, and Primers",
"label" : "<ul><li>Gene: <b>{batchName}&nbsp&nbsp&nbsp</b></li><li>TM: <b>{tm}&nbsp&nbsp&nbsp</b></li><li>GC%: <b>{gc}&nbsp&nbsp&nbsp&nbsp</b></li><p>Notes: {pair_notes}</li></p></ul>"
}
}
},
{
"compress" : 0,
Expand Down
8 changes: 4 additions & 4 deletions src/setup/trackList_no_regulatory.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"modify" : "function( track, feature, div ) { setColor='green'; if(feature.get('type') == 'ncRNA_gene'){ setColor='#8F6F8B';} else if(feature.get('type') == 'pseudogene'){setColor='#575256';} div.style.backgroundColor = setColor; }"
},
"onClick" : {
"url" : "function(){ var genome_match = location.href.match(/data=data\.(.+?)\&/); return location.protocol+'//'+location.hostname+'/src/primer-design/web/geneFeatures.html?gene={Name}&ensid={gene_id}&org='+genome_match[1] }",
"url" : "function(){ var genome_match = location.href.match(/data=data%2F(.+?)\&/); return location.protocol+'//'+location.hostname+'/src/primer-design/web/geneFeatures.html?gene={Name}&ensid={gene_id}&org='+genome_match[1] }",
"action" : "iframeDialog",
"label" : "{Name} Info, Guides, and Primers"
},
Expand Down Expand Up @@ -64,7 +64,7 @@
"onClick" : {
"action" : "iframeDialog",
"iconClass" : "dijitIconDatabase",
"url" : "function(){ var genome_match = location.href.match(/data=data\.(.+?)\&/); return location.protocol+'//'+location.hostname+'/src/primer-design/web/geneFeatures.html?gene={batchName}&ensid={ensid}&org='+genome_match[1] }",
"url" : "function(){ var genome_match = location.href.match(/data=data%2F(.+?)\&/); return location.protocol+'//'+location.hostname+'/src/primer-design/web/geneFeatures.html?gene={batchName}&ensid={ensid}&org='+genome_match[1] }",
"title" : "{batchName} Info, Guides and Primers",
"label" : "<b>{label}</b><ul><li>Specificity Score: <b>{guideScore}</b></li><li>Off-targets for 0-1-2-3-4 mismatches:<b> {otDesc}</b>&nbsp&nbsp</li><p><b>{Notes}</b></p></ul>" }
},
Expand All @@ -84,10 +84,10 @@
"onClick" : {
"action" : "iframeDialog",
"iconClass" : "dijitIconDatabase",
"url" : "function(){ var genome_match = location.href.match(/data=data\.(.+?)\&/); return location.protocol+'//'+location.hostname+'/src/primer-design/web/geneFeatures.html?gene={batchName}&ensid={ensid}&org='+genome_match[1] }",
"url" : "function(){ var genome_match = location.href.match(/data=data%2F(.+?)\&/); return location.protocol+'//'+location.hostname+'/src/primer-design/web/geneFeatures.html?gene={batchName}&ensid={ensid}&org='+genome_match[1] }",
"title" : "{batchName} Info, Guides, and Primers",
"label" : "<ul><li>Gene: <b>{batchName}&nbsp&nbsp&nbsp</b></li><li>TM: <b>{tm}&nbsp&nbsp&nbsp</b></li><li>GC%: <b>{gc}&nbsp&nbsp&nbsp&nbsp</b></li><p>Notes: {pair_notes}</li></p></ul>"
}
}
},
{
"compress" : 0,
Expand Down

0 comments on commit a30b411

Please sign in to comment.