Commit e0f9674a authored by Ludo Cottret's avatar Ludo Cottret

remove deprecated minification output

parent 92fc9800
/*
Copyright(c) 2012 Company Name
*/
Ext.define("BP.globals.ConnectionData",{singleton:true,mail:"",owner:undefined});Ext.define("BP.view.form.V_CustomForm",{extend:"Ext.form.Panel",alias:"widget.customForm",initComponent:function(){this.on("beforeadd",function(a,b){if(!b.allowBlank&&b.xtype!="checkboxfield"&&b.xtype!="displayfield"){b.labelSeparator+='<span style="color: rgb(255, 0, 0); padding-left: 2px;">*</span>'}});this.callParent(arguments)}});Ext.define("BP.view.form.V_CustomFieldSet",{extend:"Ext.form.FieldSet",alias:"widget.customFieldSet",margin:5,config:{titleWidth:11},constructor:function(a){if(Ext.isDefined(a.titleWidth)){this.setTitleWidth(a.titleWidth)}this.callParent([a])},initComponent:function(){this.on("beforeadd",function(a,b){if(!b.allowBlank&&b.xtype!="checkboxfield"&&b.xtype!="displayfield"){b.labelSeparator+='<span style="color: rgb(255, 0, 0); padding-left: 2px;">*</span>'}});this.on("beforerender",function(a){a.setTitle('<span style="font-size:'+a.getTitleWidth()+';">'+a.title+"</span>")});this.callParent(arguments)}});Ext.define("BP.view.form.V_UploadFile",{extend:"BP.view.form.V_CustomFieldSet",requires:["BP.view.form.V_CustomForm"],alias:"widget.uploadFile",config:{allowBlank:true,fileLabel:"File",buttonLabel:"Upload File",uploadAction:"uploadFile",pathVariable:"path"},constructor:function(a){if(Ext.isDefined(a.allowBlank)){this.setAllowBlank(a.allowBlank)}if(Ext.isDefined(a.fileLabel)){this.setFileLabel(a.fileLabel)}if(Ext.isDefined(a.buttonLabel)){this.setButtonLabel(a.buttonLabel)}if(Ext.isDefined(a.uploadAction)){this.setUploadAction(a.uploadAction)}if(Ext.isDefined(a.pathVariable)){this.setPathVariable(a.pathVariable)}this.callParent([a])},initComponent:function(){this.items=[{xtype:"customForm",border:0,items:[{xtype:"filefield",buttonOnly:true,clearOnSubmit:false,name:"dataFile",fieldLabel:this.getFileLabel(),labelWidth:this.labelWidth,allowBlank:this.getAllowBlank()},{xtype:"displayfield",fieldLabel:"File name",name:"filename",value:"No file defined"},{xtype:"hiddenfield",name:this.getPathVariable(),value:""}]}];this.callParent(arguments)}});Ext.define("BP.view.form.V_NumberField",{extend:"Ext.form.field.Number",requires:[],alias:"widget.custom_numberfield",hideTrigger:true,keyNavEnabled:false,mouseWheelEnabled:false,width:200,listeners:{render:function(a){Ext.create("Ext.tip.ToolTip",{anchor:"right",target:a.getEl().id,trackMouse:false,title:name,html:a.qtip,width:200})}}});Ext.define("BP.view.form.V_IprScanUpload",{extend:"BP.view.form.V_UploadFile",requires:[],alias:"widget.iprScanUpload",disabled:true});Ext.define("BP.view.form.V_ProteomeFieldSet",{extend:"BP.view.form.V_CustomFieldSet",requires:["BP.view.form.V_IprScanUpload"],alias:"widget.proteomeFieldSet",collapsible:true,collapsed:true,config:{removeButton:true},layout:{type:"hbox",align:"stretchmax"},constructor:function(d){if(Ext.isDefined(d.removeButton)){this.setRemoveButton(d.removeButton)}var b=Ext.ComponentQuery.query("checkbox[name=addIprscanResult]")[0];var a=!b.getValue();var c=Ext.create("BP.view.form.V_IprScanUpload",{disabled:a,flex:1,title:"IprScan file",allowBlank:false,fileLabel:"Select an IprScan file",buttonLabel:"Upload IprScan File",uploadAction:"uploadIprScanFile",pathVariable:"pathIprScan"});this.items=[{xtype:"customFieldSet",flex:1,title:"Proteome description",height:200,items:[{xtype:"textfield",regex:/^[;&'>0-9a-zA-Z:_.@+\#\-\s=,\"\?\(\)%~*!\[\]\{\}]*$/,regexText:"<b>Error</b></br>allowed characters are [;&'>0-9a-zA-Z:_.@+#-s=,\"?()%~*![]{}]",name:"code",fieldLabel:"Code",allowBlank:false},{xtype:"textareafield",regex:/^[;&'>0-9a-zA-Z:_.@+\#\-\s=,\"\?\(\)%~*!\[\]\{\}\ ]*$/,regexText:"<b>Error</b></br>allowed characters are [;&'>0-9a-zA-Z:_.@+#-s=,\"?()%~*![]{} ]",name:"proteomeDescription",fieldLabel:"Proteome description"},{xtype:"checkboxfield",name:"isReference",fieldLabel:"Is reference ?",value:"off",checked:false,uncheckedValue:"false",inputValue:"true"}]},{xtype:"splitter"},{xtype:"uploadFile",flex:1,title:"Proteome file",allowBlank:false,fileLabel:"Select a fasta file",buttonLabel:"Upload Fasta File",uploadAction:"uploadFastaFile",pathVariable:"pathProteome"},{xtype:"splitter"},c,{xtype:"button",iconCls:"icon-cancel",action:"removeProteome",cls:"my-btn",disabled:false,maxHeight:24}];this.callParent([d])},initComponent:function(){var b=!this.getRemoveButton();this.callParent(arguments);var a=this.query("button[action=removeProteome]")[0];a.setDisabled(b)}});Ext.define("BP.view.form.V_ProteomesFieldSet",{extend:"BP.view.form.V_CustomFieldSet",requires:["BP.view.form.V_ProteomeFieldSet"],alias:"widget.proteomesFieldSet",title:"Proteomes",collapsible:true,nb:1,items:[{xtype:"proteomeFieldSet",title:"Proteome 1",collapsed:false,removeButton:false},{xtype:"button",text:"Add Proteome",action:"addProteome"}],initComponent:function(){this.callParent(arguments)}});Ext.define("BP.view.form.V_NewAnalysis",{extend:"BP.view.form.V_CustomForm",requires:["BP.globals.ConnectionData","BP.view.form.V_ProteomesFieldSet","BP.view.form.V_UploadFile","BP.view.form.V_NumberField","BP.view.form.V_CustomFieldSet"],alias:"widget.newAnalysis",resizable:false,closable:false,autoScroll:true,bodyPadding:5,border:false,title:"New analysis",fieldDefaults:{labelAlign:"left",margin:"10 10 10 10",labelWidth:100,allowBlank:true},items:[{xtype:"container",layout:"hbox",items:[{xtype:"button",text:"Launch analysis",action:"launchAnalysis",margin:"0 0 0 10",formBind:false},{xtype:"button",text:"Reset",action:"reset",margin:"0 0 0 10",formBind:false},{xtype:"button",cls:"icon-bbric-info",tooltip:"File formats",margin:"0 0 0 10",handler:function(){window.open("https://framagit.org/BBRIC/family-companion/blob/527146eac34788169853c1fd053f7950229d140f/doc/fileFormats.md","_blank")}}]},{xtype:"uploadFile",flex:1,title:"Input data zip file",allowBlank:true,fileLabel:"Select a zip file",buttonLabel:"Upload",uploadAction:"uploadZipFile",pathVariable:"dataFile"},{xtype:"customFieldSet",title:"Analysis description",collapsible:true,collapsed:false,titleWidth:15,items:[{xtype:"textfield",regex:/^[;&'>0-9a-zA-Z:_.@+\#\-\s=,\"\?\(\)%~*!\[\]\{\}]*$/,regexText:"<b>Error</b></br>allowed characters are [;&'>0-9a-zA-Z:_.@+#-s=,\"?()%~*![]{}]",name:"analysis_title",fieldLabel:"Title",allowBlank:false},{xtype:"textareafield",regex:/^[;&'>0-9a-zA-Z:_.@+\#\-\s=,\"\?\(\)%~*!\[\]\{\}\ ]*$/,regexText:"<b>Error</b></br>allowed characters are [;&'>0-9a-zA-Z:_.@+#-s=,\"?()%~*![]{} ]",name:"analysis_description",fieldLabel:"Description"}]},{xtype:"customFieldSet",title:"General parameters",titleWidth:15,collapsible:true,collapsed:false,items:[{xtype:"checkboxfield",name:"addIprscanResult",action:"addIprscanResult",fieldLabel:"Add IprScan results ?"}]},{xtype:"customFieldSet",titleWidth:15,title:"Homology groups",layout:{type:"hbox",align:"stretchmax"},collapsible:true,collapsed:false,items:[{xtype:"uploadFile",title:"Homology groups result file",flex:1,allowBlank:true,labelWidth:200,fileLabel:"Select an OrthoMCL/OrthoFinder/Synergy file",buttonLabel:"Upload homology group File",uploadAction:"uploadHomologyGroupsFile",pathVariable:"pathHomologyGroups"},{xtype:"splitter"},{xtype:"component",html:"OR"},{xtype:"splitter"},{xtype:"customFieldSet",name:"homologygroups_parameters",flex:1,title:"Parameters",height:200,items:[{xtype:"custom_numberfield",allowDecimals:true,name:"pvCutoff",fieldLabel:"pv_cutoff",qtip:"P-Value or E-Value Cutoff in BLAST search and/or ortholog clustering, 1e-5 (DEFAULT).",value:0.00001,decimalPrecision:10,allowBlank:false},{xtype:"custom_numberfield",allowDecimals:true,name:"piCutoff",fieldLabel:"pi_cutoff",qtip:"Percent Identity Cutoff <0-100> in ortholog clustering, 0 (DEFAULT)",minValue:0,maxValue:100,value:0,allowBlank:false},{xtype:"custom_numberfield",allowDecimals:true,name:"pMatchCutoff",fieldLabel:"pmatch_cutoff",qtip:"Percent Match Cutoff <0-100> in ortholog clustering, 0 (DEFAULT).",minValue:0,maxValue:100,value:80,allowBlank:false},{xtype:"custom_numberfield",allowDecimals:true,name:"inflation",fieldLabel:"inflation",value:1.5,qtip:"Markov Inflation Index, used in MCL algorithm, 1.5 (DEFAULT). Increasing this index increases cluster tightness, and the number of clusters.",allowBlank:false}]}]},{xtype:"proteomesFieldSet",titleWidth:15},{xtype:"container",layout:"hbox",items:[{xtype:"button",text:"Launch analysis",action:"launchAnalysis",formBind:false},{xtype:"button",text:"Reset",action:"reset",formBind:false}]},],setFromJson:function(n){if(n.zipdata){data=n.zipdata.proteomes;var r=[];if(data){var e=0;for(var s in data){var o=true;if(e==0){o=false}var p=Ext.create("BP.view.form.V_ProteomeFieldSet",{title:s,collapsed:true,removeButton:o});var h=data[s]["fasta"];if(!h){Ext.Msg.alert("Failed","The proteome "+s+" does not have fasta file path");return}var a=p.down("uploadFile");var c=a.down("filefield");c.setDisabled(true);var b=a.down("displayfield");b.setValue(data[s]["fasta"].replace(/\\/g,"/").replace(/.*\//,""));var t=a.down("hiddenfield");t.setValue(data[s]["fasta"]);var g=data[s]["iprscan"];if(g){this.query('[name="addIprscanResult"]')[0].setValue(true);var q=p.down("iprScanUpload");var j=q.down("filefield");j.setDisabled(true);var k=q.down("displayfield");k.setValue(data[s]["iprscan"].replace(/\\/g,"/").replace(/.*\//,""));var i=data[s]["iprscan"];var f=q.down("hiddenfield");f.setValue(i)}p.query("[name=code]")[0].setValue(s);if(data[s]["title"]){p.query('[name="proteomeDescription"]')[0].setValue(data[s]["title"])}if(data[s]["reference"]){if(data[s]["reference"]>0){p.query('[name="isReference"]')[0].setValue(true)}}r.push(p);e++}if(r.length>0){var l=this.query("proteomesFieldSet")[0];l.removeAll();Ext.Array.each(r,function(u){l.add(u)})}}if(n.zipdata.homologygroups){if(n.zipdata.homologygroups.pi_cutoff){this.query('[name="piCutoff"]')[0].setValue(n.zipdata.homologygroups.pi_cutoff)}if(n.zipdata.homologygroups.pv_cutoff){this.query('[name="pvCutoff"]')[0].setValue(n.zipdata.homologygroups.pv_cutoff)}if(n.zipdata.homologygroups.pmatch_cutoff){this.query('[name="pMatchCutoff"]')[0].setValue(n.zipdata.homologygroups.pmatch_cutoff)}if(n.zipdata.homologygroups.inflation){this.query('[name="inflation"]')[0].setValue(n.zipdata.homologygroups.inflation)}if(n.zipdata.homologygroups.outfile){var d=this.down('uploadFile[uploadAction="uploadHomologyGroupsFile"]');var m=d.down("filefield");m.setDisabled(true);var k=d.down("displayfield");k.setValue(n.zipdata.homologygroups.outfile.replace(/\\/g,"/").replace(/.*\//,""));var i=n.zipdata.homologygroups.outfile;var f=d.down("hiddenfield");f.setValue(i)}}if(n.zipdata.title){this.down('[name="analysis_title"]').setValue(n.zipdata.title)}if(n.zipdata.description){this.down('[name="analysis_description"]').setValue(n.zipdata.description)}Ext.Msg.alert("Zip processed",n.message+".<br />Form filled with the zip data.")}}});Ext.define("BP.view.panel.V_Home",{extend:"Ext.panel.Panel",alias:"widget.homePanel",autoScroll:true,resizable:true,title:"Home",loader:{url:"home.html",autoLoad:true}});Ext.define("BP.view.panel.V_ResultPanel",{extend:"Ext.panel.Panel",alias:"widget.resultPanel",requires:[],autoScroll:true,resizable:true,closable:true,title:"",items:[],setFromJson:function(a){this.setTitle(a.directory)}});Ext.define("BP.view.panel.V_ResultsPanel",{extend:"Ext.panel.Panel",alias:"widget.resultsPanel",requires:[],autoScroll:true,resizable:false,closable:true,title:"",items:[],layout:{type:"vbox",padding:"5",align:"stretch"},setFromJson:function(a){var b=a.analysis.title;if(b.length>10){b=b.substring(0,10)+"..."}this.setTitle(b)}});Ext.define("BP.view.panel.V_BannerPanel",{extend:"Ext.Panel",alias:"widget.bannerPanel",region:"north",height:100,resizable:false,title:"Banner panel",header:false,requires:["BP.globals.ConnectionData"],layout:{type:"hbox",align:"stretch"},initComponent:function(){this.items=[{html:"<img src='resources/images/fc.png' width=100 style='float: left;'/><div id='logotitre' style='margin-left: 120px;margin-top : 30px;'>Protein family analyses</div><div style='margin-left: 120px;text-align:right;font-size:12px;margin-top : 10px;'><i>Family-Companion</i></div>",width:470,border:0,margin:0},{xtype:"container",name:"login",layout:"vbox",height:100,margin:20,flex:1,border:0}];this.callParent(arguments);this.setLogin()},setLogin:function(){var b=Ext.form.field.VTypes.email(BP.globals.ConnectionData.mail);var a=this.down("container[name=login]");a.removeAll(true,true);if(b){a.add({html:"<i>Logged as "+BP.globals.ConnectionData.mail+"</i>",border:0})}else{a.add({xtype:"button",text:"login",style:"text-align:right;",order:0,action:"login"})}}});Ext.define("BP.view.panel.V_HelpPanel",{extend:"Ext.panel.Panel",alias:"widget.helpPanel",autoScroll:true,resizable:true,title:"Help",padding:10,loader:{url:"help.html",autoLoad:true}});Ext.define("BP.view.grid.V_TreeGridResult",{extend:"Ext.tree.Panel",requires:[],alias:"widget.gridResult",resizable:false,closable:false,padding:"5",title:"Results",autoScroll:false,useArrows:true,multiSelect:true,singleExpand:true,rootVisible:false,basePath:"",collapsible:true,collapsed:true,margin:5,columns:[{text:"Status",dataIndex:"status",width:50,renderer:function(f,e,b,g,d,c,a){if(f!="success"){cls="error"}else{cls="success"}e.tdCls=cls;return""}},{text:"Name",xtype:"treecolumn",dataIndex:"name",flex:1,renderer:function(f,a,b,d,h,g,e){var j=b.data.message;if(j==""){j=b.data.description}j=Ext.String.htmlEncode(j);var i=e.up("panel")["basePath"];var c=b.data.link;if(c!=null&&c!=""){return'<a target=_blank href="'+i+"/"+c+'">'+f+"</a>"}else{return f}}},{text:"Description",dataIndex:"description",flex:2,renderer:function(g,c,b,h,e,d,a){var f=b.data.message;if(f==""){f=b.data.description}f=Ext.String.htmlEncode(f);return g}}]});Ext.define("BP.view.grid.V_KeyValueGrid",{extend:"Ext.grid.Panel",requires:[],alias:"widget.keyValueGrid",resizable:false,closable:false,padding:5,title:"Global parameters",autoScroll:false,autoHeight:true,collapsible:true,collapsed:true,margin:5,columns:[{text:"key",dataIndex:"key",width:100,renderer:function(a){return'<span style="font-weight:bold;">'+a+"</span>"}},{text:"value",dataIndex:"value",flex:1}]});Ext.define("BP.view.grid.V_GridProteomes",{extend:"Ext.grid.Panel",requires:[],alias:"widget.gridProteomes",resizable:false,closable:false,padding:5,width:"100%",title:"Proteomes",autoScroll:false,collapsible:true,collapsed:true,margin:5,columns:[{text:"code",dataIndex:"code",width:100,renderer:function(a){return'<span style="font-weight:bold;">'+a+"</span>"}},{text:"reference",width:100,dataIndex:"reference",},{text:"title",dataIndex:"title",flex:2}]});Ext.define("BP.globals.Utils",{singleton:true,displayShortMessage:function(b,a){Ext.create("Ext.window.Window",{header:false,bodyStyle:"font-color:green",border:0,resizable:false,layout:"fit",closable:false,items:{bodyCls:"short-message",html:b}}).show(a,function(){this.el.ghost("b",{delay:1000})})},basename:function(a){return a.replace(/\\/g,"/").replace(/.*\//,"")},getHostUrl:function(){var a=window.location.pathname.replace(/\/web.*/,"");var b=window.location.port;var c=window.location.protocol+"//"+window.location.hostname;if(b!==""){c+=":"+b}c+=a;return c},formatValue:function(b){var c=b;if(Ext.isDefined(b)){if(Ext.isArray(c)){for(var a=0;a<c.length;a++){c[a]=this.formatValue(c[a])}c=c.join("<br />")}else{if(!Ext.isNumeric(b)){if(this.isHttpLink(b)||this.isFtpLink(b)){c=this.toHttpHref(b)}else{if(this.isDoiLink(b)){c=this.toDoiHref(b)}}}}}return c},isHttpLink:function(a){if(a.indexOf("http")==0){return true}return false},isDoiLink:function(a){if(a.indexOf("doi:")==0){return true}return false},isFtpLink:function(a){if(a.indexOf("ftp:")==0){return true}return false},toHttpHref:function(a){var b="<a href='"+a+"' target=_blank>"+a+"</a>";return b},toDoiHref:function(b){var a=b.replace("doi:","http://dx.doi.org/");var c="<a href='"+a+"' target=_blank>"+b+"</a>";return c},replaceNewLines:function(a){return a.replace(/(?:\r\n|\r|\n)/g,"<br />")}});Ext.define("BP.view.grid.V_ListAnalyses",{extend:"Ext.grid.Panel",requires:["BP.globals.Utils"],alias:"widget.listAnalyses",resizable:false,closable:false,autoScroll:true,bodyPadding:5,store:"S_Analyses",title:"List of analyses",bubbleEvents:["viewresult","deleteresult"],dockedItems:[{xtype:"toolbar",items:[{iconCls:"icon-reload",text:"Reload",action:"reload"}]}],columns:[{text:"status",dataIndex:"status",flex:2,align:"left",renderer:function(f,e,b,g,d,c,a){if(f=="error"){e.style="background-color:red;"}else{if(f=="log"){e.style="background-color:orange;"}else{if(f=="success"){e.style="background-color:green;"}}}return""}},{xtype:"checkcolumn",align:"left",text:"public",dataIndex:"public",flex:2,listeners:{checkchange:function(d,a,e){var c=this.up("listAnalyses").getView();var b=c.getRecord(c.getNode(a));this.up("listAnalyses").fireEvent("publish",b,a);this.up("listAnalyses").update()}},},{xtype:"actioncolumn",text:"actions",align:"left",flex:2,items:[{iconCls:"icon-eye",tooltip:"View results files",handler:function(c,h,b,d,f,a,g){c.up("panel").fireEvent("viewresult",a,h)}},{iconCls:"icon-delete",tooltip:"Delete analysis",handler:function(c,h,b,d,f,a,g){Ext.MessageBox.confirm("Confirm","Are you sure you want to delete this analysis?",function(e){if(e=="yes"){c.up("panel").fireEvent("deleteresult",a,h)}})},},{iconCls:"icon-script_gear",tooltip:"Complete log",handler:function(d,i,c,f,g,a,h){var b=Ext.create("BP.view.log.V_WindowLog",{title:a.data.title+"'s log",log:BP.globals.Utils.replaceNewLines(a.data.log)});b.show()},},]},{text:"url",align:"left",dataIndex:"url",flex:1,renderer:function(a){if(a!=""){var c=a.split("/");var b=c[c.length-3]+"/"+c[c.length-2]+"/"+c[c.length-1];return"<a href='../cgi/index.cgi?download="+b+"' target=_blank>zip</a>"}},},{text:"title",align:"left",dataIndex:"title",flex:4},{text:"date",align:"left",dataIndex:"date",flex:4},{text:"log's last line",align:"left",dataIndex:"log",flex:8,renderer:function(g,a,b,c,i,h,d){var e=b.data.log.split("\n");var f=e[e.length-2];a.tdAttr='data-qtip="'+f+'"';return f}}]});Ext.define("BP.view.panel.V_MainPanel",{extend:"Ext.tab.Panel",alias:"widget.mainPanel",requires:["BP.view.form.V_NewAnalysis","BP.globals.ConnectionData","BP.view.grid.V_ListAnalyses","BP.view.panel.V_Home"],region:"center",resizable:false,title:"Main panel",header:false,items:[{xtype:"homePanel"},{xtype:"helpPanel"}],initComponent:function(){var a=Ext.form.field.VTypes.email(BP.globals.ConnectionData.mail);if(a){this.items.push({xtype:"newAnalysis"});var b=Ext.getStore("S_Analyses");var c=this;b.load();this.items.push({xtype:"listAnalyses"})}this.callParent(arguments)},listeners:{tabchange:function(c,a){var b=Ext.ComponentQuery.query("cardWindow");Ext.each(b,function(d){d.hide()})}}});Ext.define("BP.view.Viewport",{extend:"Ext.container.Viewport",layout:"border",requires:["BP.view.panel.V_BannerPanel","BP.view.panel.V_MainPanel"],items:[{xtype:"mainPanel"}],initComponent:function(){var c=Ext.Object.fromQueryString(location.search);var b=true;if("banner" in c){var a=c.banner;if(a==0){b=false}}if(b==true){this.items.push({xtype:"bannerPanel"})}this.callParent(arguments)}});Ext.define("BP.globals.Result",{singleton:true,displayResult:function(a){var c=this;var b=a+"/results.json";BP.globals.Ajax.send({url:b,waitMessage:"Displaying results...",successValue:undefined,successFunction:function(f){if(Ext.isDefined(f.analysis)){var d=Ext.create("BP.view.panel.V_ResultsPanel");d.setFromJson(f);var g=Ext.ComponentQuery.query("mainPanel")[0];g.add(d);g.setActiveTab(d);var i=b.split("/");var h=i[i.length-2];var e=BP.globals.Utils.getHostUrl()+"/ws/"+h+"/status/exists";BP.globals.Ajax.send({url:(DEBUG)?"resources/test/json/checkQueryBuilder.json":e,waitMessage:"check query builder",successValue:"true",successFunction:function(r){if(r.exists=="false"){var j=Ext.create("BP.view.button.V_BuildQueryBuilder",{analysisName:h});d.addDocked({xtype:"toolbar",items:[j]})}else{var j=Ext.create("BP.view.button.V_QueryBuilder",{analysisName:h,analysisTitle:f.analysis.title});var l=Ext.create("BP.view.button.V_RemoveQueryBuilder",{analysisName:h});d.addDocked({xtype:"toolbar",items:[j,]})}var t=[{key:"Contact",value:f.analysis.contact},{key:"Date",value:f.analysis.date}];var x=Ext.create("BP.store.S_KeyValue",{data:t});var o=Ext.create("BP.view.grid.V_KeyValueGrid",{title:"Global parameters",store:x,hideHeaders:true});d.add(o);if(Ext.isDefined(f.analysis.homologygroups)){var s=[{key:"Outfile",value:c.createLink(f.analysis.homologygroups.outfile,a)},{key:"Version",value:f.analysis.homologygroups.version},{key:"Parameters",value:f.analysis.homologygroups.parameters}];var w=Ext.create("BP.store.S_KeyValue",{data:s});var m=Ext.create("BP.view.grid.V_KeyValueGrid",{title:"Homology groups parameters",store:w,hideHeaders:true});d.add(m)}if(Ext.isDefined(f.analysis.proteomes)){var z=f.analysis.proteomes;var y=[];for(var k in z){var n=z[k];n.code=k;n.fasta=c.createLink(n.fasta,a);n.iprscan="";if(Ext.isDefined(n.iprscan)){n.iprscan=c.createLink(n.iprscan,a)}Ext.Array.push(y,n)}var u=Ext.create("BP.store.S_Proteome",{data:y});var A=Ext.create("BP.view.grid.V_GridProteomes",{title:"Proteomes",store:u});d.add(A)}if(Ext.isDefined(f.results)){var v=f.results;var q=Ext.create("BP.store.S_TreeResult",{root:v.root});var p=Ext.create("BP.view.grid.V_TreeGridResult",{title:"Results",store:q,basePath:a});d.add(p);p.updateLayout()}}})}}})},createLink:function(b,a){var c=b.replace("./","");return('<a target="_blank" href="'+a+"/"+c+'">'+c+"</a>")},displayQueryResult:function(h,i,a,c,e,f,d,g){var b=BP.globals.Utils.getHostUrl()+"/ws/"+a+"/get/"+e+"?"+f+"="+d;if(c){b+="&owner="+c}BP.globals.Ajax.send({url:b,waitMessage:"Search "+e,successValue:"true",params:{limit:g,start:0},successFunction:function(k){if(k.totalCount==0){Ext.Msg.alert("Message","No result")}else{var j=Ext.create("BP.view.querybuilder.V_QueryResultGrid",{json:k,pageSize:g,page:1,url:b});var l=Ext.create("BP.view.querybuilder.V_QueryResultPanel",{title:"List of "+e+" with "+f+" containing "+decodeURIComponent(d),closable:true,collapsible:true});l.add(j);h.insert(i,l)}}})}});Ext.define("BP.globals.Ajax",{singleton:true,config:{timeout:120*1000,useDefaultXhrHeader:true,withCredentials:false,method:"GET",serverFailureMessage:"Server error",jsonFailureMessage:"Bad response from the server",successFunction:function(){},failureFunction:function(){},callback:function(){},scope:this,successValue:1,url:"",waitMessage:"Server connection..."},buildParams:function(b){var a;if(Ext.isDefined(b)){a=Ext.clone(b)}else{a={}}if(!Ext.isDefined(a.params)){a.params={}}if(Ext.isDefined(BP.globals.ConnectionData.owner)){a.params.owner=BP.globals.ConnectionData.owner}return a},send:function(d){var a=Ext.clone(this.config);a=Ext.apply(a,d,a);a=this.buildParams(a);var c=null;if(a.waitMessage!=""){c=Ext.create("Ext.window.MessageBox");c.wait(a.waitMessage,"Please Wait...")}var b=Ext.create("Ext.data.Connection",{useDefaultXhrHeader:a.useDefaultXhrHeader});b.request({url:a.url,params:a.params,scope:a.scope,withCredentials:a.withCredentials,method:a.method,timeout:a.timeout,failure:function(e,f){a.failureFunction(e,f);if(a.serverFailureMessage!=""){Ext.create("Ext.window.MessageBox").alert("Server Error",a.serverFailureMessage)}},success:function(f,h){var g=null;try{g=Ext.decode(f.responseText)}catch(i){a.failureFunction(f,h);if(a.jsonFailureMessage!=""){Ext.create("Ext.window.MessageBox").alert("Server error",a.jsonFailureMessage)}}if(g!=null){if(g.success!=a.successValue){a.failureFunction(f,h);Ext.create("Ext.window.MessageBox").alert("Failed",(Ext.isDefined(g.message))?g.message:"Unknown error");if(Ext.isDefined(g.login)&&g.login=="false"){BP.globals.Login.logout()}}else{a.successFunction(g)}}},callback:function(e,f){a.callback();if(a.waitMessage!=""){c.close()}}})}});Ext.define("BP.globals.Login",{singleton:true,checkLogin:function(){BP.globals.Ajax.send({url:"../cgi/index.cgi",params:{authentication:1},method:"POST",serverFailureMessage:"Impossible to check login",jsonFailureMessage:"Check login: bad response from the server",successFunction:function(a){BP.globals.ConnectionData.mail=a.email;if(!Ext.form.field.VTypes.email(a.email)){Ext.create("Ext.window.MessageBox").alert("Login Failed","Connection lost, please login")}Ext.ComponentQuery.query("bannerPanel")[0].setLogin()},})},logout:function(){BP.globals.ConnectionData.mail="";Ext.ComponentQuery.query("bannerPanel")[0].setLogin();var a=Ext.ComponentQuery.query("mainPanel")[0];a.removeAll(true);a.add({xtype:"homePanel"})}});Ext.define("BP.store.S_GenericStore",{extend:"Ext.data.Store",checkLogin:false,constructor:function(a){if(!Ext.isDefined(a)){a={}}a.proxy=this.initProxy();this.callParent(arguments)},initProxy:function(){var a=this;return{type:"ajax",timeout:240*1000,afterRequest:function(c,d){var b=Ext.decode(c._operation._response.responseText);if(a.checkLogin&&Ext.isDefined(b.login)&&b.login=="false"){BP.globals.Login.logout()}},listeners:{exception:function(e,c,b,d){var g=Ext.create("Ext.window.MessageBox");if(c.status!==200){g.alert("Failed","Server Error. Status: "+c.status)}else{var f=Ext.decode(c.responseText);g.alert("Failed",f.message)}}}}}});Ext.define("BP.view.button.V_BuildQueryBuilder",{extend:"Ext.button.Button",alias:"widget.buildQueryBuilderButton",text:"Build Query builder"});Ext.define("BP.view.button.V_QueryBuilder",{extend:"Ext.button.Button",alias:"widget.queryBuilderButton",text:"Query builder",layout:{type:"vbox",padding:5,margin:5,align:"stretch"}});Ext.define("BP.view.button.V_RemoveQueryBuilder",{extend:"Ext.button.Button",alias:"widget.removeQueryBuilderButton",text:"Remove Query builder"});Ext.define("BP.view.querybuilder.V_QueryBuilderPanel",{extend:"Ext.panel.Panel",alias:"widget.queryBuilderPanel",requires:[],autoScroll:true,resizable:false,closable:true,title:"Query Builder",layout:{type:"vbox",align:"stretch",margin:5,padding:5,},initComponent:function(){var a=this;a.items=[{xtype:"searchForm",title:"Search by key word"},{xtype:"blastForm",title:"Blast"},{xtype:"includeExcludeForm",title:"Include or exclude proteomes"}];var b=BP.globals.Utils.getHostUrl()+"/ws/"+a.analysisName+"/get/proteomes?field=code";a.callParent();var c=[];BP.globals.Ajax.send({url:b,waitMessage:"Get proteomes",successValue:"true",successFunction:function(e){var f=e.list;if(!Ext.isDefined(f)){Ext.Msg.alert("Message","Server error : no list in the json");return}Ext.each(f,function(g){c.push({code:g})});var d=a.query("includeExcludeForm grid")[1];d.getStore().loadData(c)}})}});Ext.define("BP.view.querybuilder.V_SearchForm",{extend:"Ext.form.Panel",alias:"widget.searchForm",collapsible:true,margin:5,padding:5,layout:{type:"vbox"},defaults:{padding:5,margin:5,},items:[{xtype:"fieldset",border:false,plugins:"responsive",layout:{type:"hbox"},defaults:{padding:5,margin:5,},items:[{xtype:"combobox",name:"target",width:100,fieldLabel:"",store:new Ext.data.Store({fields:["name"],data:[{name:"proteins"},{name:"groups"}]}),value:"proteins",forceSelection:true,allowBlank:false,displayField:"name",valueField:"name"},{xtype:"combobox",width:100,name:"query",fieldLabel:"",displayField:"name",valueField:"name",value:"accession",allowBlank:false,store:new Ext.data.Store({fields:["name"],data:[{name:"accession"},{name:"annotation"}]}),forceSelection:true},{xtype:"textfield",width:200,name:"queryText",fieldLabel:"",allowBlank:false}]},{xtype:"numberfield",value:50,allowBlank:false,fieldLabel:"Page size",name:"pageSize",minValue:1,width:200,maxWidth:200,margin:5,padding:5,maxValue:200},{xtype:"button",text:"search",formBind:true,action:"search"}]});Ext.define("BP.view.querybuilder.V_BlastForm",{extend:"Ext.form.Panel",alias:"widget.blastForm",collapsible:true,margin:5,padding:5,layout:{type:"vbox",},defaults:{padding:5,margin:5,},items:[{xtype:"textareafield",fieldLabel:"Sequence",name:"blastquery",width:400,height:200,allowBlank:false},{xtype:"combobox",width:200,maxWidth:200,fieldLabel:"Method",name:"blastmethod",queryMode:"local",store:["blastp","blastx"],allowBlank:false},{xtype:"numberfield",value:0.001,allowBlank:false,fieldLabel:"E-value",name:"blastevalue",minValue:0,width:200,maxWidth:200,maxValue:10,decimalPrecision:10,hideTrigger:true,keyNavEnabled:false,mouseWheelEnabled:false},{xtype:"numberfield",value:50,allowBlank:false,fieldLabel:"Page size",name:"pageSize",minValue:1,width:200,maxWidth:200,maxValue:200},{xtype:"button",text:"blast",formBind:true,action:"searchByBlast"}]});Ext.define("BP.view.querybuilder.V_QueryResultGrid",{extend:"Ext.grid.Panel",alias:"widget.queryResultGrid",padding:5,margin:5,bubbleEvents:["getfasta","getgroups"],constructor:function(g){var a=this;if(!Ext.isDefined(g.json)){console.log("lacks the json parameters in the constructor of the grid")}var l=g.json;var j=l.fields;Ext.each(j,function(o){if(o.type=="array"){o.type="string"}if(o.type=="float"){o.sortType="asFloat"}o.convert=function(p){return BP.globals.Utils.formatValue(p)}});var n=l;var k=l.links;var m=Ext.create("Ext.data.Store",{fields:j,autoLoad:{start:g.start,limit:g.pageSize,owner:BP.globals.ConnectionData.owner},pageSize:g.pageSize,proxy:{type:"ajax",url:g.url,extraParams:{owner:BP.globals.ConnectionData.owner},reader:{type:"json",rootProperty:"table",totalProperty:"totalCount"}}});g.store=m;var c=[];Ext.each(j,function(o){c.push({text:o.pretty_name,dataIndex:o.name,flex:1})});if(k.length>0){var e={xtype:"actioncolumn",text:"links",menuDisabled:true,width:100,items:[]};Ext.each(k,function(p){var o="icon-link";if(p.rel=="sequences"){o="icon-F"}else{if(p.rel=="groups"){o="icon-G"}else{if(p.rel=="proteins"){o="icon-P"}else{if(p.rel=="alignment"){o="icon-A"}}}}var q=p.desc;e.items.push({iconCls:o,tooltip:q,handler:function(u,w,s,t,v,r){if(p.rel=="sequences"){a.fireEvent("getfasta",r)}else{if(p.rel=="groups"){a.fireEvent("getgroups",r,a)}else{if(p.rel=="proteins"){a.fireEvent("getproteins",r,a)}else{if(p.rel=="alignment"){a.fireEvent("getalignment",r,a)}}}}}})})}c.push(e);g.columns=c;var d=null;var f=null;var b=null;var i=l.metadata.links;if(Ext.isDefined(i)){Ext.each(i,function(o){if(o.rel=="rawdata"&&Ext.isDefined(o.href)){d=o.href}else{if(o.rel=="abundancy_matrix"&&Ext.isDefined(o.href)){f=o.href}else{if(o.rel=="binary_matrix"&&Ext.isDefined(o.href)){b=o.href}}}})}var h=[];if(d!=null){h.push({xtype:"button",tooltip:"Get raw data",iconCls:"icon-page_excel",handler:function(){window.open(d,"_blank")}})}if(f!=null){h.push({xtype:"button",tooltip:"Display abundancy matrix",iconCls:"icon-application_view_icons",handler:function(){var p=Ext.create("BP.view.matrix.V_HeatMap",{url:f,title:"Abundancy matrix"});var o=Ext.ComponentQuery.query("mainPanel")[0];o.add(p);o.setActiveItem(p)}})}if(b!=null){h.push({xtype:"button",tooltip:"Display binary matrix",iconCls:"icon-application_view_detail",handler:function(){var o=Ext.create("BP.view.matrix.V_HeatMap",{url:b,title:"Binary matrix"});var p=Ext.ComponentQuery.query("mainPanel")[0];p.add(o);p.setActiveItem(o)}})}g.dockedItems=[{xtype:"pagingtoolbar",store:m,dock:"bottom",displayInfo:true}];if(h.length>0){g.dockedItems.push({dock:"top",xtype:"toolbar",items:h})}this.callParent([g])}});Ext.define("BP.view.querybuilder.V_QueryResultPanel",{extend:"Ext.panel.Panel",alias:"widget.queryResultPanel",requires:[],autoScroll:true,resizable:false,closable:true,margin:5,padding:5,title:"",items:[],layout:{type:"vbox",align:"stretch"},listeners:{afterrender:function(a){this.up("panel").scrollBy(0,-100);a.focus()}}});Ext.define("BP.view.fasta.V_FastaWindow",{extend:"Ext.window.Window",alias:"widget.fastaWindow",title:"Fasta",height:600,width:800,autoRender:true,autoScroll:true,constrain:true,closable:true,layout:{type:"vbox",align:"stretch",margin:5,padding:5,},constructor:function(b){var a=Ext.create("BP.view.fasta.V_MultiFastaPanel",{json:b.json});b.items=[a];this.callParent([b])}});Ext.define("BP.view.fasta.V_FastaPanel",{extend:"Ext.panel.Panel",alias:"widget.fastaPanel",requires:[],layout:{type:"vbox",align:"stretch"},autoScroll:true,resizable:true,collapsible:true,title:"fasta",constructor:function(f){if(!Ext.isDefined(f.json)){console.log("lacks the json parameters in the constructor of the fasta panel")}var a=f.json;f.title=a.protein_accession;var h=a.sequence;var e=a.links;var g=">"+a.protein_accession;for(var b in a){if(b!="sequence"&&b!="links"&&b!="header"){if(a[b]!=""){g+=" "+b+"="+a[b]}}}if(Ext.isDefined(e)&&e.length>0){var d=[];Ext.each(e,function(i){var j={xtype:"button",tooltip:i.desc,link:i.href};if(i.rel=="groups"){j.action="getGroups";j.iconCls="icon-G";j.objectName=a.homologyGroup}else{if(i.rel=="proteins"){j.action="getProteins";j.iconCls="icon-P";j.objectName=a.protein_accession+" info"}}d.push(j)});var c=Ext.create("Ext.toolbar.Toolbar",{dock:"top",items:d});f.dockedItems=[c]}f.items=[{xtype:"textarea",margin:5,height:200,value:g+"\n"+h,editable:false}];this.callParent([f])}});Ext.define("BP.view.fasta.V_MultiFastaPanel",{extend:"Ext.panel.Panel",alias:"widget.multiFastaPanel",requires:[],autoScroll:true,resizable:true,collapsible:false,header:false,title:"fasta",layout:{type:"vbox",align:"stretch"},constructor:function(d){if(!Ext.isDefined(d.json)){console.log("lacks the json parameters in the constructor of the fasta window")}var a=d.json;var c=null;var b=a.metadata.links;Ext.each(b,function(f){if(f.rel=="rawdata"){c=f.href}});if(c!=null&&Ext.isDefined(c)){d.dockedItems=[{dock:"top",xtype:"toolbar",items:[{xtype:"button",tooltip:"Load fasta file",iconCls:"icon-bullet_disk",handler:function(){window.open(c,"_blank")}}]}]}var e=a.sequences;d.items=[];Ext.each(e,function(g){var f=Ext.create("BP.view.fasta.V_FastaPanel",{json:g});d.items.push(f)});this.callParent([d])}});Ext.define("BP.view.msa.V_MsaPanel",{extend:"Ext.panel.Panel",alias:"widget.msaPanel",requires:[],autoScroll:true,resizable:false,closable:true,title:"MSA",layout:"fit",url:"",listeners:{afterrender:function(){this.buildMsa()}},buildMsa:function(){var b=this.url;var a=Ext.create("Ext.container.Container",{margin:5,padding:5,html:"<div style='margin:5;padding:5;' class='msa'></div>",name:"msaZone",border:false});this.add(a);BP.globals.Ajax.send({url:b,waitMessage:"Get alignment",successValue:"true",successFunction:function(k){var c=null;var f=null;var g=k.metadata.links;Ext.each(g,function(m){if(m.rel=="rawdata"){c=m.href}else{if(m.rel=="tree"){f=m.href}}});if(c==null){Ext.Msg.alert("Failed","No file for this alignment")}else{var i=Ext.query("#"+a.getEl().id+" div.msa")[0];console.log("url alignment",c);console.log("url tree",f);var d=document.createElement("div");var e=document.createElement("div");var h=document.createElement("div");i.appendChild(d);i.appendChild(e);i.appendChild(h);msa.io.fasta.read(c,function(o,p){var n={el:e,vis:{conserv:false,overviewbox:false,labelId:false},zoomer:{labelNameLength:200},importUrl:c,seqs:p,menu:"small",bootstrapMenu:true};var l=new msa(n).render()});var j=new XMLHttpRequest();j.onreadystatechange=function(){if(j.readyState==4&&(j.status==200||j.status==0)){var s=j.responseText;console.log("newick");console.log(s);var l=760;var n=true;var r=d3.select(h).append("hr").append("div").append("span").text("Tree layout: ");var m=r.append("select").on("change",function(z){var y=tnt.tree.layout[this.value]().width(l).scale(n);x.layout(y);x.update()});m.append("option").attr("value","vertical").attr("selected",1).text("vertical");m.append("option").attr("value","radial").text("radial");var o=tnt.tree.parse_newick(s);var u=5;var t="lightgrey";var p="black";var q=tnt.tree.node_display.circle().size(u).fill(t).stroke(p);var w=tnt.tree.node_display.triangle().size(u).fill(t).stroke(p);var v=tnt.tree.node_display().size(24).display(function(y){if(y.is_collapsed()){w.display().call(this,y)}else{q.display().call(this,y)}});var x=tnt.tree().node_display(v).data(o).duration(500).layout(tnt.tree.layout.vertical().scale(n).width(l));x.on("click",function(y){y.toggle();x.update()});x(h)}};j.open("GET",f,true);j.send(null)}}})}});Ext.define("BP.view.querybuilder.V_IncludeExclude",{extend:"Ext.form.Panel",alias:"widget.includeExcludeForm",collapsible:true,margin:5,padding:5,layout:{type:"vbox"},defaults:{padding:5,margin:5,},initComponent:function(){var a=this;var c=this.up("queryBuilderPanel");var d=c.analysisName;var b=[{text:"Proteome code",flex:1,sortable:true,dataIndex:"code"}];this.items=[{xtype:"displayfield",fieldLabel:"Drag & Drop proteomes from the central grid to the other grids to include or exclude proteomes",labelWidth:500},{xtype:"container",width:600,defaults:{padding:5,margin:5,},layout:{type:"hbox",border:false,align:"stretch",},items:[{xtype:"grid",title:"Proteomes included",name:"includeGrid",flex:1,hideHeaders:true,multiSelect:true,store:new Ext.data.Store({model:"BP.model.M_Proteome"}),columns:b,viewConfig:{plugins:{ptype:"gridviewdragdrop",ddGroup:"DDgroup",enableDrop:true}}},{xtype:"grid",title:"Proteomes",name:"mainGrid",hideHeaders:true,multiSelect:true,flex:1,store:new Ext.data.Store({model:"BP.model.M_Proteome"}),columns:b,viewConfig:{plugins:{ptype:"gridviewdragdrop",ddGroup:"DDgroup"}}},{xtype:"grid",name:"excludeGrid",title:"Proteomes excluded",hideHeaders:true,multiSelect:true,flex:1,store:new Ext.data.Store({model:"BP.model.M_Proteome"}),columns:b,viewConfig:{plugins:{ptype:"gridviewdragdrop",ddGroup:"DDgroup",enableDrop:true}}}]},{xtype:"textfield",name:"annotation",width:200,fieldLabel:"Group annotation contains"},{xtype:"numberfield",value:50,allowBlank:false,fieldLabel:"Page size",name:"pageSize",minValue:1,width:200,maxWidth:200,maxValue:200},{xtype:"button",text:"Search groups",formBind:true,action:"includeExclude"}];this.callParent()}});Ext.define("BP.view.matrix.V_HeatMap",{extend:"Ext.panel.Panel",alias:"widget.heatmap",requires:[],layout:"fit",autoScroll:true,resizable:false,closable:true,url:"",constructor:function(a){this.url=a.url;this.callParent([a])},initComponent:function(){var c=this;var f=window.innerWidth-260;var e=300;var d=Ext.create("BP.view.matrix.V_CardWindow",{visible:false,x:f,y:e,renderTo:c.el});this.winCard=d;this.callParent(arguments);var b=this.id+"matrix";var a=Ext.create("Ext.container.Container",{margin:5,padding:5,html:"<div style='margin:5;padding:5;height: 600px; min-width: 310px; max-width: 100%;' id='"+b+"'></div>",name:"matrixZone",border:false});this.add(a);BP.globals.Ajax.send({url:this.url,waitMessage:"Build matrix...",successValue:"true",successFunction:function(j){var l=j.metadata.links;if(!Ext.isDefined(l)){Ext.Msg.alert("Failed","No links to build the heatmap");return}var m=null;var i=null;Ext.each(l,function(n){if(n.rel=="rawdata"&&Ext.isDefined(n.href)){m=n.href}else{if(n.rel=="inchlib"&&Ext.isDefined(n.href)){i=n.href}}});if(m!=null){a.add({xtype:"button",tooltip:"Get raw data",iconCls:"icon-page_excel",handler:function(){window.open(m,"_blank")}})}if(i==null){Ext.Msg.alert("Failed","No inchlib link");return}window.inchlib=new InCHlib({target:b,metadata:true,column_metadata:false,max_height:1200,width:1000,heatmap_colors:"Greens",metadata_colors:"Reds",independent_columns:false,draw_row_ids:true});inchlib.read_data_from_file(i);var h=inchlib.json;if(h.compression.mode===1){inchlib.settings.metadata=false;var k="WARNING: "+h.compression.input_lines+" lines compressed into max "+h.compression.threshold;var g=a.add({xtype:"box",html:'<div class="alert alert-warning">'+k+"</div>"})}inchlib.draw();c.inchlib=inchlib;c.bind_dendrogram_events();c.mouseOver=h.onmouseover}})},displayCard:function(d,a){var f=this.mouseOver[d];var g=[];for(key in f){var e=f[key];g.push({key:key,value:BP.globals.Utils.formatValue(e)})}var b=Ext.create("BP.store.S_KeyValue");b.loadData(g);var c=this.winCard.down("grid");c.setStore(b);this.winCard.setVisible(true)},hideCard:function(){this.winCard.hide()},fixCard:function(a){a.events.row_onmouseover=function(){};a.events.heatmap_onmouseout=function(){}},bind_dendrogram_events:function(c){var a=this;var c=a.inchlib;var b=c.json;c.events.row_onmouseover=function(e,d){if(b.compression.mode!==1){a.displayCard(e)}};c.events.heatmap_onmouseout=function(d){if(b.compression.mode!==1){a.hideCard()}};c.events.row_onclick=function(e,d){if(b.compression.mode!==1){a.displayCard(e)}a.fixCard(c);c.highlight_rows(e)};c.events.empty_space_onclick=function(){if(b.compression.mode!==1){a.hideCard()}c.highlight_rows([]);a.bind_dendrogram_events(c)}}});Ext.define("BP.view.matrix.V_MatrixPanel",{extend:"Ext.panel.Panel",alias:"widget.matrixPanel",requires:[],layout:{type:"hbox",align:"stretch"},autoScroll:true,resizable:false,closable:true,url:"",constructor:function(a){this.url=a.url;this.callParent([a])},initComponent:function(){var a=this;this.callParent(arguments);var c=Ext.create("BP.view.matrix.V_HeatMap",{url:this.url,header:false,title:"Abundancy matrix"});var b=Ext.create("BP.view.matrix.V_Card",{store:new Ext.data.Store({model:"BP.model.M_KeyValue",visible:false})});this.add(c)}});Ext.define("BP.view.matrix.V_Card",{extend:"Ext.grid.Panel",alias:"widget.cardGrid",viewConfig:{stripeRows:false},columns:[{text:"Source",dataIndex:"key",flex:1},{text:"Value",dataIndex:"value",}]});Ext.define("BP.view.matrix.V_CardWindow",{extend:"Ext.window.Window",alias:"widget.cardWindow",title:"Metadata",height:300,width:250,autoRender:true,autoScroll:true,constrain:true,closable:true,closeAction:"hide",layout:"fit",items:[{xtype:"cardGrid"}]});Ext.define("BP.view.log.V_WindowLog",{extend:"Ext.window.Window",alias:"widget.windowLog",width:400,height:400,layout:"fit",constrain:true,constructor:function(c){var b=c.log;var a=Ext.create("Ext.panel.Panel",{html:b,autoScroll:true});this.items=[a];this.callParent([c])}});Ext.define("BP.model.M_Result",{extend:"Ext.data.Model",fields:[{name:"name",type:"string"},{name:"description",type:"string"},{name:"message",type:"string"},{name:"status",type:"string"},{name:"link",type:"string"}]});Ext.define("BP.store.S_Result",{extend:"Ext.data.Store",model:"BP.model.M_Result"});Ext.define("BP.store.S_TreeResult",{extend:"Ext.data.TreeStore",model:"BP.model.M_Result"});Ext.define("BP.model.M_KeyValue",{extend:"Ext.data.Model",fields:[{name:"key",type:"string"},{name:"value",type:"string"}]});Ext.define("BP.store.S_KeyValue",{extend:"Ext.data.Store",model:"BP.model.M_KeyValue"});Ext.define("BP.model.M_Proteome",{extend:"Ext.data.Model",fields:[{name:"code",type:"string"},{name:"title",type:"string"},{name:"fasta",type:"string"},{name:"reference",type:"boolean"},{name:"iprscan",type:"string"}]});Ext.define("BP.store.S_Proteome",{extend:"Ext.data.Store",model:"BP.model.M_Proteome"});Ext.define("BP.model.M_Analysis",{extend:"Ext.data.Model",fields:[{name:"title",type:"string"},{name:"date",type:"string"},{name:"log",type:"string"},{name:"url",type:"string"},{name:"status",type:"string"},{name:"public",type:"bool"}]});Ext.define("BP.store.S_Analyses",{extend:"BP.store.S_GenericStore",requires:[],model:"BP.model.M_Analysis",autoLoad:false,checkLogin:true,sorters:{property:"date",direction:"DESC"},initProxy:function(){return Ext.apply(this.callParent(),{type:"ajax",url:"../cgi/index.cgi",extraParams:{__wb_function:"ListAnalyses",owner:BP.globals.ConnectionData.owner},reader:{type:"json",rootProperty:"analyses",successProperty:"success"},})}});Ext.define("BP.controller.C_Login",{extend:"Ext.app.Controller",init:function(){this.control({"button[action=login]":{click:this.login},})},login:function(a){window.onbeforeunload=null;window.open("../cgi/index.cgi?login=1","_self","width=800,height=600,left=20,top=200")}});Ext.define("BP.controller.C_Upload",{extend:"Ext.app.Controller",init:function(){this.control({filefield:{change:this.uploadFile}})},uploadFile:function(e){var a=e.up("form");var d=a.getForm();var c=a.up("fieldset");var b="Upload";if(c.uploadAction=="uploadZipFile"){b="ZipUpload"}if(d.isValid()){d.submit({url:"../cgi/index.cgi",params:{email:BP.globals.ConnectionData.email,__wb_function:b},waitMsg:"Uploading...",success:function(l,g){var f=g.result.code;if(c.uploadAction=="uploadFastaFile"){var m=c.up("fieldset").down("fieldset").down("textfield");m.setValue(f)}if(c.uploadAction=="uploadHomologyGroupsFile"){var j=Ext.ComponentQuery.query("[name=homologygroups_parameters]")[0];j.disable()}if(c.uploadAction=="uploadZipFile"){var h=Ext.ComponentQuery.query("newAnalysis")[0];if(g.result.success==1){h.setFromJson(g.result)}else{Ext.Msg.alert("Error","Error during zip processing")}}var k=a.down("displayfield");k.setValue(g.result.original_file_name);var n=g.result.path;var i=a.down("hiddenfield");i.setValue(n)},failure:function(f,h){d.reset();if(c.uploadAction=="uploadHomologyGroupsFile"){var g=Ext.ComponentQuery.query("[name=homologygroups_parameters]")[0];g.enable()}Ext.Msg.alert("Failure",h.result.message)}})}}});Ext.define("BP.controller.C_EnableIprScan",{extend:"Ext.app.Controller",requires:["BP.view.form.V_IprScanUpload"],init:function(){this.control({"checkbox[name=addIprscanResult]":{change:this.change},})},change:function(a){BP.view.form.V_IprScanUpload.prototype.disabled=!a.getValue();Ext.each(Ext.ComponentQuery.query("iprScanUpload"),function(b){b.setDisabled(!a.getValue())})}});Ext.define("BP.controller.C_LaunchAnalysis",{extend:"Ext.app.Controller",requires:["BP.globals.ConnectionData"],init:function(){this.control({"button[action=launchAnalysis]":{click:this.launchAnalysis},})},launchAnalysis:function(g){var b=g.up("form");var c=b.getForm();var a=[];var k="";c.getFields().each(function(d){if(!d.isValid()){k=k+"The field '"+d.fieldLabel+"' is invalid, reasons: "+d.getErrors()+"<br />"}});if(k.length>0){Ext.MessageBox.alert("Error",k)}if(k.length==0&&c.isValid()){var m=c.getValues();if(typeof m.code=="string"){m.code=[m.code];m.pathProteome=[m.pathProteome];m.proteomeDescription=[m.proteomeDescription];m.isReference=[m.isReference];if(typeof m.pathIprScan!=="undefined"){m.pathIprScan=[m.pathIprScan]}}if(typeof m.pathIprScan==="undefined"){m.pathIprScan=[];for(var f=0;f<m.code.length;f++){m.pathIprScan[f]=""}}var n={};n.contact=BP.globals.ConnectionData.mail;n.title=m.analysis_title;var j=new Date();n.date=Ext.Date.format(j,"Ymd H:i:s");n.description=m.analysis_description;n.homologygroups={pmatch_cutoff:m.pMatchCutoff,pi_cutoff:m.piCutoff,pv_cutoff:m.pvCutoff,inflation:m.inflation,outfile:m.pathHomologyGroups};n.proteomes={};for(var f=0;f<m.code.length;f++){if(Ext.Array.contains(a,m.code[f])){Ext.MessageBox.alert("Error","Proteome codes must be unique : "+m.code[f]+" is duplicated");return}Ext.Array.push(a,m.code[f]);var e={};e.reference=m.isReference[f];e.fasta=m.pathProteome[f];e.title=m.proteomeDescription[f];e.iprscan=m.pathIprScan[f];n.proteomes[m.code[f]]=e}var l=Ext.JSON.encode(n);var h=Ext.create("Ext.window.MessageBox");var o=Ext.create("Ext.window.MessageBox");h.wait("Launching analysis...","Please Wait");Ext.Ajax.request({url:"../cgi/index.cgi",scope:this,method:"POST",params:{json:l,__wb_function:"LaunchAnalysis"},failure:function(d,i){o.alert("Error","Error during analysis (1)");h.close()},success:function(i,q){var p=null;try{p=Ext.decode(i.responseText);if(!p.success){o.alert("Error",p.message);h.close()}else{o.alert("Success",p.message+"<br />Please regularly press the reload button in the panel 'List Of Analyses' to follow the progress of your analyses")}}catch(s){o.alert("Error","Error during analysis (2)");h.close()}var r=Ext.ComponentQuery.query("mainPanel")[0];var d=Ext.ComponentQuery.query("listAnalyses")[0];console.log(d);r.setActiveItem(d);Ext.getStore("S_Analyses").reload()},callback:function(){h.close()}})}}});Ext.define("BP.controller.C_Proteome",{extend:"Ext.app.Controller",init:function(){this.control({"button[action=addProteome]":{click:this.addProteome},"button[action=removeProteome]":{click:this.removeProteome}})},addProteome:function(a){var b=a.up("fieldset");b.nb=b.nb+1;b.remove(a);Ext.each(Ext.ComponentQuery.query("proteomeFieldSet"),function(d){d.collapse(true)});b.add({xtype:"proteomeFieldSet",title:"Proteome "+b.nb,collapsed:false,removeButton:true});b.add({xtype:"button",text:"Add Proteome",action:"addProteome"});BP.globals.Utils.displayShortMessage("New proteome",b)},removeProteome:function(a){proteomeField=a.up("fieldset");proteomesField=proteomeField.up("fieldset");proteomesField.remove(proteomeField);BP.globals.Utils.displayShortMessage("Remove proteome",proteomesField)}});Ext.define("BP.controller.C_ViewResult",{extend:"Ext.app.Controller",requires:["BP.view.panel.V_ResultsPanel"],init:function(){this.control({listAnalyses:{viewresult:this.viewResult},})},viewResult:function(b,d){var c=b.store.getAt(d).data;var a=c.url;BP.globals.Result.displayResult(a)}});Ext.define("BP.controller.C_Reload",{extend:"Ext.app.Controller",init:function(){this.control({"button[action=reload]":{click:this.reload},})},reload:function(a){var b=Ext.ComponentQuery.query("windowLog");Ext.each(b,function(c){c.close()});Ext.getStore("S_Analyses").reload()}});Ext.define("BP.controller.C_Reset",{extend:"Ext.app.Controller",requires:["BP.view.form.V_NewAnalysis"],init:function(){this.control({"button[action=reset]":{click:this.reset},})},reset:function(b){var a=b.up("form");var c=a.up("tabpanel");c.remove(a,true);c.insert(1,{xtype:"newAnalysis"});Ext.each(Ext.ComponentQuery.query("iprScanUpload"),function(d){d.setDisabled(true)});c.setActiveTab(1)}});Ext.define("BP.controller.C_DeleteResult",{extend:"Ext.app.Controller",requires:["BP.view.panel.V_ResultsPanel"],init:function(){this.control({listAnalyses:{deleteresult:this.deleteResult},})},deleteResult:function(a,d){var c=a.store.getAt(d).data;var b=BP.globals.Utils.basename(c.url);Ext.Ajax.request({url:"../cgi/index.cgi",params:{"delete":b},waitMsg:"Deleting...",success:function(e,f){Ext.Msg.alert("Success","Analysis successfully deleted");Ext.ComponentQuery.query("listAnalyses")[0].down('button[action="reload"]').fireEvent("click")},failure:function(e,f){Ext.Msg.alert("Failure","Failure while deleting analysis")}})}});Ext.define("BP.controller.C_Publish",{extend:"Ext.app.Controller",init:function(){this.control({listAnalyses:{publish:this.publish}})},publish:function(a,d){var c=a.store.getAt(d).data;var b=BP.globals.Utils.basename(c.url);BP.globals.Ajax.send({url:"../cgi/index.cgi",params:{publish:b},waitMessage:"Publishing...",successValue:"1",successFunction:function(e){Ext.Msg.alert("Success","Analysis public status successfully updated.<br />"+e.message)}})}});Ext.define("BP.controller.C_BuildQueryBuilder",{extend:"Ext.app.Controller",init:function(){this.control({buildQueryBuilderButton:{click:this.build},})},build:function(b){var c=b.analysisName;var a=BP.globals.Utils.getHostUrl()+"/ws/"+c+"/status/build";BP.globals.Ajax.send({url:a,waitMessage:"",successValue:"true",successFunction:function(d){console.log(d);Ext.Msg.alert("Message",d.message);b.disable()}})}});Ext.define("BP.controller.C_QueryBuilder",{extend:"Ext.app.Controller",init:function(){this.control({queryBuilderButton:{click:this.displayQueryBuilder},})},displayQueryBuilder:function(a){var d=Ext.ComponentQuery.query("mainPanel")[0];var b=a.analysisTitle;var e=a.analysisName;if(b.length>10){b=b.substring(0,10)+"..."}var c=Ext.create("BP.view.querybuilder.V_QueryBuilderPanel",{title:"Query builder ("+b+")",analysisName:e});d.add(c);d.setActiveItem(c)}});Ext.define("BP.controller.C_Search",{extend:"Ext.app.Controller",init:function(){this.control({"button[action=search]":{click:this.search}})},search:function(f){var i="accession";if(f.action=="searchByAnnotation"){i="annotation"}var j=f.up("queryBuilderPanel");var a=j.analysisName;var c=f.up("searchForm");var e=c.getValues();var g=e.target;var i=e.query;var b=undefined;if(e.owner){b=e.owner}var d=encodeURIComponent(e.queryText);var h=e.pageSize;var k=j.items.indexOf(c)+1;BP.globals.Result.displayQueryResult(j,k,a,b,g,i,d,h)}});Ext.define("BP.controller.C_QueryResultGrid",{extend:"Ext.app.Controller",init:function(){this.control({queryResultGrid:{getfasta:this.getFasta,getgroups:this.getGroups,getproteins:this.getProteins,getalignment:this.getAlignment},})},getFasta:function(a){var b=null;var c=a.data.accession;Ext.each(a.data.links,function(d){if(d.rel="sequences"){b=d.href}});if(b!=null){BP.globals.Ajax.send({url:b,waitMessage:"Get Fasta",successValue:"true",successFunction:function(d){if(d.totalCount>0){var e=Ext.create("BP.view.fasta.V_MultiFastaPanel",{json:d,closable:true,title:c});var f=Ext.ComponentQuery.query("mainPanel")[0];f.add(e);f.setActiveItem(e)}else{Ext.Msg.alert("Message","No result")}}})}else{Ext.Msg.alert("Failed","No associated fasta file")}},getGroups:function(c){var b="Searching group";var a="groups";var d=c.data.accession;this.displayGrid(c,b,a,d)},getProteins:function(c){var b="Searching Proteins";var a="proteins";var d=c.data.accession+" proteins";this.displayGrid(c,b,a,d)},displayGrid:function(d,b,a,f){var e=null;var g=d.data.links;Ext.each(g,function(h){if(h.rel==a){e=h.href}});var c=50;BP.globals.Ajax.send({url:e,waitMessage:b,successValue:"true",params:{limit:c,start:0},successFunction:function(i){if(i.totalCount>0){var h=Ext.create("BP.view.querybuilder.V_QueryResultGrid",{json:i,pageSize:c,page:1,url:e,title:f,closable:true});var j=Ext.ComponentQuery.query("mainPanel")[0];j.add(h);j.setActiveItem(h)}else{Ext.Msg.alert("Message","No result")}}})},getAlignment:function(a){var b=null;var d=a.data.links;Ext.each(d,function(f){if(f.rel=="alignment"){b=f.href}});if(b==null){Ext.Msg.alert("message","no link for alignment")}else{var e=Ext.create("BP.view.msa.V_MsaPanel",{url:b});var c=Ext.ComponentQuery.query("mainPanel")[0];c.add(e);c.setActiveItem(e)}}});Ext.define("BP.controller.C_FastaPanel",{extend:"Ext.app.Controller",init:function(){this.control({"fastaPanel button[action=getGroups]":{click:this.displayGrid},"fastaPanel button[action=getProteins]":{click:this.displayGrid},})},displayGrid:function(e){var f=e.objectName;var a="Searching groups";if(e.action=="getProteins"){a="Searching proteins"}var c=e.up("fastaPanel").down("queryResultGrid[title="+f+"]");console.log(c);if(c==null){var d=e.up("fastaPanel");var b=50;BP.globals.Ajax.send({url:e.link,waitMessage:a,successValue:"true",params:{limit:b,start:0},successFunction:function(h){if(h.totalCount>0){var g=Ext.create("BP.view.querybuilder.V_QueryResultGrid",{json:h,pageSize:b,start:0,url:e.link,title:f,closable:true});d.add(g)}else{Ext.Msg.alert("Message","No result")}}})}},});Ext.define("BP.controller.C_Blast",{extend:"Ext.app.Controller",init:function(){this.control({"button[action=searchByBlast]":{click:this.blast}})},blast:function(f){var h=f.up("queryBuilderPanel");var d=f.up("blastForm");var a=h.analysisName;var e=d.getValues();var j=encodeURIComponent(e.blastquery);var c=e.blastmethod;var i=e.blastevalue;var g=e.pageSize;var b=(DEBUG)?"resources/test/json/gridQueryResult.json":BP.globals.Utils.getHostUrl()+"/ws/"+a+"/search/blast?blastevalue="+i+"&blastmethod="+c+"&blastquery="+j;BP.globals.Ajax.send({url:b,waitMessage:"Blast...",successValue:"true",params:{limit:g,start:0},successFunction:function(m){if(m.totalCount==0){Ext.Msg.alert("Message","No result")}else{var l=Ext.create("BP.view.querybuilder.V_QueryResultGrid",{json:m,pageSize:g,page:1,url:b});var n=Ext.create("BP.view.querybuilder.V_QueryResultPanel",{title:"Blast result",closable:true,collapsible:true});n.add(l);var k=h.items.indexOf(d)+1;h.insert(k,n)}}})}});Ext.define("BP.controller.C_IncludeExclude",{extend:"Ext.app.Controller",init:function(){this.control({"button[action=includeExclude]":{click:this.run}})},run:function(i){var l=i.up("queryBuilderPanel");var a=l.analysisName;var c=i.up("includeExcludeForm");var n=c.down("grid[name='includeGrid']");var f=n.getStore();var m=[];f.each(function(o){m.push(o.get("code"))});var b=c.down("grid[name='excludeGrid']");var e=b.getStore();var j=[];e.each(function(o){j.push(o.get("code"))});var h=c.getValues();var k=h.pageSize;var g=h.annotation;var d=(DEBUG)?"resources/test/json/gridQueryResult.json":BP.globals.Utils.getHostUrl()+"/ws/"+a+"/get/groups?inproteome="+m.join(",");if(j.length>0){d+="&outproteome="+j.join(",")}if(g!=""){d+="&annotation="+g}BP.globals.Ajax.send({url:d,waitMessage:"Search groups...",successValue:"true",params:{limit:k,start:0},successFunction:function(q){if(q.totalCount==0){Ext.Msg.alert("Message","No result")}else{var p=Ext.create("BP.view.querybuilder.V_QueryResultGrid",{json:q,pageSize:k,page:1,url:d});var s="Groups";if(m.length>0){s+=" with proteins from "+m.join(",")}if(j.length>0){s+=" without proteins from "+j.join(",")}var r=Ext.create("BP.view.querybuilder.V_QueryResultPanel",{title:s,closable:true,collapsible:true});r.add(p);var o=l.items.indexOf(c)+1;l.insert(o,r);r.focus()}}})}});Ext.Loader.setConfig({enabled:true});Ext.override(Ext.grid.View,{enableTextSelection:true});Ext.override(Ext.form.field.Base,{labelSeparator:""});Ext.application({name:"BP",appFolder:"./js/int/src",requires:["BP.globals.ConnectionData","Ext.window.MessageBox","BP.view.Viewport","BP.view.form.V_NewAnalysis","BP.view.form.V_CustomForm","BP.view.form.V_CustomFieldSet","BP.view.form.V_UploadFile","BP.view.form.V_NumberField","BP.view.form.V_IprScanUpload","BP.view.form.V_ProteomesFieldSet","BP.view.form.V_ProteomeFieldSet","BP.view.panel.V_MainPanel","BP.view.panel.V_Home","BP.view.panel.V_ResultPanel","BP.view.panel.V_ResultsPanel","BP.view.panel.V_BannerPanel","BP.view.panel.V_HelpPanel","BP.view.grid.V_ListAnalyses","BP.view.grid.V_TreeGridResult","BP.view.grid.V_KeyValueGrid","BP.view.grid.V_GridProteomes","BP.globals.Utils","BP.globals.Result","BP.globals.Ajax","BP.globals.Login","BP.store.S_Analyses","BP.store.S_Result","BP.store.S_KeyValue","BP.store.S_Proteome","BP.store.S_GenericStore","BP.store.S_TreeResult","BP.view.button.V_BuildQueryBuilder","BP.view.button.V_QueryBuilder","BP.view.button.V_RemoveQueryBuilder","BP.view.querybuilder.V_QueryBuilderPanel","BP.view.querybuilder.V_SearchForm","BP.view.querybuilder.V_BlastForm","BP.view.querybuilder.V_QueryResultGrid","BP.view.querybuilder.V_QueryResultPanel","BP.view.fasta.V_FastaWindow","BP.view.fasta.V_FastaPanel","BP.view.fasta.V_MultiFastaPanel","BP.view.msa.V_MsaPanel","BP.view.querybuilder.V_IncludeExclude","BP.view.matrix.V_HeatMap","BP.view.matrix.V_MatrixPanel","BP.view.matrix.V_Card","BP.view.matrix.V_CardWindow","BP.store.S_KeyValue","BP.view.log.V_WindowLog"],views:["Viewport"],stores:["S_Analyses"],controllers:["C_Login","C_Upload","C_EnableIprScan","C_LaunchAnalysis","C_Proteome","C_ViewResult","C_Reload","C_Reset","C_DeleteResult","C_Publish","C_BuildQueryBuilder","C_QueryBuilder","C_Search","C_QueryResultGrid","C_FastaPanel","C_Blast","C_IncludeExclude"],launch:function(){this.setDebugMode();Ext.tip.QuickTipManager.init();Ext.apply(Ext.tip.QuickTipManager.getQuickTip(),{dismissDelay:0});var a="";BP.globals.Ajax.send({url:"../cgi/index.cgi",params:{authentication:1},method:"POST",serverFailureMessage:"Impossible to check login",jsonFailureMessage:"Check login: bad response from the server",successFunction:function(b){BP.globals.ConnectionData.mail=b.email},callback:function(){var b=Ext.create("BP.view.Viewport",{listeners:{afterrender:function(){var h=Ext.urlDecode(location.search.substring(1));if(Ext.isDefined(h.view)&&Ext.isDefined(h.owner)){if(h.owner==""){h.owner=BP.globals.ConnectionData.mail}BP.globals.ConnectionData.owner=h.owner;BP.globals.Ajax.send({url:"../cgi/index.cgi",params:{view:h.view,owner:h.owner},waitMessage:"Getting analysis...",successValue:1,successFunction:function(i){if(Ext.isDefined(i.analyses)&&i.analyses.length>0&&Ext.isDefined(i.analyses[0].url)){BP.globals.Result.displayResult(i.analyses[0].url)}else{Ext.Msg.alert("Failed","Error in the analysis format")}}})}else{if(Ext.isDefined(h.analysisid)&&(Ext.isDefined(h.proteinid)||Ext.isDefined(h.groupid))){var f="";var e="";var c=undefined;if(Ext.isDefined(h.owner)){c=h.owner}if(Ext.isDefined(h.proteinid)){f="proteins";e=h.proteinid}else{f="groups";e=h.groupid}console.log("target",f,"query",e);var g=Ext.create("BP.view.panel.V_ResultPanel",{title:e});var d=Ext.ComponentQuery.query("mainPanel")[0];d.add(g);d.setActiveItem(g);BP.globals.Result.displayQueryResult(g,0,h.analysisid,c,f,"accession",e,50)}}}}})}})},setDebugMode:function(){DEBUG=false;var a=Ext.urlDecode(location.search.substring(1));if(Ext.isDefined(a.debug)){DEBUG=true}}});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment