Skip to content

Commit

Permalink
new script working
Browse files Browse the repository at this point in the history
  • Loading branch information
olive004 committed Dec 5, 2024
1 parent 5d66a32 commit 00ef8f8
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 58 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
"dt0": 0.01,
"dt1": 0.5,
"t0": 0,
"t1": 500,
"tmax": 2000,
"t1": 5,
"tmax": 5,
"solver": "diffrax",
"use_batch_mutations": true,
"interaction_factor": 1,
Expand Down Expand Up @@ -163,34 +163,6 @@
"inputs": ["RNA_0"]
}
},
"vis_3_mutation_types_positions_1": {
"experiment": {
"purpose": "vis_3_mutation_types_positions_1"
},
"source_dirs": {
"is_source_dir_incomplete": true,
"source_dir": "./data/ensemble_simulate_by_interaction",
"purpose_to_get_source_dir_from": "summarise_simulation",
"source_dir_actually_used_POSTERITY": null
},
"tabulated_info_differentiator": "mutation_num",
"preprocessing_func": null,
"only_visualise_circuits": false
},
"vis_3_mutation_types_positions_2": {
"experiment": {
"purpose": "vis_3_mutation_types_positions_2"
},
"source_dirs": {
"is_source_dir_incomplete": true,
"source_dir": "./data/ensemble_simulate_by_interaction",
"purpose_to_get_source_dir_from": "summarise_simulation",
"source_dir_actually_used_POSTERITY": null
},
"tabulated_info_differentiator": "mutation_num",
"preprocessing_func": null,
"only_visualise_circuits": false
},
"vis_4_histplots_thresholded": {
"experiment": {
"purpose": "vis_4_histplots_thresholded"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,18 @@ def preprocess_energies(energies: np.ndarray, quantities: np.ndarray, sim_args:
}} for i, (eq, ba, bd, en) in enumerate(zip(eqconstants, a_rates, d_rates, energies))]


def subdivide_simulate(circuits, data_writer, config_file):
data_writer.update_ensemble(os.path.join('simulate_by_interaction', 'circuits')) #, safe_dir_change=False)
CircuitModeller(result_writer=data_writer, config=config_file).batch_circuits(
circuits,
write_to_subsystem=True, batch_size=config_file['simulation'].get('batch_size', 100),
methods={
"compute_interactions": {},
"write_interactions": {},
"init_circuits": {'batch': True},
"simulate_signal_batch": {'ref_circuit': None,
'batch': True},
"write_results": {'no_visualisations': config_file['experiment'].get('no_visualisations', True),
'no_numerical': config_file['experiment'].get('no_numerical', False)}
})
data_writer.update_ensemble(os.path.join('simulate_by_interaction')) #, safe_dir_change=False)
# def rm_dupes(data_writer):
# dirs_to_rem = ['eqconstants', 'binding_rates_association',
# 'binding_rates_dissociation', 'energies', 'binding_sites']
# for dir_to_rem in dirs_to_rem:
# dn = os.path.join(data_writer.ensemble_write_dir, dir_to_rem)
# if os.path.exists(dn):
# for root, dirs, files in os.walk(dn, topdown=False):
# for name in files:
# os.remove(os.path.join(root, name))
# for name in dirs:
# os.rmdir(os.path.join(root, name))
# os.rmdir(dn)


def main(config=None, data_writer=None):
Expand Down Expand Up @@ -96,20 +93,30 @@ def main(config=None, data_writer=None):
req_output=True,
name="making_circuit"
),
Protocol(
CircuitModeller(
result_writer=data_writer, config=config_file).write_interactions,
req_input=True,
req_output=True,
name="compute_interaction_strengths"
)
# Protocol(
# CircuitModeller(
# result_writer=data_writer, config=config_file).write_interactions,
# req_input=True,
# req_output=True,
# name="compute_interaction_strengths"
# )
],
Protocol(partial(subdivide_simulate,
data_writer=data_writer,
config_file=config_file),
req_input=True,
name="subdivide_and_simulate"
)
Protocol(partial(CircuitModeller(result_writer=data_writer, config=config_file).batch_circuits,
write_to_subsystem=True, batch_size=config_file['simulation'].get('batch_size', 100),
methods={
"compute_interactions": {},
"write_interactions": {},
"init_circuits": {'batch': True},
"simulate_signal_batch": {'ref_circuit': None,
'batch': True},
"write_results": {'no_visualisations': config_file['experiment'].get('no_visualisations', True),
'no_numerical': config_file['experiment'].get('no_numerical', False)}
}),
req_input=True,
name="simulate"
)
# Protocol(partial(rm_dupes, data_writer=data_writer),
# req_input=False, name="remove_duplicates")
]

experiment = Experiment(config=config, config_file=config_file, protocols=protocols,
Expand Down

0 comments on commit 00ef8f8

Please sign in to comment.