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

Biosimulators Prototype #426

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open

Biosimulators Prototype #426

wants to merge 12 commits into from

Conversation

ascibisz
Copy link
Contributor

@ascibisz ascibisz commented Nov 1, 2024

Dependent on this octopus PR

Time Estimate or Size

small

Problem

Initiate a smoldyn simulation via octopus from the example simularium viewer
Link to story or ticket

Solution

Use new message type to initiate a smoldyn simulation via octopus, using an input number (default 100) for the initial rabbit count. After this initial request, proceed like any other simulation.

To trigger this from the example UI, specify desired initial rabbit count in the input field labeled "Initial Rabbit Count:" and click the "Run Smoldyn" button.

At the moment, you need to be running the feature/prototype-biosimulators-smoldyn Octopus branch locally and have the simularium-viewer pointing to it via the npm run start --localhost npm run start --localserver. Once this octopus PR is merged, the octopus changes will be in staging, so the run smoldyn prototype will work while running the viewer normally.

Type of change

  • New feature (non-breaking change which adds functionality)

Screenshots (optional):

Screen Shot 2024-11-01 at 2 52 03 PM

Copy link

github-actions bot commented Nov 1, 2024

Coverage report

St.
Category Percentage Covered / Total
🔴 Statements
41.03% (-1.35% 🔻)
2045/4984
🔴 Branches
43.29% (-1.74% 🔻)
838/1936
🔴 Functions
37.09% (-1.89% 🔻)
418/1127
🔴 Lines
41.24% (-1.38% 🔻)
1958/4748
Show files with reduced coverage 🔻
St.
File Statements Branches Functions Lines
🟡 constants.ts
72.73% (-8.04% 🔻)
100%
40% (-18.33% 🔻)
71.43% (-8.57% 🔻)
🟢 simularium/index.ts
83.33% (-2.38% 🔻)
83.33%
56.25% (-6.25% 🔻)
84.62% (-2.56% 🔻)
🔴
... / RemoteSimulator.ts
46.72% (-2% 🔻)
56.67% (-4.05% 🔻)
25.76% (-1.66% 🔻)
50% (-2.38% 🔻)
🔴
... / VisData.ts
56% (-4.61% 🔻)
55.56% (+3.56% 🔼)
67.86% (+5.36% 🔼)
56.94% (-3.47% 🔻)
🟡 util.ts
75.93% (-10.15% 🔻)
60% (-16.92% 🔻)
50% (-18.18% 🔻)
78.43% (-8.24% 🔻)
🔴 controller/index.ts
30.14% (-1.77% 🔻)
14% (-2.67% 🔻)
17.24% (-0.3% 🔻)
30.48% (-1.86% 🔻)
🟡
... / DummyRemoteSimulator.ts
69.32% (-3.85% 🔻)
72.73%
53.57% (-7.14% 🔻)
69.05% (-4.37% 🔻)
🔴
... / index.ts
7.69% (+0.16% 🔼)
7.26% (+0.12% 🔼)
5.65% (-0.05% 🔻)
7.65% (+0.15% 🔼)

Test suite run success

125 tests passing in 15 suites.

Report generated by 🧪jest coverage report action from 1975799

@ascibisz ascibisz marked this pull request as ready for review November 1, 2024 21:55
@ascibisz ascibisz requested a review from a team as a code owner November 1, 2024 21:55
@ascibisz ascibisz requested review from interim17, tyler-foster and ShrimpCryptid and removed request for a team and tyler-foster November 1, 2024 21:55
Copy link
Contributor

@ShrimpCryptid ShrimpCryptid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Comment on lines 415 to 432
if (smoldynInput !== undefined && smoldynInput !== null) {
this.webSocketClient.sendWebSocketRequest(
{
msgType: NetMessageEnum.ID_START_SMOLDYN,
fileName: outFileName,
smoldynInputVal: smoldynInput,
},
"Start smoldyn conversion"
);
} else {
this.webSocketClient.sendWebSocketRequest(
{
msgType: NetMessageEnum.ID_START_SMOLDYN,
fileName: outFileName,
},
"Start smoldyn conversion"
);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (smoldynInput !== undefined && smoldynInput !== null) {
this.webSocketClient.sendWebSocketRequest(
{
msgType: NetMessageEnum.ID_START_SMOLDYN,
fileName: outFileName,
smoldynInputVal: smoldynInput,
},
"Start smoldyn conversion"
);
} else {
this.webSocketClient.sendWebSocketRequest(
{
msgType: NetMessageEnum.ID_START_SMOLDYN,
fileName: outFileName,
},
"Start smoldyn conversion"
);
}
this.webSocketClient.sendWebSocketRequest(
{
msgType: NetMessageEnum.ID_START_SMOLDYN,
fileName: outFileName,
smoldynInputVal: smoldynInput ?? undefined,
},
"Start smoldyn conversion"
);

Small nit to maybe make this more DRY.

Copy link
Contributor

@interim17 interim17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works, looks sound, comments are non-blocking.

I am concerned that the test bed is suffering from a death by a 1000 cuts of small additions to the UI meant to test specific features that either have some small conflict in approach, or otherwise crowd each other.

In this case, it would make more sense to me if we used the select component (where the other trajectories and TEST LIVE MODE API live) to load the smoldyn live mode. Disabling the Run Smoldyn button until that option was selected would make it clear what trajectory or live sim is currently loaded and running. But just an opinion, something to consider going forward. I'd be happy to help with that refactor if you were in agreement it was a good idea?

Comment on lines +822 to +810
<label>
Initial Rabbit Count:
<input
defaultValue="100"
onChange={(event) => {this.smoldynInput = event.target.value}}
/>
</label>
<button onClick={() => this.loadSmoldynSim()}>
Run Smoldyn
</button>
<br />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: disable/otherwise indicate when a smoldyn-live sim is not loaded in trajectory select field?

Comment on lines 413 to 423
public sendSmoldynData(outFileName: string, smoldynInput: string): void {
this.lastRequestedFile = outFileName;
if (smoldynInput !== undefined && smoldynInput !== null) {
this.webSocketClient.sendWebSocketRequest(
{
msgType: NetMessageEnum.ID_START_SMOLDYN,
fileName: outFileName,
smoldynInputVal: smoldynInput,
},
"Start smoldyn conversion"
);
Copy link
Contributor

@interim17 interim17 Nov 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: might be worth adding some comments to avoid confusion over loading/running live smoldyn sims and converting smoldyn files.

Edit: after looking at the octopus PR I get the way that converting is kind of baked into the process here, but I still wouldn't mind a comment :)

@toloudis
Copy link
Contributor

toloudis commented Nov 5, 2024

I am concerned that the test bed is suffering from a death by a 1000 cuts of small additions to the UI meant to test specific features that either have some small conflict in approach, or otherwise crowd each other.

In this case, it would make more sense to me if we used the select component (where the other trajectories and TEST LIVE MODE API live) to load the smoldyn live mode. Disabling the Run Smoldyn button until that option was selected would make it clear what trajectory or live sim is currently loaded and running. But just an opinion, something to consider going forward. I'd be happy to help with that refactor if you were in agreement it was a good idea?

I agree with this comment, it would have been great to just add the smoldyn test to the selection list of test data if possible. Wonder if/when we would ever remove this test from the test app.

@ascibisz ascibisz force-pushed the feature/smoldyn-sim-prototype branch from 1975799 to 31cc5dc Compare January 17, 2025 23:13
Copy link

github-actions bot commented Jan 17, 2025

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 24.44% 2651 / 10843
🔵 Statements 24.44% 2651 / 10843
🔵 Functions 25% 147 / 588
🔵 Branches 81.04% 342 / 422
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
examples/src/Viewer.tsx 0% 0% 0% 0% 1-1047
src/controller/index.ts 23.36% 50% 8.69% 23.36% 81-82, 90-107, 127-171, 174-179, 182-187, 190-191, 197-211, 215-216, 229-232, 235-238, 241-266, 269-273, 276-277, 280-283, 286-305, 311, 321-323, 326-330, 333-342, 345-358, 361-369, 372-418, 421-428, 431-432, 435-436, 439-449, 452-455, 458-466, 469-477, 480-510, 513-514, 517-523, 533-534, 537-538, 541-542, 545-546, 549-550, 553-554, 557-558, 561-562, 565-566
src/simularium/OctopusClient.ts 15.94% 100% 0% 15.94% 10-14, 17-22, 25-26, 29-43, 46-54, 57-64, 67-80
src/simularium/WebsocketClient.ts 76.88% 80% 66.66% 76.88% 135-139, 151, 175-176, 180-191, 201-207, 222, 225, 234-235, 247-255, 263-268, 306-307, 324-325, 332-335
Generated in workflow #535 for commit 34c9eba by the Vitest Coverage Report Action

@ascibisz ascibisz requested a review from interim17 January 17, 2025 23:23
@ascibisz ascibisz requested a review from interim17 February 3, 2025 21:50
Copy link
Contributor

@interim17 interim17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I like the update of splitting changeFile

Didn't test directly but it looks like it should work?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants