Skip to content

merging c+11 changes with master branch#25

Closed
jjtapia wants to merge 498 commits intonfsim_lib_shared_ptrfrom
master
Closed

merging c+11 changes with master branch#25
jjtapia wants to merge 498 commits intonfsim_lib_shared_ptrfrom
master

Conversation

@jjtapia
Copy link
Copy Markdown
Member

@jjtapia jjtapia commented Apr 12, 2018

No description provided.

rasi added 30 commits December 14, 2018 23:31
Added few lines to print reaction details for
specific molecules and reactions.

Realized why endocleavage at stall was not working
properly. See the notes in data/sim180620.
This code is buggy for TASEP since it ignores state changes of
trailing ribosomes that are stacked behind a leading ribosome but are
not bonded to it.
To solve this problem, I am going to look at the MappingSet of mRNA
molecules to identify the spatial region around the state change and
include any associated bonded molecules in the product list.
Will involve introducing notion of a polymer molecule and spatial
states.
PySB, BioNetGen have also been modified to be able to specify polymeric
sites on molecules, their type, location, and interaction distance.
The ribosome that has collided at the stall site is not able to
move subsequently. Needs fixing.
Also updated README listing major lessons learned.
Need to figure out how reactantTemplates are assigned for each
reactionClass instance.
The reactions match between the old exhaustive search and the new
polymerneighborhood search.
No random printing to screen.
Transcription is failing in the polymerNeighborhood search. But this
should be a fixable problem.
But the neighborhood search on its own did not improve speed
significantly. See README.org from today for details. I will come back
to this at a later time.
Once the system has been set up, I have verified that all the reactant
and product patterns read into the vector for allReactantTemplates and
allProductTemplates.
Now have to infer the connectivity matrix between the reactions.
This comparison has to be used for checking whether the reactant and
product templates of one reaction match with the reactants of any other
reaction.
I am looking at connectivity separately for reactant and product
templatemolecules.
I instead need to look at only the reactant comps that are changed by
the particular reaction.
I read the list of connected reactions into a vector for each reaction.
I have to use this connectivity now during the molecule and reaction
rate update.
My first test as to whether this speeds up the code gave about 20%
improvement with and without considering connected reactions. This was
with 100 site mRNA. I am going to try this with 200 site mRNA and see if
the difference is bigger between the two methods.
When two mRNAs had the possibility of elongation at the same position,
then the full network and the connected network simulation picked
different mRNAs. I need to figure out why this difference occurs.
I removed the search for connected reaction in every reaction firing.
Instead created a lookup array for checking whether reactions are
connected.
This has cut down the simulation time by almost 4-10 fold.
The other things remaining are to see why connected and full search
slightly differ.
Also, replace the Python code for inferring connectivity with native C++
code that uses the already defined TemplateMolecule methods.
I reordered BasicReactionClass::tryToAdd() to prevent reordering of
mappingSet in reactantList when the molecule is already part of the
reaction. This solved the difference between connected and full at the
early stage, but there seems to be still some diffence in the trajectory
later in the reaction.
Based on my tests, it looks like I am inferring and processing the
connected reactions correctly.

I removed some debugging cruft.
TODO: Further optimizations that can/should be done:

1. Instead of iterating over all reactions for each molecule to update
its membership, iterate over all the connected reactions for the fired
Reaction in =MoleculeType::updateRxnMembership()=. This is a much
smaller set with the network topology of ribosomes and mRNAs.

2. Remove =onTheFlyObservable= calculation. Right now, this loop
needlessly slows down the fire. But it can be readily removed because it
is automatically assumed for the =TotalRate= calculation for
=initiation=.

3. Identify network connectivity within =NFsim= itself. This will speed
up the reaction considerably.
=MoleculeType::updateRxnMembership()= loop is much more efficient now. I
got a 6-7 fold decrease in running time.

Need to infer the connectedReactions in C++ instead of python script
outside for speed.
I made the interaction distance to be exactly the ribosome size in
tasep.py, but made the search distance here longer so that reactant
molecules for connected reactions that are not directly bonded and
do not match the TemplateMolecule of the connectedReaction are not
missed in the update.
ASinanSaglam and others added 27 commits May 3, 2023 11:55
was missing a "[" if no operations were present
Ubuntu binary not working under WsL at least, testing different version
Merging branch made to address seg fault in Issue 37
Repackages zip files containing executables for each OS into .tgz files that are used for releases.
Uncommented lines that stopped copying of windows dll's
Fixed line 1128 in DORreaction.cpp where getCorrectedReactantCount
incorrectly returned reactantTree1->size() for DORreactantIndex2.
It should return reactantTree2->size() to match the intended pattern
where each reactant index corresponds to its own reactant tree.

Fixes issue #23 reported by external user.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@jrfaeder jrfaeder closed this Feb 20, 2026
jrfaeder pushed a commit that referenced this pull request Apr 6, 2026
* feat: add support for fixed (clamped) species

This change introduces tracking and replenishment for BioNetGen "Fixed" species (where `Fixed="1"`).

- `MoleculeType` now tracks `isFixed_`, `fixedCount_`, and `fixedCompartment_`.
- `NFinput`'s XML parser sets these attributes when reading a `<Species>` element with `Fixed="1"`. A warning is logged for unsupported multi-molecule fixed species.
- `System::replenishFixedSpecies()` creates or deletes molecules of a fixed `MoleculeType` to maintain the clamped total. It handles compartment-specific assignment for the replenished molecules.
- The replenishment fixup runs immediately post-fire in `System::sim()`, `System::stepTo()`, and `System::singleStep()`.

Tests (`v42.bngl` and `v43.bngl`) verified fixed count clamping during synthesis, degradation, and binding.

Co-authored-by: akutuva21 <44119804+akutuva21@users.noreply.github.com>

* Finalize fixed species implementation: robust single-molecule replenishment, multi-molecule error, and validation tests v42-v44. Fixes BNG root artifact clutter and validate.py BNG invocation.

* Remove subset validation scratch file.

* fix(refactor): simplify NFinput parsing for fixed species and clean up .gitignore scope. Fix test Suite trailing newlines.

* feat: add support for fixed (clamped) species

This change introduces tracking and replenishment for BioNetGen "Fixed" species (where `Fixed="1"`).

- `MoleculeType` now tracks `isFixed_`, `fixedCount_`, and `fixedCompartment_`.
- `NFinput`'s XML parser sets these attributes when reading a `<Species>` element with `Fixed="1"`. A warning is logged for unsupported multi-molecule fixed species.
- `System::replenishFixedSpecies()` creates or deletes molecules of a fixed `MoleculeType` to maintain the clamped total. It handles compartment-specific assignment for the replenished molecules.
- The replenishment fixup runs immediately post-fire in `System::sim()`, `System::stepTo()`, and `System::singleStep()`.

Tests (`v42.bngl` and `v43.bngl`) verified fixed count clamping during synthesis, degradation, and binding.

Co-authored-by: akutuva21 <44119804+akutuva21@users.noreply.github.com>

* fix: correct fixed species counting, replenishment, and testing

- Corrected `System::replenishFixedSpecies` to only count free molecules (`m->getDegree() == 0`) and safely remove explicitly free molecules, avoiding corruption of existing complexes.
- Restored delegation to `mt->addMoleculeToRunningSystem` for molecule initialization to prevent missed lifecycle steps.
- Restored `recompute_A_tot()` at the end of `replenishFixedSpecies` to prevent stale propensities in the Gillespie algorithm.
- Reverted multi-molecule fixed species check in `NFinput` to correctly error and halt (`return ""`) rather than silently skipping.
- Restored and integrated `v42` and `v43` BNGL tests into the validation suite alongside proper tracking configuration.
- Cleaned up incorrectly committed artifact files (`.gdat`, `.net`, `.xml`, `.species`) and `__pycache__` directories from the PR branch.

Co-authored-by: akutuva21 <44119804+akutuva21@users.noreply.github.com>

---------

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
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.

5 participants