Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
33fe7af
keep copy of configurations for modalities in experiment
jdmartinez24 Jul 22, 2025
cb0697e
use half of psf depth when using integrating convolved volume from th…
jdmartinez24 Jul 22, 2025
7c7e7b1
update modality with depth of field
jdmartinez24 Jul 22, 2025
f86beb9
update tests
jdmartinez24 Jul 22, 2025
4daf084
make preview optional with button
jdmartinez24 Jul 22, 2025
dc4af64
minor update
jdmartinez24 Jul 22, 2025
c889b23
update modality from widgets
jdmartinez24 Jul 22, 2025
d6af71e
icon update button
jdmartinez24 Jul 22, 2025
54681ab
updates on icons
jdmartinez24 Jul 22, 2025
ca84553
update icon in select structure
jdmartinez24 Jul 22, 2025
5e0bd76
justify content center
jdmartinez24 Jul 22, 2025
1070380
minor update
jdmartinez24 Jul 22, 2025
9c6c50e
defaults on colors and icons
jdmartinez24 Jul 22, 2025
da3a43e
use defaults
jdmartinez24 Jul 22, 2025
e0929fc
unstyle widgets
jdmartinez24 Jul 22, 2025
433ee5f
minor updates
jdmartinez24 Jul 22, 2025
3826bc3
unstyle in visualisations
jdmartinez24 Jul 22, 2025
dc0ce57
update styles visualisations
jdmartinez24 Jul 22, 2025
7e3348f
icons updates
jdmartinez24 Jul 22, 2025
cae685a
minor update
jdmartinez24 Jul 22, 2025
5ff9080
update sample widget
jdmartinez24 Jul 22, 2025
8e70939
update method to set virtualsample parameters
jdmartinez24 Jul 22, 2025
cfa90eb
minor updates
jdmartinez24 Jul 22, 2025
983cc85
minor update
jdmartinez24 Jul 22, 2025
95ac9e5
update experiment default path
jdmartinez24 Jul 23, 2025
1292f3c
capture outputs
jdmartinez24 Jul 23, 2025
194fd46
fix mehtod names
jdmartinez24 Jul 23, 2025
e00e37e
update run experiment wigets icons
jdmartinez24 Jul 23, 2025
ad374fa
return image along with its corresponding parameters in sweep
jdmartinez24 Jul 23, 2025
a68acc4
minor update
jdmartinez24 Jul 23, 2025
705fbb7
bugfix distance to epitope
jdmartinez24 Jul 23, 2025
17f3cd7
minor updates
jdmartinez24 Jul 23, 2025
8c7957e
update wobble theta parameter
jdmartinez24 Jul 23, 2025
a89f074
update sequential labelling notebook
jdmartinez24 Jul 23, 2025
520ee39
get modalities previews from new experiment instead of copying existing
jdmartinez24 Jul 23, 2025
ef3cfe5
update config parameter settings
jdmartinez24 Jul 23, 2025
642672c
sweep_gen: default probe parameter set to none
jdmartinez24 Jul 23, 2025
88ff02b
bugfix cases where depth exceeds volume
jdmartinez24 Jul 24, 2025
ac2ce36
minor update
jdmartinez24 Jul 25, 2025
2371ebb
bugfix: use exeriment attribute for vsample generation
jdmartinez24 Jul 29, 2025
f64927d
save image parameters yml
jdmartinez24 Jul 29, 2025
6e513ec
updated metrics
jdmartinez24 Jul 30, 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
6 changes: 3 additions & 3 deletions notebooks/Example_outputs/Indirect_labelling.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -71,17 +71,17 @@
"source": [
"experiment.remove_probes()\n",
"experiment.add_probe(\n",
"probe_name = \"Antibody\",\n",
"probe_template = \"Antibody\",\n",
"probe_target_type = \"Sequence\",\n",
"probe_target_value = \"ELAVGSL\",\n",
"as_primary=True,\n",
")\n",
"experiment.add_probe(\n",
"probe_name = \"Nanobody\",\n",
"probe_template = \"Nanobody\",\n",
"probe_target_type = \"Primary\",\n",
"probe_target_value = \"Antibody\"\n",
")\n",
"experiment.build()"
"experiment.build(modules=[\"particle\", \"coordinate_field\"])"
]
},
{
Expand Down
15 changes: 9 additions & 6 deletions src/supramolsim/analysis/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,17 +298,20 @@ def get_circles(img,
cirlce_params : dict
Parameters used for circle detection.
"""
if blur_px:
gray_blurred = cv2.blur(img, (blur_px, blur_px), 0)
else:
gray_blurred = img
gray_blurred = img
if gray_blurred.min() < 0:
gray_blurred += -gray_blurred.min()
if gray_blurred.dtype != np.uint8:
if gray_blurred.dtype in [np.float32, np.float64]:
gray_blurred = np.uint8(gray_blurred * 255)
#gray_blurred = np.uint8(gray_blurred * 255)
gray_blurred = np.uint8(gray_blurred/gray_blurred.max() * 255)
else:
gray_blurred = gray_blurred.astype(np.uint8)
#gray_blurred = gray_blurred.astype(np.uint8)
gray_blurred = (gray_blurred/256).astype('uint8')
if blur_px:
gray_blurred = cv2.blur(gray_blurred, (blur_px, blur_px), 0)
else:
gray_blurred = gray_blurred
circles = cv2.HoughCircles(
gray_blurred,
cv2.HOUGH_GRADIENT,
Expand Down
2 changes: 1 addition & 1 deletion src/supramolsim/analysis/sweep.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def sweep_vasmples(
probe_filepath = os.path.join(local_dir, "probes", default_probe + ".yaml")
default_params = load_yaml(probe_filepath)
probe_parameters = dict()
probe_parameters[0] = default_params
probe_parameters[0] = None
if particle_defects is None:
particle_defects = dict()
particle_defects[0] = {"use_defects": False}
Expand Down
2 changes: 1 addition & 1 deletion src/supramolsim/configs/parameter_settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ acquisition:
exp_time:
ptype: numeric
wtype: float_slider
range: [0, 1, 0.001]
range: [0, 0.01, 0.0001]
nintervals: 2
35 changes: 29 additions & 6 deletions src/supramolsim/experiments.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,14 @@
from supramolsim.utils.io import yaml_functions
from IPython.utils import io
from pathlib import Path
import sys

IN_COLAB = 'google.colab' in sys.modules
if IN_COLAB:
output_path = "/content/vlab4mic_outputs"
else:
output_path = Path.home() / "vlab4mic_outputs"

output_path = Path.home() / "vlab4mic_outputs"

if not os.path.exists(output_path):
os.makedirs(output_path)
Expand Down Expand Up @@ -67,12 +73,14 @@ def __post_init__(self):
modalities_dir = os.path.join(local_dir, "modalities")
modalities_names_list = []
modality_parameters = {}
self.config_modalities = dict()
for mods in os.listdir(modalities_dir):
if os.path.splitext(mods)[-1] == ".yaml" and "_template" not in mods:
modalities_names_list.append(os.path.splitext(mods)[0])
for mod in modalities_names_list:
mod_info = configuration_format.compile_modality_parameters(mod, local_dir)
mod_info, mod_configuration = configuration_format.compile_modality_parameters(mod, local_dir)
modality_parameters[mod] = mod_info
self.config_modalities[mod] = mod_configuration
self.local_modalities_names = modalities_names_list
self.local_modalities_parameters = modality_parameters
probes_dir = os.path.join(local_dir, "probes")
Expand Down Expand Up @@ -214,6 +222,7 @@ def update_modality(
lateral_resolution_nm: int = None,
axial_resolution_nm: int = None,
psf_voxel_nm: int = None,
depth_of_field_nm: int = None,
remove=False,
):
"""
Expand Down Expand Up @@ -277,6 +286,12 @@ def update_modality(
psf_voxel_nm,
]
changes = True
if depth_of_field_nm is not None:
depth_in_slices = None
voxel_size = self.local_modalities_parameters[modality_name]["psf_params"]["voxelsize"][2]
depth=int(depth_of_field_nm / voxel_size)
self.imaging_modalities[modality_name]["psf_params"]["depth"] = depth
changes = True
if changes:
self.imager.set_imaging_modality(
**self.imaging_modalities[modality_name]
Expand Down Expand Up @@ -822,7 +837,7 @@ def add_probe(
probe_conjugation_target_info=None,
probe_conjugation_efficiency: float = None,
probe_seconday_epitope=None,
probe_wobbling=False,
probe_wobble_theta: float = None,
labelling_efficiency: float = 1.0,
as_primary=False,
peptide_motif: dict = None,
Expand Down Expand Up @@ -931,8 +946,9 @@ def add_probe(
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["enable_wobble"] = True
probe_configuration["wobble_theta"] = probe_wobble_theta
if as_primary:
print("Adding probe as primary linker")
probe_configuration["as_linker"] = True
Expand Down Expand Up @@ -992,6 +1008,10 @@ def set_virtualsample_params(
None
"""
# load default configuration for virtual sample
try:
particle_minimal_distance = self.coordinate_field.molecules_params["minimal_distance"]
except:
particle_minimal_distance = None
virtual_sample_template = os.path.join(
self.configuration_path,
"virtualsample",
Expand All @@ -1008,7 +1028,10 @@ def set_virtualsample_params(
vsample_configuration["random_orientations"] = random_orientations
if random_placing is not None:
vsample_configuration["random_placing"] = random_placing
vsample_configuration["minimal_distance"] = minimal_distance
if minimal_distance is not None:
vsample_configuration["minimal_distance"] = minimal_distance
else:
vsample_configuration["minimal_distance"] = particle_minimal_distance
self.virtualsample_params = vsample_configuration

def use_image_for_positioning(
Expand Down
13 changes: 6 additions & 7 deletions src/supramolsim/generate/labels.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,6 @@ def construct_label(
fluorophore_id: str = "AF647",
lab_eff: float = None,
target_info=None,
enable_wobble=False,
wobble_theta=None,
**kwargs,
):
"""
Expand All @@ -230,8 +228,10 @@ def construct_label(
# keynames reserved for parameters that can be iteratet over
if "model_ID" in kwargs.keys():
label_params["model"]["ID"] = kwargs["model_ID"]
if "distance_to_epitope" in kwargs.keys():
label_params["binding"]["distance"]["to_target"] = kwargs["distance_to_epitope"]
if "distance_to_epitope" in label_params.keys():
label_params["binding"]["distance"]["to_target"] = label_params["distance_to_epitope"]
else:
print("No distance to epitope provided, using default value.")
if "distance_between_epitope" in kwargs.keys():
label_params["binding"]["distance"]["between_targets"] = kwargs["distance_between_epitope"]
if "paratope" in kwargs.keys():
Expand All @@ -242,9 +242,8 @@ def construct_label(
label_params["conjugation_sites"]["efficiency"] = kwargs["conjugation_efficiency"]
if "epitope_target_info" in kwargs.keys():
label_params["epitope"]["target"] = kwargs["epitope_target_info"]
if enable_wobble:
if label_params["binding"]["wobble_range"]["theta"] is None:
label_params["binding"]["wobble_range"]["theta"] = wobble_theta
if "wobble_theta" in label_params.keys():
label_params["binding"]["wobble_range"]["theta"] = label_params["wobble_theta"]
else:
label_params["binding"]["wobble_range"]["theta"] = None
######## information about target
Expand Down
8 changes: 6 additions & 2 deletions src/supramolsim/generate/molecular_structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -853,7 +853,7 @@ def show_target_labels(
fig.show

def show_assembly_atoms(
self, assembly_fraction=0.01, view_init=[0, 0, 0], axesoff=True
self, assembly_fraction=0.01, view_init=[0, 0, 0], axesoff=True,return_plot=False
):
"""
Visualize a fraction of the assembly atoms.
Expand Down Expand Up @@ -888,7 +888,11 @@ def show_assembly_atoms(
)
if axesoff:
ax.set_axis_off()
return fig
if return_plot:
plt.close()
return fig
else:
fig.show()

def create_instance_builder(self, write=False, savingdir=None):
"""
Expand Down
Loading