Skip to content

Commit

Permalink
Merge pull request #1274 from StochSS/develop
Browse files Browse the repository at this point in the history
Release 2.4.2
  • Loading branch information
briandrawert authored Nov 10, 2021
2 parents f93e193 + b77ad45 commit 82d8e6a
Show file tree
Hide file tree
Showing 33 changed files with 526 additions and 163 deletions.
90 changes: 90 additions & 0 deletions EXAMPLE_DIRECTORY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# Example Directory

This file contains a directory to all GillesPy2 and SpatialPy example notebooks.

## GillesPy2

["Start Here" Model](https://github.com/StochSS/GillesPy2/blob/main/examples/StartHere.ipynb)

### Starting Models

- [Michaelis Menten](https://github.com/StochSS/GillesPy2/tree/main/examples/StartingModels/MichaelisMenten)
- [SSA C Solver](https://github.com/StochSS/GillesPy2/blob/main/examples/StartingModels/MichaelisMenten/Michaelis-Menten_SSA_C.ipynb)
- [SSA NumPy Solver](https://github.com/StochSS/GillesPy2/blob/main/examples/StartingModels/MichaelisMenten/Michaelis-Menten_NumPy_SSA.ipynb)
- [Tau Leaping NumPy](https://github.com/StochSS/GillesPy2/blob/main/examples/StartingModels/MichaelisMenten/Michaelis-Menten_Basic_Tau_Leaping.ipynb)
- [Tau Hybrid NumPy](https://github.com/StochSS/GillesPy2/blob/main/examples/StartingModels/MichaelisMenten/Michaelis-Menten_Basic_Tau_Hybrid.ipynb)

- [Vilar Oscillator](https://github.com/StochSS/GillesPy2/tree/main/examples/StartingModels/VilarOscillator)
- [SSA](https://github.com/StochSS/GillesPy2/blob/main/examples/StartingModels/VilarOscillator/VilarOscillator_SSA.ipynb)
- [Tau Leaping](https://github.com/StochSS/GillesPy2/blob/main/examples/StartingModels/VilarOscillator/VilarOscillator_Tau_Leaping.ipynb)
- [Tau Hybrid](https://github.com/StochSS/GillesPy2/blob/main/examples/StartingModels/VilarOscillator/VilarOscillator_Tau_Hybrid.ipynb)


### Results Management

- [Basic Results Management](https://github.com/StochSS/GillesPy2/blob/main/examples/ResultsManagement/basic-results-management.ipynb)
- [Single Trajectory to CSV](https://github.com/StochSS/GillesPy2/blob/main/examples/ResultsManagement/to_csv-single-trajectory.ipynb)
- [Multiple Trajectories to CSV](https://github.com/StochSS/GillesPy2/blob/main/examples/ResultsManagement/to_csv-multi-trajectory.ipynb)
- [Using Pickle](https://github.com/StochSS/GillesPy2/blob/main/examples/ResultsManagement/using-pickle.ipynb)


### Data Visualization

- [Data Visualization](https://github.com/StochSS/GillesPy2/blob/main/examples/DataVisualization/DataVisualization.ipynb)
- [Live Output](https://github.com/StochSS/GillesPy2/blob/main/examples/DataVisualization/LiveOutput.ipynb)


### Advanced Features

- [Events](https://github.com/StochSS/GillesPy2/blob/main/examples/AdvancedFeatures/Events.ipynb)
- [Kinetic Model for Styrene Polymerization](https://github.com/StochSS/GillesPy2/blob/main/examples/AdvancedFeatures/KineticModelForStyrenePolymerization.ipynb)
- [Photosynthesis](https://github.com/StochSS/GillesPy2/blob/main/examples/AdvancedFeatures/Photosynthesis.ipynb)
- [GillesPy2 in Parallel](https://github.com/StochSS/GillesPy2/blob/main/examples/AdvancedFeatures/Run%20GillesPy2%20Simulations%20in%20Parallel.ipynb)
- [SBML Import](https://github.com/StochSS/GillesPy2/blob/main/examples/AdvancedFeatures/SBML_Import_Test.ipynb)
- [Variable Inputs (SSA)](https://github.com/StochSS/GillesPy2/blob/main/examples/AdvancedFeatures/Variable_SSA_C_Example.ipynb)
- [Volume Test](https://github.com/StochSS/GillesPy2/blob/main/examples/AdvancedFeatures/Volume_test.py)
- [Hybrid Continuous Species](https://github.com/StochSS/GillesPy2/blob/main/examples/AdvancedFeatures/hybrid_continuous_species.ipynb)
- [Hybrid Switching](https://github.com/StochSS/GillesPy2/blob/main/examples/AdvancedFeatures/hybrid_switching_example.ipynb)
- [Parameter Changing](https://github.com/StochSS/GillesPy2/blob/main/examples/AdvancedFeatures/parameter_changing.py)


### Extra Models

- [Brusselator](https://github.com/StochSS/GillesPy2/blob/main/examples/ExtraModels/Brusselator.ipynb)
- [Genetic Toggle Switch](https://github.com/StochSS/GillesPy2/blob/main/examples/ExtraModels/GeneticToggleSwitch.ipynb)
- [Opioid Model](https://github.com/StochSS/GillesPy2/blob/main/examples/ExtraModels/Opioid_Model.ipynb)
- [Oregonator](https://github.com/StochSS/GillesPy2/blob/main/examples/ExtraModels/Oregonator.ipynb)
- [Tyson Oscillator](https://github.com/StochSS/GillesPy2/blob/main/examples/ExtraModels/Tyson%20Oscillator.ipynb)
- [Degradation Model](https://github.com/StochSS/GillesPy2/blob/main/examples/ExtraModels/degradation_example.py)
- [Dimer Model](https://github.com/StochSS/GillesPy2/blob/main/examples/ExtraModels/dimer_example.py)
- [Tyson Oscillator](https://github.com/StochSS/GillesPy2/blob/main/examples/ExtraModels/tyson_oscillator.py)



## SpatialPy

### General Examples

- [Bistable Elf Ehrenberg](https://github.com/StochSS/SpatialPy/blob/develop/examples/Bistable_Biochem_Elf_Ehrenberg/Bistable_Biochem_Elf_Ehrenberg.ipynb)
- [Boundary Conditions](https://github.com/StochSS/SpatialPy/blob/develop/examples/BoundaryCondition/BoundaryCondition.ipynb)
- [SpatialPy Gravity](https://github.com/StochSS/SpatialPy/blob/develop/examples/Gravity/Spatialpy_gravity.ipynb)
- [Coral Reef](https://github.com/StochSS/SpatialPy/blob/develop/examples/coral_reef/CoralModel.ipynb)
- [3D Cylinder Diffusion](https://github.com/StochSS/SpatialPy/blob/develop/examples/cylinderDemo/SpatialPy_cylinderDemo3D.ipynb)
- [hes1](https://github.com/StochSS/SpatialPy/blob/develop/examples/hes1/hes1.ipynb)
- [Lid Driven Cavity](https://github.com/StochSS/SpatialPy/blob/develop/examples/lid_driven_cavity/Lid%20driven%20cavity.ipynb)
- [MinCDE](https://github.com/StochSS/SpatialPy/blob/develop/examples/mincde/mincde.ipynb)
- [Turing Pattern (Old)](https://github.com/StochSS/SpatialPy/blob/develop/examples/turing_pattern/turing_pattern.ipynb)
- [Turing Pattern (New)](https://github.com/StochSS/SpatialPy/blob/develop/examples/turing_pattern/new_turing_pattern.ipynb)
- [Weir](https://github.com/StochSS/SpatialPy/blob/develop/examples/weir/weir.ipynb)
- [Yeast Polarization](https://github.com/StochSS/SpatialPy/tree/develop/examples/yeast_polarization)
- [G-Protein 1D](https://github.com/StochSS/SpatialPy/blob/develop/examples/yeast_polarization/G-Protein_1D.ipynb)
- [Polarisome 1D](https://github.com/StochSS/SpatialPy/blob/develop/examples/yeast_polarization/Polarisome_1D.ipynb)
- [cdc42](https://github.com/StochSS/SpatialPy/blob/develop/examples/yeast_polarization/cdc42.ipynb)

### Tests

- [Diffusion Validation](https://github.com/StochSS/SpatialPy/blob/develop/examples/tests/Diffusion_validation.ipynb)
- [Spatial Birth-Death](https://github.com/StochSS/SpatialPy/blob/develop/examples/tests/Spatial_Birth_Death.ipynb)
- [Compile Time Test](https://github.com/StochSS/SpatialPy/blob/develop/examples/tests/compile_time_comparison.ipynb)
- [Read Meshes](https://github.com/StochSS/SpatialPy/blob/develop/examples/tests/read_meshes.ipynb)

2 changes: 1 addition & 1 deletion __version__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# @website https://github.com/stochss/stochss
# =============================================================================

__version__ = '2.4.1'
__version__ = '2.4.2'
__title__ = 'StochSS'
__description__ = 'StochSS is an integrated development environment (IDE) \
for simulation of biochemical networks.'
Expand Down
2 changes: 2 additions & 0 deletions client/models/presentation.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ let State = require('ampersand-state');

module.exports = State.extend({
session: {
ctime: 'string',
file: 'string',
link: 'string',
name: 'string',
size: 'number',
tag: 'string'
},
Expand Down
2 changes: 1 addition & 1 deletion client/pages/loading-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ let LoadingPage = PageView.extend({
$(self.queryByHook("loading-spinner")).css("display", "none");
let modal = $(modals.errorHtml(body.reason, body.message)).modal();
modal.on('hidden.bs.modal', function (e) {
window.location.href = this.homeLink;
window.location.href = self.homeLink;
});
}
app.getXHR(endpoint, {
Expand Down
7 changes: 6 additions & 1 deletion client/pages/model-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,17 +197,22 @@ let ModelEditor = PageView.extend({
errorCB(err, response, body);
}
else if(!body.Running){
Plotly.purge(this.queryByHook('preview-plot-container'));
if(body.Results.timeout){
$(this.queryByHook('model-timeout-message')).collapse('show');
}
this.plotResults(body.Results.results);
}else{
if(body.Results) {
Plotly.purge(this.queryByHook('preview-plot-container'));
this.plotResults(body.Results.results);
}
this.getResults();
}
},
error: errorCB
});
}, 2000);
}, 1000);
},
handlePresentationClick: function (e) {
let errorMsg = $(this.queryByHook("error-detected-msg"));
Expand Down
6 changes: 3 additions & 3 deletions client/pages/project-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ let ProjectManager = PageView.extend({
always: function (err, response, body) {
let modal = $(modals.importModelHtml(body.files)).modal();
let okBtn = document.querySelector('#importModelModal .ok-model-btn');
let select = document.querySelector('#importModelModal #modelFileInput');
let location = document.querySelector('#importModelModal #modelPathInput');
let select = document.querySelector('#importModelModal #modelFileSelect');
let location = document.querySelector('#importModelModal #modelPathSelect');
select.addEventListener("change", function (e) {
okBtn.disabled = e.target.value && body.paths[e.target.value].length >= 2;
if(body.paths[e.target.value].length >= 2) {
Expand Down Expand Up @@ -314,7 +314,7 @@ let ProjectManager = PageView.extend({
}
},
handleUploadModelClick: function (e) {
this.projectFileBrowser.uploadFile(undefined, "model")
this.projectFileBrowser.uploadFile(null, this.model.directory, "model", true)
},
renderArchiveCollection: function () {
if(this.archiveCollectionView) {
Expand Down
2 changes: 1 addition & 1 deletion client/project-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ let getNotebookContext = (view, node) => {
open: open,
publish: view.getPublishNotebookContext(node),
download: download, rename: rename,
duplicate: duplicate, delete: deleteFile
duplicate: duplicate, moveToTrash: moveToTrash
}
}

Expand Down
2 changes: 2 additions & 0 deletions client/templates/body.pug
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ body

button.my-0.btn.btn-outline-collapse.inline(data-hook="user-logs-collapse") +

button.my-0.btn.btn-light.inline(data-hook="clear-user-logs" style="float: right;") clear

div.pl-1.overflow-auto(id="user-logs")

main.col-sm-12.col-md-10.col-xl-9.col-xxl-6.body(role="main" data-hook="page-main")
Expand Down
8 changes: 6 additions & 2 deletions client/templates/includes/presentationView.pug
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,18 @@ div.mx-1

div.row

div.col-sm-6
div.col-sm-4

a.pl-2(href=this.model.link)=this.model.file
a.pl-2(href=this.model.link)=this.model.name

div.col-sm-2

button.btn.btn-outline-secondary.box-shadow(data-hook="copy-link") Copy Link

div.col-sm-2

div=this.model.ctime

div.col-sm-2

div=this.model.size + " " + this.model.tag
Expand Down
4 changes: 3 additions & 1 deletion client/templates/pages/browser.pug
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ section.page

div.mx-1.row.head.align-items-baseline

div.col-sm-8: h6 <b>File</b>
div.col-sm-6: h6 <b>File</b>

div.col-sm-2: h6 <b>Date</b>

div.col-sm-2: h6 <b>Size</b>

Expand Down
2 changes: 1 addition & 1 deletion client/views/jstree-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -900,7 +900,7 @@ module.exports = View.extend({
msg.html(reason);
msg.css("display", "inline-block");
}
app.copyToClipboard(links.presentation, onFulfilled, onReject);
app.copyToClipboard(body.links.presentation, onFulfilled, onReject);
});
},
error: (err, response, body) => {
Expand Down
101 changes: 26 additions & 75 deletions client/views/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,67 +38,6 @@ String.prototype.toHtmlEntities = function() {
});
};

let operationInfoModalHtml = (infoKey) => {
let fileBrowserInfo = `
<p>In StochSS we use custom file extensions for a number of files we work with. Here is a list of our extentions with the files they are associated with:</p>
<table style="margin-left: 2em;">
<tr>
<td width=200> StochSS Model </td>
<td> .mdl </td>
</tr>
<tr>
<td width=200> StochSS Spatial Model </td>
<td> .smdl </td>
</tr>
<tr>
<td width=200> SBML Model </td>
<td> .sbml </td>
</tr>
<tr>
<td width=200> Workflows </td>
<td> .wkfl </td>
</tr>
</table>
<br>
<p>Other useful file extensions include the following:</p>
<table style="margin-left: 2em;">
<tr>
<td width=200> Jupyter Notebook </td>
<td> .ipynb </td>
</tr>
</table>
`;
let modelInfo = `
Model Information
`;
let workflowInfo = `
Workflow Information
`;

let infoList = {"File Browser":fileBrowserInfo, "Models":modelInfo, "Workflows":workflowInfo}

return `
<div id="operationInfoModal" class="modal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content info">
<div class="modal-header">
<h5 class="modal-title"> Working with ${infoKey} </h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<p> ${infoList[infoKey]} </p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
`
}

module.exports = View.extend({
template: bodyTemplate,
autoRender: true,
Expand All @@ -109,8 +48,8 @@ module.exports = View.extend({
},
events: {
'click [data-hook=registration-link-button]' : 'handleRegistrationLinkClick',
'click [data-hook=user-logs-collapse]' : 'collapseExpandLogs'
//'click a[href]': 'handleLinkClick'
'click [data-hook=user-logs-collapse]' : 'collapseExpandLogs',
'click [data-hook=clear-user-logs]' : 'clearUserLogs'
},
render: function () {

Expand All @@ -132,18 +71,7 @@ module.exports = View.extend({
if(app.getBasePath() === "/") {
$("#presentation-nav-link").css("display", "none");
}
let self = this;
let message = app.getBasePath() === "/" ? "Welcome to StochSS!" : "Welcome to StochSS Live!";
$("#user-logs").html(message)
this.logBlock = [];
this.logs = [];
this.getUserLogs();
this.scrolled = false;
this.scrollCount = 0;
$("#user-logs").on("mousewheel", function(e) {
self.scrolled = true;
self.scrollCount = 0;
});
this.setupUserLogs();
return this;
},
addNewLogBlock: function () {
Expand Down Expand Up @@ -172,6 +100,14 @@ module.exports = View.extend({
});
this.addNewLogBlock();
},
clearUserLogs: function (e) {
let endpoint = path.join(app.getApiPath(), "clear-user-logs");
app.getXHR(endpoint, {
success: (err, response, body) => {
this.setupUserLogs({getLogs: false});
}
});
},
collapseExpandLogs: function (e) {
let logs = $("#user-logs");
let classes = logs.attr("class").split(/\s+/);
Expand Down Expand Up @@ -249,6 +185,21 @@ module.exports = View.extend({
navigate: function (page) {
window.location = url;
},
setupUserLogs: function ({getLogs = true}={}) {
let message = app.getBasePath() === "/" ? "Welcome to StochSS!" : "Welcome to StochSS Live!";
$("#user-logs").html(message)
this.logBlock = [];
this.logs = [];
this.scrolled = false;
this.scrollCount = 0;
if(getLogs) {
this.getUserLogs();
$("#user-logs").on("mousewheel", (e) => {
this.scrolled = true;
this.scrollCount = 0;
});
}
},
updateUserLogs: function () {
setTimeout(_.bind(this.getUserLogs, this), 1000);
}
Expand Down
10 changes: 9 additions & 1 deletion launch_webbrowser.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
import sys
import time
import webbrowser

MAX_WAIT_TIME = 60

try:
import docker
except ImportError:
Expand All @@ -25,11 +28,15 @@
#time.sleep(10)
print("Checking for running StochSS container: stochss-lab")
container_started = False
poll_start_time = time.time()
while not container_started:
if (time.time() - MAX_WAIT_TIME) > poll_start_time:
print(f"Stopped checking for running StochSS container after {MAX_WAIT_TIME}s")
sys.exit(1)
time.sleep(1)
try:
stochss_container=docker_client.containers.get("stochss-lab")
print("Generating StochSS webpage...")
print("Checking to see if the server is active.")
jupyter_url_generator=stochss_container.exec_run("jupyter notebook list", demux=False)
url_regex = r"(?i)\b((?:https?://|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'\".,<>?«»“”‘’]))"
jupyter_url_bytes = jupyter_url_generator.output
Expand All @@ -40,6 +47,7 @@
jupyter_url=jupyter_url_sequence[0]
jupyter_url=jupyter_url.replace('0.0.0.0','127.0.0.1')
print(f"Opening StochSS webpage...\n")
time.sleep(1)
webbrowser.open_new_tab(jupyter_url)
print("Welcome to StochSS!\n\nYou can access your local StochSS service with this URL:\n\n")
print(jupyter_url+"\n")
Expand Down
Loading

0 comments on commit 82d8e6a

Please sign in to comment.