-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into record-make-a-copy-1396
- Loading branch information
Showing
136 changed files
with
6,048 additions
and
938 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
// app/assets/javascripts/copasi_simulation.js | ||
|
||
var copasi = null; | ||
|
||
function automaticChanged() { | ||
var autoStepSize = document.getElementById("autoStepSize").checked; | ||
document.getElementById("numPoints").disabled = autoStepSize; | ||
} | ||
|
||
function loadIntoCOPASI() { | ||
var info = copasi.loadModel(document.getElementById("cps").value); | ||
document.getElementById("model_name").innerHTML = "none"; | ||
if (info['status'] != "success") { | ||
document.getElementById("simulation_error").innerHTML = "Error loading model: " + info['messages']; | ||
document.getElementById('simulation_error').hidden = false; | ||
} | ||
document.getElementById("model_name").innerHTML = 'Model name: ' + info['model']['name']; | ||
document.getElementById("copasi_version").innerHTML = 'Copasi version: ' + copasi.version; | ||
document.getElementById('simulation_info').hidden = false; | ||
} | ||
|
||
function simulate() { | ||
if (copasi == null) { | ||
alert('There is a problem to load Copasi simulator.'); | ||
return; | ||
} | ||
loadIntoCOPASI(); | ||
runSimulation(); | ||
} | ||
|
||
function runSimulation() { | ||
var autoStepSize = document.getElementById("autoStepSize").checked; | ||
var timeStart = parseFloat(document.getElementById("startTime").value); | ||
var timeEnd = parseFloat(document.getElementById("endTime").value); | ||
|
||
if (autoStepSize) { | ||
var result = copasi.simulateYaml({ | ||
"problem": { | ||
"AutomaticStepSize": true, | ||
"Duration": timeEnd, | ||
"OutputStartTime": timeStart | ||
} | ||
}); | ||
loadPlotFromResult(result); | ||
return; | ||
} | ||
|
||
var numPoints = parseInt(document.getElementById("numPoints").value); | ||
var result = copasi.simulateEx(timeStart, timeEnd, numPoints); | ||
loadPlotFromResult(result); | ||
} | ||
|
||
function loadPlotFromResult(result) { | ||
if (typeof result === 'string') { | ||
result = JSON.parse(result); | ||
} | ||
|
||
clearResults(); | ||
document.getElementById("data").innerHTML = JSON.stringify(result); | ||
|
||
var data = []; | ||
for (var i = 1; i < result.num_variables; i++) { | ||
data.push({ | ||
name: result.columns[i][0], | ||
x: result.columns[0], | ||
y: result.columns[i], | ||
type: "scatter", | ||
name: result.titles[i] | ||
}); | ||
} | ||
|
||
Plotly.newPlot('chart', data); | ||
} | ||
|
||
function clearResults() { | ||
document.getElementById("data").innerHTML = ""; | ||
document.getElementById("chart").innerHTML = ""; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
var ExtendedMetadataType = { | ||
|
||
addNewMarker: function(new_id, type) { | ||
var isNested = (type === "ExtendedMetadata"); | ||
$j("#nested-tab, #nested-tab").parent().toggleClass("active", isNested); | ||
$j("#nested-metadata-table").toggleClass("active in", isNested); | ||
$j("#top-level-tab, #top-level-tab").parent().toggleClass("active", !isNested); | ||
$j("#top-level-metadata-table").toggleClass("active in", !isNested); | ||
|
||
var table = isNested ? $j("#nested-metadata-table") : $j("#top-level-metadata-table"); | ||
table.find("tbody td#" + new_id).append(' <sup style="color:red; font-weight:bold; font-size: 12px">new</sup>'); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.