Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
865382e
sweep: changed when is the replica is generated for virtual sample to…
jdmartinez24 Jul 30, 2025
38b46d9
plot in existing axis object
jdmartinez24 Aug 1, 2025
b2867e8
minor update
jdmartinez24 Aug 4, 2025
26d15b2
visualisation update
jdmartinez24 Aug 4, 2025
a502bd2
update labelled structure scaling method
jdmartinez24 Aug 4, 2025
a646025
bugfix on generate_virtual_sample
jdmartinez24 Aug 4, 2025
0b542b2
minor update
jdmartinez24 Aug 4, 2025
84f88f0
major fix: probe axis direction vector was not calculated but used th…
jdmartinez24 Aug 5, 2025
c048a89
bugfix: translate source points as well for labelled structure and up…
jdmartinez24 Aug 5, 2025
3603181
update probe_model method
jdmartinez24 Aug 5, 2025
f110db5
minor update
jdmartinez24 Aug 5, 2025
8ff3c1a
minor update
jdmartinez24 Aug 6, 2025
9f36063
structure: keep atoms in file
jdmartinez24 Aug 6, 2025
f62efda
add option to return volume_activation
jdmartinez24 Aug 6, 2025
383a6ed
return activation volume
jdmartinez24 Aug 6, 2025
c311509
minor update
jdmartinez24 Aug 7, 2025
d521ce2
add projections method for stack visulisation
jdmartinez24 Aug 7, 2025
3671b59
add sum
jdmartinez24 Aug 7, 2025
ba04c60
update visualisation in z projections
jdmartinez24 Aug 7, 2025
37cf274
minor update
jdmartinez24 Aug 8, 2025
ba06ddf
bugfix conjugation sites not being use when adding probe to experiment
jdmartinez24 Aug 11, 2025
bd59ca2
minor update
jdmartinez24 Aug 11, 2025
b87ccd0
show labelled structure with normals
jdmartinez24 Aug 11, 2025
1281339
minor update
jdmartinez24 Aug 11, 2025
ac63f0f
buffix defect parameters
jdmartinez24 Aug 11, 2025
3729b02
minor updates
jdmartinez24 Aug 11, 2025
918b34a
update defects at experiment
jdmartinez24 Aug 11, 2025
2ef0a51
tests update
jdmartinez24 Aug 11, 2025
a50074a
format coordinates field module
jdmartinez24 Aug 11, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 54 additions & 51 deletions src/supramolsim/analysis/sweep.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ def sweep_vasmples(
"1XI5",
]
if probes is None:
print("Probe list is None. Using default probe")
probes = [
default_probe,
]
Expand All @@ -89,54 +90,56 @@ def sweep_vasmples(
for struct in structures:
experiment.structure_id = struct
experiment._build_structure()
for rep in range(repetitions):
probe_n = 0
for probe in probes:
print(f"probe: {probe}")
# probe_param_n = 0
for probe_param_n, p_param in probe_parameters.items():
# copy p_param?
experiment.remove_probes()
if p_param is None:
experiment.add_probe(
probe_template=probe,
)
#experiment.probe_parameters[probe] = default_params
#for rep in range(repetitions):
probe_n = 0
for probe in probes:
print(f"probe: {probe}")
# probe_param_n = 0
for probe_param_n, p_param in probe_parameters.items():
# copy p_param?
experiment.remove_probes()
if p_param is None:
experiment.add_probe(
probe_template=probe,
)
#experiment.probe_parameters[probe] = default_params
else:
p_param_copy = copy.deepcopy(p_param)
p_param_copy["fluorophore_id"] = default_fluorophore
experiment.add_probe(
probe_template=probe,
**p_param_copy
)
for defect_n, defects_pars in particle_defects.items():
particle_defects_copy = copy.deepcopy(defects_pars)
for d_key, d_val in particle_defects_copy.items():
if d_key=="defect_small_cluster":
experiment.defect_eps["eps1"] = d_val
if d_key=="defect_large_cluster":
experiment.defect_eps["eps2"] = d_val
if d_key=="defect":
experiment.defect_eps["defect"] = d_val
# print(experiment.defect_eps)
print(experiment.probe_parameters)
experiment._build_particle(keep=True)
if experiment.generators_status("particle"):
if len(experiment.particle.emitters) == 0:
print(f"Skipping {probe}. No emitters were generated")
break
else:
p_param_copy = copy.deepcopy(p_param)
p_param_copy["fluorophore_id"] = default_fluorophore
experiment.add_probe(
probe_template=probe,
**p_param_copy
break
#vsample_n = 0
for vsample_n, vsample_pars in virtual_samples.items():
_exported_field = None
# combination += str(vsample_n)
experiment.set_virtualsample_params(
**vsample_pars
)
for defect_n, defects_pars in particle_defects.items():
particle_defects_copy = copy.deepcopy(defects_pars)
for d_key, d_val in particle_defects_copy.items():
if d_key=="defect_small_cluster":
experiment.defect_eps["eps1"] = d_val
if d_key=="defect_large_cluster":
experiment.defect_eps["eps2"] = d_val
if d_key=="defect":
experiment.defect_eps["defect"] = d_val
# print(experiment.defect_eps)
print(experiment.probe_parameters)
experiment._build_particle(keep=True)
if experiment.generators_status("particle"):
if len(experiment.particle.emitters) == 0:
print(f"Skipping {probe}. No emitters were generated")
break
else:
break
#vsample_n = 0
for vsample_n, vsample_pars in virtual_samples.items():
_exported_field = None
# combination += str(vsample_n)
experiment.set_virtualsample_params(
**vsample_pars
)
#_exported_field = experiment._build_coordinate_field(
# keep=False, use_self_particle=True, **vsample_pars
#)
#_exported_field = experiment._build_coordinate_field(
# keep=False, use_self_particle=True, **vsample_pars
#)
for rep in range(repetitions):
experiment.clear_virtual_sample()
experiment.build(modules=["coordinate_field"], use_self_particle=True)
_exported_field = experiment.coordinate_field.export_field()
combination_n = (
Expand All @@ -159,11 +162,11 @@ def sweep_vasmples(
vsample_params[combination_n] = _parameters
vsample_outputs[combination_n] = []
vsample_outputs[combination_n].append(_exported_field)
#
#
#vsample_n += 1
# defect_n += 1
probe_n += 1
#
#
#vsample_n += 1
# defect_n += 1
probe_n += 1
return experiment, vsample_outputs, vsample_params


Expand Down
35 changes: 24 additions & 11 deletions src/supramolsim/experiments.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,9 @@ def _build_particle(self, lab_eff=1.0, defect_build=None, keep=False):
deg_dissasembly=defect,
)
else:
particle.add_defects(
deg_dissasembly=0,
)
print("Particle without defects")
if keep:
self.particle = particle
Expand Down Expand Up @@ -942,6 +945,8 @@ def add_probe(
probe_configuration["conjugation_target_info"] = (
probe_conjugation_target_info
)
probe_configuration["conjugation_sites"]["target"]["type"]= probe_conjugation_target_info["type"]
probe_configuration["conjugation_sites"]["target"]["value"]= probe_conjugation_target_info["value"]
if probe_conjugation_efficiency is not None:
probe_configuration["conjugation_efficiency"] = probe_conjugation_efficiency
if probe_seconday_epitope is not None:
Expand All @@ -956,6 +961,7 @@ def add_probe(
probe_configuration["as_linker"] = False
if probe_steric_hindrance is not None:
probe_configuration["distance_between_epitope"] = probe_steric_hindrance
probe_configuration["binding"]["distance"]["between_targets"] = probe_steric_hindrance
self.probe_parameters[probe_name] = probe_configuration
self._update_probes()

Expand Down Expand Up @@ -1138,7 +1144,8 @@ def current_settings(self, as_string=True, newline="<br>", modalities_acq_params

def generate_virtual_sample(
structure: str = "1XI5",
probe_name: str = None,
probe_template: str = "NHS_ester",
probe_name:str = None,
probe_target_type: str = None,
probe_target_value: str = None,
probe_distance_to_epitope: float = None,
Expand All @@ -1148,7 +1155,7 @@ def generate_virtual_sample(
probe_conjugation_target_info=None,
probe_conjugation_efficiency: float = None,
probe_seconday_epitope=None,
probe_wobbling=False,
probe_wobble_theta=None,
labelling_efficiency: float = 1.0,
defect_small_cluster: float = None,
defect_large_cluster: float = None,
Expand All @@ -1160,6 +1167,7 @@ def generate_virtual_sample(
random_orientations=False,
random_placing=False,
clear_probes=False,
clear_experiment = False,
**kwargs,
):
"""
Expand Down Expand Up @@ -1223,19 +1231,24 @@ def generate_virtual_sample(
- ExperimentParametrisation: The experiment containing all modules that were generated to build the virtual sample, and the virtual sample module itself. This experiment can be further used and tweaked for subsequent analysis or branching workflows.
"""
myexperiment = ExperimentParametrisation()
if clear_experiment:
myexperiment.clear_experiment()
# load default configuration for probe
if not clear_probes:
if probe_name is None:
probe_name = "NHS_ester"
print(probe_template)
probe_configuration_file = os.path.join(
myexperiment.configuration_path, "probes", probe_name + ".yaml"
myexperiment.configuration_path, "probes", probe_template + ".yaml"
)
probe_configuration = load_yaml(probe_configuration_file)
probe_configuration["probe_name"] = probe_name
probe_configuration["probe_template"] = probe_template
if probe_name is None:
probe_name = probe_template
else:
probe_configuration["label_name"] = probe_name
if probe_target_type and probe_target_value:
probe_configuration["target_info"] = dict(
type=probe_target_type, value=probe_target_value
)
print(probe_target_type, probe_target_value)
probe_configuration["probe_target_type"] = probe_target_type
probe_configuration["probe_target_value"] = probe_target_value
if probe_distance_to_epitope is not None:
probe_configuration["distance_to_epitope"] = probe_distance_to_epitope
if probe_fluorophore is not None:
Expand All @@ -1254,8 +1267,8 @@ def generate_virtual_sample(
probe_configuration["conjugation_efficiency"] = probe_conjugation_efficiency
if probe_seconday_epitope is not None:
probe_configuration["epitope_target_info"] = probe_seconday_epitope
if probe_wobbling:
probe_configuration["enable_wobble"] = probe_wobbling
if probe_wobble_theta is not None:
probe_configuration["probe_wobble_theta"] = probe_wobble_theta
myexperiment.add_probe(**probe_configuration)
# load default configuration for virtual sample
virtual_sample_template = os.path.join(
Expand Down
Loading