Skip to content

Commit

Permalink
Merge pull request #214 from CovertLab/expressionConverge_patch
Browse files Browse the repository at this point in the history
Increase iteration cap for expressionConverge, add more informative print statements
  • Loading branch information
cyrus-bio authored Oct 13, 2023
2 parents d808f15 + 2aa4844 commit 5cbdbeb
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions reconstruction/ecoli/fit_sim_data_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

# Fitting parameters
FITNESS_THRESHOLD = 1e-9
MAX_FITTING_ITERATIONS = 100
MAX_FITTING_ITERATIONS = 300
N_SEEDS = 10

# Parameters used in fitPromoterBoundProbability()
Expand Down Expand Up @@ -511,10 +511,11 @@ def buildBasalCellSpecifications(
cell_specs["basal"]["expression"],
cell_specs["basal"]["concDict"],
cell_specs["basal"]["doubling_time"],
conditionKey="basal",
variable_elongation_transcription = variable_elongation_transcription,
variable_elongation_translation = variable_elongation_translation,
disable_ribosome_capacity_fitting = disable_ribosome_capacity_fitting,
disable_rnapoly_capacity_fitting = disable_rnapoly_capacity_fitting
disable_rnapoly_capacity_fitting = disable_rnapoly_capacity_fitting,
)

# Store calculated values
Expand Down Expand Up @@ -633,6 +634,7 @@ def buildTfConditionCellSpecifications(
cell_specs[conditionKey]["concDict"],
cell_specs[conditionKey]["doubling_time"],
sim_data.process.transcription.rna_data['Km_endoRNase'],
conditionKey=conditionKey,
variable_elongation_transcription = variable_elongation_transcription,
variable_elongation_translation = variable_elongation_translation,
disable_ribosome_capacity_fitting = disable_ribosome_capacity_fitting,
Expand Down Expand Up @@ -735,6 +737,7 @@ def buildCombinedConditionCellSpecifications(
cell_specs[conditionKey]["concDict"],
cell_specs[conditionKey]["doubling_time"],
sim_data.process.transcription.rna_data['Km_endoRNase'],
conditionKey = conditionKey,
variable_elongation_transcription = variable_elongation_transcription,
variable_elongation_translation = variable_elongation_translation,
disable_ribosome_capacity_fitting = disable_ribosome_capacity_fitting,
Expand All @@ -761,6 +764,7 @@ def expressionConverge(
concDict,
doubling_time,
Km=None,
conditionKey=None,
variable_elongation_transcription=True,
variable_elongation_translation=False,
disable_ribosome_capacity_fitting=False,
Expand Down Expand Up @@ -806,7 +810,7 @@ def expressionConverge(
"""

if VERBOSE > 0:
print("Fitting RNA synthesis probabilities.")
print(f"Fitting RNA synthesis probabilities for condition {conditionKey} ...", end='')

for iteration in range(MAX_FITTING_ITERATIONS):
if VERBOSE > 1:
Expand Down Expand Up @@ -844,6 +848,7 @@ def expressionConverge(
print(f'Average cistron expression residuals: {np.linalg.norm(cistron_expression_res)}')

if degreeOfFit < FITNESS_THRESHOLD:
print('! Fitting converged after {} iterations'.format(iteration + 1))
break

else:
Expand Down

0 comments on commit 5cbdbeb

Please sign in to comment.