Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Model Exploration Settings #1043

Draft
wants to merge 17 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions client/models/model-exploration-settings.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
StochSS is a platform for simulating biochemical systems
Copyright (C) 2019-2020 StochSS developers.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

//models
var State = require('ampersand-state');
//collections
var ModelExplorationVariables = require('./model-exploration-variables');

module.exports = State.extend({
props: {
distributionType: 'string'
},
collections: {
variables: ModelExplorationVariables
},
initialize: function(attrs, options) {
State.prototype.initialize.apply(this, arguments);
},
updateVariables: function (parameters) {
this.variables.forEach(function (variable) {
let parameter = parameters.filter(function (parameter) {
return parameter.compID === variable.paramID
})[0]
if(parameter === undefined) {
this.removeVariable(variable)
}else{
variable.updateVariable(variable)
}
})
}
});
45 changes: 45 additions & 0 deletions client/models/model-exploration-variable.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
StochSS is a platform for simulating biochemical systems
Copyright (C) 2019-2020 StochSS developers.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

//models
var State = require('ampersand-state');

module.exports = State.extend({
props: {
paramID: 'number',
min: 'any',
max: 'any',
steps: 'any',
level: 'any',
outliers: 'string',
seedSize: 'any',
hasChangedRanged: 'boolean'
},
initialize: function(attrs, options) {
State.prototype.initialize.apply(this, arguments);
},
updateVariable: function (parameter) {
let value = parameter.expression
if(this.min <= 0 || !this.hasChangedRanged) {
this.min = value * 0.5
}
if(this.max <= 0 || !this.hasChangedRanged) {
this.max = value * 1.5
}
}
});
41 changes: 41 additions & 0 deletions client/models/model-exploration-variables.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
StochSS is a platform for simulating biochemical systems
Copyright (C) 2019-2020 StochSS developers.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

//models
var Variable = require('./model-exploration-variable');
//collections
var Collection = require('ampersand-collection');

module.exports = Collection.extend({
model: Variable,
addVariable: function (paramID) {
var variable = this.add({
paramID: paramID,
min: 0,
max: 0,
steps: 11,
level: 1,
outliers: "",
seedSize: 1,
hasChangedRange: false
});
},
removeVariable: function (variable) {
this.remove(variable);
}
});
2 changes: 2 additions & 0 deletions client/models/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
var State = require('ampersand-state');
var SimulationSettings = require('./simulation-settings');
var ParameterSweepSettings = require('./parameter-sweep-settings');
var ModelExplorationSettings = require('./model-exploration-settings');
var ResultsSettings = require('./results-settings');

module.exports = State.extend({
children: {
simulationSettings: SimulationSettings,
parameterSweepSettings: ParameterSweepSettings,
modelExplorationSettings: ModelExplorationSettings,
resultsSettings: ResultsSettings
},
initialize: function(attrs, options) {
Expand Down
6 changes: 5 additions & 1 deletion client/pages/workflow-selection.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ let workflowSelection = PageView.extend({
"click [data-hook=sciope-model-exploration]" : "notebookWorkflow",
"click [data-hook=model-inference]" : "notebookWorkflow",
"click [data-hook=stochss-es]" : "handleEnsembleSimulationClick",
"click [data-hook=stochss-ps]" : "handleParameterSweepClick"
"click [data-hook=stochss-ps]" : "handleParameterSweepClick",
"click [data-hook=stochss-me]" : "handleModelExplorationClick"
},
initialize: function (attrs, options) {
PageView.prototype.initialize.apply(this, arguments);
Expand Down Expand Up @@ -147,6 +148,9 @@ let workflowSelection = PageView.extend({
handleParameterSweepClick: function (e) {
this.launchStochssWorkflow("parameterSweep")
},
handleModelExplorationClick: function (e) {
this.launchStochssWorkflow("modelExploration")
},
launchStochssWorkflow: function (type) {
let queryString = "?type=" + type + "&path=" + this.modelDir + "&parentPath=" + this.parentPath
let endpoint = path.join(app.getBasePath(), "stochss/workflow/edit")+queryString
Expand Down
36 changes: 36 additions & 0 deletions client/templates/includes/modelExplorationSettings.pug
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
div#model-exploration-settings.card.card-body

div

h3.inline Model Explorataion Settings
button.btn.btn-outline-collapse(data-toggle="collapse", data-target="#collapse-mexplore-settings", data-hook="collapse") -

div.collapse(class="show", id="collapse-mexplore-settings")

div.row

div.col-md-4

span.inline(for="distribution-type") Distribution Type:

div.inline(id="distribution-type" data-hook="distribution-type")

div.col-md-4(style="display: none")

span.inline(for="exploration-type") Exploration Type:

div.inline(id="exploration-type" data-hook="exploration-type")

div.col-md-4(style="display: none")

span.inline(for="feature-extraction") Feature Extraction:

div.inline(id="feature-extraction" data-hook="feature-extraction")

div

h5 Configure Variable(s)

div(data-hook="me-variables-collection")

button.btn.btn-outline-secondary.box-shadow(data-hook="add-me-variable") Add Variable
25 changes: 25 additions & 0 deletions client/templates/includes/modelExplorationVariable.pug
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
tr

td: div(data-hook="variable-target")

td: div(data-hook="target-value")=this.parameter.expression

td: div(data-hook="variable-min")

td: div(data-hook="variable-max")

td

if(this.distributionType == "Uniform")
div(data-hook="variable-steps")

if(this.distributionType == "Factorial")
div(data-hook="variable-level")

if(this.distributionType == "Latin Hypercube")
div(data-hook="variable-seed-size")

if(this.distributionType == "Factorial")
td: div(data-hook="variable-outliers")

td: button.btn.btn-outline-secondary.box-shadow(data-hook="remove") X
40 changes: 40 additions & 0 deletions client/templates/includes/modelExplorationVariables.pug
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
table.table
thead
tr
th(scope="col")
div
div.inline Sweep Target

th(scope="col")
div
div.inline Current Value

th(scope="col")
div
div.inline Minimum Value

th(scope="col")
div
div.inline Maximum Value

th(scope="col")
if(this.distributionType == "Uniform")
div
div.inline Steps

if(this.distributionType == "Factorial")
div
div.inline Level

if(this.distributionType == "Latin Hypercube")
div
div.inline Seed Size

if(this.distributionType == "Factorial")
th(scope="col")
div
div.inline Outliers

th(scope="col"): div Remove

tbody(data-hook="me-variables")
2 changes: 2 additions & 0 deletions client/templates/includes/workflowEditor.pug
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ div#workflow-editor.card.card-body

div.collapse(class="show" data-hook="param-sweep-settings-container")

div.collapse(class="show" data-hook="model-exploration-settings-container")

div(data-hook="sim-settings-container")

div(data-hook="workflow-state-buttons-container")
3 changes: 3 additions & 0 deletions client/templates/pages/workflowSelection.pug
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ section.page

div.tooltip-icon.horizontal-space(data-html="true" data-toggle="tooltip" title=this.tooltips.parameterSweep) <sup><svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="info" class="svg-inline--fa fa-info fa-w-6" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 192 512"><path fill="currentColor" d="M20 424.229h20V279.771H20c-11.046 0-20-8.954-20-20V212c0-11.046 8.954-20 20-20h112c11.046 0 20 8.954 20 20v212.229h20c11.046 0 20 8.954 20 20V492c0 11.046-8.954 20-20 20H20c-11.046 0-20-8.954-20-20v-47.771c0-11.046 8.954-20 20-20zM96 0C56.235 0 24 32.235 24 72s32.235 72 72 72 72-32.235 72-72S135.764 0 96 0z"></path></svg></sup>

td
button.btn.btn-outline-primary.box-shadow.inline(id="stochss-me" data-hook="stochss-me") Model Exploration

table.table
thead
tr
Expand Down
Loading