Commit 447dafe0 authored by maxchaza's avatar maxchaza

Allow to manage cycles

parent 2fff8d7a
/**
* @author MC
* @description CycleDetectionForm : Display Settings
*/
Ext.define('metExploreViz.view.form.cycleDetectionForm.CycleDetectionForm', {
extend: 'Ext.panel.Panel',
alias: 'widget.cycleDetectionForm',
requires: [
"metExploreViz.view.form.cycleDetectionForm.CycleDetectionFormController",
"metExploreViz.view.form.SelectDisplayReactionLabel",
"metExploreViz.view.form.SelectDisplayMetaboliteLabel"
],
controller: "form-cycleDetectionForm-cycleDetectionForm",
region:'north',
margins:'0 0 0 0',
flex:1,
width:'100%',
border:false,
autoScroll:true,
layout: {
type: 'vbox',
align: 'stretch'
},
autoHeight: true,
disabled: true,
items:[{
xtype:'button',
text:'Draw Cycle',
margin: '10 10 10 10',
align:'stretch',
width:'95%',
reference:'buttonDrawCycle',
hidden: true
},{
xtype:'menuseparator'
},{
xtype:'fieldcontainer',
reference:'cycleDetectionPanel'
},{
xtype:'button',
text:'Hide cycle',
margin: '10 10 10 10',
align:'stretch',
width:'50%',
reference:'buttonHideCycle',
hidden: true
}]
});
\ No newline at end of file
/**
* @author MC
* @description class to control settings or configs
*/
Ext.define('metExploreViz.view.form.cycleDetectionForm.CycleDetectionFormController', {
extend: 'Ext.app.ViewController',
alias: 'controller.form-cycleDetectionForm-cycleDetectionForm',
/**
* Init function Checks the changes on drawing style
*/
init : function() {
var me = this,
viewModel = me.getViewModel(),
view = me.getView();
view.on({
listCycles : me.listCycles,
scope:me
});
view.lookupReference('buttonDrawCycle').on({
click:me.drawMetaboliteCycle,
scope:me
});
view.lookupReference('buttonHideCycle').on({
click:me.hideMetaboliteCycle,
scope:me
});
},
drawMetaboliteCycle: function () {
var me = this,
viewModel = me.getViewModel(),
view = me.getView();
this.lookupReference('cycleDetectionPanel').items.each(function (d) {
if (d.checked){
metExploreD3.GraphFunction.drawMetaboliteCycle(d.cycle);
}
})
},
hideMetaboliteCycle: function () {
var me = this,
viewModel = me.getViewModel(),
view = me.getView();
this.lookupReference('cycleDetectionPanel').items.each(function (d) {
if (d.checked){
d.setValue(false);
metExploreD3.GraphFunction.removeHighlightCycle(d.cycle);
}
})
},
listCycles: function (cycles) {
var me = this,
viewModel = me.getViewModel(),
view = me.getView();
view.enable();
this.lookupReference('cycleDetectionPanel').removeAll(true);
if (cycles.length > 0) {
for (var i = 0; i < cycles.length; i++) {
var newCheckbox = Ext.create('Ext.form.field.Radio', {
reference: 'radioCycle' + i,
boxLabel: 'Cycle ' + (i + 1),
name: 'cycle',
cycle: cycles[i],
margin: '0 0 0 20',
listeners: {
change: function () {
if (this.checked === true) {
metExploreD3.GraphFunction.highlightCycle(this.cycle);
}
}
}
});
this.lookupReference('cycleDetectionPanel').add(newCheckbox);
if (i === 0) {
this.lookupReference('radioCycle' + i).setValue(true);
}
}
Ext.getCmp('comparisonSidePanel').expand();
view.show();
view.expand();
this.lookupReference('buttonDrawCycle').show();
this.lookupReference('buttonHideCycle').show();
}
else {
this.lookupReference('buttonDrawCycle').hide();
this.lookupReference('buttonHideCycle').hide();
}
}
});
......@@ -22,7 +22,6 @@ Ext.define('metExploreViz.view.menu.viz_ExportMenu.Viz_ExportMenu', {
{
text: 'Export Viz as svg',
reference:'exportSVG',
tooltip:'Export network viz as a svg file',
iconCls:'exportSvg'
},
{
......@@ -32,8 +31,7 @@ Ext.define('metExploreViz.view.menu.viz_ExportMenu.Viz_ExportMenu', {
id:'vizExportPNGID',
reference:'vizExportPNGID',
padding:'0 0 0 0',
iconCls:'exportPng',
tooltip:'Export network viz as a png file'
iconCls:'exportPng'
},
{
text: 'Export Viz as jpeg',
......@@ -42,8 +40,7 @@ Ext.define('metExploreViz.view.menu.viz_ExportMenu.Viz_ExportMenu', {
id:'vizExportJPGID',
reference:'vizExportJPGID',
padding:'0 0 0 0',
iconCls:'exportJpg',
tooltip:'Export network viz as a jpeg file'
iconCls:'exportJpg'
}
// ,
// {
......
......@@ -22,15 +22,12 @@ Ext.define('metExploreViz.view.menu.viz_ExportPNGMenu.Viz_ExportPNGMenu', {
{
text: 'original resolution',
reference:'exportPNGX1',
tooltip:'Export network viz as a png file'
}, {
text: 'original resolution * 2',
reference:'exportPNGX2',
tooltip:'Export network viz as a png file (resolution * 2)'
}, {
text: 'original resolution * 4',
reference:'exportPNGX4',
tooltip:'Export network viz as a png file (resolution * 4)'
}
]
});
......
......@@ -21,12 +21,10 @@ Ext.define('metExploreViz.view.menu.viz_ExtractSubNetworkMenu.Viz_ExtractSubNetw
items: [
{
text: 'From Mapping',
reference:'keepOnlySubnetworkFromMapping',
tooltip:'Extract sub-network based on node mapping'
reference:'keepOnlySubnetworkFromMapping'
}, {
text: 'From Selection',
reference:'keepOnlySubnetworkFromSelection',
tooltip:'Extract sub-network based on node selection'
reference:'keepOnlySubnetworkFromSelection'
}
]
});
......
......@@ -21,7 +21,6 @@ Ext.define('metExploreViz.view.menu.viz_ImportMenu.Viz_ImportMenu', {
{
text: 'Import mapping from tab file',
reference:'importMapping',
tooltip:'Import mapping from tab file',
iconCls:'importData'
},
{
......@@ -33,7 +32,6 @@ Ext.define('metExploreViz.view.menu.viz_ImportMenu.Viz_ImportMenu', {
{
text: 'Import side compounds from tab file',
reference:'importSideCompounds',
tooltip:'Import side compounds from tab file',
iconCls:'importData'
},
{
......@@ -59,7 +57,6 @@ Ext.define('metExploreViz.view.menu.viz_ImportMenu.Viz_ImportMenu', {
{
text: 'Import Cycle',
reference: 'importCycle',
tooltip: 'Import cycle for drawing',
iconCls:'importCycle'
},
{
......@@ -74,12 +71,10 @@ Ext.define('metExploreViz.view.menu.viz_ImportMenu.Viz_ImportMenu', {
{
text: 'By Name',
reference: 'importImageMappingName',
tooltip: 'Import image for mapping by name'
},
{
text: 'By Id',
reference: 'importImageMappingID',
tooltip: 'Import image for mapping by id'
}]
},
......
......@@ -10,6 +10,7 @@ Ext.define('metExploreViz.view.panel.comparisonSidePanel.ComparisonSidePanel', {
"metExploreViz.view.panel.comparisonSidePanel.ComparisonSidePanelController",
"metExploreViz.view.form.selectConditionForm.SelectConditionForm",
"metExploreViz.view.form.drawingStyleForm.DrawingStyleForm",
"metExploreViz.view.form.cycleDetectionForm.CycleDetectionForm",
"metExploreViz.view.form.captionForm.CaptionForm",
"metExploreViz.view.form.allStylesForm.AllStylesForm"
],
......@@ -27,7 +28,6 @@ Ext.define('metExploreViz.view.panel.comparisonSidePanel.ComparisonSidePanel', {
split:true,
closable: false,
region: 'west',
// hidden:true,
tabBar:{
cls:"vizTBar"
},
......@@ -70,36 +70,8 @@ Ext.define('metExploreViz.view.panel.comparisonSidePanel.ComparisonSidePanel', {
},
{
title:'Cycle',
reference: 'cycleDetection',
id:'cycleDetection',
xtype:'panel',
autoScroll: true,
autoHeight: true,
collapsed: true,
hidden: true,
items:[{
xtype:'button',
text:'Draw Cycle',
margin: '10 10 10 10',
align:'stretch',
width:'95%',
reference:'buttonDrawCycle',
hidden: true
},{
xtype:'menuseparator'
},{
xtype:'fieldcontainer',
id:'cycleDetectionPanel',
reference:'cycleDetectionPanel'
},{
xtype:'button',
text:'Hide cycle',
margin: '10 10 10 10',
align:'stretch',
width:'50%',
reference:'buttonHideCycle',
hidden: true
}]
xtype:'cycleDetectionForm'
}
]
});
\ No newline at end of file
......@@ -14,80 +14,9 @@ Ext.define('metExploreViz.view.panel.comparisonSidePanel.ComparisonSidePanelCont
newMapping : me.drawCaption,
scope:me
});
view.lookupReference('cycleDetectionPanel').on({
listCycles : me.listCycles,
scope:me
});
view.lookupReference('buttonDrawCycle').on({
click:me.drawMetaboliteCycle,
scope:me
});
view.lookupReference('buttonHideCycle').on({
click:me.hideMetaboliteCycle,
scope:me
});
},
drawCaption : function(){
metExploreD3.GraphCaption.drawCaption();
},
drawMetaboliteCycle: function () {
this.lookupReference('cycleDetectionPanel').items.each(function (d) {
if (d.checked){
metExploreD3.GraphFunction.drawMetaboliteCycle(d.cycle);
}
})
},
hideMetaboliteCycle: function () {
this.lookupReference('cycleDetectionPanel').items.each(function (d) {
if (d.checked){
d.setValue(false);
metExploreD3.GraphFunction.removeHighlightCycle(d.cycle);
}
})
},
listCycles: function (cycles) {
this.lookupReference('cycleDetection').setVisible(true);
this.lookupReference('cycleDetectionPanel').removeAll(true);
if (cycles.length > 0) {
for (var i = 0; i < cycles.length; i++) {
var newCheckbox = Ext.create('Ext.form.field.Radio', {
reference: 'radioCycle' + i,
boxLabel: 'Cycle ' + (i + 1),
name: 'cycle',
cycle: cycles[i],
margin: '0 0 0 20',
listeners: {
change: function () {
if (this.checked === true) {
metExploreD3.GraphFunction.highlightCycle(this.cycle);
}
}
}
});
this.lookupReference('cycleDetectionPanel').add(newCheckbox);
if (i === 0) {
this.lookupReference('radioCycle' + i).setValue(true);
}
}
this.getView().expand();
this.lookupReference('cycleDetection').expand();
Ext.getCmp('selectConditionForm').collapsed = true;
Ext.getCmp('captionFormPathways').collapsed = true;
Ext.getCmp('captionFormCompartments').collapsed = true;
this.lookupReference('buttonDrawCycle').show();
this.lookupReference('buttonHideCycle').show();
}
else {
this.lookupReference('buttonDrawCycle').hide();
this.lookupReference('buttonHideCycle').hide();
}
drawCaption : function(){
metExploreD3.GraphCaption.drawCaption();
}
});
......@@ -444,7 +444,7 @@ Ext.define('metExploreViz.view.panel.viz.VizController', {
if (longestCycles.length === 0){
metExploreD3.displayWarning('No cycles found', 'There is no cycles of more than 2 reactions going through the selected nodes');
}
metExploreD3.fireEventArg('cycleDetectionPanel', "listCycles", longestCycles);
metExploreD3.fireEventArg('cycleDetection', "listCycles", longestCycles);
}
},{
text: 'Going through all selected nodes',
......@@ -465,7 +465,7 @@ Ext.define('metExploreViz.view.panel.viz.VizController', {
if (longestCycles.length === 0){
metExploreD3.displayWarning('No cycles found', 'There is no cycles of more than 2 reactions going through the selected nodes');
}
metExploreD3.fireEventArg('cycleDetectionPanel', "listCycles", longestCycles);
metExploreD3.fireEventArg('cycleDetection', "listCycles", longestCycles);
}
}]
},{
......@@ -481,7 +481,7 @@ Ext.define('metExploreViz.view.panel.viz.VizController', {
if (shortestCycles.length === 0){
metExploreD3.displayWarning('No cycles found', 'There is no cycles of more than 2 reactions going through the selected nodes');
}
metExploreD3.fireEventArg('cycleDetectionPanel', "listCycles", shortestCycles);
metExploreD3.fireEventArg('cycleDetection', "listCycles", shortestCycles);
}
},{
text: 'Going through all selected nodes',
......@@ -502,7 +502,7 @@ Ext.define('metExploreViz.view.panel.viz.VizController', {
if (shortestCycles.length === 0){
metExploreD3.displayWarning('No cycles found', 'There is no cycles of more than 2 reactions going through the selected nodes');
}
metExploreD3.fireEventArg('cycleDetectionPanel', "listCycles", shortestCycles);
metExploreD3.fireEventArg('cycleDetection', "listCycles", shortestCycles);
}
}]
},{
......
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