divergentBalloon = function() {
var f = this.feature;
var br='';
var strains = f.get('strains');
var ref = this.track.refSeq.name;
var start = f.get('start');
var stop = f.get('end');
var contents = ''+ ref +':'+ start +'..'+ stop +'' + br;
if (typeof strains === 'object') {
var pieces = strains[0].split('|');
contents = contents + 'Strains:' + br + ''+pieces[1]+'' ;
for (var i = 1; i < strains.length; i++) {
pieces = strains[i].split('|');
contents = contents + ',' + br + ''+pieces[1]+'' ;
}
}
else if (typeof strains === 'string') {
var pieces = strains.split('|');
contents = contents + 'Strain:' + br + ''+pieces[1]+'' ;
}
else {
return;
}
contents = contents + br + 'For more information about this data, see this paper.';
contents = contents + '
Click on the glyph to make this window persist.';
return contents;
}
crisprBalloon = function() {
var f = this.feature;
var name = f.get('Name');
var pairs = name.split(';');
var str ='';
for (var i in pairs) {
var items = pairs[i].split('=');
str = str + items[0] + ': '+ items[1] + '
';
}
return str;
}
crisprColor = function(f) {
var name = f.get('Name');
var pairs = name.split(';');
var color = 'gold';
for (var i in pairs) {
var items = pairs[i].split('=');
if (items[0] == 'sequence') {
if (items[1].slice(-1) == 'C') {
return 'red';
}
}
}
return color;
}
blueHeatMap = function(feature) {
var score = feature.get('score');
var max = 0.2;
var min = 0.0001;
if(score>max) {score = max;}
if (score min) {score = min;}
var blueness = 190*((score-min)/(max-min));
var hex = Math.round(blueness).toString(16);
if (hex.length < 2) { hex = '0' + hex; }
var color = '#' + hex + hex + 'DD';
return color; }
parentRainbowHeatMap = function(feature) {
var score = feature._parent.get('score');
var max = 0.01;
var min = 2.50;
if(scoremin) {score = min;}
var blueness = 190*((score-min)/(max-min));
var hex = Math.round(blueness).toString(16);
if (hex.length < 2) { hex = '0' + hex; }
var color = '#' + hex + hex + 'DD';
return color; }
snyderHeatMap = function(feature) {
var score = feature.get('score');
var max = 0.0025;
var min = 0.000001;
if(score>max) {score = max;}
if (score 255) {logscore = 255;}
if (logscore <1) {logscore = 1;}
var blueness = 255*(logscore)/255;
var color = '#' + (Math.round(blueness)).toString(16) + (Math.round(blueness)).toString(16) + 'FF';
return color; }
geneColor = function(feature) {
var type = feature.get('type');
if (type.match(/exon/)) {return 'gray';}
if (type.match(/pseudo/)) {return 'gray';}
var strand = feature.get('strand');
if (strand == -1) {return 'turquoise';}
if (strand == 1) {return 'violet';}
return 'gray'; }
intronColorOther = function(feature) {
var strand = feature.get('strand');
var logscore = feature.get('score');
if (logscore > 1000) {
logscore = 1000;
}
var deepness = 255-(140*(logscore/1000));
var hexval = Math.round(deepness).toString(16);
if (strand == -1) {
return '#' + '00' + hexval + hexval;
}
if (strand == 1) {
return '#' + hexval + '00' +hexval;
}
}
intronColor = function(feature) {
var strand = feature.get('strand');
var logscore = feature.get('score');
/* console.log(logscore); */
/* if (logscore > 9) {
// if (strand == -1) {return 'teal';}
// if (strand == 1) {return 'darkviolet';}
// } else {
*/
if (logscore > 20000) {
logscore = 20000;
}
var deepness = 255-(140*(logscore/20000));
var hexval = Math.round(deepness).toString(16);
if (strand == -1) {
return '#' + '00' + hexval + hexval;
}
if (strand == 1) {
return '#' + hexval + '00' +hexval;
}
/* } */
}
exonColor = function(f) {
var strand = f.get('strand');
if (strand == -1) {return 'turquoise';}
if (strand == 1) {return 'violet';}
return 'gray';
}
matchColor = function(f) {
var source = f.get('source');
if (source.match('BLAT_mRNA_')) {return 'yellow';}
return 'grey'; }
variationColor = function(f) {
var consequence = f.get('consequence');
if (typeof consequence === 'undefined'){ consequence = ''; }
if (consequence.match(/missense/i)) {return 'green';}
if (consequence.match(/coding_exon/i)) {return 'yellow';}
if (consequence.match(/nonsense/i)) {return 'red';}
if (consequence.match(/frameshift/i)) {return 'blue';}
return 'white'; }
rstColor = function(f) {
var name = f.get('Clone');
if (name&&name.match('RST5')) {return 'green'; }
return 'red'; }
nematodeColor = function(f) {
var source = f.get('source');
if (source.match('BLAT_Caen_mRNA')) {return 'lightblue';}
return 'green'; }
geneURL = function(track,f) {
var type = f.get('type');
var source = f.get('source');
if (type == 'ncRNA' && source == 'RNAz') {return; }
var name = f.get('name');
if (type == 'gene') {return '/get?name='+name+';class=Gene'; }
return;}
simpleGeneURL = function(track,f) {
var name = f.get('Name');
return '/get?name='+name+';class=Gene';}
transcriptURL = function(track,f) {
var parent = f.get('jbrowse_parent');
var str = parent.replace(/Gene:/, '');
return '/get?name='+str+';class=Gene';}
targetURL = function(track,f) {
var clone = f.get('clone');
return '/get?name='+clone+';class=Sequence'; }
proteinURL = function(track,f) {
var target = f.get('Target');
var name = target.match(/\S+/)[0];
return '/get?name='+name+';class=protein'; }
ssproteinURL = function(track,f) {
var target = f.get('clone');
var name = target.match(/\S+/)[0];
return '/get?name='+name+';class=protein'; }
variationURL = function(track,f) {
var name = f.get('variation');
return '/db/get?name='+name+';class=Variation'; }
motifURL = function(track,f) {
var name = f.get('protein');
return '/get?name='+name+';class=protein'; }
expressionURL = function(track,f) {
var wburl = '/species/all/expr_pattern/';
var name = f.get('Name');
return wburl+name; }
expressionProfileURL = function(track,f) {
var wburl = '/species/all/sequence/';
var name = f.get('Name');
return wburl+name;}
duplicationURL = function(track,f) {
var wburl = '/species/all/sequence/';
var name = f.get('Name');
return wburl+name;}
featureURL = function(track,f) {
var name = f.get('Name');
return '/get?name='+name+';class=Feature';
}
sequenceURL = function(track,f) {
var name = f.get('Name');
return '/get?name='+name+';class=Sequence';
}
bindingsiteURL = function(track,f) {
var note = f.get('Note');
var match = /Predicted binding site for (.*)/.exec(note);
var gene = match[1];
if (!(typeof gene === 'undefined')) {
var patt = /craCele/;
if (patt.test(gene) ) {
return 'http://www.cisred.org/c.elegans4/search_form?form.submitted=1;search_type=Gene%20Id%20Search;submit=GO;gene_id='+gene; }
return '/get?name='+gene+';class=Gene'; }
var source = f.get('source');
if (source == 'PicTar')
{return 'http://pictar.bio.nyu.edu/cgi-bin/new_PicTar_nematode.cgi?species=nematode';}
if (source == 'miRanda')
{return 'http://microrna.sanger.ac.uk/targets/v3/';}
var name = f.get('Name');
return '/get?name='+name+';class=Feature';
}
geneGlyph = function(f) {
var biotype = f.get('biotype');
if (biotype=='tRNA') {return 'wormbase-glyphs/View/FeatureGlyph/TRNAGene';}
if (biotype=='snoRNA'){return 'wormbase-glyphs/View/FeatureGlyph/SnoRNAGene';}
if (biotype=='snRNA') {return 'wormbase-glyphs/View/FeatureGlyph/SnRNAGene';}
if (biotype=='scRNA') {return 'wormbase-glyphs/View/FeatureGlyph/ScRNAGene';}
if (biotype=='rRNA') {return 'wormbase-glyphs/View/FeatureGlyph/RRNAGene';}
if (biotype=='piRNA') {return 'wormbase-glyphs/View/FeatureGlyph/PiRNAGene';}
if (biotype=='miRNA') {return 'wormbase-glyphs/View/FeatureGlyph/MiRNAGene';}
if (biotype=='lincRNA'){return 'wormbase-glyphs/View/FeatureGlyph/LincRNAGene';}
if (biotype=='ncRNA') {return 'wormbase-glyphs/View/FeatureGlyph/NcRNAGene';}
if (biotype=='ncRNA') {return 'wormbase-glyphs/View/FeatureGlyph/NcRNAGene';}
if (biotype=='asRNA') {return 'wormbase-glyphs/View/FeatureGlyph/AntisenseRNAGene';}
if (biotype=='pseudogene') {return 'wormbase-glyphs/View/FeatureGlyph/PseudoGene';}
return 'wormbase-glyphs/View/FeatureGlyph/WBGene'; }
variationGlyph = function(f) {
var type = f.get('type');
var start= f.get('start');
var end = f.get('end');
var len = end - start;
if (type.match(/insertion/i)) { return 'wormbase-glyphs/View/FeatureGlyph/DownTriangle';}
if (type =='SNV') { return 'wormbase-glyphs/View/FeatureGlyph/Diamond'; }
if (type =='SNP') { return 'wormbase-glyphs/View/FeatureGlyph/Diamond'; }
if (type =='point_mutation') { return 'wormbase-glyphs/View/FeatureGlyph/Diamond'; }
if (type =='substitution' && len ==1) { return 'wormbase-glyphs/View/FeatureGlyph/Diamond'; }
return 'JBrowse/View/FeatureGlyph/Box';
}
typeDescription = function(f) {
var type = f.get('type');
var str = type.replace(/_/g, ' ');
return str; }
nematodeLabel = function(f) {var species = f.get('species'); return species; }
geneLinkLabel = function(track,f) {
var type = f.get('type');
var patt = /RNA|transcript/;
if (patt.test(type)) {return f.get('Name');}
var aliases = f.get('Alias');
var locus;
if (Array.isArray(aliases)) {locus = aliases[0]; }
else {locus = aliases;}
var name = f.get('sequence_name');
if (locus == name) {return name; }
if (typeof locus === 'undefined') {return name;}
return locus+' ('+name+')'; }
geneLabel = function(f) {
var type = f.get('type');
var patt = /RNA|transcript/;
if (patt.test(type)) {return f.get('Name');}
var aliases = f.get('Alias');
var locus;
if (Array.isArray(aliases)) {locus = aliases[0]; }
else {locus = aliases;}
var name = f.get('sequence_name');
if (locus == name) {return name; }
if (typeof locus === 'undefined') {return name;}
if (name == 'undefined' || typeof name === 'undefined' ) {return locus;}
return locus+' ('+name+')'; }
massSpecLabel = function(f) {
var target = f.get('Target');
var name = target.replace('MSP:', '');
var newname = name.match(/\S+/)[0];
return newname; }
greenESTLabel = function(f) {
var target = f.get('Target');
var clean = target.replace(/\s+\d+\s+\d+\s*$/, '');
return clean; }
massSpecURL = function(f) {
var target = f.get('Target');
var name = target.match(/\S+/)[0];
return '/get?name='+name+';class=Mass_spec_peptide'; }
ostURL = function(track,f) {
var name = f.get('Name');
var plateid;
var matches = name.match(/OST[FR](\d{3})([A-H]\d+)/ );
if(Array.isArray(matches)) {
plateid = '10' + matches[1] + '@' + matches[2];}
matches = name.match(/OST[FR](\d{5})([A-H]\d+)/);
if(Array.isArray(matches)) {
plateid = matches[1] + '@' + matches[2];}
return 'http://worfdb.dfci.harvard.edu/searchallwormorfs.pl?by=plate&sid='+plateid; }
modencodeURL = function(track,f) {
var note = f.get('Note');
return 'http://intermine.modencode.org/release-32/keywordSearchResults.do?searchTerm=' + note + '&searchSubmit=GO'; }
variationsBalloon = function() {
var f = this.feature;
var type = f.get('type');
type = type.replace(/_/g, ' ');
var name = f.get('public_name');
var consequence = f.get('consequence');
var ref = this.track.refSeq.name;
var start = f.get('start');
var stop = f.get('end');
var status = f.get('status');
var nt_change = f.get('substitution');
var other_name = f.get('other_name');
if (typeof nt_change === 'undefined') { nt_chang = f.get('insertion');}
var aa_change = f.get('aachange');
var interpolated_map_position = f.get('interpolated_map_position');
var source = f.get('source');
source = source.replace('_Polymorphisms','');
source = source.replace(/_/g, ' ');
var notes = 'Allele: '+name+'
';
notes = notes + 'type: '+type+'
';
if (status) {
notes = notes + 'status: '+status+'
';
}
notes = notes + 'position: '+ref+':'+start+'..'+stop+'
';
if (nt_change) {
notes = notes + 'nucleotide change: '+nt_change+'
';
}
if (aa_change) {
notes = notes + 'amino acid change: '+aa_change+'
';
}
if (consequence) {
consequence = consequence.replace(/_/g, ' ');
notes = notes + 'consequence: '+consequence+'
';
}
if (interpolated_map_position) {
notes = notes + 'interpolated map position: '+interpolated_map_position+'
';
}
var strains = f.get('strain');
if( Array.isArray(strains)) {
strains = strains.join();
}
if (strains) {
notes = notes + 'strains: '+strains+'
';
}
if (other_name) {
if ( Array.isArray(other_name)) {
other_name = other_name.join();
}
notes = notes + 'other names: '+other_name+'
';
}
notes = notes + 'source: '+source+'
';
return notes; }
expressionPatternBalloon = function() { var name = this.feature.get('Name');var url = '/img-static/virtualworm/Expr_Object_Renders/'+name+'.jpg'; var rtnString; require(['dojo/request'],function(request) {request(url,{sync:true}).then(function(text) { rtnString = ''; },function(error){rtnString = 'Expression pattern not found
We are working on getting a new image'; }); }); return rtnString; }
rnaseqReads = function () {var score = this.feature.get('score'); return score + ' reads';}
miRNABalloon = function() {var score = this.feature.get('score'); var name = this.feature.get('Name'); if (score>0) {return name +' (Score: '+score+')';} return name; }
genblastgURL = function(track,f) {
var name=f.get('Name');
var match = name.match(/_([^_]+)$/);
var cleaner = match[1].match(/^[0-9]+\.(.*)$/);
if (cleaner) {match[1]=cleaner[1];}
var geneid = match[1];
return '/get?name='+geneid+';class=CDS';}
cendrColor = function(f) {
var color = 'white';
var ann = f.get('ANN');
if (typeof ann === 'undefined') {return color;}
var match = ann.values[0].match(/[ATGC]\|(\w+)(&|\|)/);
var cons = match[1];
color='peachpuff';
if(cons == 'frameshift_variant') {color = '#9400D3';}
else if(cons == 'stop_lost') {color = '#ff0000';}
else if(cons == '5_prime_UTR_premature_start_codon_gain_variant') {color = '#7ac5cd';}
else if(cons == 'splice_acceptor_variant ') {color = '#FF581A';}
else if(cons == 'protein_altering_variant') {color = '#FF0080';}
else if(cons == 'coding_sequence_variant') {color = '#458b00';}
else if(cons == 'stop_gained') {color = '#ff0000';}
else if(cons == 'incomplete_terminal_codon_variant') {color = '#ff00ff';}
else if(cons == 'transcript_ablation') {color = '#ff0000';}
else if(cons == 'start_lost') {color = '#ffd700';}
else if(cons == 'splice_donor_variant') {color = '#FF581A';}
else if(cons == 'splice_region_variant') {color = '#ff7f50';}
else if(cons == 'missense_variant') {color = '#ffd700';}
else if(cons == 'inframe_deletion') {color = '#ff69b4';}
else if(cons == 'inframer_insertion') {color = '#ff69b4';}
else if(cons == '3_prime_UTR_variant') {color = '#7ac5cd';}
else if(cons == 'synonymous_variant') {color = '#76ee00';}
else if(cons == 'upstream_gene_variant') {color = '#a2b5cd';}
else if(cons == 'downstream_gene_variant') {color = '#a2b5cd';}
else if(cons == 'non_coding_transcript_exon_variant') {color = '#32cd32';}
else if(cons == 'intron_variant') {color = '#02599c';}
else if(cons == '5_prime_UTR_variant') {color = '#7ac5cd';}
else if(cons == 'stop_retained_variant') {color = '#76ee00';}
else if(cons == 'intergenic_variant') {color = '#636363';}
else if(cons == 'non_coding_transcript_variant') {color = '#32cd32';}
else if(cons == 'non_coding_exon_variant') {color = '#7ac5cd';}
return color; }
agrVariationColor = function(f) {
var color = 'white'; /* I think I like white better than black here */
var cons = f.get('vep_impact');
if (typeof cons === 'undefined' ) {
return color;
}
if (cons=='HIGH') {return 'red';}
if (cons=='MODIFIER') {return 'purple';}
if (cons=='MODERATE') {return 'gold';}
return 'cyan';
}