Skip to content

updated parameter processing#320

Open
murrayrm wants to merge 19 commits intoBuildACell:mainfrom
murrayrm:parameter_update-22Nov2025
Open

updated parameter processing#320
murrayrm wants to merge 19 commits intoBuildACell:mainfrom
murrayrm:parameter_update-22Nov2025

Conversation

@murrayrm
Copy link
Collaborator

This PR provides a number of improvements and updates to parameter (and parameter file) processing, along with updates to unit processing and various changes to mechanisms and mixtures related to the parameter processing updates.

Parameters:

  • Parameter files are now stripped of lines starting with '#', allowing parameter files to contain comments. Parameter files that are distributed with the package now contain comments explaining their contents.

  • Components now check to see if parameter defaults are given by the mechanism that is calling the component, allowing mechanisms to define default parameter values. Default parameter files are provided for the following mechanisms: binding.py, enzyme.py, transport.py, txtl.py. Default parameters are in the matching '_parameters.tsv' files. These parameter values are overridden at the component or mixture level, so all previous behavior is preserved.

    This change allows simplified descriptions of basic circuits without specifying any parameters. For example, the following code will generate a simulatable model with no additional specification of parameter values:

     # Components
     TetR = bcp.Protein('TetR')
     aTc = bcp.Species('aTc')
     TetR_inactive=bcp.ChemicalComplex([TetR.species, aTc])
     ptet = bcp.RegulatedPromoter('ptet', TetR)
     dna_GFP = bcp.DNAassembly(
         'GFP', promoter=ptet, rbs='RBS', protein='GFP')
     
     # Mixture
     mixture = bcp.BasicPURE(
         'default', components=[dna_GFP, TetR_inactive])
     crn = mixture.compile_crn()
    
     timepoints = np.linspace(0, 100)
     results = crn.simulate_with_bioscrape_via_sbml(
         timepoints, initial_condition_dict={'dna_GFP': 1})
    
  • Parameter lookup within a component now allows the use of a "part type" in addition to the part ID. This was motivated by the 'binding' mechanisms, which get called for different purposes (eg, binding of two chemicals versus binding of protein to DNA). This functionality is implemented by allowing the part_id for a parameter lookup to be a list, with checking done in the order of elements in the list. A bit more detail below in the description of the changes to the default 'binding' parameters.

Units:

  • Put in units for all parameter files that are distributed with the package and added unit definitions for a variety of unit name variations:

    • 'hour': 'hrs', 'hr', 'hours'
    • 'minute': 'min', 'mins', 'minutes'
    • 'second': 's', 'sec', 'secs', 'seconds'

    Note: unit conversions in parameter files are not yet supported. All parameters should use units of 'uM', 'uL', and 'sec' (this is noted in the user documentation).

  • Defined a set of standard units to allow easier specifications and conversions:

    • Volume: 'nL', 'uL', 'mL', 'L'
    • Concentration: 'nM', 'uM', 'mM', 'M'
    • Time: 'sec', 'min', 'hrs'
      With these definitions, you can do the following:
     from biocrnpyler.utils.units import (
         nM, uM, mM, M, nL, uL, mL, L, sec, min, hrs
     )
     initial_conditions = {'dna_GFP': 1 * nM}
     plt.plot(results['time']/min, results['protein_GFP' / uM])
    

Mechanisms

  • The 'binding' mechanisms (in binding.py) now have default parameter values for two part types in mechanisms/binding_parameters.py: 'chemical_complex' and 'dna_protein'. This allows different uses of binding to have different default parameter values. (This uses the added functionality of allowing parameter lookups with a list of part_id's.)

  • Found and fixed a bug where the Energy_Translation_MM mechanism was missing a reverse reaction.

Mixtures

  • Default parameter values for all mixtures are now loaded by default (by giving a default value to parameter_file).

  • Default parameter values for extracts and PURE are set to values that are somewhat plausible (though they definitely need some work in some future PR).

  • Changed EnergyTxTlExtract to track ATP usage explicitly, rather than lumping it in with other nTPs. What was being done before was the NTP was being treated as an "energy" molecule. Given that we are likely to have other mechanisms that use ATP (but not other NTPs), it made sense to make it a separate molecule. (It comes up in this PR because I was adjusting the parameter values and noticed that there wasn't a separate description of ATP.)

Documentation, examples, and unit tests

  • Added an example examples/gfp_expression.py that shows comparisons between various extract mixtures (a PURE).
  • Changed documentation and code to use 'RNAse' rather than different versions of capitalization or spelling ('RNase', 'RNAase', etc).
  • Changed documentation and docstrings to use 'BioCRNpyler' as the consistent capitalized version of the package name (though it is still imported as 'biocrnpyler').
  • Updated the user documentation to give a description of these changes.
  • Fixed the issue that was generating warnings about multiple TOC trees in newer version of Sphinx (including the one used by ReadTheDocs).
  • Examples and unit tests have been updated to reflect the new defaults. The only remaining parameter file in the examples/ directory is 'default_parameters.txt', which has a lot of (undocumented) parameters for various constructs.
  • Added unit tests to make sure everything is working as expected.

@murrayrm murrayrm changed the title update default parameter files, including comments updated parameter processing Dec 29, 2025
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.

1 participant