epgg / eg

EpiGenome Gateway - WashU EpiGenome Browser
http://epigenomegateway.wustl.edu/legacy/
Other
21 stars 10 forks source link

Gene set - the gene state is not getting saved in session #32

Open debugpoint136 opened 9 years ago

debugpoint136 commented 9 years ago

debugpoint136 commented 9 years ago

Inside gsm.js

Fix applied ONLY on test instance - http://epgg-test.wustl.edu/dev/browser/

Renee - Could you test this and see if its fine now? Daofeng - if you could test it and found satisfactory - could you move this to production? Thanks!

Deepak

debugpoint136 commented 9 years ago

This is the code change - for fixing this bug - this is in gsm.js

Genome.prototype.addnewgeneset=function(obj)
{
if(!obj.lst || obj.lst.length==0) {
    print2console('Skipping one invalid gene set',2);
    return;
}
/* finish up items
name is unique identifier of items
.label might be used
*/
var hash={}; // key: unique name, val: count
for(var i=0; i<obj.lst.length; i++) {
    var e=obj.lst[i];
    if(e.a1==undefined) e.a1=e.a;
    if(e.b1==undefined) e.b1=e.b;
    if(!e.name) {
        e.name=e.c+':'+e.a+'-'+e.b;
    }
    if(e.name in hash) {
        hash[e.name]++;
        e.label=e.name;
        e.name=e.name+'_'+hash[e.name];
    } else {
        hash[e.name]=1;
    }
}
/*====================START of CODE CHANGE===================*/
// dpuru : Oct 18 - As part of fix for - https://github.com/epgg/eg/issues/32
if (obj.gss_opt !== "custom") {
    obj.gss_down=2500;
    obj.gss_up=2500;
    obj.gss_origin='txstart';
    obj.gss_opt='genebody';
} else {

    var style_slider = 130 - (parseInt(obj.gss_up) * (130/5000));
    var style_trail = parseInt(obj.gss_up) * (130/5000);
    var styleValue = style_slider.toString().concat('px');
    var styleValue_trail = style_trail.toString().concat('px');

    // we have to calculate and set - 
    gsselect.upslider.style.left = styleValue;
    gsselect.uptrail.style.width = styleValue_trail;
    document.getElementById("leftgliderlength").innerHTML = parseInt(obj.gss_up);

    //gsselect.downslider.style.left = 

    var down_style_slider = parseInt(obj.gss_down) * (130/5000);
    var down_style_trail = parseInt(obj.gss_down) * (130/5000);
    var down_styleValue = down_style_slider.toString().concat('px');
    var down_styleValue_trail = down_style_trail.toString().concat('px');

    // we have to calculate and set -
    gsselect.downslider.style.left = down_styleValue;
    gsselect.downtrail.style.width = down_styleValue_trail;
    document.getElementById("rightgliderlength").innerHTML = parseInt(obj.gss_down);

}
// code before the above change - commented now - for reference
/*obj.gss_down=2500;
obj.gss_up=2500;
obj.gss_origin='txstart';
obj.gss_opt='genebody';*/
/*====================END of CODE CHANGE===================*/
var _s=this.geneset;
_s.lst.push(obj);
var idx=_s.lst.length-1;
_s.says.innerHTML='Click a gene set for options.';
var d=dom_create('div',_s.lstdiv,'display:table;margin:10px;border:solid 1px rgba(255,255,255,0.7)');
obj.handle=d;
var d2=dom_create('div',d);
d2.className='whitebar';
d2.idx=idx;
d2.addEventListener('click',geneset_showmenu,false);
obj.namespan=dom_addtext(d2,obj.name);
obj.namespan.style.fontSize='130%';
obj.namespan.style.marginRight=20;
obj.countspan=dom_addtext(d2,obj.lst.length+' items');
if(apps.gsm && apps.gsm.main.style.display!='none') {
    panelFadeout(_s.submit_ui);
    //.style.display='none';
    _s.butt_showui.style.display='inline-block';
    panelFadein(d2);
}
if(gflag.gs_load2gsv) {
    // [sukn] add a geneset then run gsv on it
    delete gflag.gs_load2gsv;
    loading_cloak(apps.gsm.bbj.main);
    apps.gsm.bbj.run_gsv(obj.lst);
}
}
lidaof commented 9 years ago

Thanks @debugpoint136 . Changes also applied to public server.