From bb7fa023ebc17d3dabf1343b593103d33f3e89f7 Mon Sep 17 00:00:00 2001 From: Cyrille Favreau Date: Wed, 31 Aug 2022 09:36:12 +0200 Subject: [PATCH 1/3] Minor documentation and notebook edits --- DOCKER.md | 2 +- README.md | 11 ++--- ...orer_import_white_matter_allen_brain.ipynb | 16 ++----- .../BioExplorer_full_scene.ipynb | 2 +- ...Explorer_neuronmodulation_components.ipynb | 42 ++++++------------- .../neurons/BioExplorer_neurons.ipynb | 2 +- .../BioExplorer_import_vtk_to_db.ipynb | 2 +- .../vasculature/BioExplorer_vasculature.ipynb | 11 ++--- storage/database/DOCKER.md | 15 ++++++- 9 files changed, 44 insertions(+), 59 deletions(-) diff --git a/DOCKER.md b/DOCKER.md index beaf0b056..11e5231db 100644 --- a/DOCKER.md +++ b/DOCKER.md @@ -30,7 +30,7 @@ If you want to run the Blue Brain BioExplorer with a database use: docker run -ti --rm -p 5000:5000 bioexplorer --http-server :5000 --plugin "BioExplorer --db-name=bioexplorer --db-password=bioexplorer --db-user=postgres --db-host= --db-port=5432" --plugin MediaMaker ``` -Replace `` with the IP address of the host where the database docker container is running. Refer to the [database Docker readme](./storage/database/DOCKER.md) for more information on how to set up and populate the the Blue Brain BioExplorer database with publicly available datasets: +Replace `` with the IP address of the host where the database docker container is running. Refer to the [database Docker readme](./storage/database/DOCKER.md) for more information on how to set up and populate the the Blue Brain BioExplorer database with publicly available datasets. **NOTE** If you are having trouble exiting the process after you run the container (with the above command), use `docker stop ` to stop the container. `docker ps` will give you the current running process. diff --git a/README.md b/README.md index b7678eeac..be2813a4c 100644 --- a/README.md +++ b/README.md @@ -131,9 +131,7 @@ References: * [Brain microvasculature has a common topology with local differences in geometry that match metabolic load](https://www.cell.com/neuron/fulltext/S0896-6273(21)00080-5?_returnURL=https%3A%2F%2Flinkinghub.elsevier.com%2Fretrieve%2Fpii%2FS0896627321000805%3Fshowall%3Dtrue) * [Blue Brain Neuro-Glia-Vasculature Portal. Vasculature. Reconstruction Data](https://bbp.epfl.ch/ngv-portal/#explore) -### Neurons and astrocytes - -#### Neurons +### Neurons Circuits of neurons are loaded from the database (see the database [schema](./storage/database/neurons_schema.sql) and the example [notebook](./bioexplorer/pythonsdk/notebooks/neurons/BioExplorer_import_sonata_to_db.ipynb) for loading data from [Sonata](https://github.com/AllenInstitute/sonata) files) using their position and orientation. Each cell is composed of sections that form the axons and dendrites, as well as spines. Cell internals such as the nucleus and the mitochondria can be automatically generated, according to the data provided by the scientific literature. The _BBBE_ also implements procedural generation of varicosities along the axon, as well as myelin sheaths. @@ -146,9 +144,12 @@ neurons_model = bio_explorer.add_neurons( ) ``` -An [example dataset](https://zenodo.org/record/6906785#.Ywym7tVBxH6) is available in the [A Model of Rat Non-barrel Somatosensory Cortex Anatomy](https://www.biorxiv.org/content/10.1101/2022.08.11.503144v1) publication. Please refer to the documentation of the [Sonata](https://github.com/AllenInstitute/sonata) format for information how to load and analyze the model. A [jupyter notebook](./bioexplorer/pythonsdk/notebooks/neurons/rat_non-barrel_somatosensory_cortex_anatomy/BioExplorer_rat_non-barrel_somatosensory_cortex_anatomy.ipynb) has been included with basic examples of how to load, visualize and explorer the data using the Blue Brain open-source packages [NeuroM](https://neurom.readthedocs.io/en/stable/) and [Blue Brain SNAP](https://bluebrainsnap.readthedocs.io/en/stable/). +An [example dataset](https://zenodo.org/record/6906785#.Ywym7tVBxH6) is available in the [Model of Rat Non-barrel Somatosensory Cortex Anatomy](https://www.biorxiv.org/content/10.1101/2022.08.11.503144v1) publication. Please refer to the documentation of the [Sonata](https://github.com/AllenInstitute/sonata) format for information on how to load and analyze the model. A [jupyter notebook](./bioexplorer/pythonsdk/notebooks/neurons/rat_non-barrel_somatosensory_cortex_anatomy/BioExplorer_rat_non-barrel_somatosensory_cortex_anatomy.ipynb) has been included with basic examples of how to explore the data using the Blue Brain open-source packages [NeuroM](https://neurom.readthedocs.io/en/stable/) and [Blue Brain SNAP](https://bluebrainsnap.readthedocs.io/en/stable/). + +References: +* [A Model of Rat Non-barrel Somatosensory Cortex Anatomy](https://www.biorxiv.org/content/10.1101/2022.08.11.503144v1) -#### Astrocytes +### Astrocytes Circuits of astrocytes are loaded from the database (see the database [schema](./storage/database/astrocytes_schema.sql) and the example [notebook](./bioexplorer/pythonsdk/notebooks/astrocytes/BioExplorer_import_sonata_to_db.ipynb) for loading data from [Sonata](https://github.com/AllenInstitute/sonata) files) using their position and orientation. Astrocytes end-feet are connected to the vasculature using data stored in a dedicated connectome database [schema](./storage/database/connectome_schema.sql). The _BBBE_ allows end-feet to automatically adapt to the vasculature vessel size. diff --git a/bioexplorer/pythonsdk/notebooks/connectomics/BioExplorer_import_white_matter_allen_brain.ipynb b/bioexplorer/pythonsdk/notebooks/connectomics/BioExplorer_import_white_matter_allen_brain.ipynb index 6d63313d5..ee8d74f45 100644 --- a/bioexplorer/pythonsdk/notebooks/connectomics/BioExplorer_import_white_matter_allen_brain.ipynb +++ b/bioexplorer/pythonsdk/notebooks/connectomics/BioExplorer_import_white_matter_allen_brain.ipynb @@ -42,7 +42,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -215,7 +215,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -237,17 +237,9 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Connection string: postgresql+psycopg2://bioexplorer:verole2020@postgresql14-users.bbp.epfl.ch:5432/bioexplorer, schema: connectome\n" - ] - } - ], + "outputs": [], "source": [ "import os\n", "from sqlalchemy import create_engine\n", diff --git a/bioexplorer/pythonsdk/notebooks/molecular_systems/BioExplorer_full_scene.ipynb b/bioexplorer/pythonsdk/notebooks/molecular_systems/BioExplorer_full_scene.ipynb index 7d8fde13d..bda442ea1 100644 --- a/bioexplorer/pythonsdk/notebooks/molecular_systems/BioExplorer_full_scene.ipynb +++ b/bioexplorer/pythonsdk/notebooks/molecular_systems/BioExplorer_full_scene.ipynb @@ -21,7 +21,7 @@ " Cell, Sugar, Vector2, Vector3, Quaternion, AnimationParams\n", "import nglview\n", "\n", - "be = BioExplorer('localhost:5000')" + "be = BioExplorer('localhost:5000') " ] }, { diff --git a/bioexplorer/pythonsdk/notebooks/neuromodulation/BioExplorer_neuronmodulation_components.ipynb b/bioexplorer/pythonsdk/notebooks/neuromodulation/BioExplorer_neuronmodulation_components.ipynb index 9c9ce9a5b..de31cc66e 100644 --- a/bioexplorer/pythonsdk/notebooks/neuromodulation/BioExplorer_neuronmodulation_components.ipynb +++ b/bioexplorer/pythonsdk/notebooks/neuromodulation/BioExplorer_neuronmodulation_components.ipynb @@ -10,7 +10,7 @@ }, { "cell_type": "code", - "execution_count": 213, + "execution_count": null, "id": "be36b1f4", "metadata": { "scrolled": false @@ -19,7 +19,7 @@ "source": [ "from bioexplorer import BioExplorer, Vector3\n", "\n", - "url = 'r4i1n25:5000'\n", + "url = 'localhost:5000'\n", "be = BioExplorer(url)\n", "core = be.core_api()\n", "status = be.reset_scene()\n", @@ -29,7 +29,7 @@ }, { "cell_type": "code", - "execution_count": 214, + "execution_count": null, "id": "ec4b5f41", "metadata": {}, "outputs": [], @@ -40,18 +40,10 @@ }, { "cell_type": "code", - "execution_count": 215, + "execution_count": null, "id": "c635c1a6", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Connection string: postgresql+psycopg2://bioexplorer:verole2020@postgresql14-users.bbp.epfl.ch:5432/bioexplorer, schema: o1\n" - ] - } - ], + "outputs": [], "source": [ "import os\n", "from sqlalchemy import create_engine\n", @@ -81,7 +73,7 @@ }, { "cell_type": "code", - "execution_count": 216, + "execution_count": null, "id": "0e2fb09b", "metadata": {}, "outputs": [], @@ -106,7 +98,7 @@ }, { "cell_type": "code", - "execution_count": 217, + "execution_count": null, "id": "0b43ee0b", "metadata": {}, "outputs": [], @@ -130,7 +122,7 @@ }, { "cell_type": "code", - "execution_count": 218, + "execution_count": null, "id": "eb0c2ee1", "metadata": {}, "outputs": [], @@ -146,7 +138,7 @@ }, { "cell_type": "code", - "execution_count": 219, + "execution_count": null, "id": "115f6fe9", "metadata": {}, "outputs": [], @@ -166,7 +158,7 @@ }, { "cell_type": "code", - "execution_count": 220, + "execution_count": null, "id": "a9d718a1", "metadata": {}, "outputs": [], @@ -194,7 +186,7 @@ }, { "cell_type": "code", - "execution_count": 221, + "execution_count": null, "id": "7cb64b4f", "metadata": {}, "outputs": [], @@ -284,7 +276,7 @@ }, { "cell_type": "code", - "execution_count": 222, + "execution_count": null, "id": "1a1fc863", "metadata": {}, "outputs": [], @@ -317,7 +309,7 @@ }, { "cell_type": "code", - "execution_count": 223, + "execution_count": null, "id": "791df5e4", "metadata": {}, "outputs": [], @@ -341,14 +333,6 @@ "status = core.set_renderer_params(params)\n", "status = core.set_renderer()" ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "180e68c3", - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": { diff --git a/bioexplorer/pythonsdk/notebooks/neurons/BioExplorer_neurons.ipynb b/bioexplorer/pythonsdk/notebooks/neurons/BioExplorer_neurons.ipynb index ff0f50347..ca6327c6d 100644 --- a/bioexplorer/pythonsdk/notebooks/neurons/BioExplorer_neurons.ipynb +++ b/bioexplorer/pythonsdk/notebooks/neurons/BioExplorer_neurons.ipynb @@ -45,7 +45,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 7, "id": "3007d98c", "metadata": {}, "outputs": [], diff --git a/bioexplorer/pythonsdk/notebooks/vasculature/BioExplorer_import_vtk_to_db.ipynb b/bioexplorer/pythonsdk/notebooks/vasculature/BioExplorer_import_vtk_to_db.ipynb index 02b3a4d2e..f2ed7d9cd 100644 --- a/bioexplorer/pythonsdk/notebooks/vasculature/BioExplorer_import_vtk_to_db.ipynb +++ b/bioexplorer/pythonsdk/notebooks/vasculature/BioExplorer_import_vtk_to_db.ipynb @@ -168,7 +168,7 @@ " session.execute(\"INSERT INTO %s.metadata VALUES(0, 'nb_nodes', %d)\" % (db_schema, nb_points))\n", " session.execute(\"INSERT INTO %s.metadata VALUES(0, 'nb_arteries', %d)\" % (db_schema, 0))\n", " session.execute(\"INSERT INTO %s.metadata VALUES(0, 'nb_sub_graphs', %d)\" % (db_schema, 0))\n", - " session.commit()\n" + " session.commit()" ] } ], diff --git a/bioexplorer/pythonsdk/notebooks/vasculature/BioExplorer_vasculature.ipynb b/bioexplorer/pythonsdk/notebooks/vasculature/BioExplorer_vasculature.ipynb index d98f7c49c..17acf358e 100644 --- a/bioexplorer/pythonsdk/notebooks/vasculature/BioExplorer_vasculature.ipynb +++ b/bioexplorer/pythonsdk/notebooks/vasculature/BioExplorer_vasculature.ipynb @@ -26,10 +26,10 @@ "source": [ "from bioexplorer import BioExplorer, Vector3\n", "\n", - "url = 'r4i7n18:5000'\n", + "url = 'localhost:5000'\n", "be = BioExplorer(url)\n", "core = be.core_api()\n", - "# status = be.reset_scene()" + "status = be.reset_scene()" ] }, { @@ -48,7 +48,7 @@ "outputs": [], "source": [ "assembly_name = 'Vasculature'\n", - "population_name = 'vasculature_v5'\n", + "population_name = 'vasculature'\n", "be.remove_assembly(assembly_name)\n", "\n", "o = Vector3(334.274978637695, 0, 598.822242736816)\n", @@ -61,10 +61,7 @@ " assembly_name=assembly_name,\n", " population_name=population_name,\n", " representation=be.VASCULATURE_REPRESENTATION_SEGMENT,\n", - " # color_scheme=be.VASCULATURE_COLOR_SCHEME_RADIUS,\n", - " use_sdf=True,\n", - " radius_multiplier=1.0/25.0\n", - " # sql_filter=filter\n", + " use_sdf=True, sql_filter=filter\n", " # sql_filter='radius>3.5'\n", ")" ] diff --git a/storage/database/DOCKER.md b/storage/database/DOCKER.md index e78a90a82..c729c0fdf 100644 --- a/storage/database/DOCKER.md +++ b/storage/database/DOCKER.md @@ -15,15 +15,26 @@ docker build -t bioexplorer-db . ### Usage --------- -If you want to run Blue Brain BioExplorer PostgreSQL Database use: +If you want to run Blue Brain BioExplorer PostgreSQL Database, use the following command to run the database instance: ```bash # Runs Blue Brain BioExplorer Database on port 5432 docker run -d -p 5432:5432 bioexplorer-db ``` -### Populating the database +And run the Blue Brain BioExplorer with the following command: +```bash +# Runs the Blue Brain BioExplorer as a service with the HTTP interface bound to port 5000 +docker run -ti --rm -p 5000:5000 bioexplorer --http-server :5000 --plugin "BioExplorer --db-name=bioexplorer --db-password=bioexplorer --db-user=postgres --db-host= --db-port=5432" --plugin MediaMaker +``` + +Replace `` with the IP address of the host where the database docker container is running. + +### Populating the database with open datasets + +A [full circuit dataset](https://zenodo.org/record/6906785#.Ywym7tVBxH6) is available in the [Model of Rat Non-barrel Somatosensory Cortex Anatomy](https://www.biorxiv.org/content/10.1101/2022.08.11.503144v1) publication. A [Python Notebook](../../bioexplorer/pythonsdk/notebooks/neurons/rat_non-barrel_somatosensory_cortex_anatomy/BioExplorer_import_sonata_to_db.ipynb) has been included with basic examples of how to explore the dataset. A [vasculature dataset](https://bbp.epfl.ch/ngv-portal/data/anatomy/experimental-data/vasculature-data/raw-vasculature-data.vtk) is available from the Blue Brain NGV portal. An example [Python Notebook](../../bioexplorer/pythonsdk/notebooks/vasculature/BioExplorer_import_vtk_to_db.ipynb) is available to import the VTK dataset into the database. The [vasculature Python Notebook](../../bioexplorer/pythonsdk/notebooks/vasculature/BioExplorer_vasculature.ipynb) can then be used to visualize the vasculature. + **NOTE** If you are having trouble exiting the process after you run the container (with the above command), use `docker stop ` to stop the container. `docker ps` will give you the current running process. From 69b25be568c9e6540c7ac7bb4ddc5c8a3533b174 Mon Sep 17 00:00:00 2001 From: Cyrille Favreau Date: Wed, 31 Aug 2022 09:36:12 +0200 Subject: [PATCH 2/3] Minor documentation and notebook edits --- DOCKER.md | 2 +- README.md | 11 +- .../pythonsdk/bioexplorer/bio_explorer.py | 73 +- .../pythonsdk/bioexplorer/movie_maker.py | 17 +- .../animation/BioExplorer_cell.ipynb | 156 -- .../BioExplorer_mesh_based_membrane.ipynb | 247 -- .../notebooks/atlas/BioExplorer_atlas.ipynb | 21 +- .../atlas/BioExplorer_import_to_db.ipynb | 2 +- ...orer_import_white_matter_allen_brain.ipynb | 16 +- .../BioExplorer_white_matter.ipynb | 68 +- .../BioExplorer_glucose_movie.ipynb | 2127 ++++++++--------- .../BioExplorer_metabolism_plots.ipynb | 19 +- .../BioExplorer_ACE2_Receptor.ipynb | 1 - .../molecular_systems/BioExplorer_cell.ipynb | 518 ++-- .../BioExplorer_cell_diffusion.ipynb | 342 +-- .../BioExplorer_enzyme_reaction.ipynb | 657 +++-- .../BioExplorer_full_scene.ipynb | 14 +- .../BioExplorer_ion_channels_in_cell.ipynb | 474 ++-- .../BioExplorer_mesh_based_membrane.ipynb | 628 ++--- .../BioExplorer_microtubule.ipynb | 296 +-- .../BioExplorer_spike_and_ACE2_receptor.ipynb | 4 +- .../BioExplorer_synapse.ipynb | 388 +-- .../BioExplorer_volume.ipynb | 300 +-- .../animation/BioExplorer_cell.ipynb | 155 ++ .../animation/BioExplorer_infection.ipynb | 18 +- .../BioExplorer_mesh_based_membrane.ipynb | 248 ++ .../animation/BioExplorer_rna_sequence.ipynb | 19 +- .../animation/BioExplorer_spike.ipynb | 68 +- .../animation/BioExplorer_virus.ipynb | 47 +- .../BioExplorer_virus_entering_cell.ipynb | 93 +- .../animation/BioExplorer_virus_fusion.ipynb | 62 +- .../BioExplorer_virus_sphere_to_flat.ipynb | 56 +- .../fields/BioExplorer_fields.ipynb | 37 +- .../BioExplorer_high_glucose_movie.ipynb | 17 +- .../BioExplorer_high_glucose_scenario.ipynb | 21 +- .../BioExplorer_high_glucose_stills.ipynb | 11 +- .../BioExplorer_low_glucose_movie.ipynb | 0 .../BioExplorer_low_glucose_scenario.ipynb | 10 +- .../BioExplorer_low_glucose_stills.ipynb | 0 .../BioExplorer_microtubules.ipynb | 488 ++-- .../BioExplorer_neuromodulation_movie.ipynb | 1514 ++++++------ ...Explorer_neuronmodulation_components.ipynb | 42 +- .../BioExplorer_neuronmodulation_covers.ipynb | 34 +- ...Explorer_neuronmodulation_full_movie.ipynb | 26 +- .../neurons/BioExplorer_neurons.ipynb | 2 +- .../utils/BioExplorer_360_animation.ipynb | 402 ++-- .../utils/BioExplorer_atomic_radii.ipynb | 8 +- .../BioExplorer_drop_virus_on_receptor.ipynb | 134 +- .../utils/BioExplorer_frame_buffers.ipynb | 11 +- .../utils/BioExplorer_inspection.ipynb | 11 +- .../utils/BioExplorer_proteins.ipynb | 33 +- .../utils/BioExplorer_sdf_testing.ipynb | 70 +- .../utils/BioExplorer_streamlines.ipynb | 10 +- .../vasculature/BioExplorer_full_system.ipynb | 2 +- ...culature_and_astrocytes_radii_report.ipynb | 10 +- .../BioExplorer_import_vtk_to_db.ipynb | 2 +- .../vasculature/BioExplorer_vasculature.ipynb | 60 +- .../widgets/BioExplorer_widgets.ipynb | 9 + .../animated_glucose_metabolism_scenario.py | 16 +- .../scripts/animated_high_glucose_scenario.py | 8 +- .../scripts/animated_low_glucose_scenario.py | 8 +- .../animated_neuromodulation_scenario.py | 2 +- bioexplorer/pythonsdk/tests/test_cell.py | 2 +- bioexplorer/pythonsdk/tests/test_glucose.py | 2 +- bioexplorer/pythonsdk/tests/test_immune.py | 4 +- .../tests/test_mesh_based_membrane.py | 4 +- storage/database/DOCKER.md | 15 +- 67 files changed, 5099 insertions(+), 5073 deletions(-) delete mode 100644 bioexplorer/pythonsdk/notebooks/animation/BioExplorer_cell.ipynb delete mode 100644 bioexplorer/pythonsdk/notebooks/animation/BioExplorer_mesh_based_membrane.ipynb create mode 100644 bioexplorer/pythonsdk/notebooks/molecular_systems/animation/BioExplorer_cell.ipynb rename bioexplorer/pythonsdk/notebooks/{ => molecular_systems}/animation/BioExplorer_infection.ipynb (93%) create mode 100644 bioexplorer/pythonsdk/notebooks/molecular_systems/animation/BioExplorer_mesh_based_membrane.ipynb rename bioexplorer/pythonsdk/notebooks/{ => molecular_systems}/animation/BioExplorer_rna_sequence.ipynb (90%) rename bioexplorer/pythonsdk/notebooks/{ => molecular_systems}/animation/BioExplorer_spike.ipynb (76%) rename bioexplorer/pythonsdk/notebooks/{ => molecular_systems}/animation/BioExplorer_virus.ipynb (79%) rename bioexplorer/pythonsdk/notebooks/{ => molecular_systems}/animation/BioExplorer_virus_entering_cell.ipynb (88%) rename bioexplorer/pythonsdk/notebooks/{ => molecular_systems}/animation/BioExplorer_virus_fusion.ipynb (81%) rename bioexplorer/pythonsdk/notebooks/{ => molecular_systems}/animation/BioExplorer_virus_sphere_to_flat.ipynb (72%) rename bioexplorer/pythonsdk/notebooks/{ => molecular_systems}/fields/BioExplorer_fields.ipynb (80%) rename bioexplorer/pythonsdk/notebooks/{ => molecular_systems}/scenarios/high_glucose/BioExplorer_high_glucose_movie.ipynb (98%) rename bioexplorer/pythonsdk/notebooks/{ => molecular_systems}/scenarios/high_glucose/BioExplorer_high_glucose_scenario.ipynb (97%) rename bioexplorer/pythonsdk/notebooks/{ => molecular_systems}/scenarios/high_glucose/BioExplorer_high_glucose_stills.ipynb (96%) rename bioexplorer/pythonsdk/notebooks/{ => molecular_systems}/scenarios/low_glucose/BioExplorer_low_glucose_movie.ipynb (100%) rename bioexplorer/pythonsdk/notebooks/{ => molecular_systems}/scenarios/low_glucose/BioExplorer_low_glucose_scenario.ipynb (98%) rename bioexplorer/pythonsdk/notebooks/{ => molecular_systems}/scenarios/low_glucose/BioExplorer_low_glucose_stills.ipynb (100%) diff --git a/DOCKER.md b/DOCKER.md index beaf0b056..11e5231db 100644 --- a/DOCKER.md +++ b/DOCKER.md @@ -30,7 +30,7 @@ If you want to run the Blue Brain BioExplorer with a database use: docker run -ti --rm -p 5000:5000 bioexplorer --http-server :5000 --plugin "BioExplorer --db-name=bioexplorer --db-password=bioexplorer --db-user=postgres --db-host= --db-port=5432" --plugin MediaMaker ``` -Replace `` with the IP address of the host where the database docker container is running. Refer to the [database Docker readme](./storage/database/DOCKER.md) for more information on how to set up and populate the the Blue Brain BioExplorer database with publicly available datasets: +Replace `` with the IP address of the host where the database docker container is running. Refer to the [database Docker readme](./storage/database/DOCKER.md) for more information on how to set up and populate the the Blue Brain BioExplorer database with publicly available datasets. **NOTE** If you are having trouble exiting the process after you run the container (with the above command), use `docker stop ` to stop the container. `docker ps` will give you the current running process. diff --git a/README.md b/README.md index b7678eeac..be2813a4c 100644 --- a/README.md +++ b/README.md @@ -131,9 +131,7 @@ References: * [Brain microvasculature has a common topology with local differences in geometry that match metabolic load](https://www.cell.com/neuron/fulltext/S0896-6273(21)00080-5?_returnURL=https%3A%2F%2Flinkinghub.elsevier.com%2Fretrieve%2Fpii%2FS0896627321000805%3Fshowall%3Dtrue) * [Blue Brain Neuro-Glia-Vasculature Portal. Vasculature. Reconstruction Data](https://bbp.epfl.ch/ngv-portal/#explore) -### Neurons and astrocytes - -#### Neurons +### Neurons Circuits of neurons are loaded from the database (see the database [schema](./storage/database/neurons_schema.sql) and the example [notebook](./bioexplorer/pythonsdk/notebooks/neurons/BioExplorer_import_sonata_to_db.ipynb) for loading data from [Sonata](https://github.com/AllenInstitute/sonata) files) using their position and orientation. Each cell is composed of sections that form the axons and dendrites, as well as spines. Cell internals such as the nucleus and the mitochondria can be automatically generated, according to the data provided by the scientific literature. The _BBBE_ also implements procedural generation of varicosities along the axon, as well as myelin sheaths. @@ -146,9 +144,12 @@ neurons_model = bio_explorer.add_neurons( ) ``` -An [example dataset](https://zenodo.org/record/6906785#.Ywym7tVBxH6) is available in the [A Model of Rat Non-barrel Somatosensory Cortex Anatomy](https://www.biorxiv.org/content/10.1101/2022.08.11.503144v1) publication. Please refer to the documentation of the [Sonata](https://github.com/AllenInstitute/sonata) format for information how to load and analyze the model. A [jupyter notebook](./bioexplorer/pythonsdk/notebooks/neurons/rat_non-barrel_somatosensory_cortex_anatomy/BioExplorer_rat_non-barrel_somatosensory_cortex_anatomy.ipynb) has been included with basic examples of how to load, visualize and explorer the data using the Blue Brain open-source packages [NeuroM](https://neurom.readthedocs.io/en/stable/) and [Blue Brain SNAP](https://bluebrainsnap.readthedocs.io/en/stable/). +An [example dataset](https://zenodo.org/record/6906785#.Ywym7tVBxH6) is available in the [Model of Rat Non-barrel Somatosensory Cortex Anatomy](https://www.biorxiv.org/content/10.1101/2022.08.11.503144v1) publication. Please refer to the documentation of the [Sonata](https://github.com/AllenInstitute/sonata) format for information on how to load and analyze the model. A [jupyter notebook](./bioexplorer/pythonsdk/notebooks/neurons/rat_non-barrel_somatosensory_cortex_anatomy/BioExplorer_rat_non-barrel_somatosensory_cortex_anatomy.ipynb) has been included with basic examples of how to explore the data using the Blue Brain open-source packages [NeuroM](https://neurom.readthedocs.io/en/stable/) and [Blue Brain SNAP](https://bluebrainsnap.readthedocs.io/en/stable/). + +References: +* [A Model of Rat Non-barrel Somatosensory Cortex Anatomy](https://www.biorxiv.org/content/10.1101/2022.08.11.503144v1) -#### Astrocytes +### Astrocytes Circuits of astrocytes are loaded from the database (see the database [schema](./storage/database/astrocytes_schema.sql) and the example [notebook](./bioexplorer/pythonsdk/notebooks/astrocytes/BioExplorer_import_sonata_to_db.ipynb) for loading data from [Sonata](https://github.com/AllenInstitute/sonata) files) using their position and orientation. Astrocytes end-feet are connected to the vasculature using data stored in a dedicated connectome database [schema](./storage/database/connectome_schema.sql). The _BBBE_ allows end-feet to automatically adapt to the vasculature vessel size. diff --git a/bioexplorer/pythonsdk/bioexplorer/bio_explorer.py b/bioexplorer/pythonsdk/bioexplorer/bio_explorer.py index bb3759ea2..27352eaf3 100644 --- a/bioexplorer/pythonsdk/bioexplorer/bio_explorer.py +++ b/bioexplorer/pythonsdk/bioexplorer/bio_explorer.py @@ -542,10 +542,10 @@ def add_sars_cov_2(self, name, resource_folder, :rotation: rotation of the SARS-COV-2 coronavirus in the scene :apply_colors: Applies default colors to the virus """ - pdb_folder = resource_folder + "pdb/" - rna_folder = resource_folder + "rna/" - glycan_folder = pdb_folder + "glycans/" - membrane_folder = pdb_folder + "membrane/" + pdb_folder = os.path.join(resource_folder, "pdb") + rna_folder = os.path.join(resource_folder, "rna") + glycan_folder = os.path.join(pdb_folder, "glycans") + membrane_folder = os.path.join(pdb_folder, "membrane") membrane_proteins = list() @@ -561,8 +561,8 @@ def add_sars_cov_2(self, name, resource_folder, ap.seed = 0 membrane_proteins.append(Protein( name=name + '_' + self.NAME_PROTEIN_S_OPEN, - source=pdb_folder + "6vyb.pdb", - occurences=nb_protein_s, + source=os.path.join(pdb_folder, "6vyb.pdb"), + occurrences=nb_protein_s, rotation=Quaternion(0.0, 1.0, 0.0, 0.0), allowed_occurrences=open_conformation_indices, transmembrane_params=Vector2(10.5, 10.5), @@ -572,8 +572,8 @@ def add_sars_cov_2(self, name, resource_folder, # Protein S (closed) membrane_proteins.append(Protein( name=name + '_' + self.NAME_PROTEIN_S_CLOSED, - source=pdb_folder + "sars-cov-2-v1.pdb", - occurences=nb_protein_s, + source=os.path.join(pdb_folder, "sars-cov-2-v1.pdb"), + occurrences=nb_protein_s, rotation=Quaternion(0.0, 1.0, 0.0, 0.0), allowed_occurrences=closed_conformation_indices, transmembrane_params=Vector2(10.5, 10.5), @@ -584,8 +584,8 @@ def add_sars_cov_2(self, name, resource_folder, ap.seed = 1 membrane_proteins.append(Protein( name=name + '_' + self.NAME_PROTEIN_M, - source=pdb_folder + "QHD43419a.pdb", - occurences=nb_protein_m, + source=os.path.join(pdb_folder, "QHD43419a.pdb"), + occurrences=nb_protein_m, position=Vector3(2.5, 0.0, 0.0), rotation=Quaternion(0.135, 0.99, 0.0, 0.0), transmembrane_params=Vector2(0.5, 2.0), @@ -596,8 +596,8 @@ def add_sars_cov_2(self, name, resource_folder, ap.seed = 3 membrane_proteins.append(Protein( name=name + '_' + self.NAME_PROTEIN_E, - source=pdb_folder + "QHD43418a.pdb", - occurences=nb_protein_e, + source=os.path.join(pdb_folder, "QHD43418a.pdb"), + occurrences=nb_protein_e, position=Vector3(2.5, 0.0, 0.0), rotation=Quaternion(0.0, 0.707, 0.707, 0.0), transmembrane_params=Vector2(0.5, 2.0), @@ -607,10 +607,11 @@ def add_sars_cov_2(self, name, resource_folder, # Virus membrane ap.seed = 4 lipid_sources = [ - membrane_folder + 'segA.pdb', - membrane_folder + 'segB.pdb', - membrane_folder + 'segC.pdb', - membrane_folder + 'segD.pdb'] + os.path.join(membrane_folder, "segA.pdb"), + os.path.join(membrane_folder, "segB.pdb"), + os.path.join(membrane_folder, "segC.pdb"), + os.path.join(membrane_folder, "segD.pdb") + ] virus_membrane = Membrane( lipid_sources=lipid_sources, @@ -636,8 +637,8 @@ def add_sars_cov_2(self, name, resource_folder, if add_rna_sequence: params = Vector2(shape_params.x * 0.55, 0.5) rna_sequence = RNASequence( - source=rna_folder + 'sars-cov-2.rna', - protein_source=pdb_folder + '7bv1.pdb', + source=os.path.join(rna_folder, "sars-cov-2.rna"), + protein_source=os.path.join(pdb_folder, "7bv1.pdb"), shape=self.RNA_SHAPE_TREFOIL_KNOT, shape_params=params, values_range=Vector2(-8.0 * math.pi, 8.0 * math.pi), @@ -655,21 +656,23 @@ def add_sars_cov_2(self, name, resource_folder, if representation == BioExplorer.REPRESENTATION_MESH: glycan_representation = BioExplorer.REPRESENTATION_ATOMS_AND_STICKS + complex_folder = os.path.join(glycan_folder, "complex") complex_paths = [ - glycan_folder + "complex/5.pdb", - glycan_folder + "complex/15.pdb", - glycan_folder + "complex/25.pdb", - glycan_folder + "complex/35.pdb", + os.path.join(complex_folder, "5.pdb"), + os.path.join(complex_folder, "15.pdb"), + os.path.join(complex_folder, "25.pdb"), + os.path.join(complex_folder, "35.pdb"), ] + high_mannose_folder = os.path.join(glycan_folder, "high-mannose") high_mannose_paths = [ - glycan_folder + "high-mannose/1.pdb", - glycan_folder + "high-mannose/2.pdb", - glycan_folder + "high-mannose/3.pdb", - glycan_folder + "high-mannose/4.pdb", + os.path.join(high_mannose_folder, "1.pdb"), + os.path.join(high_mannose_folder, "2.pdb"), + os.path.join(high_mannose_folder, "3.pdb"), + os.path.join(high_mannose_folder, "4.pdb"), ] - o_glycan_paths = [glycan_folder + "o-glycan/12.pdb"] + o_glycan_paths = [os.path.join(glycan_folder, "o-glycan", "12.pdb")] # High-mannose indices_closed = [61, 122, 234, 603, 709, 717, 801, 1074] @@ -816,14 +819,14 @@ def add_cell(self, cell, atom_radius_multiplier=1.0, representation=REPRESENTATI ) for protein in cell.proteins: - if protein.occurences != 0: + if protein.occurrences != 0: _protein = AssemblyProtein( assembly_name=cell.name, name=protein.name, source=protein.source, load_non_polymer_chemicals=protein. load_non_polymer_chemicals, - occurrences=protein.occurences, + occurrences=protein.occurrences, allowed_occurrences=protein.allowed_occurrences, atom_radius_multiplier=atom_radius_multiplier, load_bonds=True, @@ -869,7 +872,7 @@ def add_volume(self, volume, atom_radius_multiplier=1.0, source=volume.protein.source, load_non_polymer_chemicals=volume.protein. load_non_polymer_chemicals, - occurrences=volume.protein.occurences, + occurrences=volume.protein.occurrences, atom_radius_multiplier=atom_radius_multiplier, load_bonds=volume.protein.load_bonds, load_hydrogen=volume.protein.load_hydrogen, @@ -2647,11 +2650,11 @@ def __init__(self, assembly_name, name, source, :load_hydrogen: Loads hydrogens if True :chain_ids: IDs of the protein chains to be loaded :recenter: Centers the protein if True - :occurences: Number of occurences to be added to the assembly + :occurrences: Number of occurrences to be added to the assembly :animation_params: Seed for position randomization :position: Relative position of the protein in the assembly :rotation: Relative rotation of the protein in the assembly - :allowed_occurrences: Indices of protein occurences in the assembly for + :allowed_occurrences: Indices of protein occurrences in the assembly for which proteins are added :constraints: List of assemblies that constraint the placememnt of the proteins """ @@ -2867,7 +2870,7 @@ def __init__(self, name, shape, shape_params, protein): class Protein: """A Protein holds the 3D structure of a protein as well as it Amino Acid sequences""" - def __init__(self, name, source, occurences=1, load_bonds=False, + def __init__(self, name, source, occurrences=1, load_bonds=False, load_hydrogen=False, load_non_polymer_chemicals=False, position=Vector3(), rotation=Quaternion(), allowed_occurrences=list(), chain_ids=list(), transmembrane_params=Vector2(), animation_params=AnimationParams()): @@ -2875,7 +2878,7 @@ def __init__(self, name, source, occurences=1, load_bonds=False, Protein descriptor :source: Full path to the protein PDB file - :occurences: Number of occurences to be added to the assembly + :occurrences: Number of occurrences to be added to the assembly :load_bonds: Loads bonds if True :load_hydrogen: Loads hydrogens if True :load_non_polymer_chemicals: Loads non-polymer chemicals if True @@ -2892,7 +2895,7 @@ def __init__(self, name, source, occurences=1, load_bonds=False, self.name = name self.pdb_id = os.path.splitext(os.path.basename(source))[0].lower() self.source = source - self.occurences = occurences + self.occurrences = occurrences self.load_bonds = load_bonds self.load_hydrogen = load_hydrogen self.load_non_polymer_chemicals = load_non_polymer_chemicals diff --git a/bioexplorer/pythonsdk/bioexplorer/movie_maker.py b/bioexplorer/pythonsdk/bioexplorer/movie_maker.py index 4f3ccabe2..8b1f89d85 100644 --- a/bioexplorer/pythonsdk/bioexplorer/movie_maker.py +++ b/bioexplorer/pythonsdk/bioexplorer/movie_maker.py @@ -365,7 +365,7 @@ def _set_renderer_params(self, name, samples_per_pixel, gi_length=5.0): def create_snapshot( self, renderer, size, path, base_name, samples_per_pixel, - export_intermediate_frames=False, gi_length=1e6): + export_intermediate_frames=False, gi_length=1e6, show_progress=False): """ Create a snapshot of the current frame @@ -406,8 +406,9 @@ def create_snapshot( self.build_camera_path( control_points=control_points, nb_steps_between_control_points=1, smoothing_size=1) - progress_widget = IntProgress(description='In progress...', min=0, max=100, value=0) - display(progress_widget) + if show_progress: + progress_widget = IntProgress(description='In progress...', min=0, max=100, value=0) + display(progress_widget) self.export_frames( path=path, base_name=base_name, animation_frames=animation_frames, size=size, @@ -418,12 +419,14 @@ def create_snapshot( done = False while not done: time.sleep(1) - progress = self.get_export_frames_progress()['progress'] - progress_widget.value = progress * 100 + if show_progress: + progress = self.get_export_frames_progress()['progress'] + progress_widget.value = progress * 100 done = self.get_export_frames_progress()['done'] - progress_widget.description = 'Done' - progress_widget.value = 100 + if show_progress: + progress_widget.description = 'Done' + progress_widget.value = 100 self._client.set_application_parameters(image_stream_fps=old_image_stream_fps, viewport=old_viewport_size) diff --git a/bioexplorer/pythonsdk/notebooks/animation/BioExplorer_cell.ipynb b/bioexplorer/pythonsdk/notebooks/animation/BioExplorer_cell.ipynb deleted file mode 100644 index f4855530d..000000000 --- a/bioexplorer/pythonsdk/notebooks/animation/BioExplorer_cell.ipynb +++ /dev/null @@ -1,156 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Blue Brain BioExplorer\n", - "\n", - "![](../bioexplorer_banner.png)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Simplest script to create a visualization of a cell" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "from bioexplorer import BioExplorer, MovieMaker, Protein, Membrane, Cell, AnimationParams, Vector3, Quaternion\n", - "be = BioExplorer('localhost:5000')\n", - "core = be.core_api()\n", - "status = be.reset_scene()" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "def add_cell(random_seed):\n", - " \n", - " core.set_application_parameters(image_stream_fps=0)\n", - " representation=be.REPRESENTATION_ATOMS_AND_STICKS\n", - "\n", - " # Resources\n", - " resource_folder = '../../tests/test_files/'\n", - " pdb_folder = resource_folder + 'pdb/'\n", - " membrane_folder = pdb_folder + 'membrane/'\n", - "\n", - " # ACE2 receptor definition\n", - " ace2_receptor = Protein(\n", - " name=be.NAME_RECEPTOR,\n", - " source=pdb_folder + '6m18.pdb',\n", - " occurences=8,\n", - " position=Vector3(0.0, 6.0, 0.0),\n", - " rotation=Quaternion(0.0, 1.0, 0.0, 0.0)\n", - " )\n", - "\n", - " # Membrane definition\n", - " membrane = Membrane(\n", - " lipid_sources=[\n", - " membrane_folder + 'segA.pdb',\n", - " membrane_folder + 'segB.pdb',\n", - " membrane_folder + 'segC.pdb',\n", - " membrane_folder + 'segD.pdb'],\n", - " animation_params=AnimationParams(random_seed, random_seed + 1, 1.0, random_seed + 2, 0.025)\n", - " )\n", - "\n", - " # Cell definition\n", - " cell_size = Vector3(800.0, 80.0, 800.0)\n", - " cell = Cell(\n", - " name='Cell', shape_params=cell_size,\n", - " shape=be.ASSEMBLY_SHAPE_SINUSOID,\n", - " membrane=membrane, proteins=[ace2_receptor]\n", - " )\n", - "\n", - " # Add cell to scene\n", - " be.add_cell(cell=cell, representation=representation)\n", - " \n", - " # Materials\n", - " be.apply_default_color_scheme(be.SHADING_MODE_DIFFUSE)\n", - " \n", - " be.set_models_visibility(True)\n", - " core.set_application_parameters(image_stream_fps=20)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "status = core.set_camera(\n", - " orientation=[-0.085, 0.340, 0.022, 0.936],\n", - " position=[461.372, 55.791, 480.118],\n", - " target=[23.322, -65.160, -40.892]\n", - ")" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "status = be.set_rendering_quality(be.RENDERING_QUALITY_HIGH)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "from IPython.display import clear_output\n", - "\n", - "mm = MovieMaker(be)\n", - "output_folder = '/tmp'\n", - "\n", - "for frame in range(1, 20):\n", - " clear_output()\n", - " print('Frame %i' % frame)\n", - "\n", - " '''Cell'''\n", - " add_cell(frame * 3)\n", - " \n", - " '''Snapshot'''\n", - " mm.create_snapshot(\n", - " renderer='bio_explorer',\n", - " size=[256, 256], samples_per_pixel=64,\n", - " path=output_folder, base_name='%05d' % frame)" - ] - } - ], - "metadata": { - "interpreter": { - "hash": "ea9a5fa46eb6bad2806a8ea1d08e15bb1e255a2d4320b81e765591579963c56b" - }, - "kernelspec": { - "display_name": "Python 3.8.10 64-bit ('env': venv)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.8.10" - } - }, - "nbformat": 4, - "nbformat_minor": 4 -} diff --git a/bioexplorer/pythonsdk/notebooks/animation/BioExplorer_mesh_based_membrane.ipynb b/bioexplorer/pythonsdk/notebooks/animation/BioExplorer_mesh_based_membrane.ipynb deleted file mode 100644 index 61159e573..000000000 --- a/bioexplorer/pythonsdk/notebooks/animation/BioExplorer_mesh_based_membrane.ipynb +++ /dev/null @@ -1,247 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Blue Brain BioExplorer\n", - "\n", - "![](../bioexplorer_banner.png)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Visualization of a membrane defined by a mesh" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "from bioexplorer import BioExplorer, MovieMaker, Cell, Membrane, Protein, AnimationParams, Vector2, Vector3, Quaternion\n", - "import glob\n", - "\n", - "be = BioExplorer('localhost:5000')\n", - "core = be.core_api()\n", - "status = be.reset_scene()" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Resources" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "resource_folder = '../../tests/test_files/'\n", - "pdb_folder = resource_folder + 'pdb/'\n", - "obj_folder = resource_folder + 'obj/'\n", - "membrane_folder = pdb_folder + 'membrane/'\n", - "lipids_folder = membrane_folder + 'lipids/'\n", - "transporters_folder = pdb_folder + 'transporters/'" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Configuration" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "mesh_source= obj_folder + 'suzanne.obj'\n", - "scale = Vector3(2.5, 2.5, 2.5)\n", - "\n", - "protein_representation = be.REPRESENTATION_ATOMS_AND_STICKS\n", - "protein_atom_radius_multiplier = 1.0" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Camera position" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "status = be.core_api().set_camera(\n", - " orientation=[-0.114, 0.341, 0.020, 0.932],\n", - " position=[368.152, 107.242, 367.312],\n", - " target=[50.364, -6.824, -5.159]\n", - ")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Membrane" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "def add_membrane(\n", - " frame, add_receptors,\n", - " position=Vector3(0.0, 0.0, 0.0), \n", - " rotation=Quaternion(1.0, 0.0, 0.0, 0.0)):\n", - " \n", - " name = 'Suzanne'\n", - " clip_planes = [[-1.0, 0.0, 0.0, 50.0]]\n", - "\n", - " # ACE2 receptor definition\n", - " ace2_receptor = Protein(\n", - " name=be.NAME_TRANS_MEMBRANE + '_ACE2',\n", - " source=pdb_folder + '6m18.pdb', \n", - " transmembrane_params=Vector2(1.0, 2.0),\n", - " rotation=Quaternion(0.0, 1.0, 0.0, 0.0),\n", - " animation_params=AnimationParams(1, frame * 10 + 1, 1.0, frame * 10 + 2, 0.025),\n", - " occurences=20)\n", - "\n", - " # GLUT3 definition\n", - " transporter = Protein(\n", - " name=be.NAME_TRANS_MEMBRANE + '_GLUT3',\n", - " source=transporters_folder + '4zwc.pdb',\n", - " transmembrane_params=Vector2(1.0, 2.0),\n", - " rotation=Quaternion(0.707, 0.707, 0.0, 0.0),\n", - " animation_params=AnimationParams(2, frame * 10 + 3, 1.0, frame * 10 + 4, 0.025),\n", - " chain_ids=[1], occurences=30)\n", - "\n", - " # Membrane definition\n", - " pdb_lipids = glob.glob(lipids_folder + '*.pdb')[:8]\n", - "\n", - " membrane = Membrane(\n", - " lipid_sources=pdb_lipids, lipid_density=1.0,\n", - " load_non_polymer_chemicals=True, load_bonds=True,\n", - " animation_params=AnimationParams(3, frame * 10 + 5, 1.0, frame * 10 + 6, 0.025)\n", - " )\n", - "\n", - " # Cell definition\n", - " cell = Cell(\n", - " name=name,\n", - " shape=be.ASSEMBLY_SHAPE_MESH,\n", - " shape_params=scale,\n", - " shape_mesh_source=mesh_source, \n", - " membrane=membrane,\n", - " proteins=[ace2_receptor, transporter]\n", - " )\n", - "\n", - " # Add cell to scene\n", - " status = be.add_cell(\n", - " cell=cell, representation=protein_representation,\n", - " position=position, rotation=rotation, clipping_planes=clip_planes)\n", - "\n", - " return status" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Rendering settings" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "status = be.set_rendering_quality(be.RENDERING_QUALITY_HIGH)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Animation" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "from IPython.display import clear_output\n", - "\n", - "mm = MovieMaker(be)\n", - "output_folder = '/tmp'\n", - "\n", - "pos = Vector3(0.0, 0.0, 0.0)\n", - "rot_start = Quaternion(1.0, 0.0, 0.0, 0.0)\n", - "rot_end = Quaternion(0.0, 0.0, 1.0, 0.0)\n", - "\n", - "nb_frames = 36\n", - "\n", - "for frame in range(0, nb_frames):\n", - " clear_output()\n", - " be.reset_scene()\n", - " be.set_general_settings(model_visibility_on_creation=False)\n", - " print('Frame %d' % frame)\n", - " rot = Quaternion.slerp(rot_start, rot_end, float(frame) / nb_frames)\n", - " add_membrane(\n", - " frame=frame, add_receptors=True,\n", - " position=pos, rotation=rot)\n", - " be.apply_default_color_scheme(be.SHADING_MODE_NONE)\n", - " be.set_models_visibility(True)\n", - "\n", - " '''Snapshot'''\n", - " mm.create_snapshot(\n", - " renderer='bio_explorer',\n", - " size=[512, 512], samples_per_pixel=16,\n", - " path=output_folder,\n", - " base_name='%05d' % frame)" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3.8.10 ('env')", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.8.10" - }, - "vscode": { - "interpreter": { - "hash": "ea9a5fa46eb6bad2806a8ea1d08e15bb1e255a2d4320b81e765591579963c56b" - } - } - }, - "nbformat": 4, - "nbformat_minor": 4 -} diff --git a/bioexplorer/pythonsdk/notebooks/atlas/BioExplorer_atlas.ipynb b/bioexplorer/pythonsdk/notebooks/atlas/BioExplorer_atlas.ipynb index 89687e703..b9e5ca7eb 100644 --- a/bioexplorer/pythonsdk/notebooks/atlas/BioExplorer_atlas.ipynb +++ b/bioexplorer/pythonsdk/notebooks/atlas/BioExplorer_atlas.ipynb @@ -18,13 +18,13 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from bioexplorer import BioExplorer, Vector3, Quaternion\n", "\n", - "url = 'r4i7n18:5000'\n", + "url = 'localhost:5000'\n", "be = BioExplorer(url)\n", "core = be.core_api()\n", "status = be.reset_scene()" @@ -48,17 +48,15 @@ "atlas_assembly = be.add_assembly(atlas_assembly_name)\n", "atlas_model = be.add_atlas(\n", " assembly_name=atlas_assembly_name,\n", - " load_cells=True, cell_radius=20.0, \n", + " load_cells=True, cell_radius=20.0,\n", " load_meshes=False,\n", - " region_sql_filter='level>8',\n", - " # region_sql_filter='level>=7',\n", - " # cell_sql_filter='guid%100=0',\n", + " region_sql_filter='level>8'\n", ")" ] }, { "cell_type": "code", - "execution_count": 25, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -69,10 +67,6 @@ " assembly_name=atlas_assembly_name,\n", " load_cells=False, load_meshes=True,\n", " region_sql_filter='level>=5 and guid%10=0',\n", - " # cell_sql_filter='guid%100=0',\n", - " # mesh_position=Vector3(-262, -160, -228),\n", - " # mesh_rotation=Quaternion(0,1,0,0),\n", - " # mesh_scale=Vector3(25,25,25)\n", " mesh_scale=Vector3(1, 1, 1)\n", ")" ] @@ -112,7 +106,8 @@ "source": [ "import json\n", "import os\n", - "data_folder = '/gpfs/bbp.cscs.ch/project/proj129/atlas/mouse/v2'\n", + "atlas_data_folder = os.getenv('ATLAS_DATA_FOLDER')\n", + "data_folder = os.path.join(atlas_data_folder, 'mouse', 'v2')\n", "f = open(os.path.join(data_folder, 'brain_regions.json'))\n", "obj = json.load(f)\n", "\n", @@ -176,7 +171,7 @@ " 'scale': [1.0, 1.0, 1.0],\n", " 'translation': [-6500, 3500,5500]\n", "}\n", - "core.update_model(43, transformation=transformation)\n" + "core.update_model(43, transformation=transformation)" ] } ], diff --git a/bioexplorer/pythonsdk/notebooks/atlas/BioExplorer_import_to_db.ipynb b/bioexplorer/pythonsdk/notebooks/atlas/BioExplorer_import_to_db.ipynb index f8a7f8c58..a50cb7a98 100644 --- a/bioexplorer/pythonsdk/notebooks/atlas/BioExplorer_import_to_db.ipynb +++ b/bioexplorer/pythonsdk/notebooks/atlas/BioExplorer_import_to_db.ipynb @@ -51,7 +51,7 @@ "metadata": {}, "outputs": [], "source": [ - "data_folder = os.path.joint(atlas_data_folder, 'mouse', 'v2')" + "data_folder = os.path.join(atlas_data_folder, 'mouse', 'v2')" ] }, { diff --git a/bioexplorer/pythonsdk/notebooks/connectomics/BioExplorer_import_white_matter_allen_brain.ipynb b/bioexplorer/pythonsdk/notebooks/connectomics/BioExplorer_import_white_matter_allen_brain.ipynb index 6d63313d5..ee8d74f45 100644 --- a/bioexplorer/pythonsdk/notebooks/connectomics/BioExplorer_import_white_matter_allen_brain.ipynb +++ b/bioexplorer/pythonsdk/notebooks/connectomics/BioExplorer_import_white_matter_allen_brain.ipynb @@ -42,7 +42,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -215,7 +215,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -237,17 +237,9 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Connection string: postgresql+psycopg2://bioexplorer:verole2020@postgresql14-users.bbp.epfl.ch:5432/bioexplorer, schema: connectome\n" - ] - } - ], + "outputs": [], "source": [ "import os\n", "from sqlalchemy import create_engine\n", diff --git a/bioexplorer/pythonsdk/notebooks/connectomics/BioExplorer_white_matter.ipynb b/bioexplorer/pythonsdk/notebooks/connectomics/BioExplorer_white_matter.ipynb index e4d41c357..1bd1e6316 100644 --- a/bioexplorer/pythonsdk/notebooks/connectomics/BioExplorer_white_matter.ipynb +++ b/bioexplorer/pythonsdk/notebooks/connectomics/BioExplorer_white_matter.ipynb @@ -18,7 +18,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -34,12 +34,12 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "### Load vasculature" + "### Load white matter" ] }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -50,34 +50,31 @@ "white_matter_model = be.add_white_matter(\n", " assembly_name=assembly_name,\n", " population_name=population_name,\n", - " radius=5\n", + " radius=5.0\n", ")" ] }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "True" - ] - }, - "execution_count": 3, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "status = be.reset_camera()\n", "status = core.set_renderer()" ] }, + { + "cell_type": "markdown", + "id": "329d1019", + "metadata": {}, + "source": [ + "### Rendering settings" + ] + }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -91,27 +88,20 @@ "status = core.set_renderer_params(params)" ] }, + { + "cell_type": "markdown", + "id": "df3ceb98", + "metadata": {}, + "source": [ + "### Snapshot" + ] + }, { "cell_type": "code", - "execution_count": 11, + "execution_count": null, "id": "87246634", "metadata": {}, - "outputs": [ - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "1af41d111c1b4ece89914ea1fabc226b", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "IntProgress(value=0, description='In progress...')" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "from bioexplorer import MovieMaker\n", "mm = MovieMaker(be)\n", @@ -120,14 +110,6 @@ " path='/tmp', base_name='bio_explorer_white_matter_banner',\n", " size=[1024, 256], samples_per_pixel=64)" ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "52ad197d", - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": { diff --git a/bioexplorer/pythonsdk/notebooks/metabolism/BioExplorer_glucose_movie.ipynb b/bioexplorer/pythonsdk/notebooks/metabolism/BioExplorer_glucose_movie.ipynb index 8ea0a7549..340951ea2 100644 --- a/bioexplorer/pythonsdk/notebooks/metabolism/BioExplorer_glucose_movie.ipynb +++ b/bioexplorer/pythonsdk/notebooks/metabolism/BioExplorer_glucose_movie.ipynb @@ -1,1070 +1,1059 @@ { - "cells": [ - { - "cell_type": "markdown", - "id": "f992ef9f", - "metadata": {}, - "source": [ - "# BioExplorer - Metabolism - Movie\n", - "![](../bioexplorer_metabolism_banner.png)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "fdb97b88", - "metadata": {}, - "outputs": [], - "source": [ - "from bioexplorer import BioExplorer, Protein, Membrane, Cell, Volume, AnimationParams, Vector2, Vector3, Quaternion\n", - "\n", - "url = 'localhost:5000'\n", - "be = BioExplorer(url)\n", - "core = be.core_api()" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "21190ced", - "metadata": {}, - "outputs": [], - "source": [ - "generate_snapshot = False\n", - "generate_movie = True\n", - "\n", - "status = be.reset_scene()\n", - "status = be.set_general_settings(logging_level=3)\n", - "\n", - "''' Simulation identifier '''\n", - "simulation_guid = 3\n", - "\n", - "''' Ratio to apply to concentrations for visualization purpose '''\n", - "concentration_visualization_ratio = 2.0\n", - "\n", - "representation = be.REPRESENTATION_ATOMS_AND_STICKS\n", - "atom_radius_multiplier = 1.0 \n", - "\n", - "scene_size = Vector3(250.0, 500.0, 250.0)\n", - "membrane_size = Vector3(scene_size.x, scene_size.y / 50.0, scene_size.z)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "011623ab", - "metadata": {}, - "outputs": [], - "source": [ - "resource_folder = '../../tests/test_files/'\n", - "pdb_folder = resource_folder + 'pdb/'\n", - "off_folder = resource_folder + 'off/'\n", - "membrane_folder = pdb_folder + 'membrane/'\n", - "lipids_folder = membrane_folder + 'lipids/'\n", - "ion_channels_folder = pdb_folder + 'ion_channels/'\n", - "metabolites_folder = pdb_folder + 'metabolites/'\n", - "transporters_folder = pdb_folder + 'transporters/'\n", - "\n", - "be.set_general_settings(\n", - " off_folder=off_folder,\n", - " model_visibility_on_creation=False)\n", - "\n", - "''' Neuron trans-membrane proteins '''\n", - "pdb_glut3 = transporters_folder + '4zwc.pdb'\n", - "pdb_glut3_closed = transporters_folder + '5c65.pdb'\n", - "pdb_mct2_lac = transporters_folder + '7bp3.pdb'\n", - "\n", - "''' Astrocyte trans-membrane proteins '''\n", - "pdb_glut1 = transporters_folder + '4pyp.pdb'\n", - "pdb_mct1_lac = transporters_folder + '6lz0.pdb'\n", - "\n", - "''' Trans-membrane proteins '''\n", - "pdb_nka = transporters_folder + '4hqj.pdb'\n", - "\n", - "''' Lipids '''\n", - "pdb_lipids = [\n", - " lipids_folder + 'lipid_430.pdb',\n", - " lipids_folder + 'lipid_426.pdb',\n", - " lipids_folder + 'lipid_424.pdb',\n", - " lipids_folder + 'lipid_410.pdb'\n", - "]\n", - "lipid_density = 3.0" - ] - }, - { - "cell_type": "markdown", - "id": "f5b0aef0", - "metadata": {}, - "source": [ - "## Metabolites" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "1792d171", - "metadata": {}, - "outputs": [], - "source": [ - "import psycopg2\n", - "import pandas as pd\n", - "import os\n", - "\n", - "db_host = os.environ['DB_HOST']\n", - "db_name = os.environ['DB_NAME']\n", - "db_user = os.environ['DB_USER']\n", - "db_password = os.environ['DB_PASSWORD']\n", - "db_schema = os.environ['DB_SCHEMA']\n", - "\n", - "db_connection_string = 'host=' + db_host + ' port=5432 dbname=' + db_name + \\\n", - " ' user=' + db_user + ' password=' + db_password\n", - "print(db_connection_string)\n", - "\n", - "db_connection=psycopg2.connect(db_connection_string)\n", - "print('Connected to ' + db_name + '.' + db_schema)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "ffb90d42", - "metadata": {}, - "outputs": [], - "source": [ - "def get_simulations():\n", - " simulations = dict()\n", - " sql_command = \"SELECT guid, description FROM %s.simulations ORDER BY guid\" % db_schema\n", - " data = pd.read_sql(sql_command, db_connection)\n", - " for i in range(len(data)):\n", - " simulations[data['guid'][i]] = data['description'][i]\n", - " return simulations\n", - "\n", - "def get_variables():\n", - " variables = dict()\n", - " sql_command = \"SELECT guid, pdb, description FROM %s.variable WHERE pdb IS NOT NULL ORDER BY guid\" % db_schema\n", - " data = pd.read_sql(sql_command, db_connection)\n", - " for i in range(len(data)):\n", - " pdb_guid = data['pdb'][i]\n", - " if pdb_guid:\n", - " variables[data['guid'][i]] = [pdb_guid, data['description'][i]]\n", - " return variables\n", - "\n", - "def get_metabolites():\n", - " metabolites = dict()\n", - " sql_command = \"SELECT guid, pdb, description FROM %s.variable WHERE type=0 AND pdb IS NOT NULL ORDER BY guid\" % db_schema\n", - " data = pd.read_sql(sql_command, db_connection)\n", - " for i in range(len(data)):\n", - " pdb_guid = data['pdb'][i]\n", - " if pdb_guid:\n", - " metabolites[data['guid'][i]] = [pdb_guid, data['description'][i]]\n", - " return metabolites\n", - "\n", - "def get_locations():\n", - " locations = dict()\n", - " sql_command = \"SELECT guid, description FROM %s.location ORDER BY guid\" % db_schema\n", - " data = pd.read_sql(sql_command, db_connection)\n", - " for i in range(len(data)):\n", - " locations[data['guid'][i]] = data['description'][i]\n", - " return locations\n", - "\n", - "def get_concentration(variable_guid, simulation_guid, frame, location_guid):\n", - " sql_command = 'SELECT v.guid AS guid, c.concentration AS concentration FROM %s.variable as v, %s.concentration AS c WHERE c.variable_guid=%d AND v.guid=c.variable_guid AND c.timestamp=%d AND c.simulation_guid=%d AND v.location_guid=%d ORDER BY v.guid' % (db_schema, db_schema, variable_guid, frame, simulation_guid, location_guid)\n", - " data = pd.read_sql(sql_command, db_connection)\n", - " if(len(data)>0):\n", - " return(float(data['concentration']))\n", - " return 0.0 " - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "2042588a", - "metadata": {}, - "outputs": [], - "source": [ - "''' Dimensions are in nanometers '''\n", - "\n", - "import math\n", - "\n", - "region_astrocyte_mitochondrion = 0\n", - "region_astrocyte = 1\n", - "region_extracellular_space = 2\n", - "region_neuron = 3\n", - "region_neuron_mitochondrion = 4\n", - "\n", - "region_mapping = dict()\n", - "region_mapping[0] = region_astrocyte_mitochondrion\n", - "region_mapping[1] = region_astrocyte\n", - "region_mapping[2] = region_extracellular_space\n", - "region_mapping[3] = region_neuron\n", - "region_mapping[4] = region_neuron_mitochondrion\n", - "\n", - "location_areas = dict()\n", - "location_areas[region_astrocyte_mitochondrion] = [0.0575 * 0.25, Vector2(100, scene_size.x / 2.0)] # Mitochondria of the astrocyte\n", - "location_areas[region_astrocyte] = [0.25, Vector2(20, 100)] # Cytosol of the astrocyte\n", - "location_areas[region_extracellular_space] = [0.20, Vector2(-20, 20)] # Extracellular space\n", - "location_areas[region_neuron] = [0.45, Vector2(-10, -100)] # Cytosol of the neuron\n", - "location_areas[region_neuron_mitochondrion] = [0.0575 * 0.45, Vector2(-100, -scene_size.x / 2.0)] # Mitochondria of the neuron\n", - "\n", - "\n", - "# Currently not used:\n", - "# -------------------\n", - "# region_capilarities = 5\n", - "# region_synaptic = 6\n", - "# region_vasculature = 7\n", - "# -------------------\n", - "# location_areas[region_capilarities] = [0.0055, Vector2(0, 0)] # Capillaries\n", - "# location_areas[region_synaptic] = [0.0, Vector2(0, 0)] # Synaptic part of the extracellular space\n", - "# location_areas[region_vasculature] = [0.0, Vector2(0, 0)] # Vasculature\n", - "# -------------------\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "67ec3c65", - "metadata": {}, - "outputs": [], - "source": [ - "fullNGVUnitVolumeInLiters = 2e-11 / 0.45\n", - "nanometersCubicToLiters = 1e-24\n", - "avogadro = 6.02e23\n", - "\n", - "fullSceneVolumeInLiters = scene_size.x * scene_size.y * scene_size.z * nanometersCubicToLiters\n", - "scene_ratio = fullSceneVolumeInLiters / fullNGVUnitVolumeInLiters" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "eee6375f", - "metadata": {}, - "outputs": [], - "source": [ - "def get_nb_molecules(concentration, location_guid):\n", - " return int(concentration_visualization_ratio * scene_ratio * avogadro * (1e-3 * concentration) * fullNGVUnitVolumeInLiters * location_areas[location_guid][0])\n", - "\n", - "def get_nb_proteins(concentration, location_guid):\n", - " return int(math.exp(concentration) * 1e-6 * avogadro * fullNGVUnitVolumeInLiters * scene_ratio * location_areas[location_guid][0])" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "0e7d8340", - "metadata": {}, - "outputs": [], - "source": [ - "indices = list()\n", - "indices.append(-scene_size.y / 2.0)\n", - "total = 0.0\n", - "for location_area in location_areas:\n", - " total = total + location_areas[location_area][0] * scene_size.y\n", - " indices.append(-scene_size.y / 2.0 + total)\n", - "indices.append(scene_size.y / 2.0)\n", - "# print(indices)\n", - "\n", - "i = 0\n", - "for region in region_mapping:\n", - " location_areas[region_mapping[region]][1] = Vector2(indices[i], indices[i+1])\n", - " i += 1\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "cd0fe1ad", - "metadata": {}, - "outputs": [], - "source": [ - "def add_metabolites(frame=0):\n", - " locations = get_locations()\n", - " variables = get_metabolites()\n", - "\n", - " random_seed = 1\n", - " for location in locations:\n", - " if location not in region_mapping.values():\n", - " continue\n", - "\n", - " for variable in variables:\n", - " pdb_guid = variables[variable][0]\n", - " if not pdb_guid:\n", - " continue\n", - " variable_guid = int(variable)\n", - " variable_description = variables[variable][1]\n", - " location_guid = int(location)\n", - " file_name = metabolites_folder + pdb_guid + '.pdb'\n", - " concentration = get_concentration(variable_guid, simulation_guid, frame, location_guid)\n", - " nb_molecules = get_nb_molecules(concentration, location_guid)\n", - " if nb_molecules > 0:\n", - " location_name = locations[location_guid]\n", - " print('- [%s] [%d] %s: %s.pdb: %d' % (location_name, variable_guid, variable_description, pdb_guid, nb_molecules))\n", - " try:\n", - " location_area = location_areas[location_guid][1]\n", - " area_size = Vector3(\n", - " scene_size.x,\n", - " 0.95 * (location_area.y - location_area.x),\n", - " scene_size.z)\n", - " area_position = Vector3(0.0, (location_area.y + location_area.x) / 2.0 , 0.0)\n", - "\n", - " name = location_name + '_' + variable_description\n", - "\n", - " metabolite = Protein(\n", - " name=name, source=file_name,\n", - " load_bonds=True, load_hydrogen=True,\n", - " load_non_polymer_chemicals=True, \n", - " occurences=nb_molecules,\n", - " animation_params=AnimationParams(\n", - " random_seed,\n", - " random_seed + frame + 1, 0.2,\n", - " random_seed + frame + 2, 1.0))\n", - "\n", - " volume = Volume(\n", - " name=name,\n", - " shape=be.ASSEMBLY_SHAPE_CUBE,\n", - " shape_params=area_size,\n", - " protein=metabolite\n", - " )\n", - " status = be.add_volume(\n", - " volume=volume, representation=representation, position=area_position)\n", - " random_seed += 3\n", - " except Exception as e:\n", - " print(e)" - ] - }, - { - "cell_type": "markdown", - "id": "77336189", - "metadata": {}, - "source": [ - "## Neuron" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "5d24ad1b", - "metadata": {}, - "outputs": [], - "source": [ - "def add_neuron(frame=0):\n", - " name = 'Neuron'\n", - " transmembrane_proteins = list()\n", - "\n", - " # Transporter GLUT3 (https://opm.phar.umich.edu/proteins/442)\n", - " nb_transporter_glut3 = get_nb_proteins(-0.250079574048427, region_neuron)\n", - " if nb_transporter_glut3 > 0:\n", - " print('- Transpoter GLUT3: %d' % nb_transporter_glut3)\n", - " transmembrane_proteins.append(Protein(\n", - " name=name + '_GLUT3',\n", - " chain_ids=[1],\n", - " source=pdb_glut3,\n", - " occurences=30, #nb_transporter_glut3,\n", - " rotation=Quaternion(0.707, -0.693, -0.139, 0.0),\n", - " load_non_polymer_chemicals=True, load_hydrogen=True, load_bonds=True,\n", - " animation_params=AnimationParams(1, frame + 1, 0.1, frame + 2, 0.25),\n", - " transmembrane_params=Vector2(0.0, 2.0)\n", - " ))\n", - "\n", - " # Transporter MCT2 (https://opm.phar.umich.edu/proteins/5233)\n", - " nb_transporter_mct2 = get_nb_proteins(-2.00832096285463, region_neuron)\n", - " if nb_transporter_mct2 > 0:\n", - " print('- Transporter MCT2: %d' % nb_transporter_mct2)\n", - " transmembrane_proteins.append(Protein(\n", - " name=name + '_MCT2',\n", - " position=Vector3(0.0, 1.0, 0.0),\n", - " source=pdb_mct2_lac,\n", - " occurences=nb_transporter_mct2,\n", - " load_non_polymer_chemicals=True, load_hydrogen=True, load_bonds=True,\n", - " animation_params=AnimationParams(2, frame + 3, 0.1, frame + 4, 0.005),\n", - " transmembrane_params=Vector2(0.0, 2.0)\n", - " ))\n", - "\n", - " # Transporter NKA\n", - " nb_transporter_nka = get_nb_proteins(0.325597445694269, region_neuron)\n", - " if nb_transporter_nka > 0:\n", - " print('- Transporter NKA: %d' % nb_transporter_nka)\n", - " transmembrane_proteins.append(Protein(\n", - " name=name + '_NKA',\n", - " source=pdb_nka,\n", - " occurences=nb_transporter_nka,\n", - " load_non_polymer_chemicals=True, load_hydrogen=True, load_bonds=True,\n", - " animation_params=AnimationParams(3, frame + 5, 0.1, frame + 6, 0.25),\n", - " transmembrane_params=Vector2(0.0, 2.0)\n", - " ))\n", - " \n", - "\n", - " # Membrane definition\n", - " membrane = Membrane(\n", - " lipid_sources=pdb_lipids,\n", - " lipid_density=lipid_density,\n", - " load_non_polymer_chemicals=True, load_bonds=True,\n", - " animation_params=AnimationParams(0, frame + 7, 0.1, frame + 8, 0.25)\n", - " )\n", - "\n", - " # Cell definition\n", - " neuron = Cell(\n", - " name=name,\n", - " shape=be.ASSEMBLY_SHAPE_SINUSOID,\n", - " shape_params=membrane_size,\n", - " membrane=membrane,\n", - " proteins=transmembrane_proteins)\n", - "\n", - " # Add cell to scene\n", - " status = be.add_cell(\n", - " cell=neuron, representation=representation,\n", - " atom_radius_multiplier=atom_radius_multiplier,\n", - " position=Vector3(0, location_areas[region_neuron][1].x, 0))\n", - "\n", - " return status" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "685ea7e9", - "metadata": {}, - "outputs": [], - "source": [ - "def add_neuron_mitochondrion(frame):\n", - " name = 'NeuronMitochondrion'\n", - "\n", - " # Transporter\n", - " transporter = Protein(\n", - " name=name + '_GLUT3',\n", - " source=pdb_glut3,\n", - " occurences=0,\n", - " rotation=Quaternion(0.707, 0.707, 0.0, 0.0),\n", - " load_non_polymer_chemicals=True, load_hydrogen=True, load_bonds=True,\n", - " animation_params=AnimationParams(4, frame + 9, 0.1, frame + 10, 0.25),\n", - " transmembrane_params=Vector2(0.0, 2.0)\n", - " )\n", - "\n", - " # Membrane definition\n", - " membrane = Membrane(\n", - " lipid_sources=pdb_lipids,\n", - " lipid_density=lipid_density,\n", - " load_non_polymer_chemicals=True, load_bonds=True,\n", - " animation_params=AnimationParams(0, frame + 11, 0.1, frame + 12, 0.25)\n", - " )\n", - "\n", - " # Cell definition\n", - " neuron_mitochodrion = Cell(\n", - " name=name,\n", - " shape=be.ASSEMBLY_SHAPE_SINUSOID,\n", - " shape_params=membrane_size,\n", - " membrane=membrane,\n", - " proteins=[transporter])\n", - "\n", - " # Add cell to scene\n", - " status = be.add_cell(\n", - " cell=neuron_mitochodrion, representation=representation,\n", - " rotation=Quaternion(0.0, 1.0, 0.0, 0.0),\n", - " position=Vector3(0, location_areas[region_neuron_mitochondrion][1].x, 0))\n", - "\n", - " return status" - ] - }, - { - "cell_type": "markdown", - "id": "13640f8b", - "metadata": {}, - "source": [ - "## Astrocyte" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "2df9be36", - "metadata": {}, - "outputs": [], - "source": [ - "def add_astrocyte(frame = 0):\n", - " name = 'Astrocyte'\n", - " transmembrane_proteins = list()\n", - "\n", - " # GLUT1 (https://opm.phar.umich.edu/proteins/2454)\n", - " nb_transporter_glut1 = get_nb_proteins(-0.672647584446565, region_neuron)\n", - " if nb_transporter_glut1 > 0:\n", - " print('- Transporter GLUT1: %d' % nb_transporter_glut1)\n", - " transmembrane_proteins.append(Protein(\n", - " name=name + '_GLUT1',\n", - " source=pdb_glut1,\n", - " occurences=nb_transporter_glut1,\n", - " rotation=Quaternion(0.707, 0.707, 0.0, 0.0),\n", - " load_non_polymer_chemicals=True, load_hydrogen=True, load_bonds=True,\n", - " animation_params=AnimationParams(11, frame + 13, 0.1, frame + 14, 0.25),\n", - " transmembrane_params=Vector2(0.0, 2.0)\n", - " ))\n", - "\n", - " # Transporter MCT1 (https://opm.phar.umich.edu/proteins/6402)\n", - " nb_transporter_mct1 = get_nb_proteins(-0.86948422680206, region_neuron)\n", - " if nb_transporter_mct1 > 0:\n", - " print('- Transporter MCT1: %d' % nb_transporter_mct1)\n", - " transmembrane_proteins.append(Protein(\n", - " name=name + '_MCT1',\n", - " position=Vector3(0.0, 1.0, 0.0),\n", - " source=pdb_mct1_lac,\n", - " occurences=nb_transporter_mct1,\n", - " load_non_polymer_chemicals=True, load_hydrogen=True, load_bonds=True,\n", - " animation_params=AnimationParams(12, frame + 15, 0.1, frame + 16, 0.25),\n", - " transmembrane_params=Vector2(0.0, 2.0)\n", - " ))\n", - "\n", - " # Membrane definition\n", - " membrane = Membrane(\n", - " lipid_sources=pdb_lipids,\n", - " lipid_density=lipid_density,\n", - " load_non_polymer_chemicals=True, load_bonds=True,\n", - " animation_params=AnimationParams(0, frame + 17, 0.1, frame + 18, 0.25))\n", - "\n", - " # Cell definition\n", - " astrocyte = Cell(\n", - " name=name,\n", - " shape=be.ASSEMBLY_SHAPE_SINUSOID,\n", - " shape_params=membrane_size,\n", - " membrane=membrane,\n", - " proteins=transmembrane_proteins)\n", - "\n", - " # Add cell to scene\n", - " status = be.add_cell(\n", - " cell=astrocyte, representation=representation,\n", - " rotation=Quaternion(0.0, 1.0, 0.0, 0.0),\n", - " position=Vector3(0, location_areas[region_astrocyte][1].y, 0))\n", - "\n", - " return status" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "6b50f4dd", - "metadata": {}, - "outputs": [], - "source": [ - "def add_astrocyte_mitochondrion(frame=0):\n", - " name = 'AstrocyteMitochondrion'\n", - "\n", - " # Transporter\n", - " transporter = Protein(\n", - " name=name + '_GLUT1',\n", - " source=pdb_glut1,\n", - " occurences=0,\n", - " rotation=Quaternion(0.707, 0.707, 0.0, 0.0),\n", - " load_non_polymer_chemicals=True, load_hydrogen=True, load_bonds=True,\n", - " animation_params=AnimationParams(15, frame + 19, 0.1, frame + 20, 0.25),\n", - " transmembrane_params=Vector2(0.0, 2.0)\n", - " )\n", - "\n", - " # Membrane definition\n", - " membrane = Membrane(\n", - " lipid_sources=pdb_lipids,\n", - " lipid_density=lipid_density,\n", - " load_non_polymer_chemicals=True, load_bonds=True,\n", - " animation_params=AnimationParams(0, frame + 21, 0.1, frame + 22, 0.25)\n", - " )\n", - "\n", - " # Cell definition\n", - " astrocyte_mitochodrion = Cell(\n", - " name=name,\n", - " shape=be.ASSEMBLY_SHAPE_SINUSOID,\n", - " shape_params=membrane_size,\n", - " membrane=membrane,\n", - " proteins=[transporter])\n", - "\n", - " # Add cell to scene\n", - " status = be.add_cell(\n", - " cell=astrocyte_mitochodrion, representation=representation,\n", - " rotation=Quaternion(0.0, 1.0, 0.0, 0.0),\n", - " position=Vector3(0, location_areas[region_astrocyte_mitochondrion][1].y, 0))\n", - "\n", - " return status" - ] - }, - { - "cell_type": "markdown", - "id": "c928f9c6", - "metadata": {}, - "source": [ - "## Materials" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "46439b00", - "metadata": {}, - "outputs": [], - "source": [ - "def set_materials_to_transmembrane_proteins(neuron=True, astrocyte=True):\n", - " if neuron:\n", - " name = 'Neuron'\n", - " status = be.set_protein_color_scheme(\n", - " assembly_name=name, name=name+'_GLUT3',\n", - " color_scheme=be.COLOR_SCHEME_AMINO_ACID_SEQUENCE,\n", - " palette_name='Reds_r', palette_size=2)\n", - "\n", - " status = be.set_protein_color_scheme(\n", - " assembly_name=name, name=name+'_MCT2',\n", - " color_scheme=be.COLOR_SCHEME_AMINO_ACID_SEQUENCE,\n", - " palette_name='Greens_r', palette_size=2)\n", - "\n", - " status = be.set_protein_color_scheme(\n", - " assembly_name=name, name=name+'_NKA',\n", - " color_scheme=be.COLOR_SCHEME_AMINO_ACID_SEQUENCE,\n", - " palette_name='OrRd_r', palette_size=2)\n", - "\n", - " if astrocyte:\n", - " name = 'Astrocyte'\n", - " status = be.set_protein_color_scheme(\n", - " assembly_name=name, name=name+'_GLUT1',\n", - " color_scheme=be.COLOR_SCHEME_AMINO_ACID_SEQUENCE,\n", - " palette_name='Reds_r', palette_size=2)\n", - "\n", - " status = be.set_protein_color_scheme(\n", - " assembly_name=name, name=name+'_MCT1',\n", - " color_scheme=be.COLOR_SCHEME_AMINO_ACID_SEQUENCE,\n", - " palette_name='Greens_r', palette_size=2)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "1b8eb614", - "metadata": {}, - "outputs": [], - "source": [ - "def add_shapes():\n", - " radius = 50000.0\n", - " be.add_sphere(\n", - " name='AstrocyteSphere',\n", - " position=Vector3(0, location_areas[region_astrocyte][1].y - radius,0),\n", - " radius=radius,\n", - " color=Vector3(0.4,0.4,0.25),\n", - " opacity=0.5\n", - " )\n", - " be.add_sphere(\n", - " name='AstrocyteMitochondrionSphere',\n", - " position=Vector3(0, location_areas[region_astrocyte_mitochondrion][1].y - radius, 0),\n", - " radius=radius,\n", - " color=Vector3(0.2,0.15,0.3),\n", - " opacity=0.5\n", - " )\n", - " be.add_sphere(\n", - " name='NeuronSphere',\n", - " position=Vector3(0, location_areas[region_neuron][1].x + radius, 0),\n", - " radius=radius,\n", - " color=Vector3(0.3,0.37,0.4),\n", - " opacity=0.5\n", - " )\n", - " be.add_sphere(\n", - " name='NeuronMytochondrionSphere',\n", - " position=Vector3(0, location_areas[region_neuron_mitochondrion][1].x + radius, 0),\n", - " radius=radius,\n", - " color=Vector3(0.2,0.15,0.3),\n", - " opacity=0.5\n", - " )" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "c5d4860b", - "metadata": {}, - "outputs": [], - "source": [ - "def set_color_scheme(\n", - " shading_mode, user_parameter=1.0, specular_exponent=5.0, glossiness=1.0):\n", - " \"\"\"\n", - " Apply a default color scheme to all components in the scene\n", - "\n", - " :shading_mode: Shading mode (None, basic, diffuse, electron, etc)\n", - " :user_parameter: User parameter specific to each shading mode\n", - " :specular_exponent: Specular exponent for diffuse shading modes\n", - " :glossiness: Glossiness\n", - " \"\"\"\n", - "\n", - " import seaborn as sns\n", - " model_ids = be.get_model_ids()\n", - " global_palette = sns.color_palette('rainbow', len(model_ids[\"ids\"]))\n", - "\n", - " index = 0\n", - " for model_id in model_ids[\"ids\"]:\n", - " model_name = be.get_model_name(model_id)['name']\n", - " material_ids = be.get_material_ids(model_id)[\"ids\"]\n", - " nb_materials = len(material_ids)\n", - "\n", - " if model_name.find('Neuron') != -1 and model_name.find('Mitochondrion') == -1:\n", - " palette = sns.color_palette(\"Blues\", nb_materials)\n", - " be.set_materials_from_palette(\n", - " model_ids=[model_id],\n", - " material_ids=material_ids,\n", - " palette=palette,\n", - " shading_mode=shading_mode,\n", - " user_parameter=user_parameter,\n", - " glossiness=glossiness,\n", - " specular_exponent=specular_exponent,\n", - " )\n", - " elif model_name.find('Astrocyte') != -1 and model_name.find('Mitochondrion') == -1:\n", - " palette = sns.color_palette(\"Wistia\", nb_materials)\n", - " be.set_materials_from_palette(\n", - " model_ids=[model_id],\n", - " material_ids=material_ids,\n", - " palette=palette,\n", - " shading_mode=shading_mode,\n", - " user_parameter=user_parameter,\n", - " glossiness=glossiness,\n", - " specular_exponent=specular_exponent,\n", - " )\n", - " elif model_name.find('Mitochondrion') != -1:\n", - " palette = sns.color_palette(\"Purples\", nb_materials)\n", - " be.set_materials_from_palette(\n", - " model_ids=[model_id],\n", - " material_ids=material_ids,\n", - " palette=palette,\n", - " shading_mode=shading_mode,\n", - " user_parameter=user_parameter,\n", - " glossiness=glossiness,\n", - " specular_exponent=specular_exponent,\n", - " )\n", - " else:\n", - " colors = list()\n", - " shading_modes = list()\n", - " user_parameters = list()\n", - " glossinesses = list()\n", - " specular_exponents = list()\n", - "\n", - " for m in material_ids:\n", - " colors.append(global_palette[index])\n", - " shading_modes.append(shading_mode)\n", - " user_parameters.append(user_parameter)\n", - " glossinesses.append(glossiness)\n", - " specular_exponents.append(specular_exponent)\n", - "\n", - " be.set_materials(\n", - " model_ids=[model_id],\n", - " material_ids=material_ids,\n", - " diffuse_colors=colors,\n", - " specular_colors=colors,\n", - " shading_modes=shading_modes,\n", - " user_parameters=user_parameters,\n", - " glossinesses=glossinesses,\n", - " specular_exponents=specular_exponents\n", - " )\n", - " index += 1" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "aa028c82", - "metadata": {}, - "outputs": [], - "source": [ - "def add_aabb():\n", - " return be.add_bounding_box(\n", - " name='AABB',\n", - " bottom_left_corner=Vector3(-scene_size.x / 2.0, -scene_size.y / 2.0, -scene_size.z / 2.0),\n", - " top_right_corner=Vector3(scene_size.x / 2.0, scene_size.y / 2.0, scene_size.z / 2.0),\n", - " radius=0.25)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "f3c0d39c", - "metadata": {}, - "outputs": [], - "source": [ - "def setup_frame(frame, metabolites=True, neuron=True, astrocyte=True):\n", - " be.reset_scene()\n", - " be.set_general_settings(model_visibility_on_creation=False)\n", - " print('Scene bounding box...')\n", - " add_aabb()\n", - " if metabolites:\n", - " print('Loading metabolites...')\n", - " add_metabolites(frame % 450)\n", - " if astrocyte:\n", - " print('Loading astrocyte mitochondrion membrane...')\n", - " add_astrocyte_mitochondrion(frame)\n", - " print('Loading astrocyte membrane...')\n", - " add_astrocyte(frame)\n", - " if neuron:\n", - " print('Loading neuron membrane...')\n", - " add_neuron(frame)\n", - " print('Loading neuron mitochondrion membrane...')\n", - " add_neuron_mitochondrion(frame)\n", - " print('Applying materials...')\n", - " set_color_scheme(shading_mode=be.SHADING_MODE_PERLIN, user_parameter=0.001, specular_exponent=50.0)\n", - " set_materials_to_transmembrane_proteins(neuron, astrocyte)\n", - " print('Building geometry...')\n", - " be.set_models_visibility(True)\n", - " print('Done')" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "c2bd0720-8776-4992-a0f7-bd0c379f16da", - "metadata": {}, - "outputs": [], - "source": [ - "be.set_rendering_quality(be.RENDERING_QUALITY_HIGH)\n", - "\n", - "params = core.BioExplorerRendererParams()\n", - "params.shadows = 1.0\n", - "params.soft_shadows = 0.1\n", - "params.use_hardware_randomizer = False\n", - "params.fog_start = 1000.0\n", - "params.fog_thickness = 500.0\n", - "params.gi_distance = 5.0\n", - "params.gi_weight = 0.2\n", - "params.gi_samples = 1\n", - "params = core.set_renderer_params(params)\n", - "params = core.set_renderer(head_light=True)" - ] - }, - { - "cell_type": "markdown", - "id": "9e9b6f3e", - "metadata": {}, - "source": [ - "## Snapshots" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "142234a8", - "metadata": {}, - "outputs": [], - "source": [ - "from bioexplorer import MovieMaker\n", - "mm = MovieMaker(be)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "6e11f16e", - "metadata": {}, - "outputs": [], - "source": [ - "if generate_snapshot:\n", - " core.set_camera(current='orthographic')\n", - " params = core.OrthographicCameraParams()\n", - " params.height = 100.0\n", - " core.set_camera_params(params)\n", - "\n", - " core.set_camera(\n", - " orientation = [-0.707, -0.707, 0.0, 0.0],\n", - " position = [0.7841586723976661, 3.6684584451627895, -360.03218098964624],\n", - " target = [0.7841586723976661, 3.6684584451626847, -25.817442464876535]\n", - " )\n", - "\n", - " mm.create_snapshot(\n", - " renderer='bio_explorer',\n", - " base_name = 'Metabolism_Molecular_Level_4k_v1',\n", - " path='/tmp',\n", - " size=[2160, 3840], samples_per_pixel=64\n", - ")" - ] - }, - { - "cell_type": "markdown", - "id": "65458fc8", - "metadata": {}, - "source": [ - "## Simulation movie" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "9ff2b676", - "metadata": {}, - "outputs": [], - "source": [ - "nb_frames = 120\n", - "aperture = 0.01\n", - "focus = 2.938\n", - "key_frames = [\n", - " {\n", - " 'apertureRadius': aperture,\n", - " 'direction': [-0.0, 0.0, -1.0],\n", - " 'focusDistance': focus,\n", - " 'origin': [-0.12309164325388476, -68.17223360869282, 528.224633426888],\n", - " 'up': [-1.0, -6.661338147750939e-16, 0.0]\n", - " },\n", - " {\n", - " 'apertureRadius': aperture,\n", - " 'direction': [-0.0, 0.0, -1.0],\n", - " 'focusDistance': focus,\n", - " 'origin': [-0.12309164325388476, -68.17223360869282, 140.11376864318507],\n", - " 'up': [-1.0, -6.661338147750939e-16, 0.0]\n", - " },\n", - " {\n", - " 'apertureRadius': aperture,\n", - " 'direction': [0.0, 1.0, -2.220446049250313e-16],\n", - " 'focusDistance': focus,\n", - " 'origin': [-28.5, -67.86393737792969, -2.0],\n", - " 'up': [-0.0, 2.220446049250313e-16, 1.0]\n", - " },\n", - " {\n", - " 'apertureRadius': aperture,\n", - " 'direction': [-0.0, 1.0, -4.440892098500626e-16],\n", - " 'focusDistance': focus,\n", - " 'origin': [-29.22458300330654, -18.82142928630076, -2.386302379782111],\n", - " 'up': [0.0, 4.440892098500626e-16, 1.0]\n", - " },\n", - " {\n", - " 'apertureRadius': aperture,\n", - " 'direction': [-0.0, 1.0, -2.220446049250313e-16],\n", - " 'focusDistance': focus,\n", - " 'origin': [-29.22458300330654, -0.82142928630076, -2.386302379782111],\n", - " 'up': [0.0, 2.220446049250313e-16, 1.0]\n", - " },\n", - " {\n", - " 'apertureRadius': aperture,\n", - " 'direction': [0.9999970255814865, 1.5866404717910239e-21, -0.0024390219719829798],\n", - " 'focusDistance': focus,\n", - " 'origin': [-117.00812364660472, -14.7012431105328, -16.27792336717559],\n", - " 'up': [0.0, 1.0, 6.505232384196665e-19]\n", - " },\n", - " {\n", - " 'apertureRadius': aperture,\n", - " 'direction': [0.9999970255814865, 1.5866404717910239e-21, -0.0024390219719829798],\n", - " 'focusDistance': focus,\n", - " 'origin': [-117.00812364660472, -14.7012431105328, -16.27792336717559],\n", - " 'up': [0.0, 1.0, 6.505232384196665e-19]\n", - " }\n", - "]" - ] - }, - { - "cell_type": "markdown", - "id": "abb311ed", - "metadata": {}, - "source": [ - "### Get the model that contains the glucose molecules" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "5d459d82", - "metadata": {}, - "outputs": [], - "source": [ - "def euler_to_quaternion(yaw, pitch, roll):\n", - " import numpy as np\n", - " qx = np.sin(roll/2) * np.cos(pitch/2) * np.cos(yaw/2) - np.cos(roll/2) * np.sin(pitch/2) * np.sin(yaw/2)\n", - " qy = np.cos(roll/2) * np.sin(pitch/2) * np.cos(yaw/2) + np.sin(roll/2) * np.cos(pitch/2) * np.sin(yaw/2)\n", - " qz = np.cos(roll/2) * np.cos(pitch/2) * np.sin(yaw/2) - np.sin(roll/2) * np.sin(pitch/2) * np.cos(yaw/2)\n", - " qw = np.cos(roll/2) * np.cos(pitch/2) * np.cos(yaw/2) + np.sin(roll/2) * np.sin(pitch/2) * np.sin(yaw/2)\n", - "\n", - " return Quaternion(qx, qy, qz, qw)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "3752aae1", - "metadata": { - "scrolled": false - }, - "outputs": [], - "source": [ - "import math\n", - "from IPython.display import clear_output\n", - "\n", - "version = 1\n", - "spp = 64\n", - "k = 1\n", - "\n", - "movie_folder = os.getenv('MOVIE_FOLDER', '/tmp')\n", - "output_folder = os.path.join(movie_folder, 'metabolism')\n", - "output_folder = os.path.join(output_folder, '%dK' % k)\n", - "output_folder = os.path.join(output_folder, 'v%d' % version)\n", - "if not os.path.isdir(output_folder):\n", - " print('Making folder ' + output_folder)\n", - " os.makedirs(output_folder, exist_ok=True)\n", - "\n", - "mm.build_camera_path(key_frames, nb_frames, nb_frames)\n", - "\n", - "if generate_movie:\n", - " core.set_application_parameters(image_stream_fps=0)\n", - " renderer='bio_explorer'\n", - " core.set_camera(current='bio_explorer_perspective')\n", - " \n", - " # add_shapes()\n", - "\n", - " nb_frames = mm.get_nb_frames()\n", - " for frame in range(nb_frames):\n", - " clear_output()\n", - " print('Frame %d/%d' % (frame, nb_frames))\n", - "\n", - " setup_frame(frame, neuron=True, astrocyte=False, metabolites=True)\n", - " mm.set_current_frame(frame)\n", - "\n", - " ''' Set glucose molecule position '''\n", - " p = core.get_camera()['position']\n", - " t = core.get_camera()['target']\n", - " r = core.get_camera()['orientation']\n", - " \n", - " pos = [0,0,0]\n", - " for i in range(3):\n", - " pos[i] = p[i] + (t[i] - p[i]) * 3.0\n", - " \n", - " target = Vector3(pos[0], pos[1], pos[2])\n", - " glucose_model_name = 'Extracellular space_Glucose'\n", - "\n", - " roll = math.pi / 2.0 + 0.091 * math.pi * math.cos(frame * math.pi / 45.0)\n", - " yaw = 0.125 * math.pi * math.cos(frame * math.pi / 180.0)\n", - " pitch = 0\n", - "\n", - " be.set_protein_instance_transformation(\n", - " assembly_name=glucose_model_name,\n", - " name=glucose_model_name,\n", - " instance_index=0,\n", - " position=target,\n", - " rotation=Quaternion(r[3], r[0], r[1], r[2]) * euler_to_quaternion(yaw, pitch, roll)\n", - " )\n", - "\n", - " '''Generate image'''\n", - " mm.create_snapshot(\n", - " renderer=renderer,\n", - " size=[k * 960, k * 540], samples_per_pixel=spp,\n", - " path=output_folder, base_name='%05d' % frame)\n", - " core.set_application_parameters(image_stream_fps=20)" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3.8.10 64-bit", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.8.10" - }, - "vscode": { - "interpreter": { - "hash": "916dbcbb3f70747c44a77c7bcd40155683ae19c65e1c03b4aa3499c5328201f1" - } - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} + "cells": [ + { + "cell_type": "markdown", + "id": "f992ef9f", + "metadata": {}, + "source": [ + "# BioExplorer - Metabolism - Movie\n", + "![](../bioexplorer_metabolism_banner.png)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "fdb97b88", + "metadata": {}, + "outputs": [], + "source": [ + "from bioexplorer import BioExplorer, Protein, Membrane, Cell, Volume, AnimationParams, Vector2, Vector3, Quaternion\n", + "\n", + "url = 'localhost:5000'\n", + "be = BioExplorer(url)\n", + "core = be.core_api()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "21190ced", + "metadata": {}, + "outputs": [], + "source": [ + "generate_snapshot = False\n", + "generate_movie = True\n", + "\n", + "status = be.reset_scene()\n", + "status = be.set_general_settings(logging_level=3)\n", + "\n", + "''' Simulation identifier '''\n", + "simulation_guid = 3\n", + "\n", + "''' Ratio to apply to concentrations for visualization purpose '''\n", + "concentration_visualization_ratio = 2.0\n", + "\n", + "representation = be.REPRESENTATION_ATOMS_AND_STICKS\n", + "atom_radius_multiplier = 1.0 \n", + "\n", + "scene_size = Vector3(250.0, 500.0, 250.0)\n", + "membrane_size = Vector3(scene_size.x, scene_size.y / 50.0, scene_size.z)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "011623ab", + "metadata": {}, + "outputs": [], + "source": [ + "resource_folder = '../../tests/test_files/'\n", + "pdb_folder = resource_folder + 'pdb/'\n", + "off_folder = resource_folder + 'off/'\n", + "membrane_folder = pdb_folder + 'membrane/'\n", + "lipids_folder = membrane_folder + 'lipids/'\n", + "ion_channels_folder = pdb_folder + 'ion_channels/'\n", + "metabolites_folder = pdb_folder + 'metabolites/'\n", + "transporters_folder = pdb_folder + 'transporters/'\n", + "\n", + "be.set_general_settings(\n", + " off_folder=off_folder,\n", + " model_visibility_on_creation=False)\n", + "\n", + "''' Neuron trans-membrane proteins '''\n", + "pdb_glut3 = transporters_folder + '4zwc.pdb'\n", + "pdb_glut3_closed = transporters_folder + '5c65.pdb'\n", + "pdb_mct2_lac = transporters_folder + '7bp3.pdb'\n", + "\n", + "''' Astrocyte trans-membrane proteins '''\n", + "pdb_glut1 = transporters_folder + '4pyp.pdb'\n", + "pdb_mct1_lac = transporters_folder + '6lz0.pdb'\n", + "\n", + "''' Trans-membrane proteins '''\n", + "pdb_nka = transporters_folder + '4hqj.pdb'\n", + "\n", + "''' Lipids '''\n", + "pdb_lipids = [\n", + " lipids_folder + 'lipid_430.pdb',\n", + " lipids_folder + 'lipid_426.pdb',\n", + " lipids_folder + 'lipid_424.pdb',\n", + " lipids_folder + 'lipid_410.pdb'\n", + "]\n", + "lipid_density = 3.0" + ] + }, + { + "cell_type": "markdown", + "id": "f5b0aef0", + "metadata": {}, + "source": [ + "## Metabolites" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1792d171", + "metadata": {}, + "outputs": [], + "source": [ + "import psycopg2\n", + "import pandas as pd\n", + "import os\n", + "\n", + "db_host = os.environ['DB_HOST']\n", + "db_name = os.environ['DB_NAME']\n", + "db_user = os.environ['DB_USER']\n", + "db_password = os.environ['DB_PASSWORD']\n", + "db_schema = 'Metabolism'\n", + "\n", + "db_connection_string = 'host=' + db_host + ' port=5432 dbname=' + db_name + \\\n", + " ' user=' + db_user + ' password=' + db_password\n", + "db_connection=psycopg2.connect(db_connection_string)\n", + "print(db_connection_string)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ffb90d42", + "metadata": {}, + "outputs": [], + "source": [ + "def get_simulations():\n", + " simulations = dict()\n", + " sql_command = \"SELECT guid, description FROM %s.simulations ORDER BY guid\" % db_schema\n", + " data = pd.read_sql(sql_command, db_connection)\n", + " for i in range(len(data)):\n", + " simulations[data['guid'][i]] = data['description'][i]\n", + " return simulations\n", + "\n", + "def get_variables():\n", + " variables = dict()\n", + " sql_command = \"SELECT guid, pdb, description FROM %s.variable WHERE pdb IS NOT NULL ORDER BY guid\" % db_schema\n", + " data = pd.read_sql(sql_command, db_connection)\n", + " for i in range(len(data)):\n", + " pdb_guid = data['pdb'][i]\n", + " if pdb_guid:\n", + " variables[data['guid'][i]] = [pdb_guid, data['description'][i]]\n", + " return variables\n", + "\n", + "def get_metabolites():\n", + " metabolites = dict()\n", + " sql_command = \"SELECT guid, pdb, description FROM %s.variable WHERE type=0 AND pdb IS NOT NULL ORDER BY guid\" % db_schema\n", + " data = pd.read_sql(sql_command, db_connection)\n", + " for i in range(len(data)):\n", + " pdb_guid = data['pdb'][i]\n", + " if pdb_guid:\n", + " metabolites[data['guid'][i]] = [pdb_guid, data['description'][i]]\n", + " return metabolites\n", + "\n", + "def get_locations():\n", + " locations = dict()\n", + " sql_command = \"SELECT guid, description FROM %s.location ORDER BY guid\" % db_schema\n", + " data = pd.read_sql(sql_command, db_connection)\n", + " for i in range(len(data)):\n", + " locations[data['guid'][i]] = data['description'][i]\n", + " return locations\n", + "\n", + "def get_concentration(variable_guid, simulation_guid, frame, location_guid):\n", + " sql_command = 'SELECT v.guid AS guid, c.concentration AS concentration FROM %s.variable as v, %s.concentration AS c WHERE c.variable_guid=%d AND v.guid=c.variable_guid AND c.timestamp=%d AND c.simulation_guid=%d AND v.location_guid=%d ORDER BY v.guid' % (db_schema, db_schema, variable_guid, frame, simulation_guid, location_guid)\n", + " data = pd.read_sql(sql_command, db_connection)\n", + " if(len(data)>0):\n", + " return(float(data['concentration']))\n", + " return 0.0 " + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "2042588a", + "metadata": {}, + "outputs": [], + "source": [ + "''' Dimensions are in nanometers '''\n", + "\n", + "import math\n", + "\n", + "region_astrocyte_mitochondrion = 0\n", + "region_astrocyte = 1\n", + "region_extracellular_space = 2\n", + "region_neuron = 3\n", + "region_neuron_mitochondrion = 4\n", + "\n", + "region_mapping = dict()\n", + "region_mapping[0] = region_astrocyte_mitochondrion\n", + "region_mapping[1] = region_astrocyte\n", + "region_mapping[2] = region_extracellular_space\n", + "region_mapping[3] = region_neuron\n", + "region_mapping[4] = region_neuron_mitochondrion\n", + "\n", + "location_areas = dict()\n", + "location_areas[region_astrocyte_mitochondrion] = [0.0575 * 0.25, Vector2(100, scene_size.x / 2.0)] # Mitochondria of the astrocyte\n", + "location_areas[region_astrocyte] = [0.25, Vector2(20, 100)] # Cytosol of the astrocyte\n", + "location_areas[region_extracellular_space] = [0.20, Vector2(-20, 20)] # Extracellular space\n", + "location_areas[region_neuron] = [0.45, Vector2(-10, -100)] # Cytosol of the neuron\n", + "location_areas[region_neuron_mitochondrion] = [0.0575 * 0.45, Vector2(-100, -scene_size.x / 2.0)] # Mitochondria of the neuron\n", + "\n", + "\n", + "# Currently not used:\n", + "# -------------------\n", + "# region_capilarities = 5\n", + "# region_synaptic = 6\n", + "# region_vasculature = 7\n", + "# -------------------\n", + "# location_areas[region_capilarities] = [0.0055, Vector2(0, 0)] # Capillaries\n", + "# location_areas[region_synaptic] = [0.0, Vector2(0, 0)] # Synaptic part of the extracellular space\n", + "# location_areas[region_vasculature] = [0.0, Vector2(0, 0)] # Vasculature\n", + "# -------------------\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "67ec3c65", + "metadata": {}, + "outputs": [], + "source": [ + "fullNGVUnitVolumeInLiters = 2e-11 / 0.45\n", + "nanometersCubicToLiters = 1e-24\n", + "avogadro = 6.02e23\n", + "\n", + "fullSceneVolumeInLiters = scene_size.x * scene_size.y * scene_size.z * nanometersCubicToLiters\n", + "scene_ratio = fullSceneVolumeInLiters / fullNGVUnitVolumeInLiters" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "eee6375f", + "metadata": {}, + "outputs": [], + "source": [ + "def get_nb_molecules(concentration, location_guid):\n", + " return int(concentration_visualization_ratio * scene_ratio * avogadro * (1e-3 * concentration) * fullNGVUnitVolumeInLiters * location_areas[location_guid][0])\n", + "\n", + "def get_nb_proteins(concentration, location_guid):\n", + " return int(math.exp(concentration) * 1e-6 * avogadro * fullNGVUnitVolumeInLiters * scene_ratio * location_areas[location_guid][0])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "0e7d8340", + "metadata": {}, + "outputs": [], + "source": [ + "indices = list()\n", + "indices.append(-scene_size.y / 2.0)\n", + "total = 0.0\n", + "for location_area in location_areas:\n", + " total = total + location_areas[location_area][0] * scene_size.y\n", + " indices.append(-scene_size.y / 2.0 + total)\n", + "indices.append(scene_size.y / 2.0)\n", + "\n", + "i = 0\n", + "for region in region_mapping:\n", + " location_areas[region_mapping[region]][1] = Vector2(indices[i], indices[i+1])\n", + " i += 1\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "cd0fe1ad", + "metadata": {}, + "outputs": [], + "source": [ + "def add_metabolites(frame=0):\n", + " locations = get_locations()\n", + " variables = get_metabolites()\n", + "\n", + " random_seed = 1\n", + " for location in locations:\n", + " if location not in region_mapping.values():\n", + " continue\n", + "\n", + " for variable in variables:\n", + " pdb_guid = variables[variable][0]\n", + " if not pdb_guid:\n", + " continue\n", + " variable_guid = int(variable)\n", + " variable_description = variables[variable][1]\n", + " location_guid = int(location)\n", + " file_name = metabolites_folder + pdb_guid + '.pdb'\n", + " concentration = get_concentration(variable_guid, simulation_guid, frame, location_guid)\n", + " nb_molecules = get_nb_molecules(concentration, location_guid)\n", + " if nb_molecules > 0:\n", + " location_name = locations[location_guid]\n", + " # print('- [%s] [%d] %s: %s.pdb: %d' % (location_name, variable_guid, variable_description, pdb_guid, nb_molecules))\n", + " try:\n", + " location_area = location_areas[location_guid][1]\n", + " area_size = Vector3(\n", + " scene_size.x,\n", + " 0.95 * (location_area.y - location_area.x),\n", + " scene_size.z)\n", + " area_position = Vector3(0.0, (location_area.y + location_area.x) / 2.0 , 0.0)\n", + "\n", + " name = location_name + '_' + variable_description\n", + "\n", + " metabolite = Protein(\n", + " name=name, source=file_name,\n", + " load_bonds=True, load_hydrogen=True,\n", + " load_non_polymer_chemicals=True, \n", + " occurrences=nb_molecules,\n", + " animation_params=AnimationParams(\n", + " random_seed,\n", + " random_seed + frame + 1, 0.2,\n", + " random_seed + frame + 2, 1.0))\n", + "\n", + " volume = Volume(\n", + " name=name,\n", + " shape=be.ASSEMBLY_SHAPE_CUBE,\n", + " shape_params=area_size,\n", + " protein=metabolite\n", + " )\n", + " status = be.add_volume(\n", + " volume=volume, representation=representation, position=area_position)\n", + " random_seed += 3\n", + " except Exception as e:\n", + " print(e)" + ] + }, + { + "cell_type": "markdown", + "id": "77336189", + "metadata": {}, + "source": [ + "## Neuron" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "5d24ad1b", + "metadata": {}, + "outputs": [], + "source": [ + "def add_neuron(frame=0):\n", + " name = 'Neuron'\n", + " transmembrane_proteins = list()\n", + "\n", + " # Transporter GLUT3 (https://opm.phar.umich.edu/proteins/442)\n", + " nb_transporter_glut3 = get_nb_proteins(-0.250079574048427, region_neuron)\n", + " if nb_transporter_glut3 > 0:\n", + " transmembrane_proteins.append(Protein(\n", + " name=name + '_GLUT3',\n", + " chain_ids=[1],\n", + " source=pdb_glut3,\n", + " occurrences=30, #nb_transporter_glut3,\n", + " rotation=Quaternion(0.707, -0.693, -0.139, 0.0),\n", + " load_non_polymer_chemicals=True, load_hydrogen=True, load_bonds=True,\n", + " animation_params=AnimationParams(1, frame + 1, 0.1, frame + 2, 0.25),\n", + " transmembrane_params=Vector2(0.0, 2.0)\n", + " ))\n", + "\n", + " # Transporter MCT2 (https://opm.phar.umich.edu/proteins/5233)\n", + " nb_transporter_mct2 = get_nb_proteins(-2.00832096285463, region_neuron)\n", + " if nb_transporter_mct2 > 0:\n", + " transmembrane_proteins.append(Protein(\n", + " name=name + '_MCT2',\n", + " position=Vector3(0.0, 1.0, 0.0),\n", + " source=pdb_mct2_lac,\n", + " occurrences=nb_transporter_mct2,\n", + " load_non_polymer_chemicals=True, load_hydrogen=True, load_bonds=True,\n", + " animation_params=AnimationParams(2, frame + 3, 0.1, frame + 4, 0.005),\n", + " transmembrane_params=Vector2(0.0, 2.0)\n", + " ))\n", + "\n", + " # Transporter NKA\n", + " nb_transporter_nka = get_nb_proteins(0.325597445694269, region_neuron)\n", + " if nb_transporter_nka > 0:\n", + " transmembrane_proteins.append(Protein(\n", + " name=name + '_NKA',\n", + " source=pdb_nka,\n", + " occurrences=nb_transporter_nka,\n", + " load_non_polymer_chemicals=True, load_hydrogen=True, load_bonds=True,\n", + " animation_params=AnimationParams(3, frame + 5, 0.1, frame + 6, 0.25),\n", + " transmembrane_params=Vector2(0.0, 2.0)\n", + " ))\n", + " \n", + "\n", + " # Membrane definition\n", + " membrane = Membrane(\n", + " lipid_sources=pdb_lipids,\n", + " lipid_density=lipid_density,\n", + " load_non_polymer_chemicals=True, load_bonds=True,\n", + " animation_params=AnimationParams(0, frame + 7, 0.1, frame + 8, 0.25)\n", + " )\n", + "\n", + " # Cell definition\n", + " neuron = Cell(\n", + " name=name,\n", + " shape=be.ASSEMBLY_SHAPE_SINUSOID,\n", + " shape_params=membrane_size,\n", + " membrane=membrane,\n", + " proteins=transmembrane_proteins)\n", + "\n", + " # Add cell to scene\n", + " status = be.add_cell(\n", + " cell=neuron, representation=representation,\n", + " atom_radius_multiplier=atom_radius_multiplier,\n", + " position=Vector3(0, location_areas[region_neuron][1].x, 0))\n", + "\n", + " return status" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "685ea7e9", + "metadata": {}, + "outputs": [], + "source": [ + "def add_neuron_mitochondrion(frame):\n", + " name = 'NeuronMitochondrion'\n", + "\n", + " # Transporter\n", + " transporter = Protein(\n", + " name=name + '_GLUT3',\n", + " source=pdb_glut3,\n", + " occurrences=0,\n", + " rotation=Quaternion(0.707, 0.707, 0.0, 0.0),\n", + " load_non_polymer_chemicals=True, load_hydrogen=True, load_bonds=True,\n", + " animation_params=AnimationParams(4, frame + 9, 0.1, frame + 10, 0.25),\n", + " transmembrane_params=Vector2(0.0, 2.0)\n", + " )\n", + "\n", + " # Membrane definition\n", + " membrane = Membrane(\n", + " lipid_sources=pdb_lipids,\n", + " lipid_density=lipid_density,\n", + " load_non_polymer_chemicals=True, load_bonds=True,\n", + " animation_params=AnimationParams(0, frame + 11, 0.1, frame + 12, 0.25)\n", + " )\n", + "\n", + " # Cell definition\n", + " neuron_mitochodrion = Cell(\n", + " name=name,\n", + " shape=be.ASSEMBLY_SHAPE_SINUSOID,\n", + " shape_params=membrane_size,\n", + " membrane=membrane,\n", + " proteins=[transporter])\n", + "\n", + " # Add cell to scene\n", + " status = be.add_cell(\n", + " cell=neuron_mitochodrion, representation=representation,\n", + " rotation=Quaternion(0.0, 1.0, 0.0, 0.0),\n", + " position=Vector3(0, location_areas[region_neuron_mitochondrion][1].x, 0))\n", + "\n", + " return status" + ] + }, + { + "cell_type": "markdown", + "id": "13640f8b", + "metadata": {}, + "source": [ + "## Astrocyte" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "2df9be36", + "metadata": {}, + "outputs": [], + "source": [ + "def add_astrocyte(frame = 0):\n", + " name = 'Astrocyte'\n", + " transmembrane_proteins = list()\n", + "\n", + " # GLUT1 (https://opm.phar.umich.edu/proteins/2454)\n", + " nb_transporter_glut1 = get_nb_proteins(-0.672647584446565, region_neuron)\n", + " if nb_transporter_glut1 > 0:\n", + " transmembrane_proteins.append(Protein(\n", + " name=name + '_GLUT1',\n", + " source=pdb_glut1,\n", + " occurrences=nb_transporter_glut1,\n", + " rotation=Quaternion(0.707, 0.707, 0.0, 0.0),\n", + " load_non_polymer_chemicals=True, load_hydrogen=True, load_bonds=True,\n", + " animation_params=AnimationParams(11, frame + 13, 0.1, frame + 14, 0.25),\n", + " transmembrane_params=Vector2(0.0, 2.0)\n", + " ))\n", + "\n", + " # Transporter MCT1 (https://opm.phar.umich.edu/proteins/6402)\n", + " nb_transporter_mct1 = get_nb_proteins(-0.86948422680206, region_neuron)\n", + " if nb_transporter_mct1 > 0:\n", + " transmembrane_proteins.append(Protein(\n", + " name=name + '_MCT1',\n", + " position=Vector3(0.0, 1.0, 0.0),\n", + " source=pdb_mct1_lac,\n", + " occurrences=nb_transporter_mct1,\n", + " load_non_polymer_chemicals=True, load_hydrogen=True, load_bonds=True,\n", + " animation_params=AnimationParams(12, frame + 15, 0.1, frame + 16, 0.25),\n", + " transmembrane_params=Vector2(0.0, 2.0)\n", + " ))\n", + "\n", + " # Membrane definition\n", + " membrane = Membrane(\n", + " lipid_sources=pdb_lipids,\n", + " lipid_density=lipid_density,\n", + " load_non_polymer_chemicals=True, load_bonds=True,\n", + " animation_params=AnimationParams(0, frame + 17, 0.1, frame + 18, 0.25))\n", + "\n", + " # Cell definition\n", + " astrocyte = Cell(\n", + " name=name,\n", + " shape=be.ASSEMBLY_SHAPE_SINUSOID,\n", + " shape_params=membrane_size,\n", + " membrane=membrane,\n", + " proteins=transmembrane_proteins)\n", + "\n", + " # Add cell to scene\n", + " status = be.add_cell(\n", + " cell=astrocyte, representation=representation,\n", + " rotation=Quaternion(0.0, 1.0, 0.0, 0.0),\n", + " position=Vector3(0, location_areas[region_astrocyte][1].y, 0))\n", + "\n", + " return status" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "6b50f4dd", + "metadata": {}, + "outputs": [], + "source": [ + "def add_astrocyte_mitochondrion(frame=0):\n", + " name = 'AstrocyteMitochondrion'\n", + "\n", + " # Transporter\n", + " transporter = Protein(\n", + " name=name + '_GLUT1',\n", + " source=pdb_glut1,\n", + " occurrences=0,\n", + " rotation=Quaternion(0.707, 0.707, 0.0, 0.0),\n", + " load_non_polymer_chemicals=True, load_hydrogen=True, load_bonds=True,\n", + " animation_params=AnimationParams(15, frame + 19, 0.1, frame + 20, 0.25),\n", + " transmembrane_params=Vector2(0.0, 2.0)\n", + " )\n", + "\n", + " # Membrane definition\n", + " membrane = Membrane(\n", + " lipid_sources=pdb_lipids,\n", + " lipid_density=lipid_density,\n", + " load_non_polymer_chemicals=True, load_bonds=True,\n", + " animation_params=AnimationParams(0, frame + 21, 0.1, frame + 22, 0.25)\n", + " )\n", + "\n", + " # Cell definition\n", + " astrocyte_mitochodrion = Cell(\n", + " name=name,\n", + " shape=be.ASSEMBLY_SHAPE_SINUSOID,\n", + " shape_params=membrane_size,\n", + " membrane=membrane,\n", + " proteins=[transporter])\n", + "\n", + " # Add cell to scene\n", + " status = be.add_cell(\n", + " cell=astrocyte_mitochodrion, representation=representation,\n", + " rotation=Quaternion(0.0, 1.0, 0.0, 0.0),\n", + " position=Vector3(0, location_areas[region_astrocyte_mitochondrion][1].y, 0))\n", + "\n", + " return status" + ] + }, + { + "cell_type": "markdown", + "id": "c928f9c6", + "metadata": {}, + "source": [ + "## Materials" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "46439b00", + "metadata": {}, + "outputs": [], + "source": [ + "def set_materials_to_transmembrane_proteins(neuron=True, astrocyte=True):\n", + " if neuron:\n", + " name = 'Neuron'\n", + " status = be.set_protein_color_scheme(\n", + " assembly_name=name, name=name+'_GLUT3',\n", + " color_scheme=be.COLOR_SCHEME_AMINO_ACID_SEQUENCE,\n", + " palette_name='Reds_r', palette_size=2)\n", + "\n", + " status = be.set_protein_color_scheme(\n", + " assembly_name=name, name=name+'_MCT2',\n", + " color_scheme=be.COLOR_SCHEME_AMINO_ACID_SEQUENCE,\n", + " palette_name='Greens_r', palette_size=2)\n", + "\n", + " status = be.set_protein_color_scheme(\n", + " assembly_name=name, name=name+'_NKA',\n", + " color_scheme=be.COLOR_SCHEME_AMINO_ACID_SEQUENCE,\n", + " palette_name='OrRd_r', palette_size=2)\n", + "\n", + " if astrocyte:\n", + " name = 'Astrocyte'\n", + " status = be.set_protein_color_scheme(\n", + " assembly_name=name, name=name+'_GLUT1',\n", + " color_scheme=be.COLOR_SCHEME_AMINO_ACID_SEQUENCE,\n", + " palette_name='Reds_r', palette_size=2)\n", + "\n", + " status = be.set_protein_color_scheme(\n", + " assembly_name=name, name=name+'_MCT1',\n", + " color_scheme=be.COLOR_SCHEME_AMINO_ACID_SEQUENCE,\n", + " palette_name='Greens_r', palette_size=2)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1b8eb614", + "metadata": {}, + "outputs": [], + "source": [ + "def add_shapes():\n", + " radius = 50000.0\n", + " be.add_sphere(\n", + " name='AstrocyteSphere',\n", + " position=Vector3(0, location_areas[region_astrocyte][1].y - radius,0),\n", + " radius=radius,\n", + " color=Vector3(0.4,0.4,0.25),\n", + " opacity=0.5\n", + " )\n", + " be.add_sphere(\n", + " name='AstrocyteMitochondrionSphere',\n", + " position=Vector3(0, location_areas[region_astrocyte_mitochondrion][1].y - radius, 0),\n", + " radius=radius,\n", + " color=Vector3(0.2,0.15,0.3),\n", + " opacity=0.5\n", + " )\n", + " be.add_sphere(\n", + " name='NeuronSphere',\n", + " position=Vector3(0, location_areas[region_neuron][1].x + radius, 0),\n", + " radius=radius,\n", + " color=Vector3(0.3,0.37,0.4),\n", + " opacity=0.5\n", + " )\n", + " be.add_sphere(\n", + " name='NeuronMytochondrionSphere',\n", + " position=Vector3(0, location_areas[region_neuron_mitochondrion][1].x + radius, 0),\n", + " radius=radius,\n", + " color=Vector3(0.2,0.15,0.3),\n", + " opacity=0.5\n", + " )" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c5d4860b", + "metadata": {}, + "outputs": [], + "source": [ + "def set_color_scheme(\n", + " shading_mode, user_parameter=1.0, specular_exponent=5.0, glossiness=1.0):\n", + " \"\"\"\n", + " Apply a default color scheme to all components in the scene\n", + "\n", + " :shading_mode: Shading mode (None, basic, diffuse, electron, etc)\n", + " :user_parameter: User parameter specific to each shading mode\n", + " :specular_exponent: Specular exponent for diffuse shading modes\n", + " :glossiness: Glossiness\n", + " \"\"\"\n", + "\n", + " import seaborn as sns\n", + " model_ids = be.get_model_ids()\n", + " global_palette = sns.color_palette('rainbow', len(model_ids[\"ids\"]))\n", + "\n", + " index = 0\n", + " for model_id in model_ids[\"ids\"]:\n", + " model_name = be.get_model_name(model_id)['name']\n", + " material_ids = be.get_material_ids(model_id)[\"ids\"]\n", + " nb_materials = len(material_ids)\n", + "\n", + " if model_name.find('Neuron') != -1 and model_name.find('Mitochondrion') == -1:\n", + " palette = sns.color_palette(\"Blues\", nb_materials)\n", + " be.set_materials_from_palette(\n", + " model_ids=[model_id],\n", + " material_ids=material_ids,\n", + " palette=palette,\n", + " shading_mode=shading_mode,\n", + " user_parameter=user_parameter,\n", + " glossiness=glossiness,\n", + " specular_exponent=specular_exponent,\n", + " )\n", + " elif model_name.find('Astrocyte') != -1 and model_name.find('Mitochondrion') == -1:\n", + " palette = sns.color_palette(\"Wistia\", nb_materials)\n", + " be.set_materials_from_palette(\n", + " model_ids=[model_id],\n", + " material_ids=material_ids,\n", + " palette=palette,\n", + " shading_mode=shading_mode,\n", + " user_parameter=user_parameter,\n", + " glossiness=glossiness,\n", + " specular_exponent=specular_exponent,\n", + " )\n", + " elif model_name.find('Mitochondrion') != -1:\n", + " palette = sns.color_palette(\"Purples\", nb_materials)\n", + " be.set_materials_from_palette(\n", + " model_ids=[model_id],\n", + " material_ids=material_ids,\n", + " palette=palette,\n", + " shading_mode=shading_mode,\n", + " user_parameter=user_parameter,\n", + " glossiness=glossiness,\n", + " specular_exponent=specular_exponent,\n", + " )\n", + " else:\n", + " colors = list()\n", + " shading_modes = list()\n", + " user_parameters = list()\n", + " glossinesses = list()\n", + " specular_exponents = list()\n", + "\n", + " for m in material_ids:\n", + " colors.append(global_palette[index])\n", + " shading_modes.append(shading_mode)\n", + " user_parameters.append(user_parameter)\n", + " glossinesses.append(glossiness)\n", + " specular_exponents.append(specular_exponent)\n", + "\n", + " be.set_materials(\n", + " model_ids=[model_id],\n", + " material_ids=material_ids,\n", + " diffuse_colors=colors,\n", + " specular_colors=colors,\n", + " shading_modes=shading_modes,\n", + " user_parameters=user_parameters,\n", + " glossinesses=glossinesses,\n", + " specular_exponents=specular_exponents\n", + " )\n", + " index += 1" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "aa028c82", + "metadata": {}, + "outputs": [], + "source": [ + "def add_aabb():\n", + " return be.add_bounding_box(\n", + " name='AABB',\n", + " bottom_left_corner=Vector3(-scene_size.x / 2.0, -scene_size.y / 2.0, -scene_size.z / 2.0),\n", + " top_right_corner=Vector3(scene_size.x / 2.0, scene_size.y / 2.0, scene_size.z / 2.0),\n", + " radius=0.25)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f3c0d39c", + "metadata": {}, + "outputs": [], + "source": [ + "def setup_frame(frame, metabolites=True, neuron=True, astrocyte=True):\n", + " be.reset_scene()\n", + " be.set_general_settings(model_visibility_on_creation=False)\n", + " \n", + " '''Scene bounding box'''\n", + " add_aabb()\n", + "\n", + " if metabolites:\n", + " '''Loading metabolites'''\n", + " add_metabolites(frame % 450)\n", + " if astrocyte:\n", + " '''Loading astrocyte mitochondrion membrane'''\n", + " add_astrocyte_mitochondrion(frame)\n", + " '''Loading astrocyte membrane'''\n", + " add_astrocyte(frame)\n", + " if neuron:\n", + " '''Loading neuron membrane'''\n", + " add_neuron(frame)\n", + " '''Loading neuron mitochondrion membrane'''\n", + " add_neuron_mitochondrion(frame)\n", + " '''Applying materials'''\n", + " set_color_scheme(shading_mode=be.SHADING_MODE_PERLIN, user_parameter=0.001, specular_exponent=50.0)\n", + " set_materials_to_transmembrane_proteins(neuron, astrocyte)\n", + " '''Building geometry'''\n", + " be.set_models_visibility(True)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c2bd0720-8776-4992-a0f7-bd0c379f16da", + "metadata": {}, + "outputs": [], + "source": [ + "be.set_rendering_quality(be.RENDERING_QUALITY_HIGH)\n", + "\n", + "params = core.BioExplorerRendererParams()\n", + "params.shadows = 1.0\n", + "params.soft_shadows = 0.1\n", + "params.use_hardware_randomizer = False\n", + "params.fog_start = 1000.0\n", + "params.fog_thickness = 500.0\n", + "params.gi_distance = 5.0\n", + "params.gi_weight = 0.2\n", + "params.gi_samples = 1\n", + "params = core.set_renderer_params(params)\n", + "params = core.set_renderer(head_light=True)" + ] + }, + { + "cell_type": "markdown", + "id": "9e9b6f3e", + "metadata": {}, + "source": [ + "## Snapshots" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "142234a8", + "metadata": {}, + "outputs": [], + "source": [ + "from bioexplorer import MovieMaker\n", + "mm = MovieMaker(be)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "6e11f16e", + "metadata": {}, + "outputs": [], + "source": [ + "if generate_snapshot:\n", + " core.set_camera(current='orthographic')\n", + " params = core.OrthographicCameraParams()\n", + " params.height = 100.0\n", + " core.set_camera_params(params)\n", + "\n", + " core.set_camera(\n", + " orientation = [-0.707, -0.707, 0.0, 0.0],\n", + " position = [0.7841586723976661, 3.6684584451627895, -360.03218098964624],\n", + " target = [0.7841586723976661, 3.6684584451626847, -25.817442464876535]\n", + " )\n", + "\n", + " mm.create_snapshot(\n", + " renderer='bio_explorer',\n", + " base_name = 'Metabolism_Molecular_Level_4k_v1',\n", + " path='/tmp',\n", + " size=[2160, 3840], samples_per_pixel=64\n", + ")" + ] + }, + { + "cell_type": "markdown", + "id": "65458fc8", + "metadata": {}, + "source": [ + "## Simulation movie" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "9ff2b676", + "metadata": {}, + "outputs": [], + "source": [ + "nb_frames = 120\n", + "aperture = 0.01\n", + "focus = 2.938\n", + "key_frames = [\n", + " {\n", + " 'apertureRadius': aperture,\n", + " 'direction': [-0.0, 0.0, -1.0],\n", + " 'focusDistance': focus,\n", + " 'origin': [-0.12309164325388476, -68.17223360869282, 528.224633426888],\n", + " 'up': [-1.0, -6.661338147750939e-16, 0.0]\n", + " },\n", + " {\n", + " 'apertureRadius': aperture,\n", + " 'direction': [-0.0, 0.0, -1.0],\n", + " 'focusDistance': focus,\n", + " 'origin': [-0.12309164325388476, -68.17223360869282, 140.11376864318507],\n", + " 'up': [-1.0, -6.661338147750939e-16, 0.0]\n", + " },\n", + " {\n", + " 'apertureRadius': aperture,\n", + " 'direction': [0.0, 1.0, -2.220446049250313e-16],\n", + " 'focusDistance': focus,\n", + " 'origin': [-28.5, -67.86393737792969, -2.0],\n", + " 'up': [-0.0, 2.220446049250313e-16, 1.0]\n", + " },\n", + " {\n", + " 'apertureRadius': aperture,\n", + " 'direction': [-0.0, 1.0, -4.440892098500626e-16],\n", + " 'focusDistance': focus,\n", + " 'origin': [-29.22458300330654, -18.82142928630076, -2.386302379782111],\n", + " 'up': [0.0, 4.440892098500626e-16, 1.0]\n", + " },\n", + " {\n", + " 'apertureRadius': aperture,\n", + " 'direction': [-0.0, 1.0, -2.220446049250313e-16],\n", + " 'focusDistance': focus,\n", + " 'origin': [-29.22458300330654, -0.82142928630076, -2.386302379782111],\n", + " 'up': [0.0, 2.220446049250313e-16, 1.0]\n", + " },\n", + " {\n", + " 'apertureRadius': aperture,\n", + " 'direction': [0.9999970255814865, 1.5866404717910239e-21, -0.0024390219719829798],\n", + " 'focusDistance': focus,\n", + " 'origin': [-117.00812364660472, -14.7012431105328, -16.27792336717559],\n", + " 'up': [0.0, 1.0, 6.505232384196665e-19]\n", + " },\n", + " {\n", + " 'apertureRadius': aperture,\n", + " 'direction': [0.9999970255814865, 1.5866404717910239e-21, -0.0024390219719829798],\n", + " 'focusDistance': focus,\n", + " 'origin': [-117.00812364660472, -14.7012431105328, -16.27792336717559],\n", + " 'up': [0.0, 1.0, 6.505232384196665e-19]\n", + " }\n", + "]" + ] + }, + { + "cell_type": "markdown", + "id": "abb311ed", + "metadata": {}, + "source": [ + "### Get the model that contains the glucose molecules" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "5d459d82", + "metadata": {}, + "outputs": [], + "source": [ + "def euler_to_quaternion(yaw, pitch, roll):\n", + " import numpy as np\n", + " qx = np.sin(roll/2) * np.cos(pitch/2) * np.cos(yaw/2) - np.cos(roll/2) * np.sin(pitch/2) * np.sin(yaw/2)\n", + " qy = np.cos(roll/2) * np.sin(pitch/2) * np.cos(yaw/2) + np.sin(roll/2) * np.cos(pitch/2) * np.sin(yaw/2)\n", + " qz = np.cos(roll/2) * np.cos(pitch/2) * np.sin(yaw/2) - np.sin(roll/2) * np.sin(pitch/2) * np.cos(yaw/2)\n", + " qw = np.cos(roll/2) * np.cos(pitch/2) * np.cos(yaw/2) + np.sin(roll/2) * np.sin(pitch/2) * np.sin(yaw/2)\n", + "\n", + " return Quaternion(qx, qy, qz, qw)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "3752aae1", + "metadata": { + "scrolled": false + }, + "outputs": [], + "source": [ + "import math\n", + "from tqdm import tqdm\n", + "\n", + "version = 1\n", + "spp = 64\n", + "k = 1\n", + "\n", + "movie_folder = os.getenv('MOVIE_FOLDER', '/tmp')\n", + "output_folder = os.path.join(movie_folder, 'metabolism')\n", + "output_folder = os.path.join(output_folder, '%dK' % k)\n", + "output_folder = os.path.join(output_folder, 'v%d' % version)\n", + "if not os.path.isdir(output_folder):\n", + " print('Making folder ' + output_folder)\n", + " os.makedirs(output_folder, exist_ok=True)\n", + "\n", + "mm.build_camera_path(key_frames, nb_frames, nb_frames)\n", + "\n", + "if generate_movie:\n", + " core.set_application_parameters(image_stream_fps=0)\n", + " renderer='bio_explorer'\n", + " core.set_camera(current='bio_explorer_perspective')\n", + " \n", + " nb_frames = mm.get_nb_frames()\n", + " for frame in tqdm(range(nb_frames)):\n", + " setup_frame(frame, neuron=True, astrocyte=False, metabolites=True)\n", + " mm.set_current_frame(frame)\n", + "\n", + " ''' Set glucose molecule position '''\n", + " p = core.get_camera()['position']\n", + " t = core.get_camera()['target']\n", + " r = core.get_camera()['orientation']\n", + " \n", + " pos = [0,0,0]\n", + " for i in range(3):\n", + " pos[i] = p[i] + (t[i] - p[i]) * 3.0\n", + " \n", + " target = Vector3(pos[0], pos[1], pos[2])\n", + " glucose_model_name = 'Extracellular space_Glucose'\n", + "\n", + " roll = math.pi / 2.0 + 0.091 * math.pi * math.cos(frame * math.pi / 45.0)\n", + " yaw = 0.125 * math.pi * math.cos(frame * math.pi / 180.0)\n", + " pitch = 0\n", + "\n", + " be.set_protein_instance_transformation(\n", + " assembly_name=glucose_model_name,\n", + " name=glucose_model_name,\n", + " instance_index=0,\n", + " position=target,\n", + " rotation=Quaternion(r[3], r[0], r[1], r[2]) * euler_to_quaternion(yaw, pitch, roll)\n", + " )\n", + "\n", + " '''Generate image'''\n", + " mm.create_snapshot(\n", + " renderer=renderer,\n", + " size=[k * 960, k * 540], samples_per_pixel=spp,\n", + " path=output_folder, base_name='%05d' % frame)\n", + " \n", + " core.set_application_parameters(image_stream_fps=20)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3.8.10 64-bit", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.8.10" + }, + "vscode": { + "interpreter": { + "hash": "916dbcbb3f70747c44a77c7bcd40155683ae19c65e1c03b4aa3499c5328201f1" + } + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} \ No newline at end of file diff --git a/bioexplorer/pythonsdk/notebooks/metabolism/BioExplorer_metabolism_plots.ipynb b/bioexplorer/pythonsdk/notebooks/metabolism/BioExplorer_metabolism_plots.ipynb index 16292eb56..2d6dffafb 100644 --- a/bioexplorer/pythonsdk/notebooks/metabolism/BioExplorer_metabolism_plots.ipynb +++ b/bioexplorer/pythonsdk/notebooks/metabolism/BioExplorer_metabolism_plots.ipynb @@ -63,7 +63,6 @@ "outputs": [], "source": [ "if load_neuron:\n", - " print('Loading neuron')\n", " neuron_sql_filter = 'guid=989'\n", " neuron_assembly_name = 'Neuron'\n", " be.remove_assembly(neuron_assembly_name)\n", @@ -79,7 +78,6 @@ " sql_node_filter=neuron_sql_filter, scale=scale)\n", "\n", "if load_astrocyte:\n", - " print('Loading astrocytes...')\n", " astrocytes_sql_filter='guid=7178'\n", " assembly_name = 'Astrocytes'\n", " be.remove_assembly(assembly_name)\n", @@ -94,7 +92,6 @@ "\n", "if load_vasculature:\n", " vasculature_sql_filter = 'sqrt(pow(x - %f, 2) + pow(y - %f, 2) + pow(z - %f, 2)) < 40' % (scene_center[0], scene_center[1], scene_center[2])\n", - " print('Loading vasculature...')\n", " assembly_name = 'Vasculature'\n", " population_name = 'Vasculature'\n", " be.remove_assembly(assembly_name)\n", @@ -414,9 +411,10 @@ "outputs": [], "source": [ "from bioexplorer import MovieMaker\n", + "\n", "be = BioExplorer(URL)\n", "mm = MovieMaker(be)\n", - "output_folder = '/gpfs/bbp.cscs.ch/home/favreau/tmp'" + "output_folder = '/tmp'" ] }, { @@ -465,10 +463,8 @@ "metadata": {}, "outputs": [], "source": [ - "from IPython.display import clear_output\n", - "for frame in range(nb_frames):\n", - " clear_output()\n", - " print('Frame %d of %d' % (frame, nb_frames))\n", + "from tqdm import tqdm\n", + "for frame in tqdm(range(nb_frames)):\n", " core.set_animation_parameters(current=frame)\n", " mm.create_snapshot(\n", " renderer='metabolism',\n", @@ -551,7 +547,7 @@ "metadata": {}, "outputs": [], "source": [ - "from IPython.display import clear_output\n", + "from tqdm import tqdm\n", "import os\n", "\n", "with open('metabolites.log', 'w') as f:\n", @@ -564,10 +560,7 @@ " metabolism.set_metabolites(metabolite_ids, [min_value, max_value])\n", " \n", " f.write('%s (%f, %f - %f, %f - %f)' % (metabolite, scale, min_value, max_value, scale * min_value, scale * max_value))\n", - " for frame in range(nb_frames):\n", - " clear_output()\n", - " print('%s (%f, %f - %f, %f - %f)' % (metabolite, scale, min_value, max_value, scale * min_value, scale * max_value))\n", - " print('Frame %d/%d' % (frame, nb_frames))\n", + " for frame in tqdm(range(nb_frames)):\n", " core.set_animation_parameters(current=frame)\n", " mm.create_snapshot(\n", " renderer='metabolism',\n", diff --git a/bioexplorer/pythonsdk/notebooks/molecular_systems/BioExplorer_ACE2_Receptor.ipynb b/bioexplorer/pythonsdk/notebooks/molecular_systems/BioExplorer_ACE2_Receptor.ipynb index 00819450a..5ab4c6988 100644 --- a/bioexplorer/pythonsdk/notebooks/molecular_systems/BioExplorer_ACE2_Receptor.ipynb +++ b/bioexplorer/pythonsdk/notebooks/molecular_systems/BioExplorer_ACE2_Receptor.ipynb @@ -5,7 +5,6 @@ "metadata": {}, "source": [ "# Blue Brain BioExplorer\n", - "\n", "![](../bioexplorer_banner.png)" ] }, diff --git a/bioexplorer/pythonsdk/notebooks/molecular_systems/BioExplorer_cell.ipynb b/bioexplorer/pythonsdk/notebooks/molecular_systems/BioExplorer_cell.ipynb index 47ed48f98..487c3e6bf 100644 --- a/bioexplorer/pythonsdk/notebooks/molecular_systems/BioExplorer_cell.ipynb +++ b/bioexplorer/pythonsdk/notebooks/molecular_systems/BioExplorer_cell.ipynb @@ -1,260 +1,260 @@ { - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Blue Brain BioExplorer\n", - "\n", - "![](../bioexplorer_banner.png)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Simplest script to create a visualization of a cell" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "from bioexplorer import BioExplorer, Protein, Membrane, Cell, AnimationParams, Vector2, Vector3, Quaternion\n", - "be = BioExplorer('localhost:5000')\n", - "core = be.core_api()\n", - "status = be.reset_scene()\n", - "status = be.set_general_settings(model_visibility_on_creation=False)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "import glob\n", - "\n", - "name = 'Cell'\n", - "representation=be.REPRESENTATION_ATOMS_AND_STICKS\n", - "\n", - "# Resources\n", - "resource_folder = '../../tests/test_files/'\n", - "pdb_folder = resource_folder + 'pdb/'\n", - "membrane_folder = pdb_folder + 'membrane/'\n", - "lipids_folder = membrane_folder + 'lipids/'\n", - "transporters_folder = pdb_folder + 'transporters/'\n", - "\n", - "# ACE2 receptor definition\n", - "ace2_receptor = Protein(\n", - " name=be.NAME_TRANS_MEMBRANE + '_ACE2',\n", - " source=pdb_folder + '6m18.pdb',\n", - " occurences=25,\n", - " transmembrane_params=Vector2(-6.0, 6.0))\n", - "\n", - "# GLUT3 definition\n", - "transporter = Protein(\n", - " name=be.NAME_TRANS_MEMBRANE + '_GLUT3',\n", - " source=transporters_folder + '4zwc.pdb',\n", - " rotation=Quaternion(0.707, 0.707, 0.0, 0.0),\n", - " occurences=50, chain_ids=[1],\n", - " transmembrane_params=Vector2(-3.0, 3.0))\n", - "\n", - "# Membrane definition\n", - "lipids = glob.glob(lipids_folder + '*.pdb')[:4]\n", - "\n", - "membrane = Membrane(\n", - " load_non_polymer_chemicals=True, load_bonds=True,\n", - " lipid_sources=lipids,\n", - " lipid_density=1.0,\n", - " animation_params=AnimationParams(1, 1, 0.025, 2, 0.5)\n", - ")\n", - "\n", - "# Cell definition\n", - "cell_size = Vector3(800.0, 50.0, 800.0)\n", - "cell = Cell(\n", - " name=name,\n", - " shape=be.ASSEMBLY_SHAPE_SINUSOID,\n", - " shape_params=cell_size,\n", - " membrane=membrane,\n", - " proteins=[ace2_receptor, transporter])\n", - "\n", - "# Add cell to scene\n", - "status = be.add_cell(\n", - " cell=cell, atom_radius_multiplier=2.0, representation=representation)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "status = core.set_camera(\n", - " orientation=[-0.070, -0.041, 0.006, 0.996],\n", - " position=[-76.69645577433823, 158.9458079662124, 970.5532710962468],\n", - " target=[-14.769460404641611, 56.157789477305535, 243.45558273348504]\n", - ")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Rendering settings" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "status = be.core_api().set_renderer(\n", - " background_color=[96 / 255, 125 / 255, 139 / 255],\n", - " current='bio_explorer',\n", - " samples_per_pixel=1, subsampling=4, max_accum_frames=1000)\n", - "params = status = be.core_api().BioExplorerRendererParams()\n", - "params.gi_samples = 1\n", - "params.gi_weight = 0.3\n", - "params.gi_distance = 5\n", - "params.shadows = 0.8\n", - "params.soft_shadows = 1\n", - "params.fog_start = 1500\n", - "params.fog_thickness = 1500\n", - "params.max_bounces = 1\n", - "status = be.core_api().set_renderer_params(params)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Materials" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "be.apply_default_color_scheme(be.SHADING_MODE_BASIC)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "status = be.set_protein_color_scheme(\n", - " assembly_name=name, name=be.NAME_TRANS_MEMBRANE + '_ACE2',\n", - " color_scheme=be.COLOR_SCHEME_CHAINS,\n", - " palette_name='Greens', palette_size=5)\n", - "\n", - "status = be.set_protein_color_scheme(\n", - " assembly_name=name, name=be.NAME_TRANS_MEMBRANE + '_GLUT3',\n", - " color_scheme=be.COLOR_SCHEME_CHAINS,\n", - " palette_name='Blues', palette_size=5)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "be.set_models_visibility(True)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Modify receptor protein instance" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "'''Get receptor protein instance transformation'''\n", - "instance_index = 0\n", - "transformation = be.get_protein_instance_transformation(\n", - " assembly_name=name,\n", - " name=be.NAME_TRANS_MEMBRANE + '_ACE2',\n", - " instance_index=instance_index\n", - ")\n", - "print('Position = ' + str(transformation['position']))\n", - "print('Rotation = ' + str(transformation['rotation']))" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "'''Modify receptor protein instance transformation'''\n", - "status = be.set_protein_instance_transformation(\n", - " assembly_name=name,\n", - " name=be.NAME_TRANS_MEMBRANE + '_ACE2',\n", - " instance_index=instance_index,\n", - " position=Vector3(-93.6, 20.0, 308.8),\n", - " rotation=Quaternion(0.0182919, 0.0213303, 0.758803, 0.650714)\n", - ")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Snapshot" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "from bioexplorer import MovieMaker\n", - "mm = MovieMaker(be)\n", - "mm.create_snapshot(\n", - " renderer='bio_explorer', size=[1920, 1080], samples_per_pixel=64, \n", - " path='/tmp', base_name='cell')" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3.8.10 ('env')", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.8.10" - }, - "vscode": { - "interpreter": { - "hash": "ea9a5fa46eb6bad2806a8ea1d08e15bb1e255a2d4320b81e765591579963c56b" - } - } - }, - "nbformat": 4, - "nbformat_minor": 4 -} + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Blue Brain BioExplorer\n", + "\n", + "![](../bioexplorer_banner.png)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Simplest script to create a visualization of a cell" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "from bioexplorer import BioExplorer, Protein, Membrane, Cell, AnimationParams, Vector2, Vector3, Quaternion\n", + "be = BioExplorer('localhost:5000')\n", + "core = be.core_api()\n", + "status = be.reset_scene()\n", + "status = be.set_general_settings(model_visibility_on_creation=False)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import glob\n", + "\n", + "name = 'Cell'\n", + "representation=be.REPRESENTATION_ATOMS_AND_STICKS\n", + "\n", + "# Resources\n", + "resource_folder = '../../tests/test_files/'\n", + "pdb_folder = resource_folder + 'pdb/'\n", + "membrane_folder = pdb_folder + 'membrane/'\n", + "lipids_folder = membrane_folder + 'lipids/'\n", + "transporters_folder = pdb_folder + 'transporters/'\n", + "\n", + "# ACE2 receptor definition\n", + "ace2_receptor = Protein(\n", + " name=be.NAME_TRANS_MEMBRANE + '_ACE2',\n", + " source=pdb_folder + '6m18.pdb',\n", + " occurrences=25,\n", + " transmembrane_params=Vector2(-6.0, 6.0))\n", + "\n", + "# GLUT3 definition\n", + "transporter = Protein(\n", + " name=be.NAME_TRANS_MEMBRANE + '_GLUT3',\n", + " source=transporters_folder + '4zwc.pdb',\n", + " rotation=Quaternion(0.707, 0.707, 0.0, 0.0),\n", + " occurrences=50, chain_ids=[1],\n", + " transmembrane_params=Vector2(-3.0, 3.0))\n", + "\n", + "# Membrane definition\n", + "lipids = glob.glob(lipids_folder + '*.pdb')[:4]\n", + "\n", + "membrane = Membrane(\n", + " load_non_polymer_chemicals=True, load_bonds=True,\n", + " lipid_sources=lipids,\n", + " lipid_density=1.0,\n", + " animation_params=AnimationParams(1, 1, 0.025, 2, 0.5)\n", + ")\n", + "\n", + "# Cell definition\n", + "cell_size = Vector3(800.0, 50.0, 800.0)\n", + "cell = Cell(\n", + " name=name,\n", + " shape=be.ASSEMBLY_SHAPE_SINUSOID,\n", + " shape_params=cell_size,\n", + " membrane=membrane,\n", + " proteins=[ace2_receptor, transporter])\n", + "\n", + "# Add cell to scene\n", + "status = be.add_cell(\n", + " cell=cell, atom_radius_multiplier=2.0, representation=representation)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "status = core.set_camera(\n", + " orientation=[-0.070, -0.041, 0.006, 0.996],\n", + " position=[-76.69645577433823, 158.9458079662124, 970.5532710962468],\n", + " target=[-14.769460404641611, 56.157789477305535, 243.45558273348504]\n", + ")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Rendering settings" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "status = be.core_api().set_renderer(\n", + " background_color=[96 / 255, 125 / 255, 139 / 255],\n", + " current='bio_explorer',\n", + " samples_per_pixel=1, subsampling=4, max_accum_frames=1000)\n", + "params = status = be.core_api().BioExplorerRendererParams()\n", + "params.gi_samples = 1\n", + "params.gi_weight = 0.3\n", + "params.gi_distance = 5\n", + "params.shadows = 0.8\n", + "params.soft_shadows = 1\n", + "params.fog_start = 1500\n", + "params.fog_thickness = 1500\n", + "params.max_bounces = 1\n", + "status = be.core_api().set_renderer_params(params)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Materials" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "be.apply_default_color_scheme(be.SHADING_MODE_BASIC)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "status = be.set_protein_color_scheme(\n", + " assembly_name=name, name=be.NAME_TRANS_MEMBRANE + '_ACE2',\n", + " color_scheme=be.COLOR_SCHEME_CHAINS,\n", + " palette_name='Greens', palette_size=5)\n", + "\n", + "status = be.set_protein_color_scheme(\n", + " assembly_name=name, name=be.NAME_TRANS_MEMBRANE + '_GLUT3',\n", + " color_scheme=be.COLOR_SCHEME_CHAINS,\n", + " palette_name='Blues', palette_size=5)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "be.set_models_visibility(True)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Modify receptor protein instance" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "'''Get receptor protein instance transformation'''\n", + "instance_index = 0\n", + "transformation = be.get_protein_instance_transformation(\n", + " assembly_name=name,\n", + " name=be.NAME_TRANS_MEMBRANE + '_ACE2',\n", + " instance_index=instance_index\n", + ")\n", + "print('Position = ' + str(transformation['position']))\n", + "print('Rotation = ' + str(transformation['rotation']))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "'''Modify receptor protein instance transformation'''\n", + "status = be.set_protein_instance_transformation(\n", + " assembly_name=name,\n", + " name=be.NAME_TRANS_MEMBRANE + '_ACE2',\n", + " instance_index=instance_index,\n", + " position=Vector3(-93.6, 20.0, 308.8),\n", + " rotation=Quaternion(0.0182919, 0.0213303, 0.758803, 0.650714)\n", + ")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Snapshot" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "from bioexplorer import MovieMaker\n", + "mm = MovieMaker(be)\n", + "mm.create_snapshot(\n", + " renderer='bio_explorer', size=[1920, 1080], samples_per_pixel=64, \n", + " path='/tmp', base_name='cell')" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3.8.10 ('env')", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.8.10" + }, + "vscode": { + "interpreter": { + "hash": "ea9a5fa46eb6bad2806a8ea1d08e15bb1e255a2d4320b81e765591579963c56b" + } + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} \ No newline at end of file diff --git a/bioexplorer/pythonsdk/notebooks/molecular_systems/BioExplorer_cell_diffusion.ipynb b/bioexplorer/pythonsdk/notebooks/molecular_systems/BioExplorer_cell_diffusion.ipynb index 9f5278d49..8e160fab7 100644 --- a/bioexplorer/pythonsdk/notebooks/molecular_systems/BioExplorer_cell_diffusion.ipynb +++ b/bioexplorer/pythonsdk/notebooks/molecular_systems/BioExplorer_cell_diffusion.ipynb @@ -1,172 +1,172 @@ { - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Blue Brain BioExplorer\n", - "\n", - "![](../bioexplorer_banner.png)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "scrolled": true - }, - "outputs": [], - "source": [ - "from bioexplorer import BioExplorer, Protein, Volume, Vector3, AnimationParams\n", - "import nglview\n", - "\n", - "be = BioExplorer('localhost:5000')\n", - "status = be.reset_scene()" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Resources" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "resource_folder = '../../tests/test_files/'\n", - "pdb_folder = resource_folder + 'pdb/'\n", - "glucose_path = pdb_folder + 'glucose.pdb'" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Configuration" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "# Scene\n", - "scene_size = Vector3(50.0, 0.02, 0.4)\n", - "\n", - "# Immune system\n", - "nb_glucoses = 50000\n", - "\n", - "# Proteins\n", - "protein_radius_multiplier = 1.0\n", - "protein_representation = be.REPRESENTATION_ATOMS_AND_STICKS" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "#### Glucose" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "glucose = Protein(\n", - " name=be.NAME_GLUCOSE, \n", - " source=glucose_path, load_non_polymer_chemicals=True, \n", - " occurences=nb_glucoses, load_bonds=True, load_hydrogen=True,\n", - " animation_params=AnimationParams(3, 0, 0.0, 4, 1.0)\n", - ")\n", - "volume = Volume(\n", - " name=be.NAME_GLUCOSE,\n", - " shape=be.ASSEMBLY_SHAPE_CELL_DIFFUSION, shape_params=scene_size,\n", - " protein=glucose)\n", - "status = be.add_volume(\n", - " volume=volume, \n", - " representation=protein_representation,\n", - " atom_radius_multiplier=protein_radius_multiplier)\n", - "be.core_api().set_renderer()" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Rendering settings" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "status = be.reset_camera()\n", - "status = be.set_rendering_quality(be.RENDERING_QUALITY_HIGH)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "from bioexplorer import MovieMaker\n", - "mm = MovieMaker(be)\n", - "\n", - "for i in range(10, 200):\n", - " scene_size = Vector3(i, 0.01 + 0.0001 * i, 0.4)\n", - " glucose = Protein(\n", - " name=be.NAME_GLUCOSE, \n", - " source=glucose_path, load_non_polymer_chemicals=True, \n", - " occurences=nb_glucoses, load_bonds=True, load_hydrogen=True,\n", - " animation_params=AnimationParams(3, 0, 0.0, 4 + i, 1.0)\n", - " )\n", - " volume = Volume(\n", - " name=be.NAME_GLUCOSE,\n", - " shape=be.ASSEMBLY_SHAPE_CELL_DIFFUSION, shape_params=scene_size,\n", - " protein=glucose)\n", - " status = be.add_volume(\n", - " volume=volume, \n", - " representation=protein_representation,\n", - " atom_radius_multiplier=protein_radius_multiplier)\n", - " mm.create_snapshot(\n", - " renderer='bio_explorer', size=[1920, 1080], samples_per_pixel=16,\n", - " path='/home/favreau/Videos', base_name='%05d' % i\n", - " )\n" - ] - } - ], - "metadata": { - "interpreter": { - "hash": "ea9a5fa46eb6bad2806a8ea1d08e15bb1e255a2d4320b81e765591579963c56b" - }, - "kernelspec": { - "display_name": "Python 3.8.10 64-bit ('env': venv)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.8.10" - } - }, - "nbformat": 4, - "nbformat_minor": 4 -} + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Blue Brain BioExplorer\n", + "\n", + "![](../bioexplorer_banner.png)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "scrolled": true + }, + "outputs": [], + "source": [ + "from bioexplorer import BioExplorer, Protein, Volume, Vector3, AnimationParams\n", + "import nglview\n", + "\n", + "be = BioExplorer('localhost:5000')\n", + "status = be.reset_scene()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Resources" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "resource_folder = '../../tests/test_files/'\n", + "pdb_folder = resource_folder + 'pdb/'\n", + "glucose_path = pdb_folder + 'glucose.pdb'" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Configuration" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# Scene\n", + "scene_size = Vector3(50.0, 0.02, 0.4)\n", + "\n", + "# Immune system\n", + "nb_glucoses = 50000\n", + "\n", + "# Proteins\n", + "protein_radius_multiplier = 1.0\n", + "protein_representation = be.REPRESENTATION_ATOMS_AND_STICKS" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#### Glucose" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "glucose = Protein(\n", + " name=be.NAME_GLUCOSE, \n", + " source=glucose_path, load_non_polymer_chemicals=True, \n", + " occurrences=nb_glucoses, load_bonds=True, load_hydrogen=True,\n", + " animation_params=AnimationParams(3, 0, 0.0, 4, 1.0)\n", + ")\n", + "volume = Volume(\n", + " name=be.NAME_GLUCOSE,\n", + " shape=be.ASSEMBLY_SHAPE_CELL_DIFFUSION, shape_params=scene_size,\n", + " protein=glucose)\n", + "status = be.add_volume(\n", + " volume=volume, \n", + " representation=protein_representation,\n", + " atom_radius_multiplier=protein_radius_multiplier)\n", + "be.core_api().set_renderer()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Rendering settings" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "status = be.reset_camera()\n", + "status = be.set_rendering_quality(be.RENDERING_QUALITY_HIGH)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "from bioexplorer import MovieMaker\n", + "mm = MovieMaker(be)\n", + "\n", + "for i in range(10, 200):\n", + " scene_size = Vector3(i, 0.01 + 0.0001 * i, 0.4)\n", + " glucose = Protein(\n", + " name=be.NAME_GLUCOSE, \n", + " source=glucose_path, load_non_polymer_chemicals=True, \n", + " occurrences=nb_glucoses, load_bonds=True, load_hydrogen=True,\n", + " animation_params=AnimationParams(3, 0, 0.0, 4 + i, 1.0)\n", + " )\n", + " volume = Volume(\n", + " name=be.NAME_GLUCOSE,\n", + " shape=be.ASSEMBLY_SHAPE_CELL_DIFFUSION, shape_params=scene_size,\n", + " protein=glucose)\n", + " status = be.add_volume(\n", + " volume=volume, \n", + " representation=protein_representation,\n", + " atom_radius_multiplier=protein_radius_multiplier)\n", + " mm.create_snapshot(\n", + " renderer='bio_explorer', size=[1920, 1080], samples_per_pixel=16,\n", + " path='/home/favreau/Videos', base_name='%05d' % i\n", + " )\n" + ] + } + ], + "metadata": { + "interpreter": { + "hash": "ea9a5fa46eb6bad2806a8ea1d08e15bb1e255a2d4320b81e765591579963c56b" + }, + "kernelspec": { + "display_name": "Python 3.8.10 64-bit ('env': venv)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.8.10" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} \ No newline at end of file diff --git a/bioexplorer/pythonsdk/notebooks/molecular_systems/BioExplorer_enzyme_reaction.ipynb b/bioexplorer/pythonsdk/notebooks/molecular_systems/BioExplorer_enzyme_reaction.ipynb index a8fccb1d0..22490f6a0 100644 --- a/bioexplorer/pythonsdk/notebooks/molecular_systems/BioExplorer_enzyme_reaction.ipynb +++ b/bioexplorer/pythonsdk/notebooks/molecular_systems/BioExplorer_enzyme_reaction.ipynb @@ -1,330 +1,329 @@ { - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Blue Brain BioExplorer\n", - "\n", - "![](../bioexplorer_banner.png)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Simplest script to create a visualization of an enzyme reaction" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "from bioexplorer import BioExplorer, Protein, EnzymeReaction, AnimationParams, \\\n", - " Volume, Vector3, Quaternion\n", - "import os\n", - "\n", - "be = BioExplorer('localhost:5000')\n", - "core = be.core_api()\n", - "status = be.reset_scene()" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "representation=be.REPRESENTATION_ATOMS_AND_STICKS\n", - "atom_radius_multiplier=1.0\n", - "draft = True\n", - "generate_movie = False\n", - "\n", - "# Resources\n", - "resource_folder = '../../tests/test_files/'\n", - "pdb_folder = os.path.join(resource_folder, 'pdb')\n", - "metabolites_folder = os.path.join(pdb_folder, 'metabolites')\n", - "enzymes_folder = os.path.join(pdb_folder, 'enzymes')\n", - "mesh_folder = os.path.join(resource_folder, 'obj')\n", - "\n", - "pdb_glucose = os.path.join(metabolites_folder, '5793.pdb')\n", - "pdb_atp = os.path.join(metabolites_folder, '59.pdb')\n", - "pdb_g6p = os.path.join(metabolites_folder, '439284.pdb')\n", - "pdb_adp = os.path.join(metabolites_folder, '6022.pdb')\n", - "pdb_hexokinase = os.path.join(enzymes_folder, '1bdg.pdb')\n", - "\n", - "be.set_general_settings(logging_level=3, mesh_folder=mesh_folder)\n", - "\n", - "scene_size = Vector3(200.0, 200.0, 200.0)\n", - "nb_occurences = 200\n", - "seed = 5" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "def add_molecule(\n", - " seed, position_seed, name, pdb_file, nb_occurence,\n", - " representation=be.REPRESENTATION_ATOMS_AND_STICKS, rotation=Quaternion()):\n", - " protein = Protein(\n", - " name=name,\n", - " source=pdb_file,\n", - " load_bonds=True, load_hydrogen=True, load_non_polymer_chemicals=True,\n", - " occurences=nb_occurence, animation_params=AnimationParams(seed, position_seed, 25.0, seed, 0.025),\n", - " rotation=rotation\n", - " )\n", - " volume = Volume(\n", - " name=name + 's',\n", - " shape=be.ASSEMBLY_SHAPE_CUBE, shape_params=scene_size,\n", - " protein=protein)\n", - " be.add_volume(\n", - " volume=volume,\n", - " atom_radius_multiplier=atom_radius_multiplier, representation=representation)\n", - " return protein\n", - "\n", - "# Substrates\n", - "substrates = list()\n", - "substrates.append(\n", - " add_molecule(seed, 6, 'Glucose', pdb_glucose, nb_occurences))\n", - "substrates.append(\n", - " add_molecule(seed, 7, 'ATP', pdb_atp, nb_occurences))\n", - "\n", - "# Product\n", - "products = list()\n", - "products.append(\n", - " add_molecule(seed, 8, 'G6P', pdb_g6p, nb_occurences))\n", - "products.append(\n", - " add_molecule(seed, 9, 'ADP', pdb_adp, nb_occurences))\n", - "\n", - "# Hexokinase\n", - "enzyme = add_molecule(\n", - " seed, 0, 'Hexokinase', pdb_hexokinase, nb_occurences, \n", - " be.REPRESENTATION_MESH, Quaternion(0.707, 0.707, 0.0, 0.0)\n", - ")\n", - "\n", - "# Enzyme reaction\n", - "enzyme_reaction = EnzymeReaction(\n", - " assembly_name='Hexokinase',\n", - " name='Hexokinase',\n", - " enzyme=enzyme,\n", - " substrates=substrates,\n", - " products=products)\n", - "\n", - "# Add the reaction to the scene\n", - "be.add_enzyme_reaction(enzyme_reaction)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Rendering settings" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "status = be.core_api().set_renderer(\n", - " background_color=[96 / 255, 125 / 255, 139 / 255],\n", - " current='bio_explorer',\n", - " samples_per_pixel=1, subsampling=4, max_accum_frames=16)\n", - "params = status = be.core_api().BioExplorerRendererParams()\n", - "params.gi_samples = 2\n", - "params.gi_weight = 0.2\n", - "params.gi_distance = 5\n", - "params.shadows = 1.0\n", - "params.soft_shadows = 1.0\n", - "params.fog_start = 1500\n", - "params.fog_thickness = 1500\n", - "params.max_bounces = 1\n", - "status = be.core_api().set_renderer_params(params)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Materials" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "status = be.set_protein_color_scheme(\n", - " assembly_name='ATPs', name='ATP',\n", - " color_scheme=be.COLOR_SCHEME_ATOMS,\n", - " palette_name='Blues', palette_size=2)\n", - "\n", - "status = be.set_protein_color_scheme(\n", - " assembly_name='Glucoses', name='Glucose',\n", - " color_scheme=be.COLOR_SCHEME_ATOMS,\n", - " palette_name='Blues', palette_size=2)\n", - "\n", - "\n", - "status = be.set_protein_color_scheme(\n", - " assembly_name='ADPs', name='ADP',\n", - " color_scheme=be.COLOR_SCHEME_ATOMS,\n", - " palette_name='Set1', palette_size=3)\n", - "\n", - "status = be.set_protein_color_scheme(\n", - " assembly_name='G6Ps', name='G6P',\n", - " color_scheme=be.COLOR_SCHEME_ATOMS,\n", - " palette_name='Set1', palette_size=3)\n", - "\n", - "status = be.set_protein_color_scheme(\n", - " assembly_name='Hexokinases', name='Hexokinase',\n", - " color_scheme=be.COLOR_SCHEME_CHAINS,\n", - " palette_name='Reds', palette_size=2)\n", - "be.core_api().set_renderer()" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Movie" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "from bioexplorer import MovieMaker\n", - "from IPython.display import clear_output\n", - "mm = MovieMaker(be)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "if draft:\n", - " instance_id = 2\n", - " key_frames = [\n", - " {\n", - " 'apertureRadius': 0.0,\n", - " 'direction': [-0.4228059199334163, 0.13956182704765893, -0.8954092084071824],\n", - " 'focusDistance': 1000000.0,\n", - " 'origin': [-76.94388312721057, 27.008762696107365, 101.90818416814368],\n", - " 'up': [0.03825535069708487, 0.9899381257456357, 0.13623155045091803]\n", - " }, \n", - " {\n", - " 'apertureRadius': 0.0,\n", - " 'direction': [-0.2931756929393873, -0.19137884221190335, -0.9367081465553406],\n", - " 'focusDistance': 1000000.0,\n", - " 'origin': [-80.78751362339919, 32.810933007328735, 98.7370846157903],\n", - " 'up': [-0.04288359642471887, 0.9814064493156495, -0.18708922577030282]\n", - " }\n", - " ]\n", - "else:\n", - " instance_id = 25\n", - " key_frames = [\n", - " {\n", - " 'apertureRadius': 0.0,\n", - " 'direction': [-0.813281188551245, -0.09740833983733163, -0.5736595886750337],\n", - " 'focusDistance': 1000000.0,\n", - " 'origin': [11.06562396175978, -42.45183472913227, 71.07319024762178],\n", - " 'up': [-0.26548353789130863, 0.9394084115205614, 0.2168647677081957]\n", - " }, \n", - " {\n", - " 'apertureRadius': 0.0,\n", - " 'direction': [-0.06265926430929034, -0.21184739821321946, -0.975292005743156],\n", - " 'focusDistance': 1000000.0,\n", - " 'origin': [-3.900908980540925, -40.62438454349056, 76.12253643837245],\n", - " 'up': [0.09475544149237422, 0.9715352310065103, -0.21711909455575734]\n", - " }\n", - " ] " - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "nb_frames = 360\n", - "output_folder = '/tmp'\n", - "if draft:\n", - " image_size=[960, 540]\n", - "else:\n", - " image_size=[3840, 2160]\n", - "\n", - "mm.build_camera_path(key_frames, nb_frames, 1)\n", - "\n", - "if generate_movie:\n", - " for frame in range(nb_frames):\n", - " clear_output()\n", - " mm.set_current_frame(frame)\n", - " for instance in range(nb_occurences):\n", - " progress = float(frame + instance) / float(nb_frames)\n", - " be.set_enzyme_reaction_progress(\n", - " enzyme_reaction, instance_id=instance, progress=progress)\n", - " mm.create_snapshot(\n", - " renderer='bio_explorer',\n", - " path=output_folder + '/bio_explorer', base_name='%05d' % frame,\n", - " size=image_size, samples_per_pixel=64)\n", - " mm.create_snapshot(\n", - " renderer='depth',\n", - " path=output_folder + '/depth', base_name='%05d' % frame,\n", - " size=image_size, samples_per_pixel=1)\n", - "else:\n", - " be.core_api().set_renderer(\n", - " current='basic',\n", - " samples_per_pixel=1, subsampling=1, max_accum_frames=1)\n", - " model_id = core.scene.models[len(core.scene.models)-1]['id']\n", - " import time\n", - " for frame in range(nb_frames):\n", - " clear_output()\n", - " mm.set_current_frame(frame)\n", - " progress = float(frame) / float(nb_frames)\n", - " for instance in range(nb_occurences):\n", - " progress = float(frame + instance) / float(nb_frames)\n", - " be.set_enzyme_reaction_progress(\n", - " enzyme_reaction, instance_id=instance, progress=progress)\n", - " be.core_api().set_renderer()\n", - " time.sleep(0.1)" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3.8.10 ('env')", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.8.10" - }, - "vscode": { - "interpreter": { - "hash": "ea9a5fa46eb6bad2806a8ea1d08e15bb1e255a2d4320b81e765591579963c56b" - } - } - }, - "nbformat": 4, - "nbformat_minor": 4 -} + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Blue Brain BioExplorer\n", + "\n", + "![](../bioexplorer_banner.png)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Simplest script to create a visualization of an enzyme reaction" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "from bioexplorer import BioExplorer, Protein, EnzymeReaction, AnimationParams, \\\n", + " Volume, Vector3, Quaternion\n", + "import os\n", + "\n", + "be = BioExplorer('localhost:5000')\n", + "core = be.core_api()\n", + "status = be.reset_scene()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "representation=be.REPRESENTATION_ATOMS_AND_STICKS\n", + "atom_radius_multiplier=1.0\n", + "draft = True\n", + "generate_movie = False\n", + "\n", + "# Resources\n", + "resource_folder = '../../tests/test_files'\n", + "pdb_folder = os.path.join(resource_folder, 'pdb')\n", + "metabolites_folder = os.path.join(pdb_folder, 'metabolites')\n", + "enzymes_folder = os.path.join(pdb_folder, 'enzymes')\n", + "mesh_folder = os.path.join(resource_folder, 'obj')\n", + "\n", + "pdb_glucose = os.path.join(metabolites_folder, '5793.pdb')\n", + "pdb_atp = os.path.join(metabolites_folder, '59.pdb')\n", + "pdb_g6p = os.path.join(metabolites_folder, '439284.pdb')\n", + "pdb_adp = os.path.join(metabolites_folder, '6022.pdb')\n", + "pdb_hexokinase = os.path.join(enzymes_folder, '1bdg.pdb')\n", + "\n", + "be.set_general_settings(logging_level=3, mesh_folder=mesh_folder)\n", + "\n", + "scene_size = Vector3(200.0, 200.0, 200.0)\n", + "nb_occurences = 200\n", + "seed = 5" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "def add_molecule(\n", + " seed, position_seed, name, pdb_file, nb_occurence,\n", + " representation=be.REPRESENTATION_ATOMS_AND_STICKS, rotation=Quaternion()):\n", + " protein = Protein(\n", + " name=name,\n", + " source=pdb_file,\n", + " load_bonds=True, load_hydrogen=True, load_non_polymer_chemicals=True,\n", + " occurrences=nb_occurence, animation_params=AnimationParams(seed, position_seed, 25.0, seed, 0.025),\n", + " rotation=rotation\n", + " )\n", + " volume = Volume(\n", + " name=name + 's',\n", + " shape=be.ASSEMBLY_SHAPE_CUBE, shape_params=scene_size,\n", + " protein=protein)\n", + " be.add_volume(\n", + " volume=volume,\n", + " atom_radius_multiplier=atom_radius_multiplier, representation=representation)\n", + " return protein\n", + "\n", + "# Substrates\n", + "substrates = list()\n", + "substrates.append(\n", + " add_molecule(seed, 6, 'Glucose', pdb_glucose, nb_occurences))\n", + "substrates.append(\n", + " add_molecule(seed, 7, 'ATP', pdb_atp, nb_occurences))\n", + "\n", + "# Product\n", + "products = list()\n", + "products.append(\n", + " add_molecule(seed, 8, 'G6P', pdb_g6p, nb_occurences))\n", + "products.append(\n", + " add_molecule(seed, 9, 'ADP', pdb_adp, nb_occurences))\n", + "\n", + "# Hexokinase\n", + "enzyme = add_molecule(\n", + " seed, 0, 'Hexokinase', pdb_hexokinase, nb_occurences, \n", + " be.REPRESENTATION_ATOMS_AND_STICKS, Quaternion(0.707, 0.707, 0.0, 0.0)\n", + ")\n", + "\n", + "# Enzyme reaction\n", + "enzyme_reaction = EnzymeReaction(\n", + " assembly_name='Hexokinase',\n", + " name='Hexokinase',\n", + " enzyme=enzyme,\n", + " substrates=substrates,\n", + " products=products)\n", + "\n", + "# Add the reaction to the scene\n", + "status = be.add_enzyme_reaction(enzyme_reaction)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Rendering settings" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "status = be.core_api().set_renderer(\n", + " background_color=[96 / 255, 125 / 255, 139 / 255],\n", + " current='bio_explorer',\n", + " samples_per_pixel=1, subsampling=4, max_accum_frames=16)\n", + "params = status = be.core_api().BioExplorerRendererParams()\n", + "params.gi_samples = 2\n", + "params.gi_weight = 0.2\n", + "params.gi_distance = 5\n", + "params.shadows = 1.0\n", + "params.soft_shadows = 1.0\n", + "params.fog_start = 1500\n", + "params.fog_thickness = 1500\n", + "params.max_bounces = 1\n", + "status = be.core_api().set_renderer_params(params)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Materials" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "status = be.set_protein_color_scheme(\n", + " assembly_name='ATPs', name='ATP',\n", + " color_scheme=be.COLOR_SCHEME_ATOMS,\n", + " palette_name='Blues', palette_size=2)\n", + "\n", + "status = be.set_protein_color_scheme(\n", + " assembly_name='Glucoses', name='Glucose',\n", + " color_scheme=be.COLOR_SCHEME_ATOMS,\n", + " palette_name='Blues', palette_size=2)\n", + "\n", + "\n", + "status = be.set_protein_color_scheme(\n", + " assembly_name='ADPs', name='ADP',\n", + " color_scheme=be.COLOR_SCHEME_ATOMS,\n", + " palette_name='Set1', palette_size=3)\n", + "\n", + "status = be.set_protein_color_scheme(\n", + " assembly_name='G6Ps', name='G6P',\n", + " color_scheme=be.COLOR_SCHEME_ATOMS,\n", + " palette_name='Set1', palette_size=3)\n", + "\n", + "status = be.set_protein_color_scheme(\n", + " assembly_name='Hexokinases', name='Hexokinase',\n", + " color_scheme=be.COLOR_SCHEME_CHAINS,\n", + " palette_name='Reds', palette_size=2)\n", + "be.core_api().set_renderer()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Movie" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "from bioexplorer import MovieMaker\n", + "mm = MovieMaker(be)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "if draft:\n", + " instance_id = 2\n", + " key_frames = [\n", + " {\n", + " 'apertureRadius': 0.0,\n", + " 'direction': [-0.4228059199334163, 0.13956182704765893, -0.8954092084071824],\n", + " 'focusDistance': 1000000.0,\n", + " 'origin': [-76.94388312721057, 27.008762696107365, 101.90818416814368],\n", + " 'up': [0.03825535069708487, 0.9899381257456357, 0.13623155045091803]\n", + " }, \n", + " {\n", + " 'apertureRadius': 0.0,\n", + " 'direction': [-0.2931756929393873, -0.19137884221190335, -0.9367081465553406],\n", + " 'focusDistance': 1000000.0,\n", + " 'origin': [-80.78751362339919, 32.810933007328735, 98.7370846157903],\n", + " 'up': [-0.04288359642471887, 0.9814064493156495, -0.18708922577030282]\n", + " }\n", + " ]\n", + "else:\n", + " instance_id = 25\n", + " key_frames = [\n", + " {\n", + " 'apertureRadius': 0.0,\n", + " 'direction': [-0.813281188551245, -0.09740833983733163, -0.5736595886750337],\n", + " 'focusDistance': 1000000.0,\n", + " 'origin': [11.06562396175978, -42.45183472913227, 71.07319024762178],\n", + " 'up': [-0.26548353789130863, 0.9394084115205614, 0.2168647677081957]\n", + " }, \n", + " {\n", + " 'apertureRadius': 0.0,\n", + " 'direction': [-0.06265926430929034, -0.21184739821321946, -0.975292005743156],\n", + " 'focusDistance': 1000000.0,\n", + " 'origin': [-3.900908980540925, -40.62438454349056, 76.12253643837245],\n", + " 'up': [0.09475544149237422, 0.9715352310065103, -0.21711909455575734]\n", + " }\n", + " ] " + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "from tqdm import tqdm\n", + "\n", + "nb_frames = 360\n", + "output_folder = '/tmp'\n", + "if draft:\n", + " image_size=[960, 540]\n", + "else:\n", + " image_size=[3840, 2160]\n", + "\n", + "mm.build_camera_path(key_frames, nb_frames, 1)\n", + "\n", + "if generate_movie:\n", + " for frame in tqdm(range(nb_frames)):\n", + " mm.set_current_frame(frame)\n", + " for instance in range(nb_occurences):\n", + " progress = float(frame + instance) / float(nb_frames)\n", + " be.set_enzyme_reaction_progress(\n", + " enzyme_reaction, instance_id=instance, progress=progress)\n", + " mm.create_snapshot(\n", + " renderer='bio_explorer',\n", + " path=os.path.join(output_folder, 'bio_explorer'), base_name='%05d' % frame,\n", + " size=image_size, samples_per_pixel=64)\n", + " mm.create_snapshot(\n", + " renderer='depth',\n", + " path=os.path.join(output_folder, 'depth'), base_name='%05d' % frame,\n", + " size=image_size, samples_per_pixel=1)\n", + "else:\n", + " be.core_api().set_renderer(\n", + " current='basic',\n", + " samples_per_pixel=1, subsampling=1, max_accum_frames=1)\n", + " model_id = core.scene.models[len(core.scene.models)-1]['id']\n", + " import time\n", + " for frame in tqdm(range(nb_frames)):\n", + " mm.set_current_frame(frame)\n", + " progress = float(frame) / float(nb_frames)\n", + " for instance in range(nb_occurences):\n", + " progress = float(frame + instance) / float(nb_frames)\n", + " be.set_enzyme_reaction_progress(\n", + " enzyme_reaction, instance_id=instance, progress=progress)\n", + " be.core_api().set_renderer()\n", + " time.sleep(0.1)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3.8.10 ('env')", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.8.10" + }, + "vscode": { + "interpreter": { + "hash": "ea9a5fa46eb6bad2806a8ea1d08e15bb1e255a2d4320b81e765591579963c56b" + } + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} \ No newline at end of file diff --git a/bioexplorer/pythonsdk/notebooks/molecular_systems/BioExplorer_full_scene.ipynb b/bioexplorer/pythonsdk/notebooks/molecular_systems/BioExplorer_full_scene.ipynb index 7d8fde13d..32fcd1f3c 100644 --- a/bioexplorer/pythonsdk/notebooks/molecular_systems/BioExplorer_full_scene.ipynb +++ b/bioexplorer/pythonsdk/notebooks/molecular_systems/BioExplorer_full_scene.ipynb @@ -21,7 +21,7 @@ " Cell, Sugar, Vector2, Vector3, Quaternion, AnimationParams\n", "import nglview\n", "\n", - "be = BioExplorer('localhost:5000')" + "be = BioExplorer('localhost:5000') " ] }, { @@ -158,14 +158,14 @@ "ace2_receptor = Protein(\n", " name=name + '_' + be.NAME_RECEPTOR,\n", " source=pdb_folder + '6m18.pdb',\n", - " occurences=1,\n", + " occurrences=1,\n", " transmembrane_params=Vector2(-6.0, 7.0),\n", " animation_params=AnimationParams(1))\n", "\n", "ion_channel = Protein(\n", " name=name + '_' + be.NAME_ION_CHANNEL,\n", " source=ion_channels_folder + '5kuk.pdb',\n", - " occurences=5,\n", + " occurrences=5,\n", " transmembrane_params=Vector2(-1.0, 1.0),\n", " animation_params=AnimationParams(2))\n", "\n", @@ -290,7 +290,7 @@ "glucose = Protein(\n", " name=be.NAME_GLUCOSE, \n", " source=glucose_path, load_non_polymer_chemicals=True, \n", - " occurences=nb_glucoses,\n", + " occurrences=nb_glucoses,\n", " animation_params=AnimationParams(3)\n", ")\n", "volume = Volume(\n", @@ -329,7 +329,7 @@ "lactoferrin = Protein(\n", " name=be.NAME_LACTOFERRIN, \n", " source=lactoferrin_path, load_non_polymer_chemicals=True,\n", - " occurences=nb_lactoferrins,\n", + " occurrences=nb_lactoferrins,\n", " animation_params=AnimationParams(4)\n", ")\n", "lactoferrins_volume = Volume(\n", @@ -368,7 +368,7 @@ "defensin = Protein(\n", " name=be.NAME_DEFENSIN, \n", " source=defensin_path, load_non_polymer_chemicals=True, \n", - " occurences=nb_defensins,\n", + " occurrences=nb_defensins,\n", " animation_params=AnimationParams(5)\n", ")\n", "defensins_volume = Volume(\n", @@ -548,4 +548,4 @@ }, "nbformat": 4, "nbformat_minor": 4 -} +} \ No newline at end of file diff --git a/bioexplorer/pythonsdk/notebooks/molecular_systems/BioExplorer_ion_channels_in_cell.ipynb b/bioexplorer/pythonsdk/notebooks/molecular_systems/BioExplorer_ion_channels_in_cell.ipynb index 6450ee934..20e8ab51e 100644 --- a/bioexplorer/pythonsdk/notebooks/molecular_systems/BioExplorer_ion_channels_in_cell.ipynb +++ b/bioexplorer/pythonsdk/notebooks/molecular_systems/BioExplorer_ion_channels_in_cell.ipynb @@ -1,238 +1,238 @@ { - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Blue Brain BioExplorer\n", - "\n", - "![](../bioexplorer_banner.png)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Cell with ion channels" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "from bioexplorer import BioExplorer, Protein, Membrane, Cell, AnimationParams, Vector2, Vector3, Quaternion\n", - "be = BioExplorer()\n", - "core = be.core_api()\n", - "status = be.reset_scene()\n", - "status = be.set_general_settings(model_visibility_on_creation=True)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "name = 'Cell'\n", - "representation=be.REPRESENTATION_ATOMS_AND_STICKS\n", - "atom_radius_multiplier = 2.0\n", - "\n", - "# Resources\n", - "resource_folder = '../../tests/test_files/'\n", - "pdb_folder = resource_folder + 'pdb/'\n", - "membrane_folder = pdb_folder + 'membrane/'\n", - "lipids_folder = membrane_folder + 'lipids/'\n", - "ion_channels_folder = pdb_folder + 'ion_channels/'\n", - "\n", - "\n", - "# ACE2\n", - "ace2_receptor = Protein(\n", - " name=name + '_' + BioExplorer.NAME_RECEPTOR,\n", - " source=pdb_folder + '6m18.pdb',\n", - " occurences=5,\n", - " rotation=Quaternion(1.0, 0.0, 0.0, 0.0),\n", - " transmembrane_params=Vector2(6.0, 3.0),\n", - " load_non_polymer_chemicals=True,\n", - " animation_params=AnimationParams(10)\n", - ")\n", - "\n", - "\n", - "# Ion channel 1\n", - "ion_channel_1 = Protein(\n", - " name=name + '_' + BioExplorer.NAME_ION_CHANNEL + '_1',\n", - " source=ion_channels_folder + '6uz3.pdb',\n", - " occurences=5,\n", - " rotation=Quaternion(0.0, 0.707, 0.707, 0.0),\n", - " transmembrane_params=Vector2(1.0, 3.0),\n", - " animation_params=AnimationParams(20)\n", - ")\n", - "\n", - "# Ion channel 2\n", - "ion_channel_2 = Protein(\n", - " name=name + '_' + BioExplorer.NAME_ION_CHANNEL + '_2',\n", - " source=ion_channels_folder + 'AF-O88704.pdb',\n", - " occurences=7,\n", - " rotation=Quaternion(0.0, 0.707, 0.707, 0.0),\n", - " transmembrane_params=Vector2(1.0, 3.0),\n", - " load_non_polymer_chemicals=True,\n", - " animation_params=AnimationParams(30)\n", - ")\n", - "\n", - "# Ion channel 3\n", - "ion_channel_3 = Protein(\n", - " name=name + '_' + BioExplorer.NAME_ION_CHANNEL + '_3',\n", - " source=ion_channels_folder + 'AF-P16388.pdb',\n", - " occurences=4,\n", - " rotation=Quaternion(0.0, 0.707, 0.707, 0.0),\n", - " transmembrane_params=Vector2(1.0, 3.0),\n", - " load_non_polymer_chemicals=True,\n", - " animation_params=AnimationParams(40)\n", - ")\n", - "\n", - "# Membrane definition\n", - "import glob\n", - "lipids = glob.glob(membrane_folder + '*.pdb')\n", - "membrane_size = Vector3(200.0, 0.0, 200.0)\n", - "membrane = Membrane(\n", - " lipid_sources=lipids,\n", - " # lipid_rotation=Quaternion(0.0, 0.707, 0.707, 0.0),\n", - " load_bonds=True, load_non_polymer_chemicals=True,\n", - " animation_params=AnimationParams(0, 0, 0.0, 2, 0.5)\n", - ")\n", - "\n", - "# Cell definition\n", - "cell = Cell(\n", - " name=name,\n", - " shape=be.ASSEMBLY_SHAPE_PLANE,\n", - " shape_params = membrane_size,\n", - " membrane=membrane,\n", - " proteins=[\n", - " ace2_receptor, ion_channel_1,\n", - " ion_channel_2, ion_channel_3])\n", - "\n", - "# Add cell to scene\n", - "status = be.add_cell(\n", - " cell=cell, representation=representation,\n", - " atom_radius_multiplier=atom_radius_multiplier)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "be.apply_default_color_scheme(\n", - " shading_mode=be.SHADING_MODE_DIFFUSE,\n", - " specular_exponent=50.0\n", - ")\n", - "\n", - "status = be.set_protein_color_scheme(\n", - " assembly_name=name,\n", - " name=name + '_' + BioExplorer.NAME_RECEPTOR,\n", - " color_scheme=BioExplorer.COLOR_SCHEME_CHAINS,\n", - " palette_name='Set1', palette_size=8\n", - ")\n", - "\n", - "status = be.set_protein_color_scheme(\n", - " assembly_name=name,\n", - " name=name + '_' + BioExplorer.NAME_ION_CHANNEL + '_1',\n", - " color_scheme=BioExplorer.COLOR_SCHEME_CHAINS,\n", - " palette_name='Set1', palette_size=3\n", - ")\n", - "\n", - "status = be.set_protein_color_scheme(\n", - " assembly_name=name,\n", - " name=name + '_' + BioExplorer.NAME_ION_CHANNEL + '_2',\n", - " color_scheme=BioExplorer.COLOR_SCHEME_CHAINS,\n", - " palette_name='Set2', palette_size=3\n", - ")\n", - "\n", - "status = be.set_protein_color_scheme(\n", - " assembly_name=name,\n", - " name=name + '_' + BioExplorer.NAME_ION_CHANNEL + '_3',\n", - " color_scheme=BioExplorer.COLOR_SCHEME_CHAINS,\n", - " palette_name='Set3', palette_size=3\n", - ")" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "status = core.set_camera(\n", - " orientation=[-0.298, -0.328, -0.076, 0.892],\n", - " position=[-105.37947598005452, 101.85359991498215, 120.69225266060364],\n", - " target=[4.306267491056144, -16.428973285137587, -1.9142757282462584]\n", - ")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Rendering settings" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "status = be.set_rendering_quality(be.RENDERING_QUALITY_HIGH)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Snaphot" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "from bioexplorer import MovieMaker\n", - "mm = MovieMaker(be)\n", - "mm.create_snapshot(\n", - " renderer='bio_explorer',\n", - " path='/tmp', base_name='ion_channels_in_membrane_surface',\n", - " size=[512, 512], samples_per_pixel=64)" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3.8.10 ('env')", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.8.10" - }, - "vscode": { - "interpreter": { - "hash": "ea9a5fa46eb6bad2806a8ea1d08e15bb1e255a2d4320b81e765591579963c56b" - } - } - }, - "nbformat": 4, - "nbformat_minor": 4 -} + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Blue Brain BioExplorer\n", + "\n", + "![](../bioexplorer_banner.png)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Cell with ion channels" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "from bioexplorer import BioExplorer, Protein, Membrane, Cell, AnimationParams, Vector2, Vector3, Quaternion\n", + "be = BioExplorer()\n", + "core = be.core_api()\n", + "status = be.reset_scene()\n", + "status = be.set_general_settings(model_visibility_on_creation=True)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "name = 'Cell'\n", + "representation=be.REPRESENTATION_ATOMS_AND_STICKS\n", + "atom_radius_multiplier = 2.0\n", + "\n", + "# Resources\n", + "resource_folder = '../../tests/test_files/'\n", + "pdb_folder = resource_folder + 'pdb/'\n", + "membrane_folder = pdb_folder + 'membrane/'\n", + "lipids_folder = membrane_folder + 'lipids/'\n", + "ion_channels_folder = pdb_folder + 'ion_channels/'\n", + "\n", + "\n", + "# ACE2\n", + "ace2_receptor = Protein(\n", + " name=name + '_' + BioExplorer.NAME_RECEPTOR,\n", + " source=pdb_folder + '6m18.pdb',\n", + " occurrences=5,\n", + " rotation=Quaternion(1.0, 0.0, 0.0, 0.0),\n", + " transmembrane_params=Vector2(6.0, 3.0),\n", + " load_non_polymer_chemicals=True,\n", + " animation_params=AnimationParams(10)\n", + ")\n", + "\n", + "\n", + "# Ion channel 1\n", + "ion_channel_1 = Protein(\n", + " name=name + '_' + BioExplorer.NAME_ION_CHANNEL + '_1',\n", + " source=ion_channels_folder + '6uz3.pdb',\n", + " occurrences=5,\n", + " rotation=Quaternion(0.0, 0.707, 0.707, 0.0),\n", + " transmembrane_params=Vector2(1.0, 3.0),\n", + " animation_params=AnimationParams(20)\n", + ")\n", + "\n", + "# Ion channel 2\n", + "ion_channel_2 = Protein(\n", + " name=name + '_' + BioExplorer.NAME_ION_CHANNEL + '_2',\n", + " source=ion_channels_folder + 'AF-O88704.pdb',\n", + " occurrences=7,\n", + " rotation=Quaternion(0.0, 0.707, 0.707, 0.0),\n", + " transmembrane_params=Vector2(1.0, 3.0),\n", + " load_non_polymer_chemicals=True,\n", + " animation_params=AnimationParams(30)\n", + ")\n", + "\n", + "# Ion channel 3\n", + "ion_channel_3 = Protein(\n", + " name=name + '_' + BioExplorer.NAME_ION_CHANNEL + '_3',\n", + " source=ion_channels_folder + 'AF-P16388.pdb',\n", + " occurrences=4,\n", + " rotation=Quaternion(0.0, 0.707, 0.707, 0.0),\n", + " transmembrane_params=Vector2(1.0, 3.0),\n", + " load_non_polymer_chemicals=True,\n", + " animation_params=AnimationParams(40)\n", + ")\n", + "\n", + "# Membrane definition\n", + "import glob\n", + "lipids = glob.glob(membrane_folder + '*.pdb')\n", + "membrane_size = Vector3(200.0, 0.0, 200.0)\n", + "membrane = Membrane(\n", + " lipid_sources=lipids,\n", + " # lipid_rotation=Quaternion(0.0, 0.707, 0.707, 0.0),\n", + " load_bonds=True, load_non_polymer_chemicals=True,\n", + " animation_params=AnimationParams(0, 0, 0.0, 2, 0.5)\n", + ")\n", + "\n", + "# Cell definition\n", + "cell = Cell(\n", + " name=name,\n", + " shape=be.ASSEMBLY_SHAPE_PLANE,\n", + " shape_params = membrane_size,\n", + " membrane=membrane,\n", + " proteins=[\n", + " ace2_receptor, ion_channel_1,\n", + " ion_channel_2, ion_channel_3])\n", + "\n", + "# Add cell to scene\n", + "status = be.add_cell(\n", + " cell=cell, representation=representation,\n", + " atom_radius_multiplier=atom_radius_multiplier)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "be.apply_default_color_scheme(\n", + " shading_mode=be.SHADING_MODE_DIFFUSE,\n", + " specular_exponent=50.0\n", + ")\n", + "\n", + "status = be.set_protein_color_scheme(\n", + " assembly_name=name,\n", + " name=name + '_' + BioExplorer.NAME_RECEPTOR,\n", + " color_scheme=BioExplorer.COLOR_SCHEME_CHAINS,\n", + " palette_name='Set1', palette_size=8\n", + ")\n", + "\n", + "status = be.set_protein_color_scheme(\n", + " assembly_name=name,\n", + " name=name + '_' + BioExplorer.NAME_ION_CHANNEL + '_1',\n", + " color_scheme=BioExplorer.COLOR_SCHEME_CHAINS,\n", + " palette_name='Set1', palette_size=3\n", + ")\n", + "\n", + "status = be.set_protein_color_scheme(\n", + " assembly_name=name,\n", + " name=name + '_' + BioExplorer.NAME_ION_CHANNEL + '_2',\n", + " color_scheme=BioExplorer.COLOR_SCHEME_CHAINS,\n", + " palette_name='Set2', palette_size=3\n", + ")\n", + "\n", + "status = be.set_protein_color_scheme(\n", + " assembly_name=name,\n", + " name=name + '_' + BioExplorer.NAME_ION_CHANNEL + '_3',\n", + " color_scheme=BioExplorer.COLOR_SCHEME_CHAINS,\n", + " palette_name='Set3', palette_size=3\n", + ")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "status = core.set_camera(\n", + " orientation=[-0.298, -0.328, -0.076, 0.892],\n", + " position=[-105.37947598005452, 101.85359991498215, 120.69225266060364],\n", + " target=[4.306267491056144, -16.428973285137587, -1.9142757282462584]\n", + ")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Rendering settings" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "status = be.set_rendering_quality(be.RENDERING_QUALITY_HIGH)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Snaphot" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "from bioexplorer import MovieMaker\n", + "mm = MovieMaker(be)\n", + "mm.create_snapshot(\n", + " renderer='bio_explorer',\n", + " path='/tmp', base_name='ion_channels_in_membrane_surface',\n", + " size=[512, 512], samples_per_pixel=64)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3.8.10 ('env')", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.8.10" + }, + "vscode": { + "interpreter": { + "hash": "ea9a5fa46eb6bad2806a8ea1d08e15bb1e255a2d4320b81e765591579963c56b" + } + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} \ No newline at end of file diff --git a/bioexplorer/pythonsdk/notebooks/molecular_systems/BioExplorer_mesh_based_membrane.ipynb b/bioexplorer/pythonsdk/notebooks/molecular_systems/BioExplorer_mesh_based_membrane.ipynb index 44f7a6f94..41eacea64 100644 --- a/bioexplorer/pythonsdk/notebooks/molecular_systems/BioExplorer_mesh_based_membrane.ipynb +++ b/bioexplorer/pythonsdk/notebooks/molecular_systems/BioExplorer_mesh_based_membrane.ipynb @@ -1,315 +1,315 @@ { - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Blue Brain BioExplorer\n", - "\n", - "![](../bioexplorer_banner.png)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Visualization of a membrane defined by a mesh" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "from bioexplorer import BioExplorer, Cell, Protein, Membrane, AnimationParams, Vector2, Vector3, Quaternion\n", - "import glob\n", - "\n", - "be = BioExplorer('localhost:5000')\n", - "core = be.core_api()\n", - "status = be.reset_scene()" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Resources" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "resource_folder = '../../tests/test_files/'\n", - "pdb_folder = resource_folder + 'pdb/'\n", - "obj_folder = resource_folder + 'obj/'\n", - "membrane_folder = pdb_folder + 'membrane/'\n", - "lipids_folder = membrane_folder + 'lipids/'\n", - "transporters_folder = pdb_folder + 'transporters/'\n", - "\n", - "representation = be.REPRESENTATION_ATOMS_AND_STICKS" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Configuration" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "mesh_source= obj_folder + 'suzanne.obj'\n", - "rotation = Quaternion(1, 0, 0, 0)\n", - "position = Vector3(100.0, 0.0, 0.0)\n", - "scale = Vector3(2.5,2.5,2.5)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Camera position" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "status = be.core_api().set_camera(\n", - " orientation=[-0.114, 0.341, 0.020, 0.932],\n", - " position=[368.152, 107.242, 367.312],\n", - " target=[50.364, -6.824, -5.159]\n", - ")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Membrane" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "name = 'Suzanne'\n", - "\n", - "# ACE2 receptor definition\n", - "ace2_receptor = Protein(\n", - " name=be.NAME_TRANS_MEMBRANE + '_ACE2',\n", - " source=pdb_folder + '6m18.pdb', \n", - " transmembrane_params=Vector2(1.0, 2.0),\n", - " rotation=Quaternion(0.0, 1.0, 0.0, 0.0),\n", - " animation_params=AnimationParams(1), occurences=20)\n", - "\n", - "# GLUT3 definition\n", - "transporter = Protein(\n", - " name=be.NAME_TRANS_MEMBRANE + '_GLUT3',\n", - " source=transporters_folder + '4zwc.pdb',\n", - " transmembrane_params=Vector2(1.0, 2.0),\n", - " rotation=Quaternion(0.707, 0.707, 0.0, 0.0),\n", - " animation_params=AnimationParams(2), chain_ids=[1], occurences=30)\n", - "\n", - "# Membrane definition\n", - "pdb_lipids = glob.glob(lipids_folder + '*.pdb')[:8]\n", - "\n", - "membrane = Membrane(\n", - " lipid_sources=pdb_lipids, lipid_density=1.0,\n", - " load_non_polymer_chemicals=True, load_bonds=True,\n", - " animation_params=AnimationParams(0, 1, 0.025, 2, 0.5)\n", - ")\n", - "\n", - "clipping_planes = [\n", - " [0.0, 1.0, 0.0, 20],\n", - " [1.0, 0.0, 0.0, 10],\n", - "]\n", - "\n", - "# Cell definition\n", - "cell = Cell(\n", - " name=name,\n", - " shape=be.ASSEMBLY_SHAPE_MESH,\n", - " shape_params=scale,\n", - " shape_mesh_source=mesh_source, \n", - " membrane=membrane,\n", - " proteins=[ace2_receptor, transporter]\n", - ")\n", - "\n", - "# Add cell to scene\n", - "status = be.add_cell(\n", - " cell=cell, representation=representation,\n", - " clipping_planes=clipping_planes\n", - ")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Rendering settings" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "status = be.set_rendering_quality(be.RENDERING_QUALITY_HIGH)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Environment with protein location constraints" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "from bioexplorer import Protein, Volume, AnimationParams" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "scene_size = Vector3(300, 300, 300)\n", - "nb_glucoses = 100\n", - "nb_lactoferrins = 20\n", - "\n", - "glucose_path = pdb_folder + 'glucose.pdb'\n", - "lactoferrin_path=pdb_folder + 'immune/1b0l.pdb'\n", - "defensin_path = pdb_folder + 'immune/1ijv.pdb'" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "constraints=list()\n", - "constraints.append([be.POSITION_CONSTRAINT_OUTSIDE, 'Suzanne'])" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "glucose = Protein(\n", - " name=be.NAME_GLUCOSE, \n", - " source=glucose_path, load_non_polymer_chemicals=True, \n", - " animation_params=AnimationParams(1, 0, 0.0, 2, 1.0),\n", - " occurences=nb_glucoses)\n", - "volume = Volume(\n", - " name=be.NAME_GLUCOSE, \n", - " shape=be.ASSEMBLY_SHAPE_CUBE, shape_params=scene_size,\n", - " protein=glucose)\n", - "status = be.add_volume(\n", - " volume=volume,\n", - " representation=be.REPRESENTATION_ATOMS_AND_STICKS,\n", - " atom_radius_multiplier=2.0, constraints=constraints)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "lactoferrin = Protein(\n", - " name=be.NAME_LACTOFERRIN, \n", - " source=lactoferrin_path, load_non_polymer_chemicals=True,\n", - " animation_params=AnimationParams(3, 0, 0.0, 4, 1.0),\n", - " occurences=nb_lactoferrins)\n", - "lactoferrins_volume = Volume(\n", - " name=be.NAME_LACTOFERRIN, \n", - " shape=be.ASSEMBLY_SHAPE_CUBE, shape_params=scene_size,\n", - " protein=lactoferrin,\n", - ")\n", - "status = be.add_volume(\n", - " volume=lactoferrins_volume,\n", - " representation=be.REPRESENTATION_ATOMS_AND_STICKS,\n", - " atom_radius_multiplier=2.0, constraints=constraints)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "be.apply_default_color_scheme(shading_mode=be.SHADING_MODE_BASIC)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "from bioexplorer import MovieMaker\n", - "mm = MovieMaker(be)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "mm.create_snapshot(\n", - " renderer='bio_explorer',\n", - " path='/tmp', base_name='suzanne',\n", - " size=[512, 512], samples_per_pixel=64)" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3.8.10 ('env')", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.8.10" - }, - "vscode": { - "interpreter": { - "hash": "ea9a5fa46eb6bad2806a8ea1d08e15bb1e255a2d4320b81e765591579963c56b" - } - } - }, - "nbformat": 4, - "nbformat_minor": 4 -} + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Blue Brain BioExplorer\n", + "\n", + "![](../bioexplorer_banner.png)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Visualization of a membrane defined by a mesh" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "from bioexplorer import BioExplorer, Cell, Protein, Membrane, AnimationParams, Vector2, Vector3, Quaternion\n", + "import glob\n", + "\n", + "be = BioExplorer('localhost:5000')\n", + "core = be.core_api()\n", + "status = be.reset_scene()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Resources" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "resource_folder = '../../tests/test_files/'\n", + "pdb_folder = resource_folder + 'pdb/'\n", + "obj_folder = resource_folder + 'obj/'\n", + "membrane_folder = pdb_folder + 'membrane/'\n", + "lipids_folder = membrane_folder + 'lipids/'\n", + "transporters_folder = pdb_folder + 'transporters/'\n", + "\n", + "representation = be.REPRESENTATION_ATOMS_AND_STICKS" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Configuration" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "mesh_source= obj_folder + 'suzanne.obj'\n", + "rotation = Quaternion(1, 0, 0, 0)\n", + "position = Vector3(100.0, 0.0, 0.0)\n", + "scale = Vector3(2.5,2.5,2.5)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Camera position" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "status = be.core_api().set_camera(\n", + " orientation=[-0.114, 0.341, 0.020, 0.932],\n", + " position=[368.152, 107.242, 367.312],\n", + " target=[50.364, -6.824, -5.159]\n", + ")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Membrane" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "name = 'Suzanne'\n", + "\n", + "# ACE2 receptor definition\n", + "ace2_receptor = Protein(\n", + " name=be.NAME_TRANS_MEMBRANE + '_ACE2',\n", + " source=pdb_folder + '6m18.pdb', \n", + " transmembrane_params=Vector2(1.0, 2.0),\n", + " rotation=Quaternion(0.0, 1.0, 0.0, 0.0),\n", + " animation_params=AnimationParams(1), occurrences=20)\n", + "\n", + "# GLUT3 definition\n", + "transporter = Protein(\n", + " name=be.NAME_TRANS_MEMBRANE + '_GLUT3',\n", + " source=transporters_folder + '4zwc.pdb',\n", + " transmembrane_params=Vector2(1.0, 2.0),\n", + " rotation=Quaternion(0.707, 0.707, 0.0, 0.0),\n", + " animation_params=AnimationParams(2), chain_ids=[1], occurrences=30)\n", + "\n", + "# Membrane definition\n", + "pdb_lipids = glob.glob(lipids_folder + '*.pdb')[:8]\n", + "\n", + "membrane = Membrane(\n", + " lipid_sources=pdb_lipids, lipid_density=1.0,\n", + " load_non_polymer_chemicals=True, load_bonds=True,\n", + " animation_params=AnimationParams(0, 1, 0.025, 2, 0.5)\n", + ")\n", + "\n", + "clipping_planes = [\n", + " [0.0, 1.0, 0.0, 20],\n", + " [1.0, 0.0, 0.0, 10],\n", + "]\n", + "\n", + "# Cell definition\n", + "cell = Cell(\n", + " name=name,\n", + " shape=be.ASSEMBLY_SHAPE_MESH,\n", + " shape_params=scale,\n", + " shape_mesh_source=mesh_source, \n", + " membrane=membrane,\n", + " proteins=[ace2_receptor, transporter]\n", + ")\n", + "\n", + "# Add cell to scene\n", + "status = be.add_cell(\n", + " cell=cell, representation=representation,\n", + " clipping_planes=clipping_planes\n", + ")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Rendering settings" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "status = be.set_rendering_quality(be.RENDERING_QUALITY_HIGH)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Environment with protein location constraints" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "from bioexplorer import Protein, Volume, AnimationParams" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "scene_size = Vector3(300, 300, 300)\n", + "nb_glucoses = 100\n", + "nb_lactoferrins = 20\n", + "\n", + "glucose_path = pdb_folder + 'glucose.pdb'\n", + "lactoferrin_path=pdb_folder + 'immune/1b0l.pdb'\n", + "defensin_path = pdb_folder + 'immune/1ijv.pdb'" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "constraints=list()\n", + "constraints.append([be.POSITION_CONSTRAINT_OUTSIDE, 'Suzanne'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "glucose = Protein(\n", + " name=be.NAME_GLUCOSE, \n", + " source=glucose_path, load_non_polymer_chemicals=True, \n", + " animation_params=AnimationParams(1, 0, 0.0, 2, 1.0),\n", + " occurrences=nb_glucoses)\n", + "volume = Volume(\n", + " name=be.NAME_GLUCOSE, \n", + " shape=be.ASSEMBLY_SHAPE_CUBE, shape_params=scene_size,\n", + " protein=glucose)\n", + "status = be.add_volume(\n", + " volume=volume,\n", + " representation=be.REPRESENTATION_ATOMS_AND_STICKS,\n", + " atom_radius_multiplier=2.0, constraints=constraints)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "lactoferrin = Protein(\n", + " name=be.NAME_LACTOFERRIN, \n", + " source=lactoferrin_path, load_non_polymer_chemicals=True,\n", + " animation_params=AnimationParams(3, 0, 0.0, 4, 1.0),\n", + " occurrences=nb_lactoferrins)\n", + "lactoferrins_volume = Volume(\n", + " name=be.NAME_LACTOFERRIN, \n", + " shape=be.ASSEMBLY_SHAPE_CUBE, shape_params=scene_size,\n", + " protein=lactoferrin,\n", + ")\n", + "status = be.add_volume(\n", + " volume=lactoferrins_volume,\n", + " representation=be.REPRESENTATION_ATOMS_AND_STICKS,\n", + " atom_radius_multiplier=2.0, constraints=constraints)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "be.apply_default_color_scheme(shading_mode=be.SHADING_MODE_BASIC)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "from bioexplorer import MovieMaker\n", + "mm = MovieMaker(be)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "mm.create_snapshot(\n", + " renderer='bio_explorer',\n", + " path='/tmp', base_name='suzanne',\n", + " size=[512, 512], samples_per_pixel=64)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3.8.10 ('env')", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.8.10" + }, + "vscode": { + "interpreter": { + "hash": "ea9a5fa46eb6bad2806a8ea1d08e15bb1e255a2d4320b81e765591579963c56b" + } + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} \ No newline at end of file diff --git a/bioexplorer/pythonsdk/notebooks/molecular_systems/BioExplorer_microtubule.ipynb b/bioexplorer/pythonsdk/notebooks/molecular_systems/BioExplorer_microtubule.ipynb index 649e6eb0f..a9c15d962 100644 --- a/bioexplorer/pythonsdk/notebooks/molecular_systems/BioExplorer_microtubule.ipynb +++ b/bioexplorer/pythonsdk/notebooks/molecular_systems/BioExplorer_microtubule.ipynb @@ -1,149 +1,149 @@ { - "cells": [ - { - "cell_type": "markdown", - "id": "fcf7a2b1", - "metadata": {}, - "source": [ - "# Blue Brain BioExplorer\n", - "\n", - "![](../bioexplorer_banner.png)" - ] - }, - { - "cell_type": "markdown", - "id": "ac3c2bbd", - "metadata": {}, - "source": [ - "## Visualization of a microtubule" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "eeff036f", - "metadata": {}, - "outputs": [], - "source": [ - "from bioexplorer import BioExplorer, Volume, Protein, Vector3, Quaternion\n", - "\n", - "be = BioExplorer('localhost:5000')\n", - "core = be.core_api()\n", - "status = be.reset_scene()" - ] - }, - { - "cell_type": "markdown", - "id": "c9f34251", - "metadata": {}, - "source": [ - "### Resources" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "addafa59", - "metadata": {}, - "outputs": [], - "source": [ - "resource_folder = '../../tests/test_files/'\n", - "pdb_folder = resource_folder + 'pdb/'\n", - "obj_folder = resource_folder + 'obj/'\n", - "membrane_folder = pdb_folder + 'membrane/'\n", - "lipids_folder = membrane_folder + 'lipids/'\n", - "transporters_folder = pdb_folder + 'transporters/'\n", - "tubules_folder = pdb_folder + 'tubules/'\n", - "\n", - "representation = be.REPRESENTATION_ATOMS_AND_STICKS" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "be.add_grid(min_value=0, max_value=50, interval=10, radius=0.01)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "039b5da0", - "metadata": {}, - "outputs": [], - "source": [ - "import random\n", - "\n", - "size = Vector3(5.0, 50.0, 0.0)\n", - "pos = Vector3(25, 25, 25)\n", - "name = 'Microtubule'\n", - "\n", - "# ACE2 receptor definition\n", - "tubule = Protein(\n", - " name=name + '_TUB',\n", - " source=tubules_folder + '1tub.pdb', \n", - " # rotation=Quaternion(0.0, 0.0, 0.707, 0.707),\n", - " occurences=size.y * 5.0)\n", - "\n", - "volume = Volume(\n", - " name=name,\n", - " shape=be.ASSEMBLY_SHAPE_HELIX, shape_params=size,\n", - " # shape=be.ASSEMBLY_SHAPE_CUBE, shape_params=Vector3(300,300,300),\n", - " protein=tubule)\n", - "\n", - "status = be.add_volume(\n", - " position=pos,\n", - " # representation=be.REPRESENTATION_DEBUG,\n", - " rotation=Quaternion(0.951, 0.255, -0.045, 0.168),\n", - " # rotation=Quaternion(0.0, 0.707, 0.0, 0.707),\n", - " # rotation=Q,\n", - " volume=volume)\n", - "\n", - "status = be.set_protein_color_scheme(\n", - " assembly_name=name,\n", - " name=name + '_TUB',\n", - " color_scheme=be.COLOR_SCHEME_CHAINS,\n", - " palette_name='Set2', palette_size=5)\n", - "core.set_renderer()" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "status = be.reset_camera()\n", - "status = be.set_rendering_quality(be.RENDERING_QUALITY_HIGH)" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3.8.10 ('env')", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.8.10" - }, - "vscode": { - "interpreter": { - "hash": "ea9a5fa46eb6bad2806a8ea1d08e15bb1e255a2d4320b81e765591579963c56b" - } - } - }, - "nbformat": 4, - "nbformat_minor": 4 -} + "cells": [ + { + "cell_type": "markdown", + "id": "fcf7a2b1", + "metadata": {}, + "source": [ + "# Blue Brain BioExplorer\n", + "\n", + "![](../bioexplorer_banner.png)" + ] + }, + { + "cell_type": "markdown", + "id": "ac3c2bbd", + "metadata": {}, + "source": [ + "## Visualization of a microtubule" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "eeff036f", + "metadata": {}, + "outputs": [], + "source": [ + "from bioexplorer import BioExplorer, Volume, Protein, Vector3, Quaternion\n", + "\n", + "be = BioExplorer('localhost:5000')\n", + "core = be.core_api()\n", + "status = be.reset_scene()" + ] + }, + { + "cell_type": "markdown", + "id": "c9f34251", + "metadata": {}, + "source": [ + "### Resources" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "addafa59", + "metadata": {}, + "outputs": [], + "source": [ + "resource_folder = '../../tests/test_files/'\n", + "pdb_folder = resource_folder + 'pdb/'\n", + "obj_folder = resource_folder + 'obj/'\n", + "membrane_folder = pdb_folder + 'membrane/'\n", + "lipids_folder = membrane_folder + 'lipids/'\n", + "transporters_folder = pdb_folder + 'transporters/'\n", + "tubules_folder = pdb_folder + 'tubules/'\n", + "\n", + "representation = be.REPRESENTATION_ATOMS_AND_STICKS" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "be.add_grid(min_value=0, max_value=50, interval=10, radius=0.01)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "039b5da0", + "metadata": {}, + "outputs": [], + "source": [ + "import random\n", + "\n", + "size = Vector3(5.0, 50.0, 0.0)\n", + "pos = Vector3(25, 25, 25)\n", + "name = 'Microtubule'\n", + "\n", + "# ACE2 receptor definition\n", + "tubule = Protein(\n", + " name=name + '_TUB',\n", + " source=tubules_folder + '1tub.pdb', \n", + " # rotation=Quaternion(0.0, 0.0, 0.707, 0.707),\n", + " occurrences=size.y * 5.0)\n", + "\n", + "volume = Volume(\n", + " name=name,\n", + " shape=be.ASSEMBLY_SHAPE_HELIX, shape_params=size,\n", + " # shape=be.ASSEMBLY_SHAPE_CUBE, shape_params=Vector3(300,300,300),\n", + " protein=tubule)\n", + "\n", + "status = be.add_volume(\n", + " position=pos,\n", + " # representation=be.REPRESENTATION_DEBUG,\n", + " rotation=Quaternion(0.951, 0.255, -0.045, 0.168),\n", + " # rotation=Quaternion(0.0, 0.707, 0.0, 0.707),\n", + " # rotation=Q,\n", + " volume=volume)\n", + "\n", + "status = be.set_protein_color_scheme(\n", + " assembly_name=name,\n", + " name=name + '_TUB',\n", + " color_scheme=be.COLOR_SCHEME_CHAINS,\n", + " palette_name='Set2', palette_size=5)\n", + "core.set_renderer()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "status = be.reset_camera()\n", + "status = be.set_rendering_quality(be.RENDERING_QUALITY_HIGH)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3.8.10 ('env')", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.8.10" + }, + "vscode": { + "interpreter": { + "hash": "ea9a5fa46eb6bad2806a8ea1d08e15bb1e255a2d4320b81e765591579963c56b" + } + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} \ No newline at end of file diff --git a/bioexplorer/pythonsdk/notebooks/molecular_systems/BioExplorer_spike_and_ACE2_receptor.ipynb b/bioexplorer/pythonsdk/notebooks/molecular_systems/BioExplorer_spike_and_ACE2_receptor.ipynb index 8542f5cb9..f78db281c 100644 --- a/bioexplorer/pythonsdk/notebooks/molecular_systems/BioExplorer_spike_and_ACE2_receptor.ipynb +++ b/bioexplorer/pythonsdk/notebooks/molecular_systems/BioExplorer_spike_and_ACE2_receptor.ipynb @@ -152,7 +152,7 @@ "ace2_receptor = Protein(\n", " name=name + '_' + be.NAME_RECEPTOR,\n", " source=pdb_folder + '6m18.pdb',\n", - " occurences=5,\n", + " occurrences=5,\n", " animation_params=AnimationParams(0, 1, 0.025, 2, 0.025),\n", " transmembrane_params=Vector2(-8.0, 2.0)\n", ")\n", @@ -400,4 +400,4 @@ }, "nbformat": 4, "nbformat_minor": 4 -} +} \ No newline at end of file diff --git a/bioexplorer/pythonsdk/notebooks/molecular_systems/BioExplorer_synapse.ipynb b/bioexplorer/pythonsdk/notebooks/molecular_systems/BioExplorer_synapse.ipynb index a46415a7f..227b26a8a 100644 --- a/bioexplorer/pythonsdk/notebooks/molecular_systems/BioExplorer_synapse.ipynb +++ b/bioexplorer/pythonsdk/notebooks/molecular_systems/BioExplorer_synapse.ipynb @@ -1,195 +1,195 @@ { - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Blue Brain BioExplorer\n", - "\n", - "![](../bioexplorer_banner.png)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Visualization of a membrane defined by a mesh" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": {}, - "outputs": [], - "source": [ - "from bioexplorer import BioExplorer, Cell, Membrane, Protein, AnimationParams, Vector2, Vector3, Quaternion\n", - "be = BioExplorer()\n", - "core = be.core_api()\n", - "status = be.reset_scene()" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Resources" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": {}, - "outputs": [], - "source": [ - "resource_folder = '../../tests/test_files/'\n", - "pdb_folder = resource_folder + 'pdb/'\n", - "obj_folder = resource_folder + 'obj/'\n", - "membrane_folder = pdb_folder + 'membrane/'\n", - "transporters_folder = pdb_folder + 'transporters/'" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Configuration" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": {}, - "outputs": [], - "source": [ - "mesh_source= obj_folder + 'synapse.obj'\n", - "rotation = Quaternion(1, 0, 0, 0)\n", - "position = Vector3(0.0, 0.0, 0.0)\n", - "scale = Vector3(100.0, 100.0, 100.0)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Camera position" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": {}, - "outputs": [], - "source": [ - "status = be.core_api().set_camera(\n", - " orientation=[-0.05261195893939275, 0.1340170256962661, 0.11977083138674514, 0.9823066560647004],\n", - " position=[22402.44264265657, 100057.69545508768, 36096.71038661064],\n", - " target=[21768.90019602888, 99715.34795177878, 33674.27512545227]\n", - ")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Membrane" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": {}, - "outputs": [], - "source": [ - "name = 'Synapse'\n", - "\n", - "# ACE2 receptor definition\n", - "ace2_receptor = Protein(\n", - " name=be.NAME_TRANS_MEMBRANE + '_ACE2',\n", - " source=pdb_folder + '6m18.pdb', \n", - " transmembrane_params=Vector2(1.0, 2.0),\n", - " rotation=Quaternion(0.0, 1.0, 0.0, 0.0),\n", - " animation_params=AnimationParams(1), occurences=20)\n", - "\n", - "# GLUT3 definition\n", - "transporter = Protein(\n", - " name=be.NAME_TRANS_MEMBRANE + '_GLUT3',\n", - " source=transporters_folder + '4zwc.pdb',\n", - " transmembrane_params=Vector2(1.0, 2.0),\n", - " rotation=Quaternion(0.707, 0.707, 0.0, 0.0),\n", - " animation_params=AnimationParams(2), chain_ids=[1], occurences=30)\n", - "\n", - "lipid_sources = [\n", - " membrane_folder + 'segA.pdb',\n", - " membrane_folder + 'segB.pdb',\n", - " membrane_folder + 'segC.pdb',\n", - " membrane_folder + 'segD.pdb'\n", - "]\n", - "\n", - "membrane = Membrane(\n", - " lipid_sources=lipid_sources,\n", - " load_non_polymer_chemicals=True, load_bonds=True)\n", - "\n", - "# Cell definition\n", - "cell = Cell(\n", - " name=name,\n", - " shape=be.ASSEMBLY_SHAPE_MESH,\n", - " shape_params=scale,\n", - " shape_mesh_source=mesh_source, \n", - " membrane=membrane,\n", - " proteins=[ace2_receptor, transporter]\n", - ")\n", - "\n", - "# Add cell to scene\n", - "status = be.add_cell(cell=cell)\n", - "\n", - "for i in range(len(lipid_sources)):\n", - " status = be.set_protein_color_scheme(\n", - " assembly_name=name, name=be.NAME_MEMBRANE + '_' + str(i),\n", - " color_scheme=be.COLOR_SCHEME_CHAINS,\n", - " palette_name='Set3', palette_size=5)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Rendering settings" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": {}, - "outputs": [], - "source": [ - "status = be.set_rendering_quality(be.RENDERING_QUALITY_HIGH)" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3.8.10 ('env')", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.8.10" - }, - "vscode": { - "interpreter": { - "hash": "ea9a5fa46eb6bad2806a8ea1d08e15bb1e255a2d4320b81e765591579963c56b" - } - } - }, - "nbformat": 4, - "nbformat_minor": 4 -} + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Blue Brain BioExplorer\n", + "\n", + "![](../bioexplorer_banner.png)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Visualization of a membrane defined by a mesh" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "from bioexplorer import BioExplorer, Cell, Membrane, Protein, AnimationParams, Vector2, Vector3, Quaternion\n", + "be = BioExplorer()\n", + "core = be.core_api()\n", + "status = be.reset_scene()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Resources" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [], + "source": [ + "resource_folder = '../../tests/test_files/'\n", + "pdb_folder = resource_folder + 'pdb/'\n", + "obj_folder = resource_folder + 'obj/'\n", + "membrane_folder = pdb_folder + 'membrane/'\n", + "transporters_folder = pdb_folder + 'transporters/'" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Configuration" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "mesh_source= obj_folder + 'synapse.obj'\n", + "rotation = Quaternion(1, 0, 0, 0)\n", + "position = Vector3(0.0, 0.0, 0.0)\n", + "scale = Vector3(100.0, 100.0, 100.0)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Camera position" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [], + "source": [ + "status = be.core_api().set_camera(\n", + " orientation=[-0.05261195893939275, 0.1340170256962661, 0.11977083138674514, 0.9823066560647004],\n", + " position=[22402.44264265657, 100057.69545508768, 36096.71038661064],\n", + " target=[21768.90019602888, 99715.34795177878, 33674.27512545227]\n", + ")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Membrane" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [], + "source": [ + "name = 'Synapse'\n", + "\n", + "# ACE2 receptor definition\n", + "ace2_receptor = Protein(\n", + " name=be.NAME_TRANS_MEMBRANE + '_ACE2',\n", + " source=pdb_folder + '6m18.pdb', \n", + " transmembrane_params=Vector2(1.0, 2.0),\n", + " rotation=Quaternion(0.0, 1.0, 0.0, 0.0),\n", + " animation_params=AnimationParams(1), occurrences=20)\n", + "\n", + "# GLUT3 definition\n", + "transporter = Protein(\n", + " name=be.NAME_TRANS_MEMBRANE + '_GLUT3',\n", + " source=transporters_folder + '4zwc.pdb',\n", + " transmembrane_params=Vector2(1.0, 2.0),\n", + " rotation=Quaternion(0.707, 0.707, 0.0, 0.0),\n", + " animation_params=AnimationParams(2), chain_ids=[1], occurrences=30)\n", + "\n", + "lipid_sources = [\n", + " membrane_folder + 'segA.pdb',\n", + " membrane_folder + 'segB.pdb',\n", + " membrane_folder + 'segC.pdb',\n", + " membrane_folder + 'segD.pdb'\n", + "]\n", + "\n", + "membrane = Membrane(\n", + " lipid_sources=lipid_sources,\n", + " load_non_polymer_chemicals=True, load_bonds=True)\n", + "\n", + "# Cell definition\n", + "cell = Cell(\n", + " name=name,\n", + " shape=be.ASSEMBLY_SHAPE_MESH,\n", + " shape_params=scale,\n", + " shape_mesh_source=mesh_source, \n", + " membrane=membrane,\n", + " proteins=[ace2_receptor, transporter]\n", + ")\n", + "\n", + "# Add cell to scene\n", + "status = be.add_cell(cell=cell)\n", + "\n", + "for i in range(len(lipid_sources)):\n", + " status = be.set_protein_color_scheme(\n", + " assembly_name=name, name=be.NAME_MEMBRANE + '_' + str(i),\n", + " color_scheme=be.COLOR_SCHEME_CHAINS,\n", + " palette_name='Set3', palette_size=5)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Rendering settings" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [], + "source": [ + "status = be.set_rendering_quality(be.RENDERING_QUALITY_HIGH)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3.8.10 ('env')", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.8.10" + }, + "vscode": { + "interpreter": { + "hash": "ea9a5fa46eb6bad2806a8ea1d08e15bb1e255a2d4320b81e765591579963c56b" + } + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} \ No newline at end of file diff --git a/bioexplorer/pythonsdk/notebooks/molecular_systems/BioExplorer_volume.ipynb b/bioexplorer/pythonsdk/notebooks/molecular_systems/BioExplorer_volume.ipynb index bb195a298..35bc2e8d0 100644 --- a/bioexplorer/pythonsdk/notebooks/molecular_systems/BioExplorer_volume.ipynb +++ b/bioexplorer/pythonsdk/notebooks/molecular_systems/BioExplorer_volume.ipynb @@ -1,151 +1,151 @@ { - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Blue Brain BioExplorer\n", - "\n", - "![](../bioexplorer_banner.png)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "scrolled": true - }, - "outputs": [], - "source": [ - "from bioexplorer import BioExplorer, Protein, Volume, Vector3, AnimationParams\n", - "import nglview\n", - "\n", - "be = BioExplorer('localhost:5000')\n", - "status = be.reset_scene()" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Resources" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "resource_folder = '../../tests/test_files/'\n", - "pdb_folder = resource_folder + 'pdb/'\n", - "glucose_path = pdb_folder + 'glucose.pdb'" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Configuration" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "# Scene\n", - "scene_size = Vector3(100.0, 0.0, 0.0)\n", - "\n", - "# Immune system\n", - "nb_glucoses = 10000\n", - "\n", - "# Proteins\n", - "protein_radius_multiplier = 1.0\n", - "protein_representation = be.REPRESENTATION_ATOMS_AND_STICKS" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "#### Glucose" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "nglview.show_file(glucose_path)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "glucose = Protein(\n", - " name=be.NAME_GLUCOSE, \n", - " source=glucose_path, load_non_polymer_chemicals=True, \n", - " occurences=nb_glucoses,\n", - " animation_params=AnimationParams(3)\n", - ")\n", - "volume = Volume(\n", - " name=be.NAME_GLUCOSE,\n", - " shape=be.ASSEMBLY_SHAPE_FILLED_SPHERE, shape_params=scene_size,\n", - " protein=glucose)\n", - "status = be.add_volume(\n", - " volume=volume, \n", - " representation=protein_representation,\n", - " atom_radius_multiplier=protein_radius_multiplier)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Rendering settings" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "status = be.reset_camera()\n", - "status = be.set_rendering_quality(be.RENDERING_QUALITY_HIGH)" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3.8.10 ('env')", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.8.10" - }, - "vscode": { - "interpreter": { - "hash": "ea9a5fa46eb6bad2806a8ea1d08e15bb1e255a2d4320b81e765591579963c56b" - } - } - }, - "nbformat": 4, - "nbformat_minor": 4 -} + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Blue Brain BioExplorer\n", + "\n", + "![](../bioexplorer_banner.png)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "scrolled": true + }, + "outputs": [], + "source": [ + "from bioexplorer import BioExplorer, Protein, Volume, Vector3, AnimationParams\n", + "import nglview\n", + "\n", + "be = BioExplorer('localhost:5000')\n", + "status = be.reset_scene()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Resources" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "resource_folder = '../../tests/test_files/'\n", + "pdb_folder = resource_folder + 'pdb/'\n", + "glucose_path = pdb_folder + 'glucose.pdb'" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Configuration" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# Scene\n", + "scene_size = Vector3(100.0, 0.0, 0.0)\n", + "\n", + "# Immune system\n", + "nb_glucoses = 10000\n", + "\n", + "# Proteins\n", + "protein_radius_multiplier = 1.0\n", + "protein_representation = be.REPRESENTATION_ATOMS_AND_STICKS" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#### Glucose" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "nglview.show_file(glucose_path)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "glucose = Protein(\n", + " name=be.NAME_GLUCOSE, \n", + " source=glucose_path, load_non_polymer_chemicals=True, \n", + " occurrences=nb_glucoses,\n", + " animation_params=AnimationParams(3)\n", + ")\n", + "volume = Volume(\n", + " name=be.NAME_GLUCOSE,\n", + " shape=be.ASSEMBLY_SHAPE_FILLED_SPHERE, shape_params=scene_size,\n", + " protein=glucose)\n", + "status = be.add_volume(\n", + " volume=volume, \n", + " representation=protein_representation,\n", + " atom_radius_multiplier=protein_radius_multiplier)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Rendering settings" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "status = be.reset_camera()\n", + "status = be.set_rendering_quality(be.RENDERING_QUALITY_HIGH)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3.8.10 ('env')", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.8.10" + }, + "vscode": { + "interpreter": { + "hash": "ea9a5fa46eb6bad2806a8ea1d08e15bb1e255a2d4320b81e765591579963c56b" + } + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} \ No newline at end of file diff --git a/bioexplorer/pythonsdk/notebooks/molecular_systems/animation/BioExplorer_cell.ipynb b/bioexplorer/pythonsdk/notebooks/molecular_systems/animation/BioExplorer_cell.ipynb new file mode 100644 index 000000000..909dcb20d --- /dev/null +++ b/bioexplorer/pythonsdk/notebooks/molecular_systems/animation/BioExplorer_cell.ipynb @@ -0,0 +1,155 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Blue Brain BioExplorer\n", + "\n", + "![](../../bioexplorer_banner.png)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Simplest script to create a visualization of a cell" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "from bioexplorer import BioExplorer, MovieMaker, Protein, Membrane, Cell, AnimationParams, Vector3, Quaternion\n", + "import os\n", + "\n", + "be = BioExplorer('localhost:5000')\n", + "core = be.core_api()\n", + "status = be.reset_scene()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "def add_cell(random_seed):\n", + " \n", + " core.set_application_parameters(image_stream_fps=0)\n", + " representation=be.REPRESENTATION_ATOMS_AND_STICKS\n", + "\n", + " # Resources\n", + " resource_folder = '../../../tests/test_files'\n", + " pdb_folder = os.path.join(resource_folder, 'pdb')\n", + " membrane_folder = os.path.join(pdb_folder, 'membrane')\n", + "\n", + " # ACE2 receptor definition\n", + " ace2_receptor = Protein(\n", + " name=be.NAME_RECEPTOR,\n", + " source=os.path.join(pdb_folder, '6m18.pdb'),\n", + " occurrences=8,\n", + " position=Vector3(0.0, 6.0, 0.0),\n", + " rotation=Quaternion(0.0, 1.0, 0.0, 0.0)\n", + " )\n", + "\n", + " # Membrane definition\n", + " membrane = Membrane(\n", + " lipid_sources=[\n", + " os.path.join(membrane_folder, 'segA.pdb'),\n", + " os.path.join(membrane_folder, 'segB.pdb'),\n", + " os.path.join(membrane_folder, 'segC.pdb'),\n", + " os.path.join(membrane_folder, 'segD.pdb')],\n", + " animation_params=AnimationParams(random_seed, random_seed + 1, 1.0, random_seed + 2, 0.025)\n", + " )\n", + "\n", + " # Cell definition\n", + " cell_size = Vector3(800.0, 80.0, 800.0)\n", + " cell = Cell(\n", + " name='Cell', shape_params=cell_size,\n", + " shape=be.ASSEMBLY_SHAPE_SINUSOID,\n", + " membrane=membrane, proteins=[ace2_receptor]\n", + " )\n", + "\n", + " # Add cell to scene\n", + " be.add_cell(cell=cell, representation=representation)\n", + " \n", + " # Materials\n", + " be.apply_default_color_scheme(be.SHADING_MODE_DIFFUSE)\n", + " \n", + " be.set_models_visibility(True)\n", + " core.set_application_parameters(image_stream_fps=20)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "status = core.set_camera(\n", + " orientation=[-0.085, 0.340, 0.022, 0.936],\n", + " position=[461.372, 55.791, 480.118],\n", + " target=[23.322, -65.160, -40.892]\n", + ")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "status = be.set_rendering_quality(be.RENDERING_QUALITY_HIGH)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "from tqdm import tqdm\n", + "\n", + "mm = MovieMaker(be)\n", + "output_folder = '/tmp'\n", + "\n", + "for frame in tqdm(range(1, 20)):\n", + " '''Cell'''\n", + " add_cell(frame * 3)\n", + " \n", + " '''Snapshot'''\n", + " mm.create_snapshot(\n", + " renderer='bio_explorer',\n", + " size=[256, 256], samples_per_pixel=64,\n", + " path=output_folder, base_name='%05d' % frame)" + ] + } + ], + "metadata": { + "interpreter": { + "hash": "ea9a5fa46eb6bad2806a8ea1d08e15bb1e255a2d4320b81e765591579963c56b" + }, + "kernelspec": { + "display_name": "Python 3.8.10 64-bit ('env': venv)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.8.10" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} \ No newline at end of file diff --git a/bioexplorer/pythonsdk/notebooks/animation/BioExplorer_infection.ipynb b/bioexplorer/pythonsdk/notebooks/molecular_systems/animation/BioExplorer_infection.ipynb similarity index 93% rename from bioexplorer/pythonsdk/notebooks/animation/BioExplorer_infection.ipynb rename to bioexplorer/pythonsdk/notebooks/molecular_systems/animation/BioExplorer_infection.ipynb index 944d5cf9d..9935c1022 100644 --- a/bioexplorer/pythonsdk/notebooks/animation/BioExplorer_infection.ipynb +++ b/bioexplorer/pythonsdk/notebooks/molecular_systems/animation/BioExplorer_infection.ipynb @@ -6,7 +6,7 @@ "source": [ "# Blue Brain BioExplorer\n", "\n", - "![](../bioexplorer_banner.png)" + "![](../../bioexplorer_banner.png)" ] }, { @@ -25,6 +25,8 @@ "outputs": [], "source": [ "from bioexplorer import BioExplorer, AnimationParams, Vector3, Quaternion\n", + "import os\n", + "\n", "be = BioExplorer('localhost:5000')\n", "core = be.core_api()\n", "be.reset_scene()\n", @@ -49,9 +51,9 @@ }, "outputs": [], "source": [ - "resource_folder = '../../tests/test_files/'\n", - "pdb_folder = resource_folder + 'pdb/'\n", - "membrane_folder = pdb_folder + 'membrane/'" + "resource_folder = '../../../tests/test_files/'\n", + "pdb_folder = os.path.join(resource_folder, 'pdb')\n", + "membrane_folder = os.path.join(pdb_folder, 'membrane')" ] }, { @@ -71,7 +73,7 @@ "import math\n", "\n", "scene_size = Vector3(600, 600, 600)\n", - "nb_viruses = 3\n", + "nb_viruses = 20\n", "default_radius = 60.0\n", "\n", "positions = list()\n", @@ -123,11 +125,9 @@ }, "outputs": [], "source": [ - "from IPython.display import clear_output\n", - "for i in range(nb_viruses):\n", - " clear_output()\n", + "from tqdm import tqdm\n", + "for i in tqdm(range(nb_viruses)):\n", " name='SARS-COV-2_Coronavirus%05d' % i\n", - " print(name)\n", " position = positions[i]\n", " o = orientations[i]\n", " rotation = Quaternion(o[0], o[1], o[2], o[3])\n", diff --git a/bioexplorer/pythonsdk/notebooks/molecular_systems/animation/BioExplorer_mesh_based_membrane.ipynb b/bioexplorer/pythonsdk/notebooks/molecular_systems/animation/BioExplorer_mesh_based_membrane.ipynb new file mode 100644 index 000000000..e8b2dcd35 --- /dev/null +++ b/bioexplorer/pythonsdk/notebooks/molecular_systems/animation/BioExplorer_mesh_based_membrane.ipynb @@ -0,0 +1,248 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Blue Brain BioExplorer\n", + "\n", + "![](../../bioexplorer_banner.png)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Visualization of a membrane defined by a mesh" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "from bioexplorer import BioExplorer, MovieMaker, Cell, Membrane, Protein, AnimationParams, \\\n", + " Vector2, Vector3, Quaternion\n", + "import glob\n", + "import os\n", + "\n", + "be = BioExplorer('localhost:5000')\n", + "core = be.core_api()\n", + "status = be.reset_scene()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Resources" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "resource_folder = '../../../tests/test_files'\n", + "\n", + "pdb_folder = os.path.join(resource_folder, 'pdb')\n", + "obj_folder = os.path.join(resource_folder, 'obj')\n", + "membrane_folder = os.path.join(pdb_folder, 'membrane')\n", + "lipids_folder = os.path.join(membrane_folder, 'lipids')\n", + "transporters_folder = os.path.join(pdb_folder, 'transporters')" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Configuration" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "mesh_source = os.path.join(obj_folder, 'suzanne.obj')\n", + "scale = Vector3(2.5, 2.5, 2.5)\n", + "\n", + "protein_representation = be.REPRESENTATION_ATOMS_AND_STICKS\n", + "protein_atom_radius_multiplier = 1.0" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Camera position" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "status = be.core_api().set_camera(\n", + " orientation=[-0.114, 0.341, 0.020, 0.932],\n", + " position=[368.152, 107.242, 367.312],\n", + " target=[50.364, -6.824, -5.159]\n", + ")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Membrane" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "def add_membrane(\n", + " frame, add_receptors,\n", + " position=Vector3(0.0, 0.0, 0.0), \n", + " rotation=Quaternion(1.0, 0.0, 0.0, 0.0)):\n", + " \n", + " name = 'Suzanne'\n", + " clip_planes = [[-1.0, 0.0, 0.0, 50.0]]\n", + "\n", + " # ACE2 receptor definition\n", + " ace2_receptor = Protein(\n", + " name=be.NAME_TRANS_MEMBRANE + '_ACE2',\n", + " source=os.path.join(pdb_folder, '6m18.pdb'),\n", + " transmembrane_params=Vector2(1.0, 2.0),\n", + " rotation=Quaternion(0.0, 1.0, 0.0, 0.0),\n", + " animation_params=AnimationParams(1, frame * 10 + 1, 1.0, frame * 10 + 2, 0.025),\n", + " occurrences=20)\n", + "\n", + " # GLUT3 definition\n", + " transporter = Protein(\n", + " name=be.NAME_TRANS_MEMBRANE + '_GLUT3',\n", + " source=os.path.join(transporters_folder, '4zwc.pdb'),\n", + " transmembrane_params=Vector2(1.0, 2.0),\n", + " rotation=Quaternion(0.707, 0.707, 0.0, 0.0),\n", + " animation_params=AnimationParams(2, frame * 10 + 3, 1.0, frame * 10 + 4, 0.025),\n", + " chain_ids=[1], occurrences=30)\n", + "\n", + " # Membrane definition\n", + " pdb_lipids = glob.glob(os.path.join(lipids_folder, '*.pdb'))[:8]\n", + "\n", + " membrane = Membrane(\n", + " lipid_sources=pdb_lipids, lipid_density=1.0,\n", + " load_non_polymer_chemicals=True, load_bonds=True,\n", + " animation_params=AnimationParams(3, frame * 10 + 5, 1.0, frame * 10 + 6, 0.025)\n", + " )\n", + "\n", + " # Cell definition\n", + " cell = Cell(\n", + " name=name,\n", + " shape=be.ASSEMBLY_SHAPE_MESH,\n", + " shape_params=scale,\n", + " shape_mesh_source=mesh_source, \n", + " membrane=membrane,\n", + " proteins=[ace2_receptor, transporter]\n", + " )\n", + "\n", + " # Add cell to scene\n", + " status = be.add_cell(\n", + " cell=cell, representation=protein_representation,\n", + " position=position, rotation=rotation, clipping_planes=clip_planes)\n", + "\n", + " return status" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Rendering settings" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "status = be.set_rendering_quality(be.RENDERING_QUALITY_HIGH)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Animation" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "from tqdm import tqdm\n", + "\n", + "mm = MovieMaker(be)\n", + "output_folder = '/tmp'\n", + "\n", + "pos = Vector3(0.0, 0.0, 0.0)\n", + "rot_start = Quaternion(1.0, 0.0, 0.0, 0.0)\n", + "rot_end = Quaternion(0.0, 0.0, 1.0, 0.0)\n", + "\n", + "nb_frames = 36\n", + "\n", + "for frame in tqdm(range(0, nb_frames)):\n", + " be.reset_scene()\n", + " be.set_general_settings(model_visibility_on_creation=False)\n", + " rot = Quaternion.slerp(rot_start, rot_end, float(frame) / nb_frames)\n", + " add_membrane(\n", + " frame=frame, add_receptors=True,\n", + " position=pos, rotation=rot)\n", + " be.apply_default_color_scheme(be.SHADING_MODE_NONE)\n", + " be.set_models_visibility(True)\n", + "\n", + " '''Snapshot'''\n", + " mm.create_snapshot(\n", + " renderer='bio_explorer',\n", + " size=[512, 512], samples_per_pixel=16,\n", + " path=output_folder,\n", + " base_name='%05d' % frame)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3.8.10 ('env')", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.8.10" + }, + "vscode": { + "interpreter": { + "hash": "ea9a5fa46eb6bad2806a8ea1d08e15bb1e255a2d4320b81e765591579963c56b" + } + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} \ No newline at end of file diff --git a/bioexplorer/pythonsdk/notebooks/animation/BioExplorer_rna_sequence.ipynb b/bioexplorer/pythonsdk/notebooks/molecular_systems/animation/BioExplorer_rna_sequence.ipynb similarity index 90% rename from bioexplorer/pythonsdk/notebooks/animation/BioExplorer_rna_sequence.ipynb rename to bioexplorer/pythonsdk/notebooks/molecular_systems/animation/BioExplorer_rna_sequence.ipynb index 1f7d97572..37d29616e 100644 --- a/bioexplorer/pythonsdk/notebooks/animation/BioExplorer_rna_sequence.ipynb +++ b/bioexplorer/pythonsdk/notebooks/molecular_systems/animation/BioExplorer_rna_sequence.ipynb @@ -6,7 +6,7 @@ "source": [ "# Blue Brain BioExplorer\n", "\n", - "![](../bioexplorer_banner.png)" + "![](../../bioexplorer_banner.png)" ] }, { @@ -24,6 +24,7 @@ "source": [ "from bioexplorer import BioExplorer, RNASequence, AnimationParams, Vector2, Vector3, Quaternion\n", "import math\n", + "import os\n", "\n", "be = BioExplorer()\n", "be.reset_scene()\n", @@ -39,9 +40,9 @@ "outputs": [], "source": [ "# Resources\n", - "resource_folder = '../../tests/test_files/'\n", - "rna_folder = resource_folder + 'rna/'\n", - "pdb_folder = resource_folder + 'pdb/'\n", + "resource_folder = '../../../tests/test_files'\n", + "rna_folder = os.path.join(resource_folder, 'rna')\n", + "pdb_folder = os.path.join(resource_folder, 'pdb')\n", "\n", "assembly_name = 'RNA assembly'\n", "rna_name = assembly_name + '_' + be.NAME_RNA_SEQUENCE" @@ -57,8 +58,8 @@ " offset = 0.01 * math.cos(frame * math.pi / 180.0)\n", "\n", " rna_sequence = RNASequence(\n", - " source=rna_folder + 'sars-cov-2.rna',\n", - " protein_source=pdb_folder + '7bv1.pdb',\n", + " source=os.path.join(rna_folder, 'sars-cov-2.rna'),\n", + " protein_source=os.path.join(pdb_folder, '7bv1.pdb'),\n", " shape=be.RNA_SHAPE_TREFOIL_KNOT,\n", " shape_params=Vector2(45.0, 1.0),\n", " curve_params=Vector3(1.51 + offset, 1.12 - offset, 1.93 + offset),\n", @@ -131,14 +132,12 @@ "metadata": {}, "outputs": [], "source": [ - "from IPython.display import clear_output\n", + "from tqdm import tqdm\n", "\n", "q_start = Quaternion(0.0, 1.0, 0.0, 0.0)\n", "q_end = Quaternion(1.0, 0.0, 0.0, 0.0)\n", "\n", - "for frame in range(0, 36):\n", - " clear_output()\n", - " print('Frame %d' % frame)\n", + "for frame in tqdm(range(0, 36)):\n", " add_rna_sequence(\n", " assembly_name=assembly_name, frame=frame,\n", " rotation=Quaternion.slerp(q_start, q_end, \n", diff --git a/bioexplorer/pythonsdk/notebooks/animation/BioExplorer_spike.ipynb b/bioexplorer/pythonsdk/notebooks/molecular_systems/animation/BioExplorer_spike.ipynb similarity index 76% rename from bioexplorer/pythonsdk/notebooks/animation/BioExplorer_spike.ipynb rename to bioexplorer/pythonsdk/notebooks/molecular_systems/animation/BioExplorer_spike.ipynb index c828ed218..0a4d15626 100644 --- a/bioexplorer/pythonsdk/notebooks/animation/BioExplorer_spike.ipynb +++ b/bioexplorer/pythonsdk/notebooks/molecular_systems/animation/BioExplorer_spike.ipynb @@ -6,7 +6,7 @@ "source": [ "# Blue Brain BioExplorer\n", "\n", - "![](../bioexplorer_banner.png)" + "![](../../bioexplorer_banner.png)" ] }, { @@ -23,6 +23,8 @@ "outputs": [], "source": [ "from bioexplorer import BioExplorer, AnimationParams, MovieMaker, Protein, Sugar, Quaternion\n", + "import os\n", + "\n", "uri = 'localhost:5000'\n", "be = BioExplorer(uri)\n", "core = be.core_api()\n", @@ -37,24 +39,43 @@ "outputs": [], "source": [ "'''Resources'''\n", - "resource_folder = '../../tests/test_files/'\n", - "pdb_folder = resource_folder + 'pdb/'\n", - "complex_folder = resource_folder + 'pdb/glycans/complex/'\n", + "resource_folder = '../../../tests/test_files/'\n", + "pdb_folder = os.path.join(resource_folder, 'pdb')\n", + "complex_folder = os.path.join(resource_folder, 'pdb', 'glycans', 'complex')\n", + "\n", + "glycan_folder = os.path.join(pdb_folder, 'glycans')\n", + "complex_folder = os.path.join(glycan_folder, 'complex')\n", + "high_mannose_folder = os.path.join(glycan_folder, 'high-mannose')\n", + "hybrid_folder = os.path.join(glycan_folder, 'hybrid')\n", + "o_glycan_folder = os.path.join(glycan_folder, 'o-glycan')\n", "\n", + "complex_paths = [\n", + " os.path.join(complex_folder, '33.pdb'),\n", + " os.path.join(complex_folder, '34.pdb'),\n", + " os.path.join(complex_folder, '35.pdb'),\n", + " os.path.join(complex_folder, '36.pdb')\n", + "]\n", + "high_mannose_paths = [\n", + " os.path.join(high_mannose_folder, '1.pdb'),\n", + " os.path.join(high_mannose_folder, '2.pdb'),\n", + " os.path.join(high_mannose_folder, '3.pdb'),\n", + " os.path.join(high_mannose_folder, '4.pdb')\n", + "]\n", + "hybrid_paths = [os.path.join(hybrid_folder, '24.pdb')]\n", + "o_glycan_paths = [os.path.join(o_glycan_folder, '12.pdb')]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "'''Representation'''\n", "protein_representation = BioExplorer.REPRESENTATION_ATOMS_AND_STICKS\n", "protein_radius_multiplier = 1.0\n", "glycan_representation = BioExplorer.REPRESENTATION_ATOMS_AND_STICKS\n", - "glycan_radius_multiplier = 1.0\n", - "\n", - "glycan_folder = pdb_folder + 'glycans/'\n", - "complex_paths = [glycan_folder + 'complex/33.pdb', glycan_folder + 'complex/34.pdb',\n", - " glycan_folder + 'complex/35.pdb',glycan_folder + 'complex/36.pdb']\n", - "high_mannose_paths = [glycan_folder + 'high-mannose/1.pdb', \n", - " glycan_folder + 'high-mannose/2.pdb',\n", - " glycan_folder + 'high-mannose/3.pdb',\n", - " glycan_folder + 'high-mannose/4.pdb']\n", - "hybrid_paths = [glycan_folder + 'hybrid/24.pdb']\n", - "o_glycan_paths = [glycan_folder + 'o-glycan/12.pdb']" + "glycan_radius_multiplier = 1.0" ] }, { @@ -83,9 +104,9 @@ "\n", " '''Protein'''\n", " protein_name = be.NAME_PROTEIN_S_CLOSED\n", - " source = pdb_folder + 'sars-cov-2-v1.pdb'\n", + " source = os.path.join(pdb_folder, 'sars-cov-2-v1.pdb')\n", " if open_spike:\n", - " source = pdb_folder + '6vyb.pdb'\n", + " source = os.path.join(pdb_folder, '6vyb.pdb')\n", "\n", " spike = Protein(\n", " name=protein_name, source=source,\n", @@ -115,7 +136,7 @@ " atom_radius_multiplier=glycan_radius_multiplier,\n", " animation_params=AnimationParams(0, 0, 0.0, orientation_randon_seed, 0.1)\n", " )\n", - " status = be.add_glycans(high_mannose_glycans)\n", + " status = be.add_glycan(high_mannose_glycans)\n", " \n", " '''O-Glycans'''\n", " if open_spike:\n", @@ -129,7 +150,7 @@ " representation=glycan_representation,\n", " animation_params=AnimationParams(0, 0, 0.0, orientation_randon_seed + 1, 0.1)\n", " )\n", - " be.add_sugars(o_glycan)\n", + " be.add_sugar(o_glycan)\n", " \n", " '''Complex'''\n", " indices = [17, 74, 149, 165, 282, 331, 343, 616, 657, 1098, 1134, 1158, 1173, 1194]\n", @@ -145,7 +166,7 @@ " atom_radius_multiplier=glycan_radius_multiplier,\n", " animation_params=AnimationParams(0, 0, 0.0, orientation_randon_seed + 2, 0.1)\n", " )\n", - " status = be.add_glycans(complex_glycans)\n", + " status = be.add_glycan(complex_glycans)\n", " \n", " '''Materials'''\n", " be.apply_default_color_scheme(\n", @@ -163,15 +184,12 @@ "metadata": {}, "outputs": [], "source": [ - "from IPython.display import clear_output\n", + "from tqdm import tqdm\n", "\n", "mm = MovieMaker(be)\n", "output_folder = '/tmp'\n", "\n", - "for frame in range(1, 20):\n", - " clear_output()\n", - " print('Frame %i' % frame)\n", - "\n", + "for frame in tqdm(range(1, 20)):\n", " '''Cell'''\n", " add_spike(frame)\n", " \n", diff --git a/bioexplorer/pythonsdk/notebooks/animation/BioExplorer_virus.ipynb b/bioexplorer/pythonsdk/notebooks/molecular_systems/animation/BioExplorer_virus.ipynb similarity index 79% rename from bioexplorer/pythonsdk/notebooks/animation/BioExplorer_virus.ipynb rename to bioexplorer/pythonsdk/notebooks/molecular_systems/animation/BioExplorer_virus.ipynb index 3a7cd493d..75e8d0de0 100644 --- a/bioexplorer/pythonsdk/notebooks/animation/BioExplorer_virus.ipynb +++ b/bioexplorer/pythonsdk/notebooks/molecular_systems/animation/BioExplorer_virus.ipynb @@ -6,7 +6,7 @@ "source": [ "# Blue Brain BioExplorer\n", "\n", - "![](../bioexplorer_banner.png)" + "![](../../bioexplorer_banner.png)" ] }, { @@ -18,6 +18,8 @@ "outputs": [], "source": [ "from bioexplorer import BioExplorer, AnimationParams, MovieMaker\n", + "import os\n", + "\n", "be = BioExplorer('localhost:5000')\n", "core = be.core_api()\n", "status = be.reset_scene()\n", @@ -37,20 +39,31 @@ "metadata": {}, "outputs": [], "source": [ - "resource_folder = '../../tests/test_files/'\n", - "pdb_folder = resource_folder + 'pdb/'\n", - "rna_folder = resource_folder + 'rna/'\n", - "glycan_folder = pdb_folder + 'glycans/'\n", - "membrane_folder = pdb_folder + 'membrane/'\n", + "resource_folder = '../../../tests/test_files/'\n", + "\n", + "pdb_folder = os.path.join(resource_folder, 'pdb')\n", + "rna_folder = os.path.join(resource_folder, 'rna')\n", + "\n", + "glycan_folder = os.path.join(pdb_folder, 'glycans')\n", + "complex_folder = os.path.join(glycan_folder, 'complex')\n", + "high_mannose_folder = os.path.join(glycan_folder, 'high-mannose')\n", + "hybrid_folder = os.path.join(glycan_folder, 'hybrid')\n", + "o_glycan_folder = os.path.join(glycan_folder, 'o-glycan')\n", "\n", - "complex_paths = [glycan_folder + 'complex/33.pdb', glycan_folder + 'complex/34.pdb',\n", - " glycan_folder + 'complex/35.pdb',glycan_folder + 'complex/36.pdb']\n", - "high_mannose_paths = [glycan_folder + 'high-mannose/1.pdb', \n", - " glycan_folder + 'high-mannose/2.pdb',\n", - " glycan_folder + 'high-mannose/3.pdb',\n", - " glycan_folder + 'high-mannose/4.pdb']\n", - "hybrid_paths = [glycan_folder + 'hybrid/24.pdb']\n", - "o_glycan_paths = [glycan_folder + 'o-glycan/12.pdb']" + "complex_paths = [\n", + " os.path.join(complex_folder, '33.pdb'),\n", + " os.path.join(complex_folder, '34.pdb'),\n", + " os.path.join(complex_folder, '35.pdb'),\n", + " os.path.join(complex_folder, '36.pdb')\n", + "]\n", + "high_mannose_paths = [\n", + " os.path.join(high_mannose_folder, '1.pdb'),\n", + " os.path.join(high_mannose_folder, '2.pdb'),\n", + " os.path.join(high_mannose_folder, '3.pdb'),\n", + " os.path.join(high_mannose_folder, '4.pdb')\n", + "]\n", + "hybrid_paths = [os.path.join(hybrid_folder, '24.pdb')]\n", + "o_glycan_paths = [os.path.join(o_glycan_folder, '12.pdb')]" ] }, { @@ -172,14 +185,12 @@ }, "outputs": [], "source": [ - "from IPython.display import clear_output\n", + "from tqdm import tqdm\n", "\n", "mm = MovieMaker(be)\n", "output_folder = '/tmp'\n", "\n", - "for frame in range(36):\n", - " clear_output()\n", - " print('Frame %d' % frame)\n", + "for frame in tqdm(range(36)):\n", " add_virus(1 + frame * 10, 2 + frame * 10, 3 + 10 * frame)\n", " be.reset_camera()\n", "\n", diff --git a/bioexplorer/pythonsdk/notebooks/animation/BioExplorer_virus_entering_cell.ipynb b/bioexplorer/pythonsdk/notebooks/molecular_systems/animation/BioExplorer_virus_entering_cell.ipynb similarity index 88% rename from bioexplorer/pythonsdk/notebooks/animation/BioExplorer_virus_entering_cell.ipynb rename to bioexplorer/pythonsdk/notebooks/molecular_systems/animation/BioExplorer_virus_entering_cell.ipynb index 340e333eb..63cb440fc 100644 --- a/bioexplorer/pythonsdk/notebooks/animation/BioExplorer_virus_entering_cell.ipynb +++ b/bioexplorer/pythonsdk/notebooks/molecular_systems/animation/BioExplorer_virus_entering_cell.ipynb @@ -6,7 +6,7 @@ "source": [ "# Blue Brain BioExplorer\n", "\n", - "![](../bioexplorer_banner.png)" + "![](../../bioexplorer_banner.png)" ] }, { @@ -27,6 +27,7 @@ "from bioexplorer import BioExplorer, Protein, Surfactant, Membrane, Volume, \\\n", " Cell, Sugar, AnimationParams, Vector2, Vector3, Quaternion, MovieMaker\n", "import glob\n", + "import os\n", "\n", "url = 'localhost:5000'\n", "be = BioExplorer(url)\n", @@ -48,28 +49,41 @@ "metadata": {}, "outputs": [], "source": [ - "resource_folder = '../../tests/test_files/'\n", - "pdb_folder = resource_folder + 'pdb/'\n", - "membrane_folder = pdb_folder + 'membrane/'\n", - "lipids_folder = membrane_folder + 'lipids/'\n", - "\n", - "glucose_path = pdb_folder + 'glucose.pdb'\n", - "lactoferrin_path=pdb_folder + 'immune/1b0l.pdb'\n", - "defensin_path = pdb_folder + 'immune/1ijv.pdb'\n", - "\n", - "surfactant_head_source = pdb_folder + 'surfactant/1pw9.pdb'\n", - "surfactant_branch_source = pdb_folder + 'surfactant/1k6f.pdb'\n", - "\n", - "\n", - "glycan_folder = pdb_folder + 'glycans/'\n", - "complex_paths = [glycan_folder + 'complex/5.pdb', glycan_folder + 'complex/15.pdb',\n", - " glycan_folder + 'complex/25.pdb',glycan_folder + 'complex/35.pdb']\n", - "high_mannose_paths = [glycan_folder + 'high-mannose/1.pdb', \n", - " glycan_folder + 'high-mannose/2.pdb',\n", - " glycan_folder + 'high-mannose/3.pdb',\n", - " glycan_folder + 'high-mannose/4.pdb']\n", - "hybrid_paths = [glycan_folder + 'hybrid/20.pdb']\n", - "o_glycan_paths = [glycan_folder + 'o-glycan/1.pdb']" + "resource_folder = '../../../tests/test_files'\n", + "\n", + "pdb_folder = os.path.join(resource_folder, 'pdb')\n", + "membrane_folder = os.path.join(pdb_folder, 'membrane')\n", + "lipids_folder = os.path.join(membrane_folder, 'lipids')\n", + "\n", + "glucose_path = os.path.join(pdb_folder, 'glucose.pdb')\n", + "immune_folder = os.path.join(pdb_folder, 'immune')\n", + "lactoferrin_path = os.path.join(immune_folder, '1b0l.pdb')\n", + "defensin_path = os.path.join(immune_folder, '1ijv.pdb')\n", + "\n", + "surfactant_folder = os.path.join(pdb_folder, 'surfactant')\n", + "surfactant_head_source = os.path.join(surfactant_folder, '1pw9.pdb')\n", + "surfactant_branch_source = os.path.join(surfactant_folder, '1k6f.pdb')\n", + "\n", + "glycan_folder = os.path.join(pdb_folder, 'glycans')\n", + "complex_folder = os.path.join(glycan_folder, 'complex')\n", + "high_mannose_folder = os.path.join(glycan_folder, 'high-mannose')\n", + "hybrid_folder = os.path.join(glycan_folder, 'hybrid')\n", + "o_glycan_folder = os.path.join(glycan_folder, 'o-glycan')\n", + "\n", + "complex_paths = [\n", + " os.path.join(complex_folder, '33.pdb'),\n", + " os.path.join(complex_folder, '34.pdb'),\n", + " os.path.join(complex_folder, '35.pdb'),\n", + " os.path.join(complex_folder, '36.pdb')\n", + "]\n", + "high_mannose_paths = [\n", + " os.path.join(high_mannose_folder, '1.pdb'),\n", + " os.path.join(high_mannose_folder, '2.pdb'),\n", + " os.path.join(high_mannose_folder, '3.pdb'),\n", + " os.path.join(high_mannose_folder, '4.pdb')\n", + "]\n", + "hybrid_paths = [os.path.join(hybrid_folder, '24.pdb')]\n", + "o_glycan_paths = [os.path.join(o_glycan_folder, '12.pdb')]" ] }, { @@ -174,12 +188,12 @@ " '''ACE2 receptor definition'''\n", " ace2_receptor = Protein(\n", " name=name + '_' + be.NAME_RECEPTOR,\n", - " source=pdb_folder + '6m18.pdb',\n", - " occurences=nb_receptors,\n", + " source=os.path.join(pdb_folder, '6m18.pdb'),\n", + " occurrences=nb_receptors,\n", " transmembrane_params=Vector2(-6.0, 2.0))\n", "\n", " '''Membrane definition'''\n", - " lipids = glob.glob(lipids_folder + '*.pdb')[:4]\n", + " lipids = glob.glob(os.path.join(lipids_folder, '*.pdb'))[:4]\n", " membrane = Membrane(\n", " load_non_polymer_chemicals=True, load_bonds=True,\n", " lipid_sources=lipids,\n", @@ -235,7 +249,7 @@ " rotation=index[1],\n", " animation_params=AnimationParams(\n", " random_seed, random_position_seed, 0.2, random_rotation_seed, 0.025))\n", - " be.add_sugars(o_glycan)\n", + " be.add_sugar(o_glycan)\n", " return status" ] }, @@ -271,7 +285,7 @@ " source=glucose_path, load_non_polymer_chemicals=True, \n", " animation_params=AnimationParams(\n", " 1, random_seed + 1, scene_size.y / 500.0, random_seed + 2, 1.0),\n", - " occurences=nb_glucoses)\n", + " occurrences=nb_glucoses)\n", " volume = Volume(\n", " name=be.NAME_GLUCOSE,\n", " shape=be.ASSEMBLY_SHAPE_CUBE,\n", @@ -293,14 +307,13 @@ "source": [ "def set_materials():\n", " be.apply_default_color_scheme(\n", - " shading_mode=be.SHADING_MODE_BASIC, user_parameter=1)\n", + " shading_mode=be.SHADING_MODE_BASIC, user_parameter=1.0)\n", " for model in core.scene.models:\n", " model_id = model['id']\n", " model_name = model['name']\n", " if be.NAME_COLLAGEN in model_name:\n", " material_ids = list(be.get_material_ids(model_id)['ids'])\n", " nb_materials = len(material_ids)\n", - " print(model_name)\n", " palette = list()\n", " emissions = list()\n", " for i in range(nb_materials):\n", @@ -390,7 +403,7 @@ }, "outputs": [], "source": [ - "from IPython.display import clear_output\n", + "from tqdm import tqdm\n", "\n", "'''Settings'''\n", "output_folder = '/tmp'\n", @@ -409,18 +422,14 @@ "'''Virus merging information'''\n", "merging_nb_frames = 100\n", "\n", - "be.set_general_settings(model_visibility_on_creation=False, off_folder='/tmp')\n", + "be.set_general_settings(model_visibility_on_creation=False, mesh_folder='/tmp')\n", "core.set_application_parameters(image_stream_fps=0)\n", "\n", - "for frame in range(nb_frames):\n", - " clear_output()\n", - " print('Frame %i out of %i' % (frame, nb_frames))\n", - " \n", + "for frame in tqdm(range(nb_frames)):\n", " '''Camera'''\n", " mm.set_current_frame(frame)\n", " \n", " '''Cell'''\n", - " print('Cell...')\n", " add_cell(5, 2, 5 * frame + 2, 5 * frame + 3)\n", " \n", " '''sars-cov-2'''\n", @@ -430,13 +439,11 @@ " o = q_c_end\n", " if frame <= flying_nb_frames:\n", " '''Flying'''\n", - " print('Flying virus...')\n", " p = Vector3(55.0, -5.0 + flying_nb_frames - frame, -45.0 - (frame - flying_nb_frames) / 2.0)\n", " o = Quaternion.slerp(q_c_start, q_c_end, (frame + 1) / flying_nb_frames)\n", " elif frame <= landing_nb_frames + flying_nb_frames:\n", " '''Landing...'''\n", " progress = float(frame - flying_nb_frames) * (landing_distance / float(landing_nb_frames))\n", - " print('Landing virus...')\n", " p = Vector3(55.0, -5.0 - progress, -45.0)\n", "\n", " '''Modify receptor position to dive into the cell membrane'''\n", @@ -452,9 +459,7 @@ " '''Merging...'''\n", " p = Vector3(55.0, -5.0 - landing_distance, -45.0)\n", " morphing_step = float(frame - flying_nb_frames - landing_nb_frames) / float(merging_nb_frames)\n", - " print('Merging virus (%f)...' % morphing_step)\n", " else:\n", - " print('No virus...')\n", " be.remove_assembly('sars-cov-2')\n", " show_virus = False\n", "\n", @@ -467,7 +472,6 @@ " morphing_step=morphing_step) \n", "\n", " '''Surfactant-D'''\n", - " print('SP-D...')\n", " o = Quaternion.slerp(\n", " q_s_start, q_s_end, (frame + 1) / q_s_nb_frames)\n", " add_surfactant_d(\n", @@ -481,18 +485,15 @@ " )\n", "\n", " '''Glucose'''\n", - " print('Glucose...')\n", " add_glucose(frame)\n", "\n", " '''Materials'''\n", - " print('Materials...')\n", " set_materials()\n", " \n", " '''Make all models visible'''\n", " be.set_models_visibility(True)\n", " \n", " '''Snapshot'''\n", - " print('Snapshot...')\n", " mm.create_snapshot(\n", " renderer='bio_explorer',\n", " size=image_size, samples_per_pixel=image_samples_per_pixel,\n", @@ -528,4 +529,4 @@ }, "nbformat": 4, "nbformat_minor": 4 -} +} \ No newline at end of file diff --git a/bioexplorer/pythonsdk/notebooks/animation/BioExplorer_virus_fusion.ipynb b/bioexplorer/pythonsdk/notebooks/molecular_systems/animation/BioExplorer_virus_fusion.ipynb similarity index 81% rename from bioexplorer/pythonsdk/notebooks/animation/BioExplorer_virus_fusion.ipynb rename to bioexplorer/pythonsdk/notebooks/molecular_systems/animation/BioExplorer_virus_fusion.ipynb index f9e57329a..980061d1d 100644 --- a/bioexplorer/pythonsdk/notebooks/animation/BioExplorer_virus_fusion.ipynb +++ b/bioexplorer/pythonsdk/notebooks/molecular_systems/animation/BioExplorer_virus_fusion.ipynb @@ -6,7 +6,7 @@ "source": [ "# Blue Brain BioExplorer\n", "\n", - "![](../bioexplorer_banner.png)" + "![](../../bioexplorer_banner.png)" ] }, { @@ -24,6 +24,8 @@ "source": [ "from bioexplorer import BioExplorer, Protein, Membrane, Cell, Sugar, \\\n", " AnimationParams, Vector2, Vector3, Quaternion, MovieMaker\n", + "import os\n", + "\n", "be = BioExplorer('localhost:5000')\n", "core = be.core_api()\n", "be.reset_scene()\n", @@ -45,18 +47,31 @@ }, "outputs": [], "source": [ - "resource_folder = '../../tests/test_files/'\n", - "pdb_folder = resource_folder + 'pdb/'\n", + "resource_folder = '../../../tests/test_files/'\n", + "\n", + "pdb_folder = os.path.join(resource_folder, 'pdb')\n", + "membrane_folder = os.path.join(pdb_folder, 'membrane')\n", + "\n", + "glycan_folder = os.path.join(pdb_folder, 'glycans')\n", + "complex_folder = os.path.join(glycan_folder, 'complex')\n", + "high_mannose_folder = os.path.join(glycan_folder, 'high-mannose')\n", + "hybrid_folder = os.path.join(glycan_folder, 'hybrid')\n", + "o_glycan_folder = os.path.join(glycan_folder, 'o-glycan')\n", "\n", - "glycan_folder = pdb_folder + 'glycans/'\n", - "complex_paths = [glycan_folder + 'complex/5.pdb', glycan_folder + 'complex/15.pdb',\n", - " glycan_folder + 'complex/25.pdb',glycan_folder + 'complex/35.pdb']\n", - "high_mannose_paths = [glycan_folder + 'high-mannose/1.pdb', \n", - " glycan_folder + 'high-mannose/2.pdb',\n", - " glycan_folder + 'high-mannose/3.pdb',\n", - " glycan_folder + 'high-mannose/4.pdb']\n", - "hybrid_paths = [glycan_folder + 'hybrid/20.pdb']\n", - "o_glycan_paths = [glycan_folder + 'o-glycan/1.pdb']" + "complex_paths = [\n", + " os.path.join(complex_folder, '33.pdb'),\n", + " os.path.join(complex_folder, '34.pdb'),\n", + " os.path.join(complex_folder, '35.pdb'),\n", + " os.path.join(complex_folder, '36.pdb')\n", + "]\n", + "high_mannose_paths = [\n", + " os.path.join(high_mannose_folder, '1.pdb'),\n", + " os.path.join(high_mannose_folder, '2.pdb'),\n", + " os.path.join(high_mannose_folder, '3.pdb'),\n", + " os.path.join(high_mannose_folder, '4.pdb')\n", + "]\n", + "hybrid_paths = [os.path.join(hybrid_folder, '24.pdb')]\n", + "o_glycan_paths = [os.path.join(o_glycan_folder, '12.pdb')]" ] }, { @@ -107,14 +122,14 @@ " '''ACE2 receptor definition'''\n", " ace2_receptor = Protein(\n", " name=name + '_' + be.NAME_RECEPTOR,\n", - " source=pdb_folder + '6m18.pdb',\n", - " occurences=nb_receptors,\n", + " source=os.path.join(pdb_folder, '6m18.pdb'),\n", + " occurrences=nb_receptors,\n", " transmembrane_params=Vector2(-6.0, 5.0))\n", "\n", " '''Membrane definition'''\n", " membrane_size = Vector3(scene_size.x, scene_size.y / 10.0, scene_size.z)\n", " membrane = Membrane(\n", - " lipid_sources=[pdb_folder + 'membrane/popc.pdb'],\n", + " lipid_sources=[os.path.join(pdb_folder, 'membrane/popc.pdb')],\n", " animation_params=AnimationParams(\n", " random_seed, random_position_seed, 0.25, random_rotation_seed, 0.2)\n", " )\n", @@ -158,7 +173,7 @@ " representation=protein_representation,\n", " chain_ids=[2, 4], site_indices=[index[0]], \n", " rotation=index[1])\n", - " be.add_sugars(o_glycan)\n", + " be.add_sugar(o_glycan)\n", " return status" ] }, @@ -188,22 +203,18 @@ }, "outputs": [], "source": [ - "from IPython.display import clear_output\n", + "from tqdm import tqdm\n", "\n", "mm = MovieMaker(be)\n", "output_folder = '/tmp'\n", - "be.set_general_settings(\n", - " model_visibility_on_creation=False, off_folder='/tmp/')\n", + "be.set_general_settings(model_visibility_on_creation=False, mesh_folder=output_folder)\n", "\n", "nb_frames = 40\n", "nb_going_down_frames = 20\n", "going_down_distance = 33.0\n", "\n", - "for frame in range(25, nb_going_down_frames + nb_frames, 5):\n", - "# for frame in range(nb_going_down_frames + nb_frames):\n", - " clear_output()\n", + "for frame in tqdm(range(nb_going_down_frames + nb_frames)):\n", " core.set_application_parameters(image_stream_fps=0)\n", - " print('Frame %d' % frame)\n", " \n", " '''Cell'''\n", " status = add_cell(5, 1, 5 * frame + 1, 5 * frame + 2)\n", @@ -221,8 +232,7 @@ " )\n", "\n", " '''Materials'''\n", - " be.apply_default_color_scheme(\n", - " shading_mode=be.SHADING_MODE_BASIC, user_parameter=1)\n", + " be.apply_default_color_scheme(shading_mode=be.SHADING_MODE_BASIC, user_parameter=1.0)\n", " be.set_models_visibility(True)\n", " \n", " '''Snapshot'''\n", @@ -261,4 +271,4 @@ }, "nbformat": 4, "nbformat_minor": 4 -} +} \ No newline at end of file diff --git a/bioexplorer/pythonsdk/notebooks/animation/BioExplorer_virus_sphere_to_flat.ipynb b/bioexplorer/pythonsdk/notebooks/molecular_systems/animation/BioExplorer_virus_sphere_to_flat.ipynb similarity index 72% rename from bioexplorer/pythonsdk/notebooks/animation/BioExplorer_virus_sphere_to_flat.ipynb rename to bioexplorer/pythonsdk/notebooks/molecular_systems/animation/BioExplorer_virus_sphere_to_flat.ipynb index 81c661817..bd76d9398 100644 --- a/bioexplorer/pythonsdk/notebooks/animation/BioExplorer_virus_sphere_to_flat.ipynb +++ b/bioexplorer/pythonsdk/notebooks/molecular_systems/animation/BioExplorer_virus_sphere_to_flat.ipynb @@ -6,7 +6,7 @@ "source": [ "# Blue Brain BioExplorer\n", "\n", - "![](../bioexplorer_banner.png)" + "![](../../bioexplorer_banner.png)" ] }, { @@ -23,6 +23,8 @@ "outputs": [], "source": [ "from bioexplorer import BioExplorer, MovieMaker, AnimationParams\n", + "import os\n", + "\n", "be = BioExplorer()\n", "core = be.core_api()\n", "be.reset_scene()\n", @@ -44,18 +46,30 @@ }, "outputs": [], "source": [ - "resource_folder = '../../tests/test_files/'\n", - "pdb_folder = resource_folder + 'pdb/'\n", + "resource_folder = '../../../tests/test_files/'\n", + "\n", + "pdb_folder = os.path.join(resource_folder, 'pdb')\n", + "\n", + "glycan_folder = os.path.join(pdb_folder, 'glycans')\n", + "complex_folder = os.path.join(glycan_folder, 'complex')\n", + "high_mannose_folder = os.path.join(glycan_folder, 'high-mannose')\n", + "hybrid_folder = os.path.join(glycan_folder, 'hybrid')\n", + "o_glycan_folder = os.path.join(glycan_folder, 'o-glycan')\n", "\n", - "glycan_folder = pdb_folder + 'glycans/'\n", - "complex_paths = [glycan_folder + 'complex/5.pdb', glycan_folder + 'complex/15.pdb',\n", - " glycan_folder + 'complex/25.pdb',glycan_folder + 'complex/35.pdb']\n", - "high_mannose_paths = [glycan_folder + 'high-mannose/1.pdb', \n", - " glycan_folder + 'high-mannose/2.pdb',\n", - " glycan_folder + 'high-mannose/3.pdb',\n", - " glycan_folder + 'high-mannose/4.pdb']\n", - "hybrid_paths = [glycan_folder + 'hybrid/20.pdb']\n", - "o_glycan_paths = [glycan_folder + 'o-glycan/1.pdb']" + "complex_paths = [\n", + " os.path.join(complex_folder, '33.pdb'),\n", + " os.path.join(complex_folder, '34.pdb'),\n", + " os.path.join(complex_folder, '35.pdb'),\n", + " os.path.join(complex_folder, '36.pdb')\n", + "]\n", + "high_mannose_paths = [\n", + " os.path.join(high_mannose_folder, '1.pdb'),\n", + " os.path.join(high_mannose_folder, '2.pdb'),\n", + " os.path.join(high_mannose_folder, '3.pdb'),\n", + " os.path.join(high_mannose_folder, '4.pdb')\n", + "]\n", + "hybrid_paths = [os.path.join(hybrid_folder, '24.pdb')]\n", + "o_glycan_paths = [os.path.join(o_glycan_folder, '12.pdb')]" ] }, { @@ -118,28 +132,22 @@ }, "outputs": [], "source": [ - "from IPython.display import clear_output\n", + "from tqdm import tqdm\n", "\n", "mm = MovieMaker(be)\n", "output_folder = '/tmp'\n", "\n", - "be.set_general_settings(\n", - " model_visibility_on_creation=False, off_folder='/tmp/')\n", + "be.set_general_settings(model_visibility_on_creation=False, mesh_folder=output_folder)\n", "nb_frames = 100\n", "\n", - "for frame in range(nb_frames):\n", - " clear_output()\n", - " core.set_application_parameters(image_stream_fps=0)\n", - " print('Frame %d' % frame)\n", + "core.set_application_parameters(image_stream_fps=0)\n", + "for frame in tqdm(range(nb_frames)):\n", " \n", " '''Virus'''\n", - " add_virus(5 * frame + 1, 5 * frame + 2, frame + 3,\n", - " float(frame) / float(nb_frames)\n", - " )\n", + " add_virus(5 * frame + 1, 5 * frame + 2, frame + 3, float(frame) / float(nb_frames))\n", "\n", " '''Materials'''\n", - " be.apply_default_color_scheme(\n", - " shading_mode=be.SHADING_MODE_BASIC, user_parameter=1)\n", + " be.apply_default_color_scheme(shading_mode=be.SHADING_MODE_BASIC, user_parameter=1.0)\n", " be.set_models_visibility(True)\n", " \n", " '''Snapshot'''\n", diff --git a/bioexplorer/pythonsdk/notebooks/fields/BioExplorer_fields.ipynb b/bioexplorer/pythonsdk/notebooks/molecular_systems/fields/BioExplorer_fields.ipynb similarity index 80% rename from bioexplorer/pythonsdk/notebooks/fields/BioExplorer_fields.ipynb rename to bioexplorer/pythonsdk/notebooks/molecular_systems/fields/BioExplorer_fields.ipynb index f13027cd7..352197fe3 100644 --- a/bioexplorer/pythonsdk/notebooks/fields/BioExplorer_fields.ipynb +++ b/bioexplorer/pythonsdk/notebooks/molecular_systems/fields/BioExplorer_fields.ipynb @@ -5,7 +5,7 @@ "metadata": {}, "source": [ "# Blue Brain BioExplorer\n", - "![](../bioexplorer_banner.png)" + "![](../../bioexplorer_banner.png)" ] }, { @@ -29,12 +29,15 @@ "outputs": [], "source": [ "from bioexplorer import BioExplorer, TransferFunction\n", + "import os\n", + "\n", "uri = 'localhost:5000'\n", "be = BioExplorer(uri)\n", + "core = be.core_api()\n", "be.reset_scene()\n", "\n", - "resource_folder = '../../tests/test_files/'\n", - "colormap_folder = resource_folder + 'colormap/'" + "resource_folder = os.path.abspath('../../../tests/test_files')\n", + "colormap_folder = os.path.join(resource_folder, 'colormap')" ] }, { @@ -50,9 +53,8 @@ "metadata": {}, "outputs": [], "source": [ - "filename = resource_folder + 'fields/receptor.fields'\n", - "status = be.import_fields_from_file(filename=filename)\n", - "print(status)" + "filename = os.path.join(resource_folder, 'fields', 'receptor.fields')\n", + "status = be.import_fields_from_file(filename=filename)" ] }, { @@ -61,8 +63,6 @@ "metadata": {}, "outputs": [], "source": [ - "be = BioExplorer(uri)\n", - "core = be.core_api()\n", "fields_model_id = core.scene.models[len(core.scene.models)-1]['id']" ] }, @@ -79,7 +79,7 @@ "metadata": {}, "outputs": [], "source": [ - "image_samples_per_pixel = 1" + "image_samples_per_pixel = 16" ] }, { @@ -94,9 +94,9 @@ "\n", "params = core.BioExplorerFieldsRendererParams()\n", "params.cutoff = 15000\n", - "params.exposure = 1.0\n", - "params.alpha_correction = 1\n", - "params.nb_ray_steps = 8\n", + "params.exposure = 2.0\n", + "params.alpha_correction = 0.5\n", + "params.nb_ray_steps = 16\n", "params.nb_ray_refinement_steps = image_samples_per_pixel\n", "params.use_hardware_randomizer = True\n", "status = core.set_renderer_params(params)" @@ -117,8 +117,10 @@ }, "outputs": [], "source": [ - "tf = TransferFunction(bioexplorer=be, model_id=fields_model_id, filename=colormap_folder + 'spike_v1.1dt')\n", - "tf.set_range((0, 5))" + "tf = TransferFunction(\n", + " bioexplorer=be, model_id=fields_model_id,\n", + " filename=os.path.join(colormap_folder, 'spike_v1.1dt'))\n", + "tf.set_range((0, 0.005))" ] }, { @@ -164,7 +166,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3.8.10 64-bit ('env': venv)", "language": "python", "name": "python3" }, @@ -179,6 +181,11 @@ "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.10" + }, + "vscode": { + "interpreter": { + "hash": "ea9a5fa46eb6bad2806a8ea1d08e15bb1e255a2d4320b81e765591579963c56b" + } } }, "nbformat": 4, diff --git a/bioexplorer/pythonsdk/notebooks/scenarios/high_glucose/BioExplorer_high_glucose_movie.ipynb b/bioexplorer/pythonsdk/notebooks/molecular_systems/scenarios/high_glucose/BioExplorer_high_glucose_movie.ipynb similarity index 98% rename from bioexplorer/pythonsdk/notebooks/scenarios/high_glucose/BioExplorer_high_glucose_movie.ipynb rename to bioexplorer/pythonsdk/notebooks/molecular_systems/scenarios/high_glucose/BioExplorer_high_glucose_movie.ipynb index 199dc4fd7..a10c72fae 100644 --- a/bioexplorer/pythonsdk/notebooks/scenarios/high_glucose/BioExplorer_high_glucose_movie.ipynb +++ b/bioexplorer/pythonsdk/notebooks/molecular_systems/scenarios/high_glucose/BioExplorer_high_glucose_movie.ipynb @@ -5,7 +5,7 @@ "metadata": {}, "source": [ "# Blue Brain BioExplorer\n", - "![](../../bioexplorer_banner.png)" + "![](../../../bioexplorer_banner.png)" ] }, { @@ -18,7 +18,7 @@ "import os\n", "\n", "hostname = 'localhost:5000'\n", - "resource_folder = '../../../tests/test_files/'\n", + "resource_folder = '../../../../tests/test_files/'\n", " \n", "be = BioExplorer(hostname)\n", "core = be.core_api()\n", @@ -47,9 +47,7 @@ "outputs": [], "source": [ "'''Accelerate loading by not showing models as they are loaded'''\n", - "status = be.set_general_settings(\n", - " logging_enabled=True,\n", - " model_visibility_on_creation=False)" + "status = be.set_general_settings(model_visibility_on_creation=False)" ] }, { @@ -603,7 +601,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3.8.10 64-bit ('env': venv)", "language": "python", "name": "python3" }, @@ -618,8 +616,13 @@ "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.10" + }, + "vscode": { + "interpreter": { + "hash": "ea9a5fa46eb6bad2806a8ea1d08e15bb1e255a2d4320b81e765591579963c56b" + } } }, "nbformat": 4, "nbformat_minor": 5 -} \ No newline at end of file +} diff --git a/bioexplorer/pythonsdk/notebooks/scenarios/high_glucose/BioExplorer_high_glucose_scenario.ipynb b/bioexplorer/pythonsdk/notebooks/molecular_systems/scenarios/high_glucose/BioExplorer_high_glucose_scenario.ipynb similarity index 97% rename from bioexplorer/pythonsdk/notebooks/scenarios/high_glucose/BioExplorer_high_glucose_scenario.ipynb rename to bioexplorer/pythonsdk/notebooks/molecular_systems/scenarios/high_glucose/BioExplorer_high_glucose_scenario.ipynb index 1bae53f5b..77d57caf4 100644 --- a/bioexplorer/pythonsdk/notebooks/scenarios/high_glucose/BioExplorer_high_glucose_scenario.ipynb +++ b/bioexplorer/pythonsdk/notebooks/molecular_systems/scenarios/high_glucose/BioExplorer_high_glucose_scenario.ipynb @@ -5,7 +5,7 @@ "metadata": {}, "source": [ "# Blue Brain BioExplorer\n", - "![](../../bioexplorer_banner.png)" + "![](../../../bioexplorer_banner.png)" ] }, { @@ -35,7 +35,7 @@ "import nglview\n", "\n", "hostname = 'localhost:5000'\n", - "resource_folder = '../../../tests/test_files/'\n", + "resource_folder = '../../../../tests/test_files/'\n", "\n", "be = BioExplorer(hostname)\n", "core = be.core_api()\n", @@ -56,7 +56,6 @@ "source": [ "'''Accelerate loading by not showing models as they are loaded'''\n", "status = be.set_general_settings(\n", - " logging_enabled=False,\n", " model_visibility_on_creation=False,\n", " v1_compatibility=True\n", ")\n", @@ -264,7 +263,7 @@ " seed = 10\n", " ace2_receptor = Protein(\n", " name=name + '_' + be.NAME_RECEPTOR,\n", - " source=pdb_folder + '6m18.pdb', occurences=nb_receptors,\n", + " source=pdb_folder + '6m18.pdb', occurrences=nb_receptors,\n", " transmembrane_params=Vector2(-6.0, 5.0),\n", " animation_params=AnimationParams(seed, 1, 0.025, 2, 0.025))\n", " \n", @@ -309,7 +308,7 @@ " assembly_name=name, name=o_glycan_name, source=o_glycan_paths[0],\n", " protein_name=name + '_' + be.NAME_RECEPTOR, representation=glycan_representation,\n", " chain_ids=[2, 4], site_indices=[index[0]], rotation=index[1])\n", - " be.add_sugars(o_glycan)" + " be.add_sugar(o_glycan)" ] }, { @@ -441,7 +440,7 @@ " assembly_name=name, name=glucose_name, source=glucose_path,\n", " protein_name=name + '_' + be.NAME_SURFACTANT_HEAD, \n", " representation=glycan_representation, site_indices=[index])\n", - " be.add_sugars(glucose)\n", + " be.add_sugar(glucose)\n", "add_glucose_to_surfactant_head('Surfactant-D 1')\n", "add_glucose_to_surfactant_head('Surfactant-D 2')\n", "add_glucose_to_surfactant_head('Surfactant-D 3')\n", @@ -475,7 +474,7 @@ "glucose = Protein(\n", " name=be.NAME_GLUCOSE,\n", " source=glucose_path, load_non_polymer_chemicals=True, \n", - " occurences=nb_glucoses, animation_params=AnimationParams(0, 1, 2.0, 2, 1.0))\n", + " occurrences=nb_glucoses, animation_params=AnimationParams(0, 1, 2.0, 2, 1.0))\n", "volume = Volume(\n", " name=be.NAME_GLUCOSE,\n", " shape=be.ASSEMBLY_SHAPE_CUBE, shape_params=scene_size,\n", @@ -512,7 +511,7 @@ "lactoferrin = Protein(\n", " name=be.NAME_LACTOFERRIN,\n", " source=lactoferrin_path, load_non_polymer_chemicals=True,\n", - " occurences=nb_lactoferrins, animation_params=AnimationParams(2, 2, 2.0, 3, 1.0))\n", + " occurrences=nb_lactoferrins, animation_params=AnimationParams(2, 2, 2.0, 3, 1.0))\n", "lactoferrins_volume = Volume(\n", " name=be.NAME_LACTOFERRIN,\n", " shape=be.ASSEMBLY_SHAPE_CUBE, shape_params=scene_size,\n", @@ -551,7 +550,7 @@ "defensin = Protein(\n", " name=be.NAME_DEFENSIN,\n", " source=defensin_path, load_non_polymer_chemicals=True, \n", - " occurences=nb_defensins, animation_params=AnimationParams(3, 3, 2.0, 4, 1.0))\n", + " occurrences=nb_defensins, animation_params=AnimationParams(3, 3, 2.0, 4, 1.0))\n", "defensins_volume = Volume(\n", " name=be.NAME_DEFENSIN, shape=be.ASSEMBLY_SHAPE_CUBE, shape_params=scene_size,\n", " protein=defensin)\n", @@ -575,7 +574,7 @@ "source": [ "be.apply_default_color_scheme(\n", " shading_mode=be.SHADING_MODE_DIFFUSE,\n", - " specular_exponent=50)" + " specular_exponent=50.0)" ] }, { @@ -630,7 +629,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 32, "metadata": { "scrolled": true }, diff --git a/bioexplorer/pythonsdk/notebooks/scenarios/high_glucose/BioExplorer_high_glucose_stills.ipynb b/bioexplorer/pythonsdk/notebooks/molecular_systems/scenarios/high_glucose/BioExplorer_high_glucose_stills.ipynb similarity index 96% rename from bioexplorer/pythonsdk/notebooks/scenarios/high_glucose/BioExplorer_high_glucose_stills.ipynb rename to bioexplorer/pythonsdk/notebooks/molecular_systems/scenarios/high_glucose/BioExplorer_high_glucose_stills.ipynb index 4d6c1a9f7..c0f46dbe7 100644 --- a/bioexplorer/pythonsdk/notebooks/scenarios/high_glucose/BioExplorer_high_glucose_stills.ipynb +++ b/bioexplorer/pythonsdk/notebooks/molecular_systems/scenarios/high_glucose/BioExplorer_high_glucose_stills.ipynb @@ -5,7 +5,7 @@ "metadata": {}, "source": [ "# Blue Brain BioExplorer\n", - "![](../../bioexplorer_banner.png)" + "![](../../../bioexplorer_banner.png)" ] }, { @@ -241,7 +241,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3.8.10 64-bit", "language": "python", "name": "python3" }, @@ -256,8 +256,13 @@ "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.10" + }, + "vscode": { + "interpreter": { + "hash": "916dbcbb3f70747c44a77c7bcd40155683ae19c65e1c03b4aa3499c5328201f1" + } } }, "nbformat": 4, "nbformat_minor": 5 -} \ No newline at end of file +} diff --git a/bioexplorer/pythonsdk/notebooks/scenarios/low_glucose/BioExplorer_low_glucose_movie.ipynb b/bioexplorer/pythonsdk/notebooks/molecular_systems/scenarios/low_glucose/BioExplorer_low_glucose_movie.ipynb similarity index 100% rename from bioexplorer/pythonsdk/notebooks/scenarios/low_glucose/BioExplorer_low_glucose_movie.ipynb rename to bioexplorer/pythonsdk/notebooks/molecular_systems/scenarios/low_glucose/BioExplorer_low_glucose_movie.ipynb diff --git a/bioexplorer/pythonsdk/notebooks/scenarios/low_glucose/BioExplorer_low_glucose_scenario.ipynb b/bioexplorer/pythonsdk/notebooks/molecular_systems/scenarios/low_glucose/BioExplorer_low_glucose_scenario.ipynb similarity index 98% rename from bioexplorer/pythonsdk/notebooks/scenarios/low_glucose/BioExplorer_low_glucose_scenario.ipynb rename to bioexplorer/pythonsdk/notebooks/molecular_systems/scenarios/low_glucose/BioExplorer_low_glucose_scenario.ipynb index 9aaf059bd..c7c468957 100644 --- a/bioexplorer/pythonsdk/notebooks/scenarios/low_glucose/BioExplorer_low_glucose_scenario.ipynb +++ b/bioexplorer/pythonsdk/notebooks/molecular_systems/scenarios/low_glucose/BioExplorer_low_glucose_scenario.ipynb @@ -277,7 +277,7 @@ " seed = 10\n", " ace2_receptor = Protein(\n", " name=name + '_' + be.NAME_RECEPTOR,\n", - " source=pdb_folder + '6m18.pdb', occurences=nb_receptors,\n", + " source=pdb_folder + '6m18.pdb', occurrences=nb_receptors,\n", " transmembrane_params=Vector2(-6.0, 5.0),\n", " animation_params=AnimationParams(seed, 1, 0.025, 2, 0.025))\n", " \n", @@ -469,7 +469,7 @@ "glucose = Protein(\n", " name=be.NAME_GLUCOSE,\n", " source=glucose_path, load_non_polymer_chemicals=True, \n", - " occurences=nb_glucoses, animation_params=AnimationParams(1, 2, 0.025, 3, 1.0))\n", + " occurrences=nb_glucoses, animation_params=AnimationParams(1, 2, 0.025, 3, 1.0))\n", "volume = Volume(\n", " name=be.NAME_GLUCOSE,\n", " shape=be.ASSEMBLY_SHAPE_CUBE, shape_params=scene_size,\n", @@ -506,7 +506,7 @@ "lactoferrin = Protein(\n", " name=be.NAME_LACTOFERRIN,\n", " source=lactoferrin_path, load_non_polymer_chemicals=True,\n", - " occurences=nb_lactoferrins, animation_params=AnimationParams(2, 3, 1.0, 4, 0.5))\n", + " occurrences=nb_lactoferrins, animation_params=AnimationParams(2, 3, 1.0, 4, 0.5))\n", "lactoferrins_volume = Volume(\n", " name=be.NAME_LACTOFERRIN,\n", " shape=be.ASSEMBLY_SHAPE_CUBE, shape_params=scene_size,\n", @@ -543,7 +543,7 @@ "defensin = Protein(\n", " name=be.NAME_DEFENSIN,\n", " source=defensin_path, load_non_polymer_chemicals=True, \n", - " occurences=nb_defensins, animation_params=AnimationParams(3, 4, 0.025, 5, 1.0))\n", + " occurrences=nb_defensins, animation_params=AnimationParams(3, 4, 0.025, 5, 1.0))\n", "defensins_volume = Volume(\n", " name=be.NAME_DEFENSIN,\n", " shape=be.ASSEMBLY_SHAPE_CUBE, shape_params=scene_size,\n", @@ -719,4 +719,4 @@ }, "nbformat": 4, "nbformat_minor": 5 -} +} \ No newline at end of file diff --git a/bioexplorer/pythonsdk/notebooks/scenarios/low_glucose/BioExplorer_low_glucose_stills.ipynb b/bioexplorer/pythonsdk/notebooks/molecular_systems/scenarios/low_glucose/BioExplorer_low_glucose_stills.ipynb similarity index 100% rename from bioexplorer/pythonsdk/notebooks/scenarios/low_glucose/BioExplorer_low_glucose_stills.ipynb rename to bioexplorer/pythonsdk/notebooks/molecular_systems/scenarios/low_glucose/BioExplorer_low_glucose_stills.ipynb diff --git a/bioexplorer/pythonsdk/notebooks/neuromodulation/BioExplorer_microtubules.ipynb b/bioexplorer/pythonsdk/notebooks/neuromodulation/BioExplorer_microtubules.ipynb index 9935f3223..838e5f998 100644 --- a/bioexplorer/pythonsdk/notebooks/neuromodulation/BioExplorer_microtubules.ipynb +++ b/bioexplorer/pythonsdk/notebooks/neuromodulation/BioExplorer_microtubules.ipynb @@ -1,245 +1,245 @@ { - "cells": [ - { - "cell_type": "markdown", - "id": "fcf7a2b1", - "metadata": {}, - "source": [ - "# Blue Brain BioExplorer - Neuromodulation\n", - "![](../bioexplorer_neuromodulation_banner.png)" - ] - }, - { - "cell_type": "markdown", - "id": "ac3c2bbd", - "metadata": {}, - "source": [ - "## Visualization of a microtubule" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "eeff036f", - "metadata": {}, - "outputs": [], - "source": [ - "from bioexplorer import BioExplorer, Volume, Protein, AnimationParams, Vector3, Quaternion\n", - "\n", - "be = BioExplorer('localhost:5000')\n", - "core = be.core_api()\n", - "status = be.reset_scene()" - ] - }, - { - "cell_type": "markdown", - "id": "c9f34251", - "metadata": {}, - "source": [ - "### Resources" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "addafa59", - "metadata": {}, - "outputs": [], - "source": [ - "resource_folder = '../../tests/test_files/'\n", - "pdb_folder = resource_folder + 'pdb/'\n", - "obj_folder = resource_folder + 'obj/'\n", - "membrane_folder = pdb_folder + 'membrane/'\n", - "lipids_folder = membrane_folder + 'lipids/'\n", - "transporters_folder = pdb_folder + 'transporters/'\n", - "tubules_folder = pdb_folder + 'tubules/'\n", - "\n", - "representation = be.REPRESENTATION_ATOMS_AND_STICKS\n", - "\n", - "scale = 1000.0" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "import numpy as np\n", - "import quaternion\n", - "import math\n", - "from bioexplorer import MovieMaker\n", - "\n", - "index = 4\n", - "\n", - "def createFromAxisAngle(axis, angle):\n", - " halfAngle = angle * 0.5\n", - " s = math.sin(halfAngle)\n", - " return quaternion.quaternion(axis[0] * s, axis[1] * s, axis[2] * s, math.cos(halfAngle))\n", - "\n", - "\n", - "def lookAt(sourcePoint, destPoint):\n", - " forward = np.array([0.0, 0.0, 1.0])\n", - " forwardVector = np.subtract(destPoint, sourcePoint)\n", - " forwardVector = forwardVector / np.sqrt(np.sum(forwardVector**2))\n", - " dot = np.dot(forward, forwardVector)\n", - " angle = math.acos(dot)\n", - " axis = np.cross(forward, forwardVector)\n", - " axis = axis / np.sqrt(np.sum(axis**2))\n", - " return createFromAxisAngle(axis, angle)\n", - "\n", - "points = be.get_neuron_section_points('Neuron', 4, 0)\n", - "p0 = points[index]\n", - "p1 = points[index + 1]\n", - "print(p0)\n", - "print(p1)\n", - "\n", - "src = np.array(p0[:3])\n", - "dst = np.array(p1[:3])\n", - "q = lookAt(src, dst)\n", - "Q = Quaternion(q.w, q.x, q.y, q.z)\n", - "print(Q)\n", - "\n", - "mm = MovieMaker(be)\n", - "forwardVector = np.subtract(dst, src)\n", - "forward_length = np.sqrt(np.sum(forwardVector**2))\n", - "mm.set_camera(origin=p0, direction=list(forwardVector[:3]), up=[0,1,0])\n", - "core.set_renderer()\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "# be.add_sphere(name='test', position=Vector3(p0[0], p0[1], p0[2]), radius=0.7 * scale, color=Vector3(1,1,1))\n", - "# be.add_sphere(name='test', position=Vector3(p1[0], p1[1], p1[2]), radius=0.7 * scale, color=Vector3(1,1,1))" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "039b5da0", - "metadata": {}, - "outputs": [], - "source": [ - "import random\n", - "\n", - "size = Vector3(5.0, forward_length, 0.0)\n", - "for i in range(5):\n", - " position = Vector3(\n", - " p0[0] + random.randint(-scale / 20.0, scale / 20.0),\n", - " p0[1] + random.randint(-scale / 20.0, scale / 20.0),\n", - " p0[2] + random.randint(-scale / 20.0, scale / 20.0))\n", - " name = 'Microtubule%05d' % i\n", - "\n", - " # ACE2 receptor definition\n", - " tubule = Protein(\n", - " name=name + '_TUB',\n", - " source=tubules_folder + '1tub.pdb', \n", - " rotation=Quaternion(0.0, 0.0, 0.707, 0.707),\n", - " occurences=size.y * 5.0)\n", - "\n", - " volume = Volume(\n", - " name=name,\n", - " shape=be.ASSEMBLY_SHAPE_HELIX, shape_params=size,\n", - " protein=tubule)\n", - "\n", - " status = be.add_volume(\n", - " position=position,\n", - " rotation=Quaternion( 0.212, 0.700, -0.231, 0.642),\n", - " volume=volume)\n", - "\n", - " status = be.set_protein_color_scheme(\n", - " assembly_name=name,\n", - " name=name + '_TUB',\n", - " color_scheme=be.COLOR_SCHEME_CHAINS,\n", - " palette_name='Set2', palette_size=5)\n", - "core.set_renderer()" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "be.reset_camera()\n", - "core.set_renderer()" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "core.set_camera(\n", - " orientation=[0.0, 0.0, 0.0, 1.0],\n", - " position=[27451.090107478147, 195917.513949172, 38855.97730085014],\n", - " target=[27451.090107478147, 195917.513949172, 38338.56432876815], \n", - ")" - ] - }, - { - "cell_type": "markdown", - "id": "b522863a", - "metadata": {}, - "source": [ - "## Rendering settings" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "034c40ec", - "metadata": {}, - "outputs": [], - "source": [ - "status = be.reset_camera()\n", - "status = be.set_rendering_quality(be.RENDERING_QUALITY_HIGH)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "from bioexplorer import MovieMaker\n", - "mm = MovieMaker(be)\n", - "mm.create_snapshot(\n", - " renderer='bio_explorer',\n", - " path='/tmp', base_name='neuromodulation_4k_v1',\n", - " size=[4 * 960, 4 * 540], samples_per_pixel=64)" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3.8.10 ('env')", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.8.10" - }, - "vscode": { - "interpreter": { - "hash": "ea9a5fa46eb6bad2806a8ea1d08e15bb1e255a2d4320b81e765591579963c56b" - } - } - }, - "nbformat": 4, - "nbformat_minor": 4 -} + "cells": [ + { + "cell_type": "markdown", + "id": "fcf7a2b1", + "metadata": {}, + "source": [ + "# Blue Brain BioExplorer - Neuromodulation\n", + "![](../bioexplorer_neuromodulation_banner.png)" + ] + }, + { + "cell_type": "markdown", + "id": "ac3c2bbd", + "metadata": {}, + "source": [ + "## Visualization of a microtubule" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "eeff036f", + "metadata": {}, + "outputs": [], + "source": [ + "from bioexplorer import BioExplorer, Volume, Protein, AnimationParams, Vector3, Quaternion\n", + "\n", + "be = BioExplorer('localhost:5000')\n", + "core = be.core_api()\n", + "status = be.reset_scene()" + ] + }, + { + "cell_type": "markdown", + "id": "c9f34251", + "metadata": {}, + "source": [ + "### Resources" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "addafa59", + "metadata": {}, + "outputs": [], + "source": [ + "resource_folder = '../../tests/test_files/'\n", + "pdb_folder = resource_folder + 'pdb/'\n", + "obj_folder = resource_folder + 'obj/'\n", + "membrane_folder = pdb_folder + 'membrane/'\n", + "lipids_folder = membrane_folder + 'lipids/'\n", + "transporters_folder = pdb_folder + 'transporters/'\n", + "tubules_folder = pdb_folder + 'tubules/'\n", + "\n", + "representation = be.REPRESENTATION_ATOMS_AND_STICKS\n", + "\n", + "scale = 1000.0" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import numpy as np\n", + "import quaternion\n", + "import math\n", + "from bioexplorer import MovieMaker\n", + "\n", + "index = 4\n", + "\n", + "def createFromAxisAngle(axis, angle):\n", + " halfAngle = angle * 0.5\n", + " s = math.sin(halfAngle)\n", + " return quaternion.quaternion(axis[0] * s, axis[1] * s, axis[2] * s, math.cos(halfAngle))\n", + "\n", + "\n", + "def lookAt(sourcePoint, destPoint):\n", + " forward = np.array([0.0, 0.0, 1.0])\n", + " forwardVector = np.subtract(destPoint, sourcePoint)\n", + " forwardVector = forwardVector / np.sqrt(np.sum(forwardVector**2))\n", + " dot = np.dot(forward, forwardVector)\n", + " angle = math.acos(dot)\n", + " axis = np.cross(forward, forwardVector)\n", + " axis = axis / np.sqrt(np.sum(axis**2))\n", + " return createFromAxisAngle(axis, angle)\n", + "\n", + "points = be.get_neuron_section_points('Neuron', 4, 0)\n", + "p0 = points[index]\n", + "p1 = points[index + 1]\n", + "print(p0)\n", + "print(p1)\n", + "\n", + "src = np.array(p0[:3])\n", + "dst = np.array(p1[:3])\n", + "q = lookAt(src, dst)\n", + "Q = Quaternion(q.w, q.x, q.y, q.z)\n", + "print(Q)\n", + "\n", + "mm = MovieMaker(be)\n", + "forwardVector = np.subtract(dst, src)\n", + "forward_length = np.sqrt(np.sum(forwardVector**2))\n", + "mm.set_camera(origin=p0, direction=list(forwardVector[:3]), up=[0,1,0])\n", + "core.set_renderer()\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# be.add_sphere(name='test', position=Vector3(p0[0], p0[1], p0[2]), radius=0.7 * scale, color=Vector3(1,1,1))\n", + "# be.add_sphere(name='test', position=Vector3(p1[0], p1[1], p1[2]), radius=0.7 * scale, color=Vector3(1,1,1))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "039b5da0", + "metadata": {}, + "outputs": [], + "source": [ + "import random\n", + "\n", + "size = Vector3(5.0, forward_length, 0.0)\n", + "for i in range(5):\n", + " position = Vector3(\n", + " p0[0] + random.randint(-scale / 20.0, scale / 20.0),\n", + " p0[1] + random.randint(-scale / 20.0, scale / 20.0),\n", + " p0[2] + random.randint(-scale / 20.0, scale / 20.0))\n", + " name = 'Microtubule%05d' % i\n", + "\n", + " # ACE2 receptor definition\n", + " tubule = Protein(\n", + " name=name + '_TUB',\n", + " source=tubules_folder + '1tub.pdb', \n", + " rotation=Quaternion(0.0, 0.0, 0.707, 0.707),\n", + " occurrences=size.y * 5.0)\n", + "\n", + " volume = Volume(\n", + " name=name,\n", + " shape=be.ASSEMBLY_SHAPE_HELIX, shape_params=size,\n", + " protein=tubule)\n", + "\n", + " status = be.add_volume(\n", + " position=position,\n", + " rotation=Quaternion( 0.212, 0.700, -0.231, 0.642),\n", + " volume=volume)\n", + "\n", + " status = be.set_protein_color_scheme(\n", + " assembly_name=name,\n", + " name=name + '_TUB',\n", + " color_scheme=be.COLOR_SCHEME_CHAINS,\n", + " palette_name='Set2', palette_size=5)\n", + "core.set_renderer()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "be.reset_camera()\n", + "core.set_renderer()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "core.set_camera(\n", + " orientation=[0.0, 0.0, 0.0, 1.0],\n", + " position=[27451.090107478147, 195917.513949172, 38855.97730085014],\n", + " target=[27451.090107478147, 195917.513949172, 38338.56432876815], \n", + ")" + ] + }, + { + "cell_type": "markdown", + "id": "b522863a", + "metadata": {}, + "source": [ + "## Rendering settings" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "034c40ec", + "metadata": {}, + "outputs": [], + "source": [ + "status = be.reset_camera()\n", + "status = be.set_rendering_quality(be.RENDERING_QUALITY_HIGH)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "from bioexplorer import MovieMaker\n", + "mm = MovieMaker(be)\n", + "mm.create_snapshot(\n", + " renderer='bio_explorer',\n", + " path='/tmp', base_name='neuromodulation_4k_v1',\n", + " size=[4 * 960, 4 * 540], samples_per_pixel=64)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3.8.10 ('env')", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.8.10" + }, + "vscode": { + "interpreter": { + "hash": "ea9a5fa46eb6bad2806a8ea1d08e15bb1e255a2d4320b81e765591579963c56b" + } + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} \ No newline at end of file diff --git a/bioexplorer/pythonsdk/notebooks/neuromodulation/BioExplorer_neuromodulation_movie.ipynb b/bioexplorer/pythonsdk/notebooks/neuromodulation/BioExplorer_neuromodulation_movie.ipynb index 48a6731f1..5a50ce98d 100644 --- a/bioexplorer/pythonsdk/notebooks/neuromodulation/BioExplorer_neuromodulation_movie.ipynb +++ b/bioexplorer/pythonsdk/notebooks/neuromodulation/BioExplorer_neuromodulation_movie.ipynb @@ -1,763 +1,753 @@ { - "cells": [ - { - "cell_type": "markdown", - "id": "366158c0", - "metadata": {}, - "source": [ - "# Blue Brain BioExplorer - Neuromodulation movie\n", - "![](../bioexplorer_neuromodulation_banner.png)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "7e4ad31c", - "metadata": {}, - "outputs": [], - "source": [ - "from bioexplorer import BioExplorer, Protein, Volume, Vector3, Quaternion, AnimationParams\n", - "import os\n", - "\n", - "URL = 'localhost:5000'\n", - "be = BioExplorer(URL)\n", - "core = be.core_api()\n", - "be.reset_scene()\n", - "be.set_general_settings(model_visibility_on_creation=False)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "0926f9c0", - "metadata": {}, - "outputs": [], - "source": [ - "data_folder = os.getenv('NEUROMODULATION_DATA_FOLDER')" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "36cb237b", - "metadata": {}, - "outputs": [], - "source": [ - "load_neuron = True\n", - "load_mesh_neuron = True\n", - "neuron_guid = 989\n", - "load_astrocytes = True\n", - "load_vasculature = True\n", - "load_microtubules = True\n", - "use_sdf = True\n", - "generate_movie = False\n", - "\n", - "scale = Vector3(1000.0, 1000.0, 1000.0)\n", - "scene_center = [552.193724,1736.099481,235.409219]" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "7f3bf01b", - "metadata": { - "scrolled": false - }, - "outputs": [], - "source": [ - "neuron_population_name = 'o1'\n", - "vasculature_population_name = 'vasculature'\n", - "astrocytes_population_name = 'astrocytes'\n", - "\n", - "if load_neuron:\n", - " print('Loading neuron')\n", - " neuron_sql_filter = 'guid=%d' % neuron_guid\n", - " neuron_assembly_name = 'Neuron'\n", - " be.remove_assembly(neuron_assembly_name)\n", - " be.add_assembly(neuron_assembly_name)\n", - " be.add_neurons(\n", - " assembly_name=neuron_assembly_name,\n", - " morphology_color_scheme=be.MORPHOLOGY_COLOR_SCHEME_SECTION_TYPE,\n", - " population_name=neuron_population_name,\n", - " use_sdf=use_sdf, generate_buttons=True,\n", - " load_synapses=True, show_membrane=not load_mesh_neuron,\n", - " generate_internals=True, generate_externals=False,\n", - " sql_node_filter=neuron_sql_filter, scale=scale,\n", - " animation_params=AnimationParams(1))\n", - "\n", - "if load_mesh_neuron:\n", - " neuron_mesh_model = core.add_model(\n", - " name='Neuron',\n", - " path=os.path.join(data_folder, 'meshes', 'vd100621_idB_-_Scale_x1.000_y1.025_z1.000_-_Clone_6.obj'))\n", - " tf = {\n", - " 'rotation': [0, -0.87495604080936, 0, 0.48420236126149724],\n", - " 'rotation_center': [0.0, 0.0, 0.0],\n", - " 'scale': [scale.x, scale.y, scale.z],\n", - " 'translation': [552.193724,1736.099481,235.409219]\n", - " }\n", - " core.update_model(id=neuron_mesh_model['id'], transformation=tf)\n", - "\n", - "if load_astrocytes:\n", - " print('Loading astrocytes...')\n", - " # astrocytes_sql_filter = 'guid=7178'\n", - " astrocytes_sql_filter = 'sqrt(pow(x - %f, 2) + pow(y - %f, 2) + pow(z - %f, 2)) < 200 AND guid%%6=0' % (scene_center[0], scene_center[1], scene_center[2])\n", - " astrocytes_assembly_name = 'Astrocytes'\n", - " be.remove_assembly(astrocytes_assembly_name)\n", - " astrocytes_assembly = be.add_assembly(astrocytes_assembly_name)\n", - " astrocytes_model = be.add_astrocytes(\n", - " assembly_name=astrocytes_assembly_name,\n", - " population_name=astrocytes_population_name,\n", - " vasculature_population_name=vasculature_population_name,\n", - " radius_multiplier=0.5,\n", - " use_sdf=use_sdf, generate_internals=True,\n", - " load_somas=True, load_dendrites=True,\n", - " sql_filter=astrocytes_sql_filter, scale=scale)\n", - " tf = {\n", - " 'rotation': [0, 0, 0, 1],\n", - " 'rotation_center': [0.0, 0.0, 0.0],\n", - " 'scale': [1,1,1],\n", - " 'translation': [ 20, 50, -80]\n", - " }\n", - " model_ids = be.get_model_ids()['ids']\n", - " core.update_model(id=model_ids[len(model_ids)-1], transformation=tf)\n", - "\n", - "if load_vasculature:\n", - " vasculature_sql_filter = 'sqrt(pow(x - %f, 2) + pow(y - %f, 2) + pow(z - %f, 2)) < 300' % (scene_center[0], scene_center[1], scene_center[2])\n", - " print('Loading vasculature...')\n", - " vasculature_assembly_name = 'Vasculature'\n", - " be.remove_assembly(vasculature_assembly_name)\n", - " vasculature_assembly = be.add_assembly(vasculature_assembly_name)\n", - " vasculature_model = be.add_vasculature(\n", - " assembly_name=vasculature_assembly_name,\n", - " population_name=vasculature_population_name,\n", - " representation=be.VASCULATURE_REPRESENTATION_SECTION,\n", - " use_sdf=use_sdf,\n", - " sql_filter=vasculature_sql_filter, scale=scale)\n", - " tf = {\n", - " 'rotation': [0, 0, 0, 1],\n", - " 'rotation_center': [0.0, 0.0, 0.0],\n", - " 'scale': [1,1,1],\n", - " 'translation': [ 20, 50, -80]\n", - " }\n", - " model_ids = be.get_model_ids()['ids']\n", - " core.update_model(id=model_ids[len(model_ids)-1], transformation=tf)\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "0956f3ce", - "metadata": {}, - "outputs": [], - "source": [ - "def set_neuron_materials(model_id, opacity, color, shading_mode):\n", - " colors = list()\n", - " opacities = list()\n", - " refraction_indices = list()\n", - " specular_exponents = list()\n", - " shading_modes = list()\n", - " user_params = list()\n", - " glossinesses = list()\n", - " emissions = list()\n", - " reflection_indices = list()\n", - " \n", - " material_ids = be.get_material_ids(model_id)['ids']\n", - " for material_id in material_ids:\n", - " mid = material_id % be.NB_MATERIALS_PER_MORPHOLOGY\n", - " if mid == be.NEURON_MATERIAL_MITOCHONDRION:\n", - " opacities.append(1.0)\n", - " # colors.append([0.4, 0.08, 0.4])\n", - " colors.append([0.3, 0.3, 0.3])\n", - " shading_modes.append(be.SHADING_MODE_NONE)\n", - " glossinesses.append(0.8)\n", - " user_params.append(1.0 / scale.x)\n", - " specular_exponents.append(60.0)\n", - " emissions.append(0.5)\n", - " reflection_indices.append(0.2)\n", - " elif mid == be.NEURON_MATERIAL_NUCLEUS:\n", - " opacities.append(1.0)\n", - " # colors.append([0.6, 0.7, 0.2])\n", - " colors.append([0.9, 0.8, 0.8])\n", - " shading_modes.append(be.SHADING_MODE_PERLIN)\n", - " glossinesses.append(0.8)\n", - " user_params.append(0.1 / scale.x)\n", - " specular_exponents.append(4.0)\n", - " emissions.append(0.2)\n", - " reflection_indices.append(0.0)\n", - " elif mid == be.NEURON_MATERIAL_SOMA or mid==be.NEURON_MATERIAL_AXON:\n", - " opacities.append(opacity)\n", - " colors.append(color)\n", - " shading_modes.append(shading_mode)\n", - " glossinesses.append(0.75)\n", - " user_params.append(0.05 / scale.x)\n", - " specular_exponents.append(5.0)\n", - " emissions.append(0.0)\n", - " reflection_indices.append(0.0)\n", - " elif mid == be.NEURON_MATERIAL_MYELIN_STEATH:\n", - " # opacities.append(0.3)\n", - " opacities.append(1.0)\n", - " colors.append([0.59, 0.82, 0.14])\n", - " shading_modes.append(be.SHADING_MODE_PERLIN)\n", - " glossinesses.append(0.1)\n", - " user_params.append(0.1 / scale.x)\n", - " specular_exponents.append(5.0)\n", - " emissions.append(0.0)\n", - " reflection_indices.append(0.0)\n", - " else:\n", - " # Membrane\n", - " opacities.append(opacity)\n", - " colors.append(color)\n", - " shading_modes.append(be.SHADING_MODE_DIFFUSE)\n", - " glossinesses.append(0.7)\n", - " user_params.append(0.02 / scale.x)\n", - " specular_exponents.append(5.0)\n", - " emissions.append(0.0)\n", - " reflection_indices.append(0.0)\n", - " \n", - " refraction_indices.append(1.2)\n", - " \n", - " be.set_materials(\n", - " model_ids=[model_id], material_ids=material_ids,\n", - " diffuse_colors=colors, specular_colors=colors,\n", - " opacities=opacities, refraction_indices=refraction_indices,\n", - " reflection_indices=reflection_indices,\n", - " shading_modes=shading_modes, specular_exponents=specular_exponents,\n", - " user_parameters=user_params, glossinesses=glossinesses,\n", - " emissions=emissions\n", - " )\n", - "\n", - "def set_neuron_mesh_materials(model_id, opacity, color, shading_mode):\n", - " colors = list()\n", - " opacities = list()\n", - " refraction_indices = list()\n", - " specular_exponents = list()\n", - " shading_modes = list()\n", - " user_params = list()\n", - " glossinesses = list()\n", - " emissions = list()\n", - " reflection_indices = list()\n", - " \n", - " material_ids = be.get_material_ids(model_id)['ids']\n", - " for material_id in material_ids:\n", - " mid = material_id % be.NB_MATERIALS_PER_MORPHOLOGY\n", - " opacities.append(opacity)\n", - " colors.append(color)\n", - " shading_modes.append(shading_mode)\n", - " glossinesses.append(0.5)\n", - " user_params.append(0.2 / scale.x)\n", - " specular_exponents.append(5.0)\n", - " emissions.append(0.0)\n", - " reflection_indices.append(0.0)\n", - " refraction_indices.append(1.01)\n", - " \n", - " be.set_materials(\n", - " model_ids=[model_id], material_ids=material_ids,\n", - " diffuse_colors=colors, specular_colors=colors,\n", - " opacities=opacities, refraction_indices=refraction_indices,\n", - " reflection_indices=reflection_indices,\n", - " shading_modes=shading_modes, specular_exponents=specular_exponents,\n", - " user_parameters=user_params, glossinesses=glossinesses,\n", - " emissions=emissions\n", - " )\n", - "\n", - "def set_astrocyte_materials(model_id, opacity, color, shading_mode):\n", - " colors = list()\n", - " opacities = list()\n", - " refraction_indices = list()\n", - " specular_exponents = list()\n", - " shading_modes = list()\n", - " user_params = list()\n", - " glossinesses = list()\n", - " emissions = list()\n", - " reflection_indices = list()\n", - " \n", - " material_ids = be.get_material_ids(model_id)['ids']\n", - " for material_id in material_ids:\n", - " mid = material_id % be.NB_MATERIALS_PER_MORPHOLOGY\n", - " opacities.append(opacity)\n", - " colors.append(color)\n", - " shading_modes.append(shading_mode)\n", - " glossinesses.append(0.1)\n", - " user_params.append(0.01 / scale.x)\n", - " specular_exponents.append(5.0)\n", - " emissions.append(0.0)\n", - " reflection_indices.append(0.0)\n", - " refraction_indices.append(1.01)\n", - " \n", - " be.set_materials(\n", - " model_ids=[model_id], material_ids=material_ids,\n", - " diffuse_colors=colors, specular_colors=colors,\n", - " opacities=opacities, refraction_indices=refraction_indices,\n", - " reflection_indices=reflection_indices,\n", - " shading_modes=shading_modes, specular_exponents=specular_exponents,\n", - " user_parameters=user_params, glossinesses=glossinesses,\n", - " emissions=emissions\n", - " )\n", - "\n", - "def set_vasculature_materials(model_id):\n", - " colors = list()\n", - " opacities = list()\n", - " refraction_indices = list()\n", - " reflection_indices = list()\n", - " specular_exponents = list()\n", - " shading_modes = list()\n", - " user_params = list()\n", - " glossinesses = list()\n", - " \n", - " material_ids = be.get_material_ids(model_id)['ids']\n", - " for _ in material_ids:\n", - " opacities.append(1.0)\n", - " colors.append([1, 0, 0])\n", - " # shading_modes.append(be.SHADING_MODE_NONE)\n", - " shading_modes.append(be.SHADING_MODE_PERLIN)\n", - " glossinesses.append(0.1)\n", - " user_params.append(0.01 / scale.x)\n", - " specular_exponents.append(3.0)\n", - " refraction_indices.append(2.5)\n", - " reflection_indices.append(0.0)\n", - " \n", - " be.set_materials(\n", - " model_ids=[model_id], material_ids=material_ids,\n", - " diffuse_colors=colors, specular_colors=colors,\n", - " opacities=opacities, refraction_indices=refraction_indices,\n", - " shading_modes=shading_modes, specular_exponents=specular_exponents,\n", - " user_parameters=user_params, glossinesses=glossinesses,\n", - " reflection_indices=reflection_indices\n", - " )\n", - "\n", - "model_ids = be.get_model_ids()['ids']\n", - "index = 0\n", - "if load_neuron:\n", - " set_neuron_materials(\n", - " model_ids[index], 0.6, [206 / 256, 185 / 256, 135 / 256],\n", - " be.SHADING_MODE_NONE)\n", - " index += 1\n", - "if load_mesh_neuron:\n", - " be.set_material_extra_attributes(model_ids[index])\n", - " set_neuron_mesh_materials(\n", - " model_ids[index], 0.6, [206 / 256, 185 / 256, 135 / 256],\n", - " be.SHADING_MODE_PERLIN)\n", - " index += 1\n", - "if load_astrocytes:\n", - " set_astrocyte_materials(\n", - " model_ids[index], 1.0, [206 / 256, 185 / 256, 135 / 256],\n", - " be.SHADING_MODE_NONE)\n", - " index += 1\n", - "if load_vasculature:\n", - " set_vasculature_materials(model_ids[index])\n", - "status = core.set_renderer()" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "34dc12a0", - "metadata": {}, - "outputs": [], - "source": [ - "status = be.reset_camera()\n", - "status = core.set_renderer()" - ] - }, - { - "cell_type": "markdown", - "id": "f61f866a", - "metadata": {}, - "source": [ - "From nucleus to bouton" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "299871da", - "metadata": {}, - "outputs": [], - "source": [ - "resource_folder = '../../tests/test_files/'\n", - "pdb_folder = resource_folder + 'pdb/'\n", - "membrane_folder = pdb_folder + 'membrane/'\n", - "lipids_folder = membrane_folder + 'lipids/'\n", - "transporters_folder = pdb_folder + 'transporters/'\n", - "tubules_folder = pdb_folder + 'tubules/'\n", - "\n", - "points = be.get_neuron_section_points(\n", - " assembly_name=neuron_assembly_name, neuron_guid=neuron_guid, section_guid=0)" - ] - }, - { - "cell_type": "markdown", - "id": "2babbddb", - "metadata": {}, - "source": [ - "### Microtubules" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "bb1813e8", - "metadata": {}, - "outputs": [], - "source": [ - "import numpy as np\n", - "import math\n", - "\n", - "nb_microtubules = 3\n", - "microtubule_id = 0\n", - "\n", - "tracks = [[111, -29, -73], [-10, -98, -3], [70, 50, 20]]\n", - "\n", - "if load_microtubules:\n", - " for j in range(nb_microtubules):\n", - " for i in range(len(points) - 1):\n", - "\n", - " p0 = points[i]\n", - " p1 = points[i+1]\n", - "\n", - " src = np.array(p0[:3])\n", - " dst = np.array(p1[:3])\n", - " forwardVector = np.subtract(dst, src)\n", - " forward_length = np.sqrt(np.sum(forwardVector**2))\n", - " microtubule_size = Vector3(5.0, forward_length, 0.0)\n", - "\n", - " q = be.look_at(\n", - " Vector3(p0[0], p0[1], p0[2]),\n", - " Vector3(p1[0], p1[1], p1[2])\n", - " )\n", - "\n", - " position = Vector3(\n", - " tracks[j][0] + p0[0],\n", - " tracks[j][1] + p0[1],\n", - " tracks[j][2] + p0[2])\n", - " \n", - " name = 'Microtubule%05d' % microtubule_id\n", - " microtubule_id += 1\n", - "\n", - " tubule = Protein(\n", - " name=name + '_TUB',\n", - " source=tubules_folder + '1tub.pdb', \n", - " rotation=Quaternion(0.0, 0.0, 0.707, 0.707),\n", - " occurences=microtubule_size.y * 7.0)\n", - "\n", - " volume = Volume(\n", - " name=name,\n", - " shape=be.ASSEMBLY_SHAPE_HELIX, shape_params=microtubule_size,\n", - " protein=tubule)\n", - "\n", - " status = be.add_volume(\n", - " position=position,\n", - " rotation=q,\n", - " volume=volume)\n", - "\n", - " status = be.set_protein_color_scheme(\n", - " assembly_name=name,\n", - " name=name + '_TUB',\n", - " color_scheme=be.COLOR_SCHEME_CHAINS,\n", - " palette_name='Set2', palette_size=5)" - ] - }, - { - "cell_type": "markdown", - "id": "b2184aea", - "metadata": {}, - "source": [ - "### Acetylcholin" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "8f448f95", - "metadata": {}, - "outputs": [], - "source": [ - "from bioexplorer import AnimationParams\n", - "resource_folder = '../../tests/test_files/'\n", - "pdb_folder = os.path.join(resource_folder, 'pdb')\n", - "acetylcholin_path = os.path.join(pdb_folder, 'neuromodulation', 'acetylcholin.pdb')\n", - "\n", - "\n", - "# Molecules\n", - "nb_molecules = 5000\n", - "protein_radius_multiplier = 1.0\n", - "protein_representation = be.REPRESENTATION_ATOMS_AND_STICKS\n", - "\n", - "def add_molecules(radius, frame):\n", - " acetylcholin_assembly_name = 'Acetylcholin'\n", - " acetylcholin_name = 'Acetylcholin'\n", - " acetylcholin_position = Vector3(54080 + radius, 180960, 24110)\n", - " acetylcholin = Protein(\n", - " name=acetylcholin_name, \n", - " source=acetylcholin_path, load_non_polymer_chemicals=True, \n", - " occurences=nb_molecules,\n", - " animation_params=AnimationParams(3, frame*2, 0.5, frame*2 + 1, 1.0)\n", - " )\n", - " volume = Volume(\n", - " name=acetylcholin_assembly_name,\n", - " shape=be.ASSEMBLY_SHAPE_FILLED_SPHERE, shape_params=Vector3(radius, 0, 0),\n", - " protein=acetylcholin)\n", - " be.add_volume(\n", - " volume=volume, \n", - " representation=protein_representation,\n", - " position=acetylcholin_position,\n", - " atom_radius_multiplier=protein_radius_multiplier)\n", - " model_ids = be.get_model_ids()['ids']\n", - " model_id = model_ids[len(model_ids)-1]\n", - " set_astrocyte_materials(model_id, 1.0, [0.5,0.8,0.7], be.SHADING_MODE_DIFFUSE)" - ] - }, - { - "cell_type": "markdown", - "id": "d64a35f1", - "metadata": {}, - "source": [ - "## Movie" - ] - }, - { - "cell_type": "markdown", - "id": "1df34178", - "metadata": {}, - "source": [ - "### Inside Axon, follow microtubule" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "ab913b03", - "metadata": {}, - "outputs": [], - "source": [ - "from bioexplorer import MovieMaker\n", - "mm = MovieMaker(be)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "4c5e9251", - "metadata": {}, - "outputs": [], - "source": [ - "import math\n", - "\n", - "nb_frames = 100\n", - "aperture = 0.01\n", - "focus = 2.938\n", - "key_frames = list()\n", - "\n", - "key_frames.append(\n", - " {\n", - " 'apertureRadius': 0.0,\n", - " 'direction': [-0.5161824932867844, 0.71089422191883, 0.47768717678692263],\n", - " 'focusDistance': 1000000.0,\n", - " 'origin': [10 * 61645.09332918549, 10 * 164939.92821114144, 10 * 17640.52720466037],\n", - " 'up': [0.7637641783394794, 0.6344538040102345, -0.11888082462013372]\n", - " }\n", - ")\n", - "\n", - "key_frames.append(\n", - " {\n", - " 'apertureRadius': 0.0,\n", - " 'direction': [-0.7166883232084326, 0.6973190499228045, -0.01019754830550157],\n", - " 'focusDistance': 1000000.0,\n", - " 'origin': [10 * 56185.91520320514, 10 * 172743.7060708133, 10 * 23601.54634817272],\n", - " 'up': [0.6915583632197203, 0.7087280378295366, -0.13946898814846398]\n", - " }\n", - ")\n", - "\n", - "key_frames.append(\n", - " {\n", - " 'apertureRadius': 0.0,\n", - " 'direction': [-0.08489556391375896, 0.9184638069706967, -0.38628613554288993],\n", - " 'focusDistance': 1000000.0,\n", - " 'origin': [10 * 55063.99282926692, 10 * 173129.80736023423, 10 * 24155.774633378987],\n", - " 'up': [0.7637641783394794, 0.6344538040102345, -0.11888082462013372]\n", - " } \n", - ")\n", - "\n", - "for i in range(0, len(points)-20, 5):\n", - " origin = [\n", - " points[i][0] - 15,\n", - " points[i][1] + 15,\n", - " points[i][2] - 15\n", - " ]\n", - " \n", - " target = [\n", - " points[i+1][0],\n", - " points[i+1][1],\n", - " points[i+1][2]\n", - " ]\n", - "\n", - " dir = [0.0, 0.0, 0.0]\n", - " ldir = 0.0\n", - " for k in range(3):\n", - " l = target[k] - origin[k]\n", - " dir[k] = l * scale.to_list()[k]\n", - " ldir += l * l\n", - " for k in range(3):\n", - " dir[k] /= math.sqrt(ldir)\n", - " \n", - " mm.set_camera(origin=origin, direction=dir, up=[0, 1, 0])\n", - " key_frames.append(mm.get_camera())\n", - "\n", - "key_frames.append(\n", - "{\n", - " 'apertureRadius': 0.0,\n", - " 'direction': [-0.7788156442562865, 0.46643004505381463, 0.4193914702670549],\n", - " 'focusDistance': 1000000.0,\n", - " 'origin': [10 * 54276.71983440195, 10 * 180841.0051283754, 10 * 24040.887191176796],\n", - " 'up': [0.29883854644002006, 0.8637709263664873, -0.4057034753679049]}\n", - ")\n", - "\n", - "key_frames.append(\n", - "{\n", - " 'apertureRadius': 0.0,\n", - " 'direction': [-0.5701341231776339, 0.6236003424401975, 0.5348548349757523],\n", - " 'focusDistance': 1000000.0,\n", - " 'origin': [10 * 54220.26233495012, 10 * 180839.3287436113, 10 * 24015.522296933832],\n", - " 'up': [0.4420071457778133, 0.7816083500807779, -0.44013415019213764]} \n", - ")\n", - "\n", - "mm.build_camera_path(key_frames, nb_frames, nb_frames / 4.0)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "5b2b3e91", - "metadata": {}, - "outputs": [], - "source": [ - "def set_rendering_settings(inside):\n", - " params = core.BioExplorerRendererParams()\n", - " params.exposure = 1\n", - " params.max_bounces = 10\n", - " params.epsilon_factor = 2.0\n", - " params.fog_start = 100.0 * scale.x\n", - " params.fog_thickness = 40.0 * scale.x\n", - " params.gi_distance = 100.0 * scale.x\n", - "\n", - " if inside:\n", - " params.gi_distance = 1.0 * scale.x\n", - " params.fog_start = 5.0 * scale.x\n", - " params.fog_thickness = 1.0 * scale.x\n", - "\n", - " params.gi_samples = 1\n", - " params.gi_weight = 0.2\n", - " params.shadows = 0.75\n", - " params.soft_shadows = 0.25\n", - " params.use_hardware_randomizer = True\n", - " return core.set_renderer_params(params)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "6d5d73fb", - "metadata": {}, - "outputs": [], - "source": [ - "set_rendering_settings(False)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "bedfab50", - "metadata": {}, - "outputs": [], - "source": [ - "be.set_models_visibility(True)" - ] - }, - { - "cell_type": "markdown", - "id": "b6af6ece", - "metadata": {}, - "source": [ - "## Rendering" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "69568d3a", - "metadata": {}, - "outputs": [], - "source": [ - "core.set_renderer(current='bio_explorer', subsampling=4, max_accum_frames=64)\n", - "set_rendering_settings(False)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "bd714369", - "metadata": {}, - "outputs": [], - "source": [ - "from IPython.display import clear_output\n", - "\n", - "k = 1\n", - "resolution = [k * 960, k * 540]\n", - "output_folder = '/tmp')\n", - "nb_frames = mm.get_nb_frames()\n", - "nb_diffusion_frames = 100\n", - "start_diffustion_frame = nb_frames - nb_diffusion_frames\n", - "\n", - "core.set_renderer(current='bio_explorer', subsampling=4, max_accum_frames=64)\n", - "if not generate_movie:\n", - " core.set_renderer(current='basic', subsampling=4, max_accum_frames=1)\n", - "\n", - "for frame in range(nb_frames):\n", - " clear_output()\n", - " print('Frame %d/%d' % (frame, nb_frames))\n", - " inside = frame > 198 and frame < 703\n", - " set_rendering_settings(inside)\n", - "\n", - " mm.set_current_frame(frame)\n", - " if frame >= start_diffustion_frame:\n", - " add_molecules(2 + frame - start_diffustion_frame, frame - start_diffustion_frame)\n", - " be.set_models_visibility(True)\n", - "\n", - " if generate_movie:\n", - " mm.create_snapshot(\n", - " renderer='bio_explorer',\n", - " size=resolution, samples_per_pixel=8,\n", - " base_name='%05d' % frame,\n", - " path=output_folder)\n", - " else:\n", - " core.set_renderer()\n", - " import time\n", - " time.sleep(0.1)" - ] - } - ], - "metadata": { - "interpreter": { - "hash": "ea9a5fa46eb6bad2806a8ea1d08e15bb1e255a2d4320b81e765591579963c56b" - }, - "kernelspec": { - "display_name": "Python 3.8.10 64-bit ('env': venv)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.8.10" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} + "cells": [ + { + "cell_type": "markdown", + "id": "366158c0", + "metadata": {}, + "source": [ + "# Blue Brain BioExplorer - Neuromodulation movie\n", + "![](../bioexplorer_neuromodulation_banner.png)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7e4ad31c", + "metadata": {}, + "outputs": [], + "source": [ + "from bioexplorer import BioExplorer, Protein, Volume, Vector3, Quaternion, AnimationParams\n", + "import os\n", + "\n", + "URL = 'localhost:5000'\n", + "be = BioExplorer(URL)\n", + "core = be.core_api()\n", + "be.reset_scene()\n", + "be.set_general_settings(model_visibility_on_creation=False)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "0926f9c0", + "metadata": {}, + "outputs": [], + "source": [ + "data_folder = os.getenv('NEUROMODULATION_DATA_FOLDER')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "36cb237b", + "metadata": {}, + "outputs": [], + "source": [ + "load_neuron = True\n", + "load_mesh_neuron = True\n", + "neuron_guid = 989\n", + "load_astrocytes = True\n", + "load_vasculature = True\n", + "load_microtubules = True\n", + "use_sdf = True\n", + "generate_movie = False\n", + "\n", + "scale = Vector3(1000.0, 1000.0, 1000.0)\n", + "scene_center = [552.193724,1736.099481,235.409219]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7f3bf01b", + "metadata": { + "scrolled": false + }, + "outputs": [], + "source": [ + "neuron_population_name = 'o1'\n", + "vasculature_population_name = 'vasculature'\n", + "astrocytes_population_name = 'astrocytes'\n", + "\n", + "if load_neuron:\n", + " neuron_sql_filter = 'guid=%d' % neuron_guid\n", + " neuron_assembly_name = 'Neuron'\n", + " be.remove_assembly(neuron_assembly_name)\n", + " be.add_assembly(neuron_assembly_name)\n", + " be.add_neurons(\n", + " assembly_name=neuron_assembly_name,\n", + " morphology_color_scheme=be.MORPHOLOGY_COLOR_SCHEME_SECTION_TYPE,\n", + " population_name=neuron_population_name,\n", + " use_sdf=use_sdf, generate_buttons=True,\n", + " load_synapses=True, show_membrane=not load_mesh_neuron,\n", + " generate_internals=True, generate_externals=False,\n", + " sql_node_filter=neuron_sql_filter, scale=scale,\n", + " animation_params=AnimationParams(1))\n", + "\n", + "if load_mesh_neuron:\n", + " neuron_mesh_model = core.add_model(\n", + " name='Neuron',\n", + " path=os.path.join(data_folder, 'meshes', 'vd100621_idB_-_Scale_x1.000_y1.025_z1.000_-_Clone_6.obj'))\n", + " tf = {\n", + " 'rotation': [0, -0.87495604080936, 0, 0.48420236126149724],\n", + " 'rotation_center': [0.0, 0.0, 0.0],\n", + " 'scale': [scale.x, scale.y, scale.z],\n", + " 'translation': [552.193724,1736.099481,235.409219]\n", + " }\n", + " core.update_model(id=neuron_mesh_model['id'], transformation=tf)\n", + "\n", + "if load_astrocytes:\n", + " astrocytes_sql_filter = 'sqrt(pow(x - %f, 2) + pow(y - %f, 2) + pow(z - %f, 2)) < 200 AND guid%%6=0' % (scene_center[0], scene_center[1], scene_center[2])\n", + " astrocytes_assembly_name = 'Astrocytes'\n", + " be.remove_assembly(astrocytes_assembly_name)\n", + " astrocytes_assembly = be.add_assembly(astrocytes_assembly_name)\n", + " astrocytes_model = be.add_astrocytes(\n", + " assembly_name=astrocytes_assembly_name,\n", + " population_name=astrocytes_population_name,\n", + " vasculature_population_name=vasculature_population_name,\n", + " radius_multiplier=0.5,\n", + " use_sdf=use_sdf, generate_internals=True,\n", + " load_somas=True, load_dendrites=True,\n", + " sql_filter=astrocytes_sql_filter, scale=scale)\n", + " tf = {\n", + " 'rotation': [0, 0, 0, 1],\n", + " 'rotation_center': [0.0, 0.0, 0.0],\n", + " 'scale': [1,1,1],\n", + " 'translation': [ 20, 50, -80]\n", + " }\n", + " model_ids = be.get_model_ids()['ids']\n", + " core.update_model(id=model_ids[len(model_ids)-1], transformation=tf)\n", + "\n", + "if load_vasculature:\n", + " vasculature_sql_filter = 'sqrt(pow(x - %f, 2) + pow(y - %f, 2) + pow(z - %f, 2)) < 300' % (scene_center[0], scene_center[1], scene_center[2])\n", + " vasculature_assembly_name = 'Vasculature'\n", + " be.remove_assembly(vasculature_assembly_name)\n", + " vasculature_assembly = be.add_assembly(vasculature_assembly_name)\n", + " vasculature_model = be.add_vasculature(\n", + " assembly_name=vasculature_assembly_name,\n", + " population_name=vasculature_population_name,\n", + " representation=be.VASCULATURE_REPRESENTATION_SECTION,\n", + " use_sdf=use_sdf,\n", + " sql_filter=vasculature_sql_filter, scale=scale)\n", + " tf = {\n", + " 'rotation': [0, 0, 0, 1],\n", + " 'rotation_center': [0.0, 0.0, 0.0],\n", + " 'scale': [1,1,1],\n", + " 'translation': [ 20, 50, -80]\n", + " }\n", + " model_ids = be.get_model_ids()['ids']\n", + " core.update_model(id=model_ids[len(model_ids)-1], transformation=tf)\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "0956f3ce", + "metadata": {}, + "outputs": [], + "source": [ + "def set_neuron_materials(model_id, opacity, color, shading_mode):\n", + " colors = list()\n", + " opacities = list()\n", + " refraction_indices = list()\n", + " specular_exponents = list()\n", + " shading_modes = list()\n", + " user_params = list()\n", + " glossinesses = list()\n", + " emissions = list()\n", + " reflection_indices = list()\n", + " \n", + " material_ids = be.get_material_ids(model_id)['ids']\n", + " for material_id in material_ids:\n", + " mid = material_id % be.NB_MATERIALS_PER_MORPHOLOGY\n", + " if mid == be.NEURON_MATERIAL_MITOCHONDRION:\n", + " opacities.append(1.0)\n", + " colors.append([0.3, 0.3, 0.3])\n", + " shading_modes.append(be.SHADING_MODE_NONE)\n", + " glossinesses.append(0.8)\n", + " user_params.append(1.0 / scale.x)\n", + " specular_exponents.append(60.0)\n", + " emissions.append(0.5)\n", + " reflection_indices.append(0.2)\n", + " elif mid == be.NEURON_MATERIAL_NUCLEUS:\n", + " opacities.append(1.0)\n", + " colors.append([0.9, 0.8, 0.8])\n", + " shading_modes.append(be.SHADING_MODE_PERLIN)\n", + " glossinesses.append(0.8)\n", + " user_params.append(0.1 / scale.x)\n", + " specular_exponents.append(4.0)\n", + " emissions.append(0.2)\n", + " reflection_indices.append(0.0)\n", + " elif mid == be.NEURON_MATERIAL_SOMA or mid==be.NEURON_MATERIAL_AXON:\n", + " opacities.append(opacity)\n", + " colors.append(color)\n", + " shading_modes.append(shading_mode)\n", + " glossinesses.append(0.75)\n", + " user_params.append(0.05 / scale.x)\n", + " specular_exponents.append(5.0)\n", + " emissions.append(0.0)\n", + " reflection_indices.append(0.0)\n", + " elif mid == be.NEURON_MATERIAL_MYELIN_STEATH:\n", + " opacities.append(1.0)\n", + " colors.append([0.59, 0.82, 0.14])\n", + " shading_modes.append(be.SHADING_MODE_PERLIN)\n", + " glossinesses.append(0.1)\n", + " user_params.append(0.1 / scale.x)\n", + " specular_exponents.append(5.0)\n", + " emissions.append(0.0)\n", + " reflection_indices.append(0.0)\n", + " else:\n", + " # Membrane\n", + " opacities.append(opacity)\n", + " colors.append(color)\n", + " shading_modes.append(be.SHADING_MODE_DIFFUSE)\n", + " glossinesses.append(0.7)\n", + " user_params.append(0.02 / scale.x)\n", + " specular_exponents.append(5.0)\n", + " emissions.append(0.0)\n", + " reflection_indices.append(0.0)\n", + " \n", + " refraction_indices.append(1.2)\n", + " \n", + " be.set_materials(\n", + " model_ids=[model_id], material_ids=material_ids,\n", + " diffuse_colors=colors, specular_colors=colors,\n", + " opacities=opacities, refraction_indices=refraction_indices,\n", + " reflection_indices=reflection_indices,\n", + " shading_modes=shading_modes, specular_exponents=specular_exponents,\n", + " user_parameters=user_params, glossinesses=glossinesses,\n", + " emissions=emissions\n", + " )\n", + "\n", + "def set_neuron_mesh_materials(model_id, opacity, color, shading_mode):\n", + " colors = list()\n", + " opacities = list()\n", + " refraction_indices = list()\n", + " specular_exponents = list()\n", + " shading_modes = list()\n", + " user_params = list()\n", + " glossinesses = list()\n", + " emissions = list()\n", + " reflection_indices = list()\n", + " \n", + " material_ids = be.get_material_ids(model_id)['ids']\n", + " for material_id in material_ids:\n", + " mid = material_id % be.NB_MATERIALS_PER_MORPHOLOGY\n", + " opacities.append(opacity)\n", + " colors.append(color)\n", + " shading_modes.append(shading_mode)\n", + " glossinesses.append(0.5)\n", + " user_params.append(0.2 / scale.x)\n", + " specular_exponents.append(5.0)\n", + " emissions.append(0.0)\n", + " reflection_indices.append(0.0)\n", + " refraction_indices.append(1.01)\n", + " \n", + " be.set_materials(\n", + " model_ids=[model_id], material_ids=material_ids,\n", + " diffuse_colors=colors, specular_colors=colors,\n", + " opacities=opacities, refraction_indices=refraction_indices,\n", + " reflection_indices=reflection_indices,\n", + " shading_modes=shading_modes, specular_exponents=specular_exponents,\n", + " user_parameters=user_params, glossinesses=glossinesses,\n", + " emissions=emissions\n", + " )\n", + "\n", + "def set_astrocyte_materials(model_id, opacity, color, shading_mode):\n", + " colors = list()\n", + " opacities = list()\n", + " refraction_indices = list()\n", + " specular_exponents = list()\n", + " shading_modes = list()\n", + " user_params = list()\n", + " glossinesses = list()\n", + " emissions = list()\n", + " reflection_indices = list()\n", + " \n", + " material_ids = be.get_material_ids(model_id)['ids']\n", + " for material_id in material_ids:\n", + " mid = material_id % be.NB_MATERIALS_PER_MORPHOLOGY\n", + " opacities.append(opacity)\n", + " colors.append(color)\n", + " shading_modes.append(shading_mode)\n", + " glossinesses.append(0.1)\n", + " user_params.append(0.01 / scale.x)\n", + " specular_exponents.append(5.0)\n", + " emissions.append(0.0)\n", + " reflection_indices.append(0.0)\n", + " refraction_indices.append(1.01)\n", + " \n", + " be.set_materials(\n", + " model_ids=[model_id], material_ids=material_ids,\n", + " diffuse_colors=colors, specular_colors=colors,\n", + " opacities=opacities, refraction_indices=refraction_indices,\n", + " reflection_indices=reflection_indices,\n", + " shading_modes=shading_modes, specular_exponents=specular_exponents,\n", + " user_parameters=user_params, glossinesses=glossinesses,\n", + " emissions=emissions\n", + " )\n", + "\n", + "def set_vasculature_materials(model_id):\n", + " colors = list()\n", + " opacities = list()\n", + " refraction_indices = list()\n", + " reflection_indices = list()\n", + " specular_exponents = list()\n", + " shading_modes = list()\n", + " user_params = list()\n", + " glossinesses = list()\n", + " \n", + " material_ids = be.get_material_ids(model_id)['ids']\n", + " for _ in material_ids:\n", + " opacities.append(1.0)\n", + " colors.append([1, 0, 0])\n", + " shading_modes.append(be.SHADING_MODE_PERLIN)\n", + " glossinesses.append(0.1)\n", + " user_params.append(0.01 / scale.x)\n", + " specular_exponents.append(3.0)\n", + " refraction_indices.append(2.5)\n", + " reflection_indices.append(0.0)\n", + " \n", + " be.set_materials(\n", + " model_ids=[model_id], material_ids=material_ids,\n", + " diffuse_colors=colors, specular_colors=colors,\n", + " opacities=opacities, refraction_indices=refraction_indices,\n", + " shading_modes=shading_modes, specular_exponents=specular_exponents,\n", + " user_parameters=user_params, glossinesses=glossinesses,\n", + " reflection_indices=reflection_indices\n", + " )\n", + "\n", + "model_ids = be.get_model_ids()['ids']\n", + "index = 0\n", + "if load_neuron:\n", + " set_neuron_materials(\n", + " model_ids[index], 0.6, [206 / 256, 185 / 256, 135 / 256],\n", + " be.SHADING_MODE_NONE)\n", + " index += 1\n", + "if load_mesh_neuron:\n", + " be.set_material_extra_attributes(model_ids[index])\n", + " set_neuron_mesh_materials(\n", + " model_ids[index], 0.6, [206 / 256, 185 / 256, 135 / 256],\n", + " be.SHADING_MODE_PERLIN)\n", + " index += 1\n", + "if load_astrocytes:\n", + " set_astrocyte_materials(\n", + " model_ids[index], 1.0, [206 / 256, 185 / 256, 135 / 256],\n", + " be.SHADING_MODE_NONE)\n", + " index += 1\n", + "if load_vasculature:\n", + " set_vasculature_materials(model_ids[index])\n", + "status = core.set_renderer()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "34dc12a0", + "metadata": {}, + "outputs": [], + "source": [ + "status = be.reset_camera()\n", + "status = core.set_renderer()" + ] + }, + { + "cell_type": "markdown", + "id": "f61f866a", + "metadata": {}, + "source": [ + "From nucleus to bouton" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "299871da", + "metadata": {}, + "outputs": [], + "source": [ + "resource_folder = '../../tests/test_files/'\n", + "pdb_folder = resource_folder + 'pdb/'\n", + "membrane_folder = pdb_folder + 'membrane/'\n", + "lipids_folder = membrane_folder + 'lipids/'\n", + "transporters_folder = pdb_folder + 'transporters/'\n", + "tubules_folder = pdb_folder + 'tubules/'\n", + "\n", + "points = be.get_neuron_section_points(\n", + " assembly_name=neuron_assembly_name, neuron_guid=neuron_guid, section_guid=0)" + ] + }, + { + "cell_type": "markdown", + "id": "2babbddb", + "metadata": {}, + "source": [ + "### Microtubules" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "bb1813e8", + "metadata": {}, + "outputs": [], + "source": [ + "import numpy as np\n", + "import math\n", + "\n", + "nb_microtubules = 3\n", + "microtubule_id = 0\n", + "\n", + "tracks = [[111, -29, -73], [-10, -98, -3], [70, 50, 20]]\n", + "\n", + "if load_microtubules:\n", + " for j in range(nb_microtubules):\n", + " for i in range(len(points) - 1):\n", + "\n", + " p0 = points[i]\n", + " p1 = points[i+1]\n", + "\n", + " src = np.array(p0[:3])\n", + " dst = np.array(p1[:3])\n", + " forwardVector = np.subtract(dst, src)\n", + " forward_length = np.sqrt(np.sum(forwardVector**2))\n", + " microtubule_size = Vector3(5.0, forward_length, 0.0)\n", + "\n", + " q = be.look_at(\n", + " Vector3(p0[0], p0[1], p0[2]),\n", + " Vector3(p1[0], p1[1], p1[2])\n", + " )\n", + "\n", + " position = Vector3(\n", + " tracks[j][0] + p0[0],\n", + " tracks[j][1] + p0[1],\n", + " tracks[j][2] + p0[2])\n", + " \n", + " name = 'Microtubule%05d' % microtubule_id\n", + " microtubule_id += 1\n", + "\n", + " tubule = Protein(\n", + " name=name + '_TUB',\n", + " source=tubules_folder + '1tub.pdb', \n", + " rotation=Quaternion(0.0, 0.0, 0.707, 0.707),\n", + " occurrences=microtubule_size.y * 7.0)\n", + "\n", + " volume = Volume(\n", + " name=name,\n", + " shape=be.ASSEMBLY_SHAPE_HELIX, shape_params=microtubule_size,\n", + " protein=tubule)\n", + "\n", + " status = be.add_volume(\n", + " position=position,\n", + " rotation=q,\n", + " volume=volume)\n", + "\n", + " status = be.set_protein_color_scheme(\n", + " assembly_name=name,\n", + " name=name + '_TUB',\n", + " color_scheme=be.COLOR_SCHEME_CHAINS,\n", + " palette_name='Set2', palette_size=5)" + ] + }, + { + "cell_type": "markdown", + "id": "b2184aea", + "metadata": {}, + "source": [ + "### Acetylcholin" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "8f448f95", + "metadata": {}, + "outputs": [], + "source": [ + "from bioexplorer import AnimationParams\n", + "\n", + "resource_folder = '../../tests/test_files/'\n", + "pdb_folder = os.path.join(resource_folder, 'pdb')\n", + "acetylcholin_path = os.path.join(pdb_folder, 'neuromodulation', 'acetylcholin.pdb')\n", + "\n", + "# Molecules\n", + "nb_molecules = 5000\n", + "protein_radius_multiplier = 1.0\n", + "protein_representation = be.REPRESENTATION_ATOMS_AND_STICKS\n", + "\n", + "def add_molecules(radius, frame):\n", + " acetylcholin_assembly_name = 'Acetylcholin'\n", + " acetylcholin_name = 'Acetylcholin'\n", + " acetylcholin_position = Vector3(54080 + radius, 180960, 24110)\n", + " acetylcholin = Protein(\n", + " name=acetylcholin_name, \n", + " source=acetylcholin_path, load_non_polymer_chemicals=True, \n", + " occurrences=nb_molecules,\n", + " animation_params=AnimationParams(3, frame*2, 0.5, frame*2 + 1, 1.0)\n", + " )\n", + " volume = Volume(\n", + " name=acetylcholin_assembly_name,\n", + " shape=be.ASSEMBLY_SHAPE_FILLED_SPHERE, shape_params=Vector3(radius, 0, 0),\n", + " protein=acetylcholin)\n", + " be.add_volume(\n", + " volume=volume, \n", + " representation=protein_representation,\n", + " position=acetylcholin_position,\n", + " atom_radius_multiplier=protein_radius_multiplier)\n", + " model_ids = be.get_model_ids()['ids']\n", + " model_id = model_ids[len(model_ids)-1]\n", + " set_astrocyte_materials(model_id, 1.0, [0.5,0.8,0.7], be.SHADING_MODE_DIFFUSE)" + ] + }, + { + "cell_type": "markdown", + "id": "d64a35f1", + "metadata": {}, + "source": [ + "## Movie" + ] + }, + { + "cell_type": "markdown", + "id": "1df34178", + "metadata": {}, + "source": [ + "### Inside Axon, follow microtubule" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ab913b03", + "metadata": {}, + "outputs": [], + "source": [ + "from bioexplorer import MovieMaker\n", + "mm = MovieMaker(be)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "4c5e9251", + "metadata": {}, + "outputs": [], + "source": [ + "import math\n", + "\n", + "nb_frames = 100\n", + "aperture = 0.01\n", + "focus = 2.938\n", + "key_frames = list()\n", + "\n", + "key_frames.append(\n", + " {\n", + " 'apertureRadius': 0.0,\n", + " 'direction': [-0.5161824932867844, 0.71089422191883, 0.47768717678692263],\n", + " 'focusDistance': 1000000.0,\n", + " 'origin': [10 * 61645.09332918549, 10 * 164939.92821114144, 10 * 17640.52720466037],\n", + " 'up': [0.7637641783394794, 0.6344538040102345, -0.11888082462013372]\n", + " }\n", + ")\n", + "\n", + "key_frames.append(\n", + " {\n", + " 'apertureRadius': 0.0,\n", + " 'direction': [-0.7166883232084326, 0.6973190499228045, -0.01019754830550157],\n", + " 'focusDistance': 1000000.0,\n", + " 'origin': [10 * 56185.91520320514, 10 * 172743.7060708133, 10 * 23601.54634817272],\n", + " 'up': [0.6915583632197203, 0.7087280378295366, -0.13946898814846398]\n", + " }\n", + ")\n", + "\n", + "key_frames.append(\n", + " {\n", + " 'apertureRadius': 0.0,\n", + " 'direction': [-0.08489556391375896, 0.9184638069706967, -0.38628613554288993],\n", + " 'focusDistance': 1000000.0,\n", + " 'origin': [10 * 55063.99282926692, 10 * 173129.80736023423, 10 * 24155.774633378987],\n", + " 'up': [0.7637641783394794, 0.6344538040102345, -0.11888082462013372]\n", + " } \n", + ")\n", + "\n", + "for i in range(0, len(points)-20, 5):\n", + " origin = [\n", + " points[i][0] - 15,\n", + " points[i][1] + 15,\n", + " points[i][2] - 15\n", + " ]\n", + " \n", + " target = [\n", + " points[i+1][0],\n", + " points[i+1][1],\n", + " points[i+1][2]\n", + " ]\n", + "\n", + " dir = [0.0, 0.0, 0.0]\n", + " ldir = 0.0\n", + " for k in range(3):\n", + " l = target[k] - origin[k]\n", + " dir[k] = l * scale.to_list()[k]\n", + " ldir += l * l\n", + " for k in range(3):\n", + " dir[k] /= math.sqrt(ldir)\n", + " \n", + " mm.set_camera(origin=origin, direction=dir, up=[0, 1, 0])\n", + " key_frames.append(mm.get_camera())\n", + "\n", + "key_frames.append(\n", + "{\n", + " 'apertureRadius': 0.0,\n", + " 'direction': [-0.7788156442562865, 0.46643004505381463, 0.4193914702670549],\n", + " 'focusDistance': 1000000.0,\n", + " 'origin': [10 * 54276.71983440195, 10 * 180841.0051283754, 10 * 24040.887191176796],\n", + " 'up': [0.29883854644002006, 0.8637709263664873, -0.4057034753679049]}\n", + ")\n", + "\n", + "key_frames.append(\n", + "{\n", + " 'apertureRadius': 0.0,\n", + " 'direction': [-0.5701341231776339, 0.6236003424401975, 0.5348548349757523],\n", + " 'focusDistance': 1000000.0,\n", + " 'origin': [10 * 54220.26233495012, 10 * 180839.3287436113, 10 * 24015.522296933832],\n", + " 'up': [0.4420071457778133, 0.7816083500807779, -0.44013415019213764]} \n", + ")\n", + "\n", + "mm.build_camera_path(key_frames, nb_frames, nb_frames / 4.0)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "5b2b3e91", + "metadata": {}, + "outputs": [], + "source": [ + "def set_rendering_settings(inside):\n", + " params = core.BioExplorerRendererParams()\n", + " params.exposure = 1\n", + " params.max_bounces = 10\n", + " params.epsilon_factor = 2.0\n", + " params.fog_start = 100.0 * scale.x\n", + " params.fog_thickness = 40.0 * scale.x\n", + " params.gi_distance = 100.0 * scale.x\n", + "\n", + " if inside:\n", + " params.gi_distance = 1.0 * scale.x\n", + " params.fog_start = 5.0 * scale.x\n", + " params.fog_thickness = 1.0 * scale.x\n", + "\n", + " params.gi_samples = 1\n", + " params.gi_weight = 0.2\n", + " params.shadows = 0.75\n", + " params.soft_shadows = 0.25\n", + " params.use_hardware_randomizer = True\n", + " return core.set_renderer_params(params)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "6d5d73fb", + "metadata": {}, + "outputs": [], + "source": [ + "set_rendering_settings(False)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "bedfab50", + "metadata": {}, + "outputs": [], + "source": [ + "be.set_models_visibility(True)" + ] + }, + { + "cell_type": "markdown", + "id": "b6af6ece", + "metadata": {}, + "source": [ + "## Rendering" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "69568d3a", + "metadata": {}, + "outputs": [], + "source": [ + "core.set_renderer(current='bio_explorer', subsampling=4, max_accum_frames=64)\n", + "set_rendering_settings(False)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "bd714369", + "metadata": {}, + "outputs": [], + "source": [ + "from tqdm import tqdm\n", + "\n", + "k = 1\n", + "resolution = [k * 960, k * 540]\n", + "output_folder = '/tmp'\n", + "nb_frames = mm.get_nb_frames()\n", + "nb_diffusion_frames = 100\n", + "start_diffustion_frame = nb_frames - nb_diffusion_frames\n", + "\n", + "core.set_renderer(current='bio_explorer', subsampling=4, max_accum_frames=64)\n", + "if not generate_movie:\n", + " core.set_renderer(current='basic', subsampling=4, max_accum_frames=1)\n", + "\n", + "for frame in tqdm(range(nb_frames)):\n", + " inside = frame > 198 and frame < 703\n", + " set_rendering_settings(inside)\n", + "\n", + " mm.set_current_frame(frame)\n", + " if frame >= start_diffustion_frame:\n", + " add_molecules(2 + frame - start_diffustion_frame, frame - start_diffustion_frame)\n", + " be.set_models_visibility(True)\n", + "\n", + " if generate_movie:\n", + " mm.create_snapshot(\n", + " renderer='bio_explorer',\n", + " size=resolution, samples_per_pixel=8,\n", + " base_name='%05d' % frame,\n", + " path=output_folder)\n", + " else:\n", + " core.set_renderer()\n", + " import time\n", + " time.sleep(0.1)" + ] + } + ], + "metadata": { + "interpreter": { + "hash": "ea9a5fa46eb6bad2806a8ea1d08e15bb1e255a2d4320b81e765591579963c56b" + }, + "kernelspec": { + "display_name": "Python 3.8.10 64-bit ('env': venv)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.8.10" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} \ No newline at end of file diff --git a/bioexplorer/pythonsdk/notebooks/neuromodulation/BioExplorer_neuronmodulation_components.ipynb b/bioexplorer/pythonsdk/notebooks/neuromodulation/BioExplorer_neuronmodulation_components.ipynb index 9c9ce9a5b..de31cc66e 100644 --- a/bioexplorer/pythonsdk/notebooks/neuromodulation/BioExplorer_neuronmodulation_components.ipynb +++ b/bioexplorer/pythonsdk/notebooks/neuromodulation/BioExplorer_neuronmodulation_components.ipynb @@ -10,7 +10,7 @@ }, { "cell_type": "code", - "execution_count": 213, + "execution_count": null, "id": "be36b1f4", "metadata": { "scrolled": false @@ -19,7 +19,7 @@ "source": [ "from bioexplorer import BioExplorer, Vector3\n", "\n", - "url = 'r4i1n25:5000'\n", + "url = 'localhost:5000'\n", "be = BioExplorer(url)\n", "core = be.core_api()\n", "status = be.reset_scene()\n", @@ -29,7 +29,7 @@ }, { "cell_type": "code", - "execution_count": 214, + "execution_count": null, "id": "ec4b5f41", "metadata": {}, "outputs": [], @@ -40,18 +40,10 @@ }, { "cell_type": "code", - "execution_count": 215, + "execution_count": null, "id": "c635c1a6", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Connection string: postgresql+psycopg2://bioexplorer:verole2020@postgresql14-users.bbp.epfl.ch:5432/bioexplorer, schema: o1\n" - ] - } - ], + "outputs": [], "source": [ "import os\n", "from sqlalchemy import create_engine\n", @@ -81,7 +73,7 @@ }, { "cell_type": "code", - "execution_count": 216, + "execution_count": null, "id": "0e2fb09b", "metadata": {}, "outputs": [], @@ -106,7 +98,7 @@ }, { "cell_type": "code", - "execution_count": 217, + "execution_count": null, "id": "0b43ee0b", "metadata": {}, "outputs": [], @@ -130,7 +122,7 @@ }, { "cell_type": "code", - "execution_count": 218, + "execution_count": null, "id": "eb0c2ee1", "metadata": {}, "outputs": [], @@ -146,7 +138,7 @@ }, { "cell_type": "code", - "execution_count": 219, + "execution_count": null, "id": "115f6fe9", "metadata": {}, "outputs": [], @@ -166,7 +158,7 @@ }, { "cell_type": "code", - "execution_count": 220, + "execution_count": null, "id": "a9d718a1", "metadata": {}, "outputs": [], @@ -194,7 +186,7 @@ }, { "cell_type": "code", - "execution_count": 221, + "execution_count": null, "id": "7cb64b4f", "metadata": {}, "outputs": [], @@ -284,7 +276,7 @@ }, { "cell_type": "code", - "execution_count": 222, + "execution_count": null, "id": "1a1fc863", "metadata": {}, "outputs": [], @@ -317,7 +309,7 @@ }, { "cell_type": "code", - "execution_count": 223, + "execution_count": null, "id": "791df5e4", "metadata": {}, "outputs": [], @@ -341,14 +333,6 @@ "status = core.set_renderer_params(params)\n", "status = core.set_renderer()" ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "180e68c3", - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": { diff --git a/bioexplorer/pythonsdk/notebooks/neuromodulation/BioExplorer_neuronmodulation_covers.ipynb b/bioexplorer/pythonsdk/notebooks/neuromodulation/BioExplorer_neuronmodulation_covers.ipynb index ae5b51883..919dce22d 100644 --- a/bioexplorer/pythonsdk/notebooks/neuromodulation/BioExplorer_neuronmodulation_covers.ipynb +++ b/bioexplorer/pythonsdk/notebooks/neuromodulation/BioExplorer_neuronmodulation_covers.ipynb @@ -32,7 +32,8 @@ "status = be.reset_scene()\n", "\n", "scale = Vector3(1000, 1000, 1000)\n", - "varicosity = Vector3(59.711, 1085.713, 334.307)\n" + "varicosity = Vector3(59.711, 1085.713, 334.307)\n", + "output_folder = '/tmp'" ] }, { @@ -202,7 +203,7 @@ " name=acetylcholin_name, \n", " source=acetylcholin_path,\n", " load_non_polymer_chemicals=True, load_bonds=True, load_hydrogen=True,\n", - " occurences=nb_molecules,\n", + " occurrences=nb_molecules,\n", " animation_params=AnimationParams(3, (frame + 1) * 2, 0.5, (frame + 2) * 2, 1.0)\n", " )\n", " volume = Volume(\n", @@ -409,8 +410,8 @@ "mm.create_snapshot(\n", " renderer='bio_explorer',\n", " size=[3840, 2160], samples_per_pixel=64,\n", - " base_name='neuromodulation_4k_v7',\n", - " path='/gpfs/bbp.cscs.ch/project/proj129/images/neuromodulation')" + " base_name='neuromodulation_%dx%d_v1' % (size[0], size[1]),\n", + " path=output_folder)" ] }, { @@ -437,8 +438,8 @@ "mm.create_snapshot(\n", " renderer='bio_explorer',\n", " size=[3840, 2160], samples_per_pixel=64,\n", - " base_name='neuromodulation_4k_v8',\n", - " path='/gpfs/bbp.cscs.ch/project/proj129/images/neuromodulation')" + " base_name='neuromodulation_%dx%d_v2' % (size[0], size[1]),\n", + " path=output_folder)" ] }, { @@ -456,8 +457,8 @@ "mm.create_snapshot(\n", " renderer='bio_explorer',\n", " size=[3840, 2160], samples_per_pixel=64,\n", - " base_name='neuromodulation_4k_v9',\n", - " path='/gpfs/bbp.cscs.ch/project/proj129/images/neuromodulation')" + " base_name='neuromodulation_%dx%d_v3' % (size[0], size[1]),\n", + " path=output_folder)" ] }, { @@ -475,8 +476,8 @@ "mm.create_snapshot(\n", " renderer='bio_explorer',\n", " size=[3840, 2160], samples_per_pixel=64,\n", - " base_name='neuromodulation_4k_v10',\n", - " path='/gpfs/bbp.cscs.ch/project/proj129/images/neuromodulation')" + " base_name='neuromodulation_%dx%d_v4' % (size[0], size[1]),\n", + " path=output_folder)" ] }, { @@ -519,16 +520,14 @@ "metadata": {}, "outputs": [], "source": [ - "from IPython.display import clear_output\n", + "from tqdm import tqdm\n", "\n", "draft = False\n", "atom_radius_multiplier = 2.0\n", "nb_molecules = 5000000\n", "\n", "nb_frames = mm.get_nb_frames()\n", - "for frame in range(nb_frames):\n", - " clear_output()\n", - " print('Frame %d/%d' % (frame, nb_frames))\n", + "for frame in tqdm(range(nb_frames)):\n", " add_acetylcholin(scale.x * (0.88 + frame / nb_frames), nb_molecules, atom_radius_multiplier, frame)\n", " mm.set_current_frame(frame)\n", " if draft:\n", @@ -540,12 +539,13 @@ " renderer='depth',\n", " size=[3840, 2160], samples_per_pixel=2,\n", " base_name='%05d' % frame,\n", - " path='/gpfs/bbp.cscs.ch/project/proj129/movies/neuromodulation/v2/depth')\n", + " path=os.path.join(output_folder, 'depth'))\n", + "\n", " mm.create_snapshot(\n", " renderer='bio_explorer',\n", " size=[3840, 2160], samples_per_pixel=64,\n", " base_name='%05d' % frame,\n", - " path='/gpfs/bbp.cscs.ch/project/proj129/movies/neuromodulation/v2/bio_explorer')" + " path=os.path.join(output_folder, 'bio_explorer'))\n" ] } ], @@ -573,4 +573,4 @@ }, "nbformat": 4, "nbformat_minor": 5 -} +} \ No newline at end of file diff --git a/bioexplorer/pythonsdk/notebooks/neuromodulation/BioExplorer_neuronmodulation_full_movie.ipynb b/bioexplorer/pythonsdk/notebooks/neuromodulation/BioExplorer_neuronmodulation_full_movie.ipynb index 08162ee1a..59921c2ce 100644 --- a/bioexplorer/pythonsdk/notebooks/neuromodulation/BioExplorer_neuronmodulation_full_movie.ipynb +++ b/bioexplorer/pythonsdk/notebooks/neuromodulation/BioExplorer_neuronmodulation_full_movie.ipynb @@ -272,7 +272,7 @@ " name=acetylcholin_name, \n", " source=acetylcholin_path,\n", " load_non_polymer_chemicals=True, load_bonds=True, load_hydrogen=True,\n", - " occurences=nb_molecules,\n", + " occurrences=nb_molecules,\n", " animation_params=AnimationParams(3, (frame + 1) * 2, 0.5, (frame + 2) * 2, 1.0)\n", " )\n", " volume = Volume(\n", @@ -403,8 +403,6 @@ " set_morphology_materials(\n", " model_id, palettes[i], be.NB_MATERIALS_PER_MORPHOLOGY,\n", " be.SHADING_MODE_PERLIN, 0.5, emission, user_param)\n", - " # be.SHADING_MODE_CARTOON, 1.0, emission, 3.0)\n", - " # be.SHADING_MODE_NONE, 1.0, emission, 3.0)\n", " i += 1\n", " core.set_renderer()\n", "\n", @@ -542,8 +540,9 @@ "metadata": {}, "outputs": [], "source": [ - "from IPython.display import clear_output\n", + "from tqdm import tqdm\n", "\n", + "output_folder = '/tmp'\n", "draft = False\n", "export_frames = False\n", "image_size = [1920, 1080]\n", @@ -563,18 +562,16 @@ " varicosities[0][2] - 0.3\n", ")\n", "\n", - "# Remove acetylcholin\n", + "'''Remove acetylcholin'''\n", "add_acetylcholin(synapse, 0.0, 0, 0.0, 0)\n", "\n", "nb_frames = mm.get_nb_frames()\n", - "for frame in range(nb_frames):\n", - " clear_output()\n", - " print('Frame %d/%d' % (frame, nb_frames))\n", + "for frame in tqdm(range(nb_frames)):\n", " if not draft:\n", - " # Diffusion\n", + " '''Transmission'''\n", " if frame >= diffusion_1_start_frame and frame= diffusion_2_start_frame and frame --db-port=5432" --plugin MediaMaker +``` + +Replace `` with the IP address of the host where the database docker container is running. + +### Populating the database with open datasets + +A [full circuit dataset](https://zenodo.org/record/6906785#.Ywym7tVBxH6) is available in the [Model of Rat Non-barrel Somatosensory Cortex Anatomy](https://www.biorxiv.org/content/10.1101/2022.08.11.503144v1) publication. A [Python Notebook](../../bioexplorer/pythonsdk/notebooks/neurons/rat_non-barrel_somatosensory_cortex_anatomy/BioExplorer_import_sonata_to_db.ipynb) has been included with basic examples of how to explore the dataset. A [vasculature dataset](https://bbp.epfl.ch/ngv-portal/data/anatomy/experimental-data/vasculature-data/raw-vasculature-data.vtk) is available from the Blue Brain NGV portal. An example [Python Notebook](../../bioexplorer/pythonsdk/notebooks/vasculature/BioExplorer_import_vtk_to_db.ipynb) is available to import the VTK dataset into the database. The [vasculature Python Notebook](../../bioexplorer/pythonsdk/notebooks/vasculature/BioExplorer_vasculature.ipynb) can then be used to visualize the vasculature. + **NOTE** If you are having trouble exiting the process after you run the container (with the above command), use `docker stop ` to stop the container. `docker ps` will give you the current running process. From 56d57d572c9a93f9a95022e29f9107a4bbffb37d Mon Sep 17 00:00:00 2001 From: Cyrille Favreau Date: Thu, 1 Sep 2022 18:06:58 +0200 Subject: [PATCH 3/3] Documetation update --- ...plorer_pythonsdk_doc_source_USERGUIDE.html | 18 +- docs/d1/df4/tests_2Protein_8cpp_source.html | 222 +++++++++--------- .../d6d/tests_2RNASequence_8cpp_source.html | 178 +++++++------- ..._favreau_git_BioExplorer_ARCHITECTURE.html | 78 +++--- .../d7/d36/MeshBasedMembrane_8cpp_source.html | 190 +++++++-------- docs/d8/d20/tests_2Glycans_8cpp_source.html | 168 ++++++------- ...__home_favreau_git_BioExplorer_DOCKER.html | 8 +- docs/index.html | 65 ++--- docs/navtreedata.js | 152 ++++++------ docs/navtreeindex0.js | 18 +- docs/navtreeindex1.js | 78 +++--- docs/navtreeindex2.js | 6 +- docs/navtreeindex4.js | 4 +- docs/navtreeindex5.js | 47 ++-- 14 files changed, 619 insertions(+), 613 deletions(-) diff --git a/docs/d0/de8/md__home_favreau_git_BioExplorer_bioexplorer_pythonsdk_doc_source_USERGUIDE.html b/docs/d0/de8/md__home_favreau_git_BioExplorer_bioexplorer_pythonsdk_doc_source_USERGUIDE.html index a9813fff2..6b3e166bb 100644 --- a/docs/d0/de8/md__home_favreau_git_BioExplorer_bioexplorer_pythonsdk_doc_source_USERGUIDE.html +++ b/docs/d0/de8/md__home_favreau_git_BioExplorer_bioexplorer_pythonsdk_doc_source_USERGUIDE.html @@ -86,7 +86,7 @@
User guide
-

+

Protein

Proteins are loaded from PDB files. Atoms, non-polymer chemicals and bonds can be loaded and displayed in various color schemes: chain id, atom, residue, etc.... Proteins also contain the amino acid sequences of the individual chains; these sequences can be used to query targeted sites (such as glycosylation sites), or functional regions of the protein.

virus_protein_s = Protein(
@@ -103,21 +103,21 @@
ace2_receptor = Protein(sources=['6m1d.pdb'])
status = be.add_protein(
name='ACE2 receptor', protein=ace2_receptor)
-

+

Glycan

Glycans are small elements (branches of monosaccharides) that are attached to an existing protein of the assembly. Individual glycan trees are loaded from PDB files and attached to the glycosylation sites of the specified protein. By default, glycans are attached to all available glycosylation sites, but a set of specific sites can be specified.

be.add_multiple_glycans(
assembly_name=name, glycan_type=be.NAME_GLYCAN_HIGH_MANNOSE,
protein_name=be.NAME_PROTEIN_S_CLOSED,
paths=['high_mannose_glycan.pdb'])
-

+

RNA sequence

An RNA sequence can be loaded from a text sequence of nucleotides. Various shapes can be selected to represent the RNA sequence: Trefoil knot, torus, star, etc….. This allows the sequence to be efficiently packed into a given volume. A different color is assigned per type of nucleotides.

-

+

Membrane

A membrane is an assembly of phospholipids. Phospholipids structures are created following the process described in the VMD (https://www.ks.uiuc.edu/Research/vmd/) Membrane Proteins Tutorial (http://www.ks.uiuc.edu/Training/Tutorials/). The assembly itself is generated by the BioExplorer, for a given shape, and a number of instances of phospholipids.

virus_membrane = Membrane(lipid_sources=['popc.pdb'])
-

+

Surfactants

The BioExplorer exposes an API to help create 3D models of surfactants, according to given proteins for the branches and for the head.

surfactant_a = Surfactant(
@@ -137,7 +137,7 @@

-

+

Virus

A viral particle (= “virus”) is an assembly consisting of a membrane, an RNA sequence, and a given number of S, M and E proteins. The virus has a predefined spherical shape defined by its radius. The default parameters for the virus are a radius of 45 nanometers, 62 S proteins, 42 E proteins, and 50 M proteins. Dimensions and concentrations were retrieved from the literature (see list of dimensions and concentrations in appendix B2 and B3)

virus_protein_s = Protein(
@@ -186,7 +186,7 @@

-

+

Host cell

A host cell is an assembly composed of a membrane of a given size and shape (cylindric, sinusoidal, ect), and a given number of ACE2 receptors.

ace2_receptor = Protein(
@@ -207,7 +207,7 @@

-

+

Glycans Models

Glycan trees models are retrieved from Glycam Builder (http://glycam.org/Pre-builtLibraries.jsp). Only one exemplar of each type of glycan (HM, C, Hy and O-type) is represented in the current reconstruction and listed in appendix C1. Glycosylation sites can be visualized by applying a specific color scheme (COLOR_SCHEME_GLYCOSYLATION_SITE) to the protein.

status = be.set_protein_color_scheme(
@@ -237,7 +237,7 @@

-

+

Visualization

A specific site or an amino-acid sequence can be visualized on the protein by providing a range of indices, and applying a specific color scheme (COLOR_SCHEME_AMINO_ACID_SEQUENCE) to the protein.

status = be.set_protein_amino_acid_sequence_as_range(
diff --git a/docs/d1/df4/tests_2Protein_8cpp_source.html b/docs/d1/df4/tests_2Protein_8cpp_source.html index 1cba9b6fb..03c5cf333 100644 --- a/docs/d1/df4/tests_2Protein_8cpp_source.html +++ b/docs/d1/df4/tests_2Protein_8cpp_source.html @@ -86,118 +86,120 @@
Protein.cpp
-
1 /* Copyright (c) 2020-2022, EPFL/Blue Brain Project
-
2  * All rights reserved. Do not distribute without permission.
-
3  * Responsible Author: cyrille.favreau@epfl.ch
+
1 /*
+
2  * The Blue Brain BioExplorer is a tool for scientists to extract and analyse
+
3  * scientific data from visualization
4  *
-
5  * This library is free software; you can redistribute it and/or modify it under
-
6  * the terms of the GNU Lesser General Public License version 3.0 as published
-
7  * by the Free Software Foundation.
-
8  *
-
9  * This library is distributed in the hope that it will be useful, but WITHOUT
-
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-
11  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
-
12  * details.
-
13  *
-
14  * You should have received a copy of the GNU Lesser General Public License
-
15  * along with this library; if not, write to the Free Software Foundation, Inc.,
-
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
17  */
-
18 
-
19 #include <plugin/common/Logs.h>
-
20 #include <plugin/molecularsystems/Protein.h>
-
21 
-
22 #include <brayns/Brayns.h>
-
23 #include <brayns/engineapi/Engine.h>
-
24 #include <brayns/engineapi/Scene.h>
-
25 
-
26 #define BOOST_TEST_MODULE protein
-
27 #include <boost/test/unit_test.hpp>
-
28 
-
29 #include <fstream>
+
5  * Copyright 2020-2022 Blue BrainProject / EPFL
+
6  *
+
7  * This program is free software: you can redistribute it and/or modify it under
+
8  * the terms of the GNU General Public License as published by the Free Software
+
9  * Foundation, either version 3 of the License, or (at your option) any later
+
10  * version.
+
11  *
+
12  * This program is distributed in the hope that it will be useful, but WITHOUT
+
13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+
14  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+
15  * details.
+
16  *
+
17  * You should have received a copy of the GNU General Public License along with
+
18  * this program. If not, see <https://www.gnu.org/licenses/>.
+
19  */
+
20 
+
21 #include <plugin/common/Logs.h>
+
22 #include <plugin/molecularsystems/Protein.h>
+
23 
+
24 #include <brayns/Brayns.h>
+
25 #include <brayns/engineapi/Engine.h>
+
26 #include <brayns/engineapi/Scene.h>
+
27 
+
28 #define BOOST_TEST_MODULE protein
+
29 #include <boost/test/unit_test.hpp>
30 
-
31 namespace tests
-
32 {
-
33 using namespace bioexplorer;
-
34 using namespace molecularsystems;
-
35 
-
36 std::string getFileContents(const std::string& filename)
-
37 {
-
38  std::ifstream file(filename);
-
39  std::string str;
-
40  if (file)
-
41  {
-
42  std::ostringstream ss;
-
43  ss << file.rdbuf();
-
44  str = ss.str();
-
45  }
-
46  else
-
47  PLUGIN_THROW("Failed to open " + filename);
-
48  return str;
-
49 }
-
50 
-
51 ProteinDetails getProteinDescriptor()
-
52 {
-
53  ProteinDetails descriptor;
-
54  descriptor.assemblyName = "test";
-
55  descriptor.name = "test";
-
56  descriptor.contents = getFileContents(
-
57  "./bioexplorer/pythonsdk/tests/test_files/pdb/6m1d.pdb");
-
58  descriptor.atomRadiusMultiplier = 1.0;
-
59  descriptor.loadBonds = true;
-
60  descriptor.loadNonPolymerChemicals = true;
-
61  descriptor.loadHydrogen = true;
-
62  descriptor.representation = ProteinRepresentation::atoms;
-
63  descriptor.chainIds = {};
-
64  descriptor.recenter = true;
-
65  descriptor.occurrences = 1;
-
66  descriptor.allowedOccurrences = {};
-
67  descriptor.animationParams = {};
-
68  descriptor.position = {0.0, 0.0, 0.0};
-
69  descriptor.rotation = {0.0, 0.0, 0.0, 1.0};
-
70  return descriptor;
-
71 }
-
72 
-
73 BOOST_AUTO_TEST_CASE(protein)
-
74 {
-
75  std::vector<const char*> argv{
-
76  "brayns", "--http-server", "localhost:0", "--plugin",
-
77  "BioExplorer --db-name=bioexplorer --db-user=brayns "
-
78  "--db-password=brayns --db-host=localhost --db-port=5432"};
-
79  brayns::Brayns brayns(argv.size(), argv.data());
-
80  auto& scene = brayns.getEngine().getScene();
-
81  Protein protein(scene, getProteinDescriptor());
-
82 
-
83  BOOST_CHECK(protein.getAtoms().size() == 21776);
-
84  BOOST_CHECK(protein.getResidues().size() == 20);
-
85  BOOST_CHECK(protein.getResidueSequences().size() == 4);
-
86 
-
87  std::vector<Vector3d> positions;
-
88  std::vector<Quaterniond> rotations;
-
89  const std::vector<size_t> siteIndices = {};
-
90  protein.getGlycosilationSites(positions, rotations, siteIndices);
-
91  BOOST_CHECK(positions.size() == 24);
-
92  BOOST_CHECK(rotations.size() == positions.size());
-
93 
-
94  positions.clear();
-
95  rotations.clear();
-
96  const size_ts chainIds = {};
-
97  protein.getSugarBindingSites(positions, rotations, siteIndices, chainIds);
-
98  BOOST_CHECK(positions.size() == 0);
-
99  BOOST_CHECK(rotations.size() == 0);
-
100 
-
101  const auto sites = protein.getGlycosylationSites(siteIndices);
-
102  BOOST_CHECK(sites.size() == 4);
-
103 
-
104  const std::vector<size_t> expectedSizes{5, 7, 5, 7};
-
105  size_t count = 0;
-
106  for (const auto& site : sites)
-
107  {
-
108  BOOST_CHECK(site.second.size() == expectedSizes[count]);
-
109  ++count;
-
110  }
-
111 }
-
112 } // namespace tests
+
31 #include <fstream>
+
32 
+
33 namespace tests
+
34 {
+
35 using namespace bioexplorer;
+
36 using namespace molecularsystems;
+
37 
+
38 std::string getFileContents(const std::string& filename)
+
39 {
+
40  std::ifstream file(filename);
+
41  std::string str;
+
42  if (file)
+
43  {
+
44  std::ostringstream ss;
+
45  ss << file.rdbuf();
+
46  str = ss.str();
+
47  }
+
48  else
+
49  PLUGIN_THROW("Failed to open " + filename);
+
50  return str;
+
51 }
+
52 
+
53 ProteinDetails getProteinDescriptor()
+
54 {
+
55  ProteinDetails descriptor;
+
56  descriptor.assemblyName = "test";
+
57  descriptor.name = "test";
+
58  descriptor.contents = getFileContents(
+
59  "./bioexplorer/pythonsdk/tests/test_files/pdb/6m1d.pdb");
+
60  descriptor.atomRadiusMultiplier = 1.0;
+
61  descriptor.loadBonds = true;
+
62  descriptor.loadNonPolymerChemicals = true;
+
63  descriptor.loadHydrogen = true;
+
64  descriptor.representation = ProteinRepresentation::atoms;
+
65  descriptor.chainIds = {};
+
66  descriptor.recenter = true;
+
67  descriptor.occurrences = 1;
+
68  descriptor.allowedOccurrences = {};
+
69  descriptor.animationParams = {};
+
70  descriptor.position = {0.0, 0.0, 0.0};
+
71  descriptor.rotation = {0.0, 0.0, 0.0, 1.0};
+
72  return descriptor;
+
73 }
+
74 
+
75 BOOST_AUTO_TEST_CASE(protein)
+
76 {
+
77  std::vector<const char*> argv{
+
78  "brayns", "--http-server", "localhost:0", "--plugin",
+
79  "BioExplorer --db-name=bioexplorer --db-user=brayns "
+
80  "--db-password=brayns --db-host=localhost --db-port=5432"};
+
81  brayns::Brayns brayns(argv.size(), argv.data());
+
82  auto& scene = brayns.getEngine().getScene();
+
83  Protein protein(scene, getProteinDescriptor());
+
84 
+
85  BOOST_CHECK(protein.getAtoms().size() == 21776);
+
86  BOOST_CHECK(protein.getResidues().size() == 20);
+
87  BOOST_CHECK(protein.getResidueSequences().size() == 4);
+
88 
+
89  std::vector<Vector3d> positions;
+
90  std::vector<Quaterniond> rotations;
+
91  const std::vector<size_t> siteIndices = {};
+
92  protein.getGlycosilationSites(positions, rotations, siteIndices);
+
93  BOOST_CHECK(positions.size() == 24);
+
94  BOOST_CHECK(rotations.size() == positions.size());
+
95 
+
96  positions.clear();
+
97  rotations.clear();
+
98  const size_ts chainIds = {};
+
99  protein.getSugarBindingSites(positions, rotations, siteIndices, chainIds);
+
100  BOOST_CHECK(positions.size() == 0);
+
101  BOOST_CHECK(rotations.size() == 0);
+
102 
+
103  const auto sites = protein.getGlycosylationSites(siteIndices);
+
104  BOOST_CHECK(sites.size() == 4);
+
105 
+
106  const std::vector<size_t> expectedSizes{5, 7, 5, 7};
+
107  size_t count = 0;
+
108  for (const auto& site : sites)
+
109  {
+
110  BOOST_CHECK(site.second.size() == expectedSizes[count]);
+
111  ++count;
+
112  }
+
113 }
+
114 } // namespace tests
diff --git a/docs/d3/d6d/tests_2RNASequence_8cpp_source.html b/docs/d3/d6d/tests_2RNASequence_8cpp_source.html index 37456d9ce..3ac6ab1b1 100644 --- a/docs/d3/d6d/tests_2RNASequence_8cpp_source.html +++ b/docs/d3/d6d/tests_2RNASequence_8cpp_source.html @@ -86,96 +86,98 @@
RNASequence.cpp
-
1 /* Copyright (c) 2020-2022, EPFL/Blue Brain Project
-
2  * All rights reserved. Do not distribute without permission.
-
3  * Responsible Author: cyrille.favreau@epfl.ch
+
1 /*
+
2  * The Blue Brain BioExplorer is a tool for scientists to extract and analyse
+
3  * scientific data from visualization
4  *
-
5  * This library is free software; you can redistribute it and/or modify it under
-
6  * the terms of the GNU Lesser General Public License version 3.0 as published
-
7  * by the Free Software Foundation.
-
8  *
-
9  * This library is distributed in the hope that it will be useful, but WITHOUT
-
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-
11  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
-
12  * details.
-
13  *
-
14  * You should have received a copy of the GNU Lesser General Public License
-
15  * along with this library; if not, write to the Free Software Foundation, Inc.,
-
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
17  */
-
18 
-
19 #include <plugin/common/Assembly.h>
-
20 #include <plugin/common/Logs.h>
-
21 #include <plugin/molecularsystems/RNASequence.h>
-
22 
-
23 #include <brayns/Brayns.h>
-
24 #include <brayns/engineapi/Engine.h>
-
25 #include <brayns/engineapi/Scene.h>
-
26 
-
27 #define BOOST_TEST_MODULE rnasequence
-
28 #include <boost/test/unit_test.hpp>
-
29 
-
30 #include <fstream>
+
5  * Copyright 2020-2022 Blue BrainProject / EPFL
+
6  *
+
7  * This program is free software: you can redistribute it and/or modify it under
+
8  * the terms of the GNU General Public License as published by the Free Software
+
9  * Foundation, either version 3 of the License, or (at your option) any later
+
10  * version.
+
11  *
+
12  * This program is distributed in the hope that it will be useful, but WITHOUT
+
13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+
14  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+
15  * details.
+
16  *
+
17  * You should have received a copy of the GNU General Public License along with
+
18  * this program. If not, see <https://www.gnu.org/licenses/>.
+
19  */
+
20 
+
21 #include <plugin/common/Assembly.h>
+
22 #include <plugin/common/Logs.h>
+
23 #include <plugin/molecularsystems/RNASequence.h>
+
24 
+
25 #include <brayns/Brayns.h>
+
26 #include <brayns/engineapi/Engine.h>
+
27 #include <brayns/engineapi/Scene.h>
+
28 
+
29 #define BOOST_TEST_MODULE rnasequence
+
30 #include <boost/test/unit_test.hpp>
31 
-
32 namespace tests
-
33 {
-
34 using namespace bioexplorer;
-
35 using namespace molecularsystems;
-
36 
-
37 std::string getFileContents(const std::string& filename)
-
38 {
-
39  std::ifstream file(filename);
-
40  std::string str;
-
41  if (file)
-
42  {
-
43  std::ostringstream ss;
-
44  ss << file.rdbuf();
-
45  str = ss.str();
-
46  }
-
47  else
-
48  PLUGIN_THROW("Failed to open " + filename);
-
49  return str;
-
50 }
-
51 
-
52 AssemblyDetails getAssemblyDescriptor()
-
53 {
-
54  AssemblyDetails descriptor;
-
55  descriptor.name = "assembly";
-
56  descriptor.shape = AssemblyShape::point;
-
57  return descriptor;
-
58 }
-
59 
-
60 RNASequenceDetails getRNASequenceDescriptor()
-
61 {
-
62  RNASequenceDetails descriptor;
-
63 
-
64  descriptor.assemblyName = "test";
-
65  descriptor.name = "test";
-
66  descriptor.contents = getFileContents(
-
67  "./bioexplorer/pythonsdk/tests/test_files/rna/sars-cov-2.rna");
-
68  descriptor.shape = RNAShapeType::trefoilKnot;
-
69  descriptor.shapeParams = {11.0, 0.5};
-
70  descriptor.valuesRange = {0.0, 30.5 * static_cast<double>(M_PI)};
-
71  descriptor.curveParams = {1.51, 1.12, 1.93};
-
72  descriptor.position = {0.0, 0.0, 0.0};
-
73  descriptor.rotation = {1.0, 0.0, 0.0, 0.0};
-
74  return descriptor;
-
75 }
-
76 
-
77 BOOST_AUTO_TEST_CASE(rna_sequence)
-
78 {
-
79  std::vector<const char*> argv{
-
80  "brayns", "--http-server", "localhost:0", "--plugin",
-
81  "BioExplorer --db-name=bioexplorer --db-user=brayns "
-
82  "--db-password=brayns --db-host=localhost --db-port=5432"};
-
83  brayns::Brayns brayns(argv.size(), argv.data());
-
84  auto& scene = brayns.getEngine().getScene();
-
85  Assembly assembly(scene, getAssemblyDescriptor());
-
86  assembly.addRNASequence(getRNASequenceDescriptor());
-
87 
-
88  BOOST_CHECK(assembly.getRNASequence()->getRNASequences().size() == 0);
-
89 }
-
90 } // namespace tests
+
32 #include <fstream>
+
33 
+
34 namespace tests
+
35 {
+
36 using namespace bioexplorer;
+
37 using namespace molecularsystems;
+
38 
+
39 std::string getFileContents(const std::string& filename)
+
40 {
+
41  std::ifstream file(filename);
+
42  std::string str;
+
43  if (file)
+
44  {
+
45  std::ostringstream ss;
+
46  ss << file.rdbuf();
+
47  str = ss.str();
+
48  }
+
49  else
+
50  PLUGIN_THROW("Failed to open " + filename);
+
51  return str;
+
52 }
+
53 
+
54 AssemblyDetails getAssemblyDescriptor()
+
55 {
+
56  AssemblyDetails descriptor;
+
57  descriptor.name = "assembly";
+
58  descriptor.shape = AssemblyShape::point;
+
59  return descriptor;
+
60 }
+
61 
+
62 RNASequenceDetails getRNASequenceDescriptor()
+
63 {
+
64  RNASequenceDetails descriptor;
+
65 
+
66  descriptor.assemblyName = "test";
+
67  descriptor.name = "test";
+
68  descriptor.contents = getFileContents(
+
69  "./bioexplorer/pythonsdk/tests/test_files/rna/sars-cov-2.rna");
+
70  descriptor.shape = RNAShapeType::trefoilKnot;
+
71  descriptor.shapeParams = {11.0, 0.5};
+
72  descriptor.valuesRange = {0.0, 30.5 * static_cast<double>(M_PI)};
+
73  descriptor.curveParams = {1.51, 1.12, 1.93};
+
74  descriptor.position = {0.0, 0.0, 0.0};
+
75  descriptor.rotation = {1.0, 0.0, 0.0, 0.0};
+
76  return descriptor;
+
77 }
+
78 
+
79 BOOST_AUTO_TEST_CASE(rna_sequence)
+
80 {
+
81  std::vector<const char*> argv{
+
82  "brayns", "--http-server", "localhost:0", "--plugin",
+
83  "BioExplorer --db-name=bioexplorer --db-user=brayns "
+
84  "--db-password=brayns --db-host=localhost --db-port=5432"};
+
85  brayns::Brayns brayns(argv.size(), argv.data());
+
86  auto& scene = brayns.getEngine().getScene();
+
87  Assembly assembly(scene, getAssemblyDescriptor());
+
88  assembly.addRNASequence(getRNASequenceDescriptor());
+
89 
+
90  BOOST_CHECK(assembly.getRNASequence()->getRNASequences().size() == 0);
+
91 }
+
92 } // namespace tests
diff --git a/docs/d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html b/docs/d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html index 67b582a90..aab66a65d 100644 --- a/docs/d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html +++ b/docs/d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html @@ -90,7 +90,7 @@
___
-

+

Motivation

One of the keys towards seeing how the brain functions is representation of how the individual cells work. Specifically, the more morphologically precise the representation can be, the simpler it is for specialists in the organic field to approve cell structures; photograph reasonable rendering is accordingly significant.

The BBBE is built as a plug-in of the Blue Brain Brayns platform, that can intelligently perform high-quality and high-fidelity rendering of large neuroscience datasets. Thanks to its client/server architecture, Blue Brain Brayns can be run in the cloud as well as on a supercomputer, and stream the rendering to any browser, either in a web UI or a Jupyter notebook. The challenges of neuroscience are numerous, but in the context of visualization at the Blue Brain Project, four objectives have to be reached: Large data sets, large displays, rendering performance and image quality.

@@ -99,7 +99,7 @@

___

As an academic institution, we also want to provide free software that can be run on virtually any type of architecture: CPUs, GPUs or virtual machines hosted in the cloud. In order to be used by a community as large possible, the target audience for Blue Brain Brayns includes developers, scientists, digital artists, and media designers.

-

+

Design goals

Blue Brain Brayns is designed to address the challenges of visualizing large scale neuroscientific data (hundreds of thousands up to few millions of highly detailed neurons and Terabytes of simulation data). It has a research-oriented modular architecture that uses plug-ins, which makes it easy to experiment with novel rendering techniques, for instance trying to visualize neural electrical activity with signed distance fields.

This architecture is well-suited to address new use cases that are requested by scientists on a regular basis. Blue Brain Brayns has a client-server architecture allowing to run on a desktop PC, in the cloud or on a supercomputer. The core of Blue Brain Brayns currently provides two rendering engines, a CPU implementation built on top of Intel OSPRay, and a GPU one based on OptiX. Blue Brain Brayns provides an engine API that facilitates the integration of additional rendering engines.

@@ -110,76 +110,76 @@

  • Focus on the the science, not on the engineering
  • As a general rule, engines do not need to have a similar set of functionalities, but implement what is necessary to serve the use-cases they are used for. Typically, the OSPRay implementation is used to render very large data sets, and the OptiX one runs the realtime immersive use-cases.

    -

    +

    Software Architecture

    -

    +

    Modular design

    Modular design is a methodology that subdivides a framework into littler parts called modules, which can be freely made, changed, supplanted or traded between various frameworks. In the case of Blue Brain Brayns, the philosophy is "Write code that is easy to replace, not easy to extend". In that context, modularity is at the component level. Blue Brain Brayns makes extensive use of the class factory pattern to create objects for the selected implementations.

    The design was initially inspired by the Sol-R rendering engine that allows multiple engines (CUDA and OpenCL) to deliver interactive visualization of scientific data using the ray-tracing technique.

    -

    +

    Distributed architecture

    In the context of large scale rendering, computation is usually distributed on many nodes, when the visualization and interaction with the system still has to be performed from a single machine. For that reason, Blue Brain Brayns is built upon a distributed architecture that allows all client components (python scripts, UI widgets, etc) to be run on separate machines.

    -

    +

    Abstraction

    The abstraction layer defines the interface to every element that can be used by the various engines in the system. The abstraction was put at the lowest possible level where the compromise between execution speed and code duplication was found acceptable. Regarding the geometry, and for the sake of memory consumption, Blue Brain Brayns currently uses abstract data structures that are identical to the ones used by the underlying rendering engines (OSPRay and OptiX). This could vary in the future as new engines are added, but in this particular case of the geometry, and since it can be massive in the context of the Blue Brain project, the design decision was to force the engines to adapt to the definition of the abstract objects used by Blue Brain Brayns.

    -

    +

    Properties

    Blue Brain Brayns objects holding a list of properties that are mapped by name to a supported C++ type. This mechanism is used at every level of the software in order to facilitate the exposure of internal objects to the external API.

    -

    +

    Core components

    -

    +

    Blue Brain Brayns

    The initialization of the system involves command line parsing, engine creation, plug-in loading, data loading and setup of input devices. Command line parameters provide options about the application itself, the geometry and the renderer. Blue Brain Brayns creates the scene using built-in and plug-in provided loaders.

    -

    +

    Parameter manager

    The parameter manager manages all parameters registered by the application. By default, an instance of application, rendering, geometry and volume parameters are registered. The parameters managers offer the necessary methods to register any additional custom types of parameters.

    -

    +

    Camera manipulators

    Blue Brain Brayns provides two types of camera manipulators: Inspect and Fly. Inspect is the default, and allows the user to orbit around a target. The fly manipulator allows navigation in a flight simulator way.

    -

    +

    Engine factory

    The engine factory is in charge of instantiating engines according to their name.

    -

    +

    Plug-ins

    A plug-in is a set a functionalities that are not provided by the core of the application. For example, exposing a REST interface via HTTP, or streaming images to an distant display. Plug-ins are components external to the core that are dynamically loaded during the initialization process. Blue Brain Brayns accepts multiple iterations of the plug-in command line argument, followed by the name of the plug-in. The plug-in manager is in charge of loading and keeping track of the plug-ins for the lifetime of the application. At every iteration of the rendering loop, the preRender and postRender methods are respectively invoked before and after the rendering of the current frame, and this for every plug-in.

    -

    +

    Data loaders

    Blue Brain Brayns provides a default loader for meshes, proteins, volumes and point clouds.

    -

    +

    Engine

    The engine abstraction is a container for all components that make a rendering engine: A scene, a renderer, a set of lights, and a list of frame buffers. When adding a new engine to Blue Brain Brayns, those components have to be linked to the underlying corresponding ones provided by the 3rd party acceleration library, typically OSPRay or OptiX, that provides the ray-tracing implementation.

    An engine can have several renderers, cameras and frame buffers but only has one single scene. The engine is responsible for the creation of the components that it contains. For this, the engine provides a set of methods that have to be called by the individual implementations. Typically, createCamera creates the camera for the current engine, createRenderer creates the renderer and so on for every other component. The engine also provides statistics about the rendering speed of a frame via getStatistics.

    -

    +

    Scene

    A scene contains collections of geometries, materials and light sources that are used to describe the 3D scene to be rendered.

    -

    +

    Model descriptor

    The model descriptor defines the metadata attached to a model. Enabling a model means that the model is part of scene. If disabled, the model still exists in Blue Brain Brayns, but is removed from the rendered scene. The visible attribute defines if the model should be visible or not. If invisible, the model is removed from the BVH. If set to true, the bounding box attribute displays a bounding box for the current model. Model descriptor are exposed via the HTTP/WS interface. The metadata structure is a simple map of strings that contains the name of a property and its value. This can be used to describe the model, with any piece of information that is relevant to the end user. The model descriptor manages instances of the model it contains via a list of transformations. The model descriptor provides functions to manage the metadata and the instances, to compute the bounds of the geometry, and access to the underlying model object.

    -

    +

    Model

    The model class holds the geometry attached to an asset of the scene (mesh, circuit, volume, etc). The model handles resources attached to the geometry such as implementation specific classes, and acceleration structures). Models provide a simple API to manipulate geometries (spheres, cylinders, cones, signed distance fields, triangle meshes, streamlines, etc), materials, a unique simulation handler, volumes and a unique transfer function. An OSPRay model holds two internal sets of geometries, a primary and a secondary one. The model is responsible for creating the materials attached to the geometry that it contains.

    -

    +

    Application Programming Interface

    -

    +

    Action interface

    The Action Interface allows developer to extend the API exposed via the network interface. It can register notifications, which have no return values with an optional parameter, and requests, which return a value after processing. The encoding of the parameter and return value is restricted to JSON.

    -

    +

    plug-in

    The plug-in interface defines the methods that need to be implemented by any new plug-in added to the list of components that Blue Brain Brayns can dynamically load. using the --plug-in command line argument, the name of the plug-in can be specified and Blue Brain Brayns will load the corresponding library at startup. A plug-in can access the engine, the action interface, the keyboard handler, and the camera manipulator provided by Blue Brain Brayns.

    Plug-ins can expose new external API, implement new data loaders, as well as shaders, cameras, geometries, materials, etc. plug-ins are also the place where use-case specific implementations are required. Blue Brain Brayns aims to remain agnostic to what it renders, plug-ins are responsible for giving a meaning to what is rendered.

    -

    +

    Loader

    In a research environment, new datasets appear on a daily basis, and being able to visualize them in a fast and easy way is crucial. Blue Brain Brayns offers an interface to data loaders so that custom implementations can easily be added to the system. Loaders are in charge of reading the data from external sources (IO, Databases, etc) and build the corresponding 3D scene via the creation of models. Loaders are asynchronous and run in a dedicated thread.

    Loaders can define custom attributes via the property registration mechanism. importFromBlob and importFromFile are the two methods that need to be implemented in order for Blue Brain Brayns to accept the new loader. At runtime, the choice of the loaded is automatically determined by the extensions that it supports. If two loaders register the same extension, the priority matches to the loading order.

    -

    +

    Client software development kits

    -

    +

    Introduction

    Blue Brain Brayns client SDKs are build on a dynamic approach, meaning that they are constructed according to the API exposed by the server, at runtime. Whenever a new end point is added to Blue Brain Brayns, the client SDK does not need to be adapted. Methods and data structures are automatically interpreted by the SDK and appear to the client application as Python or Javascript native objects. Client SDKs use the registry and schema end-points to list and define native and language-specific methods and data structures. As an example, the camera object appears in the registry (/registry) as follows:

    {"camera": ["PUT", "GET"]}

    And the corresponding schema (/camera/schema):

    {"type":"object","properties":{"current":{"type":"string"},"orientation":{"type":"array","items":{"type":"number"},"minItems":4,"maxItems":4},"position":{"type":"array","items":{"type":"number"},"minItems":3,"maxItems":3},"target":{"type":"array","items":{"type":"number"},"minItems":3,"maxItems":3},"types":{"type":"array","items":{"type":"string"}}},"additionalProperties":false,"title":"Camera"}
    -

    +

    Python SDK

    The Python SDK offers a simple and easy way to connect to Blue Brain Brayns, using the following API:

    from brayns import Client
    @@ -188,30 +188,30 @@

    This architecture allows the Python scripts to be run on light weight clients (mobile devices, laptop computers, etc) regardless of the size of the 3D scene which is handled by the server part of Blue Brain Brayns. This also allows the server to be run in distributed mode. The generated Client class has a getter/setter method for every end points exposed by the Blue Brain Brayns server hat respectively has a GET/PUT method defined in the schema. For instance, the following code snippet illustrates how to manipulate a camera:

    camera = brayns.get_camera()
    brayns.set_camera(position=(0,0,0), orientation=camera['orientation'])
    -

    +

    Javascript SDK

    The Javascript SDK is collection of web apps and JavaScript packages for the C++ rendering service Blue Brain Brayns.

    -

    +

    Deflect

    Based on the data-parallel rendering feature provided by the OSPRay engine, the Deflect plug-in extends the PixelOp implementation to stream tiles from multiple nodes to Tide. Individual tiles are computed by rendering nodes, and sent to Tide that is in charge of reconstructing the full frame and displaying it on the large screens. The deflect plug-in also processes input messages such as touches provided by Tide and implements the corresponding actions. Typically camera movements and the rendering options that are mapped to keyboard entries.

    -

    +

    Rockets

    Rockets is a library for easy HTTP and websockets messaging in C++ applications. It provides HTTP server with integrated websockets support, HTTP client for making simple asynchronous requests, websocket client for sending, broadcasting and receiving text and binary messages, support for JSON-RPC as a communication protocol over HTTP and websockets. Rockets extends the 2.0 specification by providing support for cancellation and progress notifications of pending requests.

    The Rockets plug-in allows Blue Brain Brayns to expose core and use-case specific API via HTTP or websocket protocols. The loading of the plug-in is initiated at startup time with the http-server command line argument where an optional host (default is localhost) and a mandatory port are specified. End-points are registered in the c++ code using the registerNotification or registerRequest method of the ActionInterface component. The list of registered end-points can be accessed via the registry end-point.

    -

    +

    VRPN

    The VRPN plug-in receives events from input devices and transform them into Blue Brain Brayns usable information: Camera position and orientation, and fly stick interactions (position, orientation, joystick and buttons). This plug-in is mainly use for immersive setups.

    -

    +

    Applications

    -

    +

    Service

    The service is an off-screen application that is typically used when running Blue Brain Brayns as a service in the cloud or in a supercomputer. This application does not require any kind of graphics acceleration when run with the OSPRay engine.

    -

    +

    Viewer

    The viewer is an OpenGL based application that is used to run Blue Brain Brayns as a heavy client on a consumer PC.

    -

    +

    Use-cases

    -

    +

    Visualization of Blue Brain / Sonata datasets

    The visualization of Blue Brain datasets requires a specific plug-in called the BBBE. This components allows the loading of the neuron , glial cells, or vasculatures, with a placement and orientation defined in the microcircuit description.

    @@ -223,7 +223,7 @@

    ___

    -

    +

    MOOC

    The Blue Brain Project provides a number of massive online courses in which students want to visualize micro-circuit structures and corresponding simulations. Since datasets can be large, running the visualization using client hardware and software resources is likely to give unacceptable results. Thanks to its client/server architecture, visualization can be processed server side on a virtual machine running in the cloud. Computed images are then streamed to the end client in real-time, allowing smooth navigation at a constant rate, regardless of the size of the dataset.

    @@ -236,14 +236,14 @@

    ___

    -

    +

    OpenDeck

    The OpenDeck is the Blue Brain visualization display for presentations and immersive exploration of scientific data in 3D.

    ___
    -

    +

    Native rendering

    The system consists of a semi-cylindrical screen measuring 8 by 3 meters, with a total pixel count of about 35 megapixels, 8 high-end Sony laser projectors (7 for the screen projection + 1 for the floor projection), 4 surround speakers, a microphone, 2 video conferencing cameras, 6 infrared LED tracking cameras to track user's head motion, an infrared touch interface, a cooling system to cool down the projectors, a Windows 10 PC from which the projectors, speakers, a microphone and a display cluster of 8 nodes, each one connected to a projector.

    That immersive setup requires images to be delivered at a high frame rate (60 frames per seconds) and at a very high resolution (7x4K). Naturally, the choice of the engine goes in favor of the GPU implementation. Recent updates in the hardware such as NVIDIA's RTX technology dramatically improve the rendering speed. The drawback of such a setup being the size of the data that can be rendered, and advanced software solutions such as out-of-core and geometry streaming have to be implemented.

    @@ -256,7 +256,7 @@

    ___
    -

    +

    Remote rendering

    Blue Brain Brayns uses the CPU engine, and runs in distributed mode to visualize Blue Brain large datasets. Three plug-ins are used on the server side:

    • VRPN for position tracking and flight stick management
    • @@ -273,7 +273,7 @@

      ___
      -

      +

      What next?

      Blue Brain Brayns is currently the main platform used by the Blue Brain Project to visualize different types of data including morphologies, surface meshes and volumes. Currently, Blue Brain Brayns has plug-ins for visualizing simulated electro-physiological activity of point neuron and full compartmental models of large scale circuits up to the size of a mouse isocortex, diffusion tensor imaging data, large volumes.

      The BBBE application is built on top of a fork of Blue Brain Brayns 1.0.0 , the Blue Brain rendering platform. The BBBE uses the underlying technical capabilities of the rendering platform to create large scale and accurate 3D scenes from Jupyter notebooks.

      diff --git a/docs/d7/d36/MeshBasedMembrane_8cpp_source.html b/docs/d7/d36/MeshBasedMembrane_8cpp_source.html index 5cfa103f2..1cd363702 100644 --- a/docs/d7/d36/MeshBasedMembrane_8cpp_source.html +++ b/docs/d7/d36/MeshBasedMembrane_8cpp_source.html @@ -86,103 +86,105 @@
      MeshBasedMembrane.cpp
      -
      1 /* Copyright (c) 2020-2022, EPFL/Blue Brain Project
      -
      2  * All rights reserved. Do not distribute without permission.
      -
      3  * Responsible Author: cyrille.favreau@epfl.ch
      +
      1 /*
      +
      2  * The Blue Brain BioExplorer is a tool for scientists to extract and analyse
      +
      3  * scientific data from visualization
      4  *
      -
      5  * This library is free software; you can redistribute it and/or modify it under
      -
      6  * the terms of the GNU Lesser General Public License version 3.0 as published
      -
      7  * by the Free Software Foundation.
      -
      8  *
      -
      9  * This library is distributed in the hope that it will be useful, but WITHOUT
      -
      10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
      -
      11  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
      -
      12  * details.
      -
      13  *
      -
      14  * You should have received a copy of the GNU Lesser General Public License
      -
      15  * along with this library; if not, write to the Free Software Foundation, Inc.,
      -
      16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
      -
      17  */
      -
      18 
      -
      19 #include <plugin/common/Assembly.h>
      -
      20 #include <plugin/common/Logs.h>
      -
      21 #include <plugin/molecularsystems/Membrane.h>
      -
      22 #include <plugin/molecularsystems/Protein.h>
      -
      23 
      -
      24 #include <brayns/Brayns.h>
      -
      25 #include <brayns/engineapi/Engine.h>
      -
      26 #include <brayns/engineapi/Scene.h>
      -
      27 
      -
      28 #define BOOST_TEST_MODULE mesh
      -
      29 #include <boost/test/unit_test.hpp>
      -
      30 
      -
      31 #include <fstream>
      +
      5  * Copyright 2020-2022 Blue BrainProject / EPFL
      +
      6  *
      +
      7  * This program is free software: you can redistribute it and/or modify it under
      +
      8  * the terms of the GNU General Public License as published by the Free Software
      +
      9  * Foundation, either version 3 of the License, or (at your option) any later
      +
      10  * version.
      +
      11  *
      +
      12  * This program is distributed in the hope that it will be useful, but WITHOUT
      +
      13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
      +
      14  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
      +
      15  * details.
      +
      16  *
      +
      17  * You should have received a copy of the GNU General Public License along with
      +
      18  * this program. If not, see <https://www.gnu.org/licenses/>.
      +
      19  */
      +
      20 
      +
      21 #include <plugin/common/Assembly.h>
      +
      22 #include <plugin/common/Logs.h>
      +
      23 #include <plugin/molecularsystems/Membrane.h>
      +
      24 #include <plugin/molecularsystems/Protein.h>
      +
      25 
      +
      26 #include <brayns/Brayns.h>
      +
      27 #include <brayns/engineapi/Engine.h>
      +
      28 #include <brayns/engineapi/Scene.h>
      +
      29 
      +
      30 #define BOOST_TEST_MODULE mesh
      +
      31 #include <boost/test/unit_test.hpp>
      32 
      -
      33 namespace tests
      -
      34 {
      -
      35 using namespace bioexplorer;
      -
      36 using namespace molecularsystems;
      -
      37 
      -
      38 const std::string folder = "./bioexplorer/pythonsdk/tests/test_files/";
      +
      33 #include <fstream>
      +
      34 
      +
      35 namespace tests
      +
      36 {
      +
      37 using namespace bioexplorer;
      +
      38 using namespace molecularsystems;
      39 
      -
      40 std::string getFileContents(const std::string& filename)
      -
      41 {
      -
      42  std::ifstream file(filename);
      -
      43  std::string str;
      -
      44  if (file)
      -
      45  {
      -
      46  std::ostringstream ss;
      -
      47  ss << file.rdbuf();
      -
      48  str = ss.str();
      -
      49  }
      -
      50  else
      -
      51  PLUGIN_THROW("Failed to open " + filename);
      -
      52  return str;
      -
      53 }
      -
      54 
      -
      55 AssemblyDetails getAssemblyDescriptor()
      -
      56 {
      -
      57  AssemblyDetails descriptor;
      -
      58  descriptor.name = "assembly";
      -
      59  descriptor.shape = AssemblyShape::mesh;
      -
      60  descriptor.shapeMeshContents = getFileContents(folder + "obj/suzanne.obj");
      -
      61  return descriptor;
      -
      62 }
      -
      63 
      -
      64 MembraneDetails getMembraneDescriptor()
      -
      65 {
      -
      66  MembraneDetails descriptor;
      -
      67 
      -
      68  descriptor.assemblyName = "test";
      -
      69  descriptor.name = "test";
      -
      70  descriptor.lipidContents =
      -
      71  getFileContents(folder + "pdb/membrane/popc.pdb");
      -
      72  descriptor.representation = ProteinRepresentation::atoms;
      -
      73  descriptor.animationParams = {};
      -
      74  return descriptor;
      -
      75 }
      -
      76 
      -
      77 BOOST_AUTO_TEST_CASE(meshBasedMembrane)
      -
      78 {
      -
      79  std::vector<const char*> argv{
      -
      80  "brayns", "--http-server", "localhost:0", "--plugin",
      -
      81  "BioExplorer --db-name=bioexplorer --db-user=brayns "
      -
      82  "--db-password=brayns --db-host=localhost --db-port=5432"};
      -
      83  brayns::Brayns brayns(argv.size(), argv.data());
      -
      84  auto& scene = brayns.getEngine().getScene();
      -
      85 
      -
      86  Assembly assembly(scene, getAssemblyDescriptor());
      -
      87  assembly.addMembrane(getMembraneDescriptor());
      -
      88 
      -
      89  BOOST_CHECK(assembly.getMembrane()
      -
      90  ->getLipids()
      -
      91  .begin()
      -
      92  ->second->getAtoms()
      -
      93  .size() == 426);
      -
      94 
      -
      95  BOOST_CHECK(assembly.isInside(Vector3d(0.0, 0.0, 0.0)));
      -
      96 }
      -
      97 } // namespace tests
      +
      40 const std::string folder = "./bioexplorer/pythonsdk/tests/test_files/";
      +
      41 
      +
      42 std::string getFileContents(const std::string& filename)
      +
      43 {
      +
      44  std::ifstream file(filename);
      +
      45  std::string str;
      +
      46  if (file)
      +
      47  {
      +
      48  std::ostringstream ss;
      +
      49  ss << file.rdbuf();
      +
      50  str = ss.str();
      +
      51  }
      +
      52  else
      +
      53  PLUGIN_THROW("Failed to open " + filename);
      +
      54  return str;
      +
      55 }
      +
      56 
      +
      57 AssemblyDetails getAssemblyDescriptor()
      +
      58 {
      +
      59  AssemblyDetails descriptor;
      +
      60  descriptor.name = "assembly";
      +
      61  descriptor.shape = AssemblyShape::mesh;
      +
      62  descriptor.shapeMeshContents = getFileContents(folder + "obj/suzanne.obj");
      +
      63  return descriptor;
      +
      64 }
      +
      65 
      +
      66 MembraneDetails getMembraneDescriptor()
      +
      67 {
      +
      68  MembraneDetails descriptor;
      +
      69 
      +
      70  descriptor.assemblyName = "test";
      +
      71  descriptor.name = "test";
      +
      72  descriptor.lipidContents =
      +
      73  getFileContents(folder + "pdb/membrane/popc.pdb");
      +
      74  descriptor.representation = ProteinRepresentation::atoms;
      +
      75  descriptor.animationParams = {};
      +
      76  return descriptor;
      +
      77 }
      +
      78 
      +
      79 BOOST_AUTO_TEST_CASE(meshBasedMembrane)
      +
      80 {
      +
      81  std::vector<const char*> argv{
      +
      82  "brayns", "--http-server", "localhost:0", "--plugin",
      +
      83  "BioExplorer --db-name=bioexplorer --db-user=brayns "
      +
      84  "--db-password=brayns --db-host=localhost --db-port=5432"};
      +
      85  brayns::Brayns brayns(argv.size(), argv.data());
      +
      86  auto& scene = brayns.getEngine().getScene();
      +
      87 
      +
      88  Assembly assembly(scene, getAssemblyDescriptor());
      +
      89  assembly.addMembrane(getMembraneDescriptor());
      +
      90 
      +
      91  BOOST_CHECK(assembly.getMembrane()
      +
      92  ->getLipids()
      +
      93  .begin()
      +
      94  ->second->getAtoms()
      +
      95  .size() == 426);
      +
      96 
      +
      97  BOOST_CHECK(assembly.isInside(Vector3d(0.0, 0.0, 0.0)));
      +
      98 }
      +
      99 } // namespace tests
      diff --git a/docs/d8/d20/tests_2Glycans_8cpp_source.html b/docs/d8/d20/tests_2Glycans_8cpp_source.html index e8a131ee5..6490d784c 100644 --- a/docs/d8/d20/tests_2Glycans_8cpp_source.html +++ b/docs/d8/d20/tests_2Glycans_8cpp_source.html @@ -86,91 +86,93 @@
      Glycans.cpp
      -
      1 /* Copyright (c) 2020-2022, EPFL/Blue Brain Project
      -
      2  * All rights reserved. Do not distribute without permission.
      -
      3  * Responsible Author: cyrille.favreau@epfl.ch
      +
      1 /*
      +
      2  * The Blue Brain BioExplorer is a tool for scientists to extract and analyse
      +
      3  * scientific data from visualization
      4  *
      -
      5  * This library is free software; you can redistribute it and/or modify it under
      -
      6  * the terms of the GNU Lesser General Public License version 3.0 as published
      -
      7  * by the Free Software Foundation.
      -
      8  *
      -
      9  * This library is distributed in the hope that it will be useful, but WITHOUT
      -
      10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
      -
      11  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
      -
      12  * details.
      -
      13  *
      -
      14  * You should have received a copy of the GNU Lesser General Public License
      -
      15  * along with this library; if not, write to the Free Software Foundation, Inc.,
      -
      16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
      -
      17  */
      -
      18 
      -
      19 #include <plugin/common/Logs.h>
      -
      20 #include <plugin/common/Node.h>
      -
      21 #include <plugin/molecularsystems/Glycans.h>
      -
      22 
      -
      23 #include <brayns/Brayns.h>
      -
      24 #include <brayns/engineapi/Engine.h>
      -
      25 #include <brayns/engineapi/Scene.h>
      -
      26 
      -
      27 #define BOOST_TEST_MODULE glycans
      -
      28 #include <boost/test/unit_test.hpp>
      -
      29 
      -
      30 #include <fstream>
      +
      5  * Copyright 2020-2022 Blue BrainProject / EPFL
      +
      6  *
      +
      7  * This program is free software: you can redistribute it and/or modify it under
      +
      8  * the terms of the GNU General Public License as published by the Free Software
      +
      9  * Foundation, either version 3 of the License, or (at your option) any later
      +
      10  * version.
      +
      11  *
      +
      12  * This program is distributed in the hope that it will be useful, but WITHOUT
      +
      13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
      +
      14  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
      +
      15  * details.
      +
      16  *
      +
      17  * You should have received a copy of the GNU General Public License along with
      +
      18  * this program. If not, see <https://www.gnu.org/licenses/>.
      +
      19  */
      +
      20 
      +
      21 #include <plugin/common/Logs.h>
      +
      22 #include <plugin/common/Node.h>
      +
      23 #include <plugin/molecularsystems/Glycans.h>
      +
      24 
      +
      25 #include <brayns/Brayns.h>
      +
      26 #include <brayns/engineapi/Engine.h>
      +
      27 #include <brayns/engineapi/Scene.h>
      +
      28 
      +
      29 #define BOOST_TEST_MODULE glycans
      +
      30 #include <boost/test/unit_test.hpp>
      31 
      -
      32 namespace tests
      -
      33 {
      -
      34 using namespace bioexplorer;
      -
      35 using namespace molecularsystems;
      -
      36 
      -
      37 std::string getFileContents(const std::string& filename)
      -
      38 {
      -
      39  std::ifstream file(filename);
      -
      40  std::string str;
      -
      41  if (file)
      -
      42  {
      -
      43  std::ostringstream ss;
      -
      44  ss << file.rdbuf();
      -
      45  str = ss.str();
      -
      46  }
      -
      47  else
      -
      48  PLUGIN_THROW("Failed to open " + filename);
      -
      49  return str;
      -
      50 }
      -
      51 
      -
      52 SugarDetails getDescriptor()
      -
      53 {
      -
      54  SugarDetails descriptor;
      -
      55  descriptor.assemblyName = "test";
      -
      56  descriptor.name = "test";
      -
      57  descriptor.pdbId = "1";
      -
      58  descriptor.contents = getFileContents(
      -
      59  "./bioexplorer/pythonsdk/tests/test_files/pdb/glycans/complex/1.pdb");
      -
      60  descriptor.proteinName;
      -
      61  descriptor.atomRadiusMultiplier;
      -
      62  descriptor.loadBonds = true;
      -
      63  descriptor.representation = ProteinRepresentation::atoms;
      -
      64  descriptor.recenter = true;
      -
      65  descriptor.chainIds = {};
      -
      66  descriptor.siteIndices = {};
      -
      67  descriptor.rotation = {0.0, 0.0, 0.0, 1.0};
      -
      68  return descriptor;
      -
      69 }
      -
      70 
      -
      71 BOOST_AUTO_TEST_CASE(glycans)
      -
      72 {
      -
      73  std::vector<const char*> argv{
      -
      74  "brayns", "--http-server", "localhost:0", "--plugin",
      -
      75  "BioExplorer --db-name=bioexplorer --db-user=brayns "
      -
      76  "--db-password=brayns --db-host=localhost --db-port=5432"};
      -
      77  brayns::Brayns brayns(argv.size(), argv.data());
      -
      78  auto& scene = brayns.getEngine().getScene();
      -
      79  Glycans glycans(scene, getDescriptor());
      -
      80 
      -
      81  BOOST_CHECK(glycans.getAtoms().size() == 291);
      -
      82  BOOST_CHECK(glycans.getResidues().size() == 6);
      -
      83  BOOST_CHECK(glycans.getSequencesAsString().size() == 0);
      -
      84 }
      -
      85 } // namespace tests
      +
      32 #include <fstream>
      +
      33 
      +
      34 namespace tests
      +
      35 {
      +
      36 using namespace bioexplorer;
      +
      37 using namespace molecularsystems;
      +
      38 
      +
      39 std::string getFileContents(const std::string& filename)
      +
      40 {
      +
      41  std::ifstream file(filename);
      +
      42  std::string str;
      +
      43  if (file)
      +
      44  {
      +
      45  std::ostringstream ss;
      +
      46  ss << file.rdbuf();
      +
      47  str = ss.str();
      +
      48  }
      +
      49  else
      +
      50  PLUGIN_THROW("Failed to open " + filename);
      +
      51  return str;
      +
      52 }
      +
      53 
      +
      54 SugarDetails getDescriptor()
      +
      55 {
      +
      56  SugarDetails descriptor;
      +
      57  descriptor.assemblyName = "test";
      +
      58  descriptor.name = "test";
      +
      59  descriptor.pdbId = "1";
      +
      60  descriptor.contents = getFileContents(
      +
      61  "./bioexplorer/pythonsdk/tests/test_files/pdb/glycans/complex/1.pdb");
      +
      62  descriptor.proteinName;
      +
      63  descriptor.atomRadiusMultiplier;
      +
      64  descriptor.loadBonds = true;
      +
      65  descriptor.representation = ProteinRepresentation::atoms;
      +
      66  descriptor.recenter = true;
      +
      67  descriptor.chainIds = {};
      +
      68  descriptor.siteIndices = {};
      +
      69  descriptor.rotation = {0.0, 0.0, 0.0, 1.0};
      +
      70  return descriptor;
      +
      71 }
      +
      72 
      +
      73 BOOST_AUTO_TEST_CASE(glycans)
      +
      74 {
      +
      75  std::vector<const char*> argv{
      +
      76  "brayns", "--http-server", "localhost:0", "--plugin",
      +
      77  "BioExplorer --db-name=bioexplorer --db-user=brayns "
      +
      78  "--db-password=brayns --db-host=localhost --db-port=5432"};
      +
      79  brayns::Brayns brayns(argv.size(), argv.data());
      +
      80  auto& scene = brayns.getEngine().getScene();
      +
      81  Glycans glycans(scene, getDescriptor());
      +
      82 
      +
      83  BOOST_CHECK(glycans.getAtoms().size() == 291);
      +
      84  BOOST_CHECK(glycans.getResidues().size() == 6);
      +
      85  BOOST_CHECK(glycans.getSequencesAsString().size() == 0);
      +
      86 }
      +
      87 } // namespace tests
      diff --git a/docs/d9/d23/md__home_favreau_git_BioExplorer_DOCKER.html b/docs/d9/d23/md__home_favreau_git_BioExplorer_DOCKER.html index c2ab81cab..d2ad9876f 100644 --- a/docs/d9/d23/md__home_favreau_git_BioExplorer_DOCKER.html +++ b/docs/d9/d23/md__home_favreau_git_BioExplorer_DOCKER.html @@ -89,13 +89,13 @@

      Use Docker to run the Blue Brain BioExplorer as a service and avoid painful tooling setup.

      -

      +

      Prerequisites

      Head over to Docker and install Docker for your own platform.

      -

      +

      Setup

      First build the image (it's necessary to do this step if you want to run Brayns):

      docker build . -t bioexplorer
      -

      +

      Usage

      By default, the entrypoint when running the image is braynsService, but if you want to ssh into the container use:

      # `-p 5000:5000` is used only to provide some port bindings (host:container) if you want to run and access Brayns from your host while in the container
      docker run -ti --rm --entrypoint bash -p 5000:5000 bioexplorer
      @@ -103,7 +103,7 @@

      docker run -ti --rm -p 5000:5000 bioexplorer

      If you want to run the Blue Brain BioExplorer with a database use:

      # Runs the Blue Brain BioExplorer as a service with the HTTP interface bound to port 5000
      docker run -ti --rm -p 5000:5000 bioexplorer --http-server :5000 --plugin "BioExplorer --db-name=bioexplorer --db-password=bioexplorer --db-user=postgres --db-host=<ip address> --db-port=5432" --plugin MediaMaker
      -

      Replace <ip address> with the IP address of the host where the database docker container is running. Refer to the database Docker readme for more information on how to set up and populate the the Blue Brain BioExplorer database with publicly available datasets:

      +

      Replace <ip address> with the IP address of the host where the database docker container is running. Refer to the database Docker readme for more information on how to set up and populate the the Blue Brain BioExplorer database with publicly available datasets.

      NOTE If you are having trouble exiting the process after you run the container (with the above command), use docker stop <container-id> to stop the container. docker ps will give you the current running process.

      If you'd like to also run the UI, use docker stack:

      # UI on port 8000 and Python SDK on port 8888
      docker stack deploy -c docker-compose.yml bioexplorer
      diff --git a/docs/index.html b/docs/index.html index 70a969463..e704c75ee 100644 --- a/docs/index.html +++ b/docs/index.html @@ -98,9 +98,8 @@ ___

      Description

      -

      In the context of the 'A Machine-Generated View of the Role of Blood Glucose Levels in the Severity of COVID-19' study, the Blue Brain BioExplorer (BBBE) started as an internal project with the aim to answer key scientific questions related to the Coronavirus as a use case. This project aimed to deliver a visualization tool, the BioExplorer, to reconstruct, visualize, explore and describe in detail the structure and function of highly-detailed biological structures such as molecular systems, neurons, astrocytes, blood vessels, and more.

      -

      Check out the movie by clicking on the following image, and see the coronavirus as you have never seen it before!

      -

      +

      Exploration relies on building software that combines data integration, analysis and interactive visualization to build, modify and navigate through large scientific datasets. For this, Blue Brain built and open-sourced the Blue Brain BioExplorer. The Blue Brain BioExplorer (BBBE), which started as an internal project, is now open source. It was originally developed to answer key scientific questions related to the Coronavirus as a use case and to deliver a visualization tool. Today, the BioExplorer allows to reconstruct, visualize, explore and describe in detail the structure and function of highly-detailed biological structures such as molecular systems, neurons, astrocytes, blood vessels, and more. You can see the first application of the BioExplorer in 'A Machine-Generated View of the Role of Blood Glucose Levels in the Severity of COVID-19' study, and see the SARS-COV-2 coronavirus as you have never seen it before by clicking on the following image!

      +

      At the museum

      July 2022: The EPFL Blue Brain Project is featuring in the exciting Brain(s) exhibition at the Barcelona Centre of Contemporary Culture at the Fundación Telefónica Madrid.

      ___

      @@ -168,9 +167,7 @@

    • Blue Brain Neuro-Glia-Vasculature Portal. Vasculature. Reconstruction Data

    -Neurons and astrocytes

    -

    -Neurons

    +Neurons

    Circuits of neurons are loaded from the database (see the database schema and the example notebook for loading data from Sonata files) using their position and orientation. Each cell is composed of sections that form the axons and dendrites, as well as spines. Cell internals such as the nucleus and the mitochondria can be automatically generated, according to the data provided by the scientific literature. The BBBE also implements procedural generation of varicosities along the axon, as well as myelin sheaths.

    neurons_model = bio_explorer.add_neurons(
    assembly_name='Neurons',
    @@ -178,9 +175,12 @@

    use_sdf=True, load_synapses=True, generate_varicosities=True,
    generate_internals=True, generate_externals=False
    )
    -

    An example dataset is available in the A Model of Rat Non-barrel Somatosensory Cortex Anatomy publication. Please refer to the documentation of the Sonata format for information how to load and analyze the model. A jupyter notebook has been included with basic examples of how to load, visualize and explorer the data using the Blue Brain open-source packages NeuroM and Blue Brain SNAP.

    -

    -Astrocytes

    +

    An example dataset is available in the Model of Rat Non-barrel Somatosensory Cortex Anatomy publication. Please refer to the documentation of the Sonata format for information on how to load and analyze the model. A jupyter notebook has been included with basic examples of how to explore the data using the Blue Brain open-source packages NeuroM and Blue Brain SNAP.

    +

    References:

    +

    +Astrocytes

    Circuits of astrocytes are loaded from the database (see the database schema and the example notebook for loading data from Sonata files) using their position and orientation. Astrocytes end-feet are connected to the vasculature using data stored in a dedicated connectome database schema. The BBBE allows end-feet to automatically adapt to the vasculature vessel size.

    vasculature_model = be.add_astrocytes(
    assembly_name='Astrocytes', population_name='astrocytes', use_sdf=True)
    @@ -207,10 +207,10 @@

  • Blue Brain Neuro-Glia-Vasculature Portal. Anatomy. Reconstruction Data
  • The SONATA data format for efficient description of large-scale network models
  • -

    +

    Simulation of neuronal activity

    Using the NEURON simulation package, the circuit information is loaded from disk, instantiating the various cell models (morphologies with ion channel distribution) and synaptic connections. The experimenter selects a stimulus protocol which will inject electrical current into the network and increase the membrane voltages of cells. As cells approach a threshold current, they release an action potential (AP) which will then propagate additional current changes to other cells via the synapses' release mechanisms. BBBE loads the simulation reports generated by NEURON and maps the voltages to the corresponding segments of the morphologies. A transfer function defines the mapping between a color and a voltage value.

    -

    +

    Morphology synthesis

    The goal of computational synthesis of cortical dendritic morphologies is to be able to generate an arbitrary number of neurons (and also other cells, such as glia) that can be subsequently used in various types of simulation. Part of this goal is to recreate in the synthesized cells as many morphological features as possible.

    @@ -218,7 +218,7 @@

    ___

    The synthesis scheme is based on the assumption that it is necessary to know the environment within which the cells are growing in order to recreate them accurately. Neuronal morphologies are influenced both by the embedding space and the presence of other cells. Their axons may target certain regions or the dendrites may mass in one region to collect input, such as the apical tuft of pyramidal cells. It is important therefore to synthesize the cells within biologically accurate volumes.

    -

    +

    Proximity detection

    In the context of brain simulation, detecting touches between neurons is a essential part of the process. The BBBE provides a renderer that computes the distance between the geometries in the 3D scene.

    @@ -226,10 +226,10 @@

    ___

    When a ray hits a geometry, a random secondary ray is sent in a direction belonging to an hemisphere defined by the normal to the surface. If that secondary ray hits another geometry, the distance between the initial hit and the new intersection is computed, and the corresponding color is assigned to the pixel. By default, red is for short distances (including touches), and green for longer ones. The notion of short and long is defined in the settings of the renderer.

    -

    +

    White matter

    White matter is composed of bundles, which connect various grey matter areas (the locations of nerve cell bodies) of the brain to each other, and carry nerve impulses between neurons. Myelin acts as an insulator, which allows electrical signals to jump, rather than coursing through the axon, increasing the speed of transmission of all nerve signals.

    -

    A Python notebook example demonstrates how to download and import white matter streamlines from the Allen Brain Institute website into the BBBE database. Another Python notebook demonstrates how to visualize the streamlines with the BBBE.

    +

    A Python notebook example demonstrates how to download and import white matter streamlines from the Allen Brain Institute website into the BBBE database. Another Python notebook demonstrates how to visualize the streamlines with the BBBE.

    white_matter_model = be.add_white_matter(
    assembly_name='White matter', population_name='connectome', radius=2.5)
    @@ -240,7 +240,8 @@

  • Allen Brain Institute: mouse connectivity projections
  • Allen Brain Institute: mouse connectivity atlas
  • -

    +

    The white matter feature contributed to generating images for the null model of the mouse whole-neocortex micro-connectome publication and produce the corresponding movie.

    +

    Enzyme reactions

    An enzyme attracts substrates to its active site, catalyzes the chemical reaction by which products are formed, and then allows the products to dissociate (separate from the enzyme surface). The combination formed by an enzyme and its substrates is called the enzyme–substrate complex. The BBBE allows easy visualization of enzyme reactions by providing a substrate, a product, and a type of reaction (for example: Hexokinase).

    @@ -250,7 +251,7 @@

    References:

    -

    +

    Neuromodulation

    Neuromodulation of neocortical microcircuits is one of the most fascinating and mysterious aspects of brain physiology. Despite over a century of research, the neuroscientific community has yet to uncover the fundamental biological organizing principles underlying neuromodulatory release. Phylogenetically, Acetylcholine (ACh) is perhaps the oldest neuromodulator, and one of the most well-studied. ACh regulates the physiology of neurons and synapses, and modulates neural microcircuits to bring about a reconfiguration of global network states. ACh is known to support cognitive processes such as learning and memory, and is involved in the regulation of arousal, attention and sensory processing. While the effects of ACh in the neocortex have been characterized extensively, integrated knowledge of its mechanisms of action is lacking. Furthermore, the ways in which ACh is released from en-passant axons originating in subcortical nuclei are still debatable. Simulation-based paradigms play an important role in testing scientific hypotheses, and provide a useful framework to integrate what is already known and systematically explore previously uncharted territory. Importantly, data-driven computational approaches highlight gaps in current knowledge and guide experimental research. To this end, I developed a multi-scale model of cholinergic innervation of rodent somatosensory cortex comprising two distinct sets of ascending projections implementing either synaptic (ST) or volumetric transmission (VT). The model enables the projection types to be combined in arbitrary proportions, thus permitting investigations of the relative contributions of these two transmission modalities. Using our ACh model, we find that the two modes of cholinergic release act in concert and have powerful desynchronizing effects on microcircuit activity. Furthermore we show that this modeling framework can be extended to other neuromodulators, such as dopamine and serotonin, with minimal constraining data. In summary, our results suggest a more nuanced view of neuromodulation in which multiple modes of transmitter release - ST vs VT - are required to produce synergistic functional effects.

    @@ -260,45 +261,45 @@

    References:

    -

    +

    Python SDK

    A simple API if exposed via the BBBE python library. The API allows scientists to easily create and modify assemblies, according the biological parameters. The BBBE programming language is not necessarily reflecting the underlying implementation, but is meant to be as simple as close as possible to the language used by the scientists to describe biological assemblies.

    The BBBE Python SDK is available on pypi.

    A large number of examples (as python notebooks) are provided in the notebooks folder.

    -

    +

    Documentation

    See here for detailed documentation of the source code.

    -

    +

    Deployment

    BBBE binaries are publicly available as docker images. BBBE is designed to run in distributed mode, and is composed of 3 modules: A server, a python SDK, and a web user interface. This means that there are 3 docker images to be downloaded on run. Those images can of course run on different machines.

    Note: The BBBE is NOT a web application. It uses web technologies for the user interface but the BBBE is a single session system that requires one back-end instance per user. There is no limitation in the number of user interface instances that can connect to the back-end, but they will all be sharing the same session.

    In this example, we will expose the server on port 5000, the python SDK jupyter notebooks on port 5001, and the user interface on port 5002. One is free to change those ports at will.

    -

    +

    Server

    docker run -ti --rm -p 5000:8200 bluebrain/bioexplorer
    -

    +

    Python SDK

    docker run -ti --rm -p 5001:8888 bluebrain/bioexplorer-python-sdk

    Note that a local folder can be specified to access personal notebooks:

    docker run -ti --rm -p 5001:8888 -v <my_notebooks_folder>:/app/BioExplorer/notebooks bluebrain/bioexplorer-python-sdk
    -

    +

    Web User Interface

    docker run -ti --rm -p 5002:8080 bluebrain/bioexplorer-ui
    -

    +

    PostgreSQL Database

    A PostgreSQL Database can be created as a Docker image and used by the BBBE as a storage component. More information on how to create and populate the database with sample datasets can be found in the dedicated Docker Database documentation.

    ___
    -

    +

    Building from Source

    -

    +

    Blue Brain Brayns

    In order to run the BioExplorer, it is necessary to build Blue Brain Brayns first.

    -

    +

    BioExplorer

    -

    +

    Compile

    With Blue Brain Brayns compiled and installed in the <brayns_installation_folder>, run the statements to build the BioExplorer.

    git clone https://github.com/BlueBrain/BioExplorer.git
    @@ -306,30 +307,30 @@

    cd build
    CMAKE_PREFIX_PATH=<brayns_installation_folder> cmake .. -DCMAKE_INSTALL_PREFIX=<brayns_installation_folder>
    make install
    -

    +

    Run

    The BioExplorer being a plug-in for Blue Brain Brayns, the following commands can be used to start the backend:

    export LD_LIBRARY_PATH=<brayns_installation_folder>/lib:${LD_LIBRARY_PATH}
    export PATH=<brayns_installation_folder>/bin:${PATH}
    braynsService --http-server localhost:5000 --plugin BioExplorer
    -

    +

    Simple example

    Considering that the BBBE server is running on the local host, on port 5000, the simplest example to visualize a SARS-COV-2 coronavirus is:

    from bioexplorer import BioExplorer
    be = BioExplorer('localhost:5000')
    resource_folder = '../../tests/test_files/'
    name='Coronavirus'
    be.add_sars_cov_2(name=name, resource_folder=resource_folder)
    -

    +

    License

    BBBE is available to download and use under the GNU General Public License (GPL, or “free software”). The code is open sourced with approval from the open sourcing committee and principal coordinators of the Blue Brain Project in February 2022.

    -

    +

    Contact

    For more information on BBBE, please contact:

    Cyrille Favreau
    Senior Scientific Visualization Engineer
    Blue Brain Project
    cyrille.favreau@epfl.ch

    -

    +

    Funding & Acknowledgment

    The development of this software was supported by funding to the Blue Brain Project, a research center of the École polytechnique fédérale de Lausanne (EPFL), from the Swiss government’s ETH Board of the Swiss Federal Institutes of Technology.

    COPYRIGHT 2020–2022 Blue Brain Project/EPFL

    diff --git a/docs/navtreedata.js b/docs/navtreedata.js index fc19a6abc..3fba9afb6 100644 --- a/docs/navtreedata.js +++ b/docs/navtreedata.js @@ -36,100 +36,98 @@ var NAVTREE = [ "Virus", "index.html#autotoc_md10", null ], [ "Membrane", "index.html#autotoc_md11", null ], [ "Vasculature", "index.html#autotoc_md12", null ], - [ "Neurons and astrocytes", "index.html#autotoc_md13", [ - [ "Neurons", "index.html#autotoc_md14", null ], - [ "Astrocytes", "index.html#autotoc_md15", null ] - ] ], - [ "Simulation of neuronal activity", "index.html#autotoc_md16", null ], - [ "Morphology synthesis", "index.html#autotoc_md17", null ], - [ "Proximity detection", "index.html#autotoc_md18", null ], - [ "White matter", "index.html#autotoc_md19", null ], - [ "Enzyme reactions", "index.html#autotoc_md20", null ], - [ "Neuromodulation", "index.html#autotoc_md21", null ] + [ "Neurons", "index.html#autotoc_md13", null ], + [ "Astrocytes", "index.html#autotoc_md14", null ], + [ "Simulation of neuronal activity", "index.html#autotoc_md15", null ], + [ "Morphology synthesis", "index.html#autotoc_md16", null ], + [ "Proximity detection", "index.html#autotoc_md17", null ], + [ "White matter", "index.html#autotoc_md18", null ], + [ "Enzyme reactions", "index.html#autotoc_md19", null ], + [ "Neuromodulation", "index.html#autotoc_md20", null ] ] ], - [ "Python SDK", "index.html#autotoc_md22", null ], - [ "Documentation", "index.html#autotoc_md23", null ], - [ "Deployment", "index.html#autotoc_md24", [ - [ "Server", "index.html#autotoc_md25", null ], - [ "Python SDK", "index.html#autotoc_md26", null ], - [ "Web User Interface", "index.html#autotoc_md27", null ], - [ "PostgreSQL Database", "index.html#autotoc_md28", null ] + [ "Python SDK", "index.html#autotoc_md21", null ], + [ "Documentation", "index.html#autotoc_md22", null ], + [ "Deployment", "index.html#autotoc_md23", [ + [ "Server", "index.html#autotoc_md24", null ], + [ "Python SDK", "index.html#autotoc_md25", null ], + [ "Web User Interface", "index.html#autotoc_md26", null ], + [ "PostgreSQL Database", "index.html#autotoc_md27", null ] ] ], - [ "Building from Source", "index.html#autotoc_md29", [ - [ "Blue Brain Brayns", "index.html#autotoc_md30", null ], - [ "BioExplorer", "index.html#autotoc_md31", [ - [ "Compile", "index.html#autotoc_md32", null ], - [ "Run", "index.html#autotoc_md33", null ] + [ "Building from Source", "index.html#autotoc_md28", [ + [ "Blue Brain Brayns", "index.html#autotoc_md29", null ], + [ "BioExplorer", "index.html#autotoc_md30", [ + [ "Compile", "index.html#autotoc_md31", null ], + [ "Run", "index.html#autotoc_md32", null ] ] ] ] ], - [ "Simple example", "index.html#autotoc_md34", null ] + [ "Simple example", "index.html#autotoc_md33", null ] ] ], - [ "License", "index.html#autotoc_md35", null ], - [ "Contact", "index.html#autotoc_md36", null ], - [ "Funding & Acknowledgment", "index.html#autotoc_md37", null ], + [ "License", "index.html#autotoc_md34", null ], + [ "Contact", "index.html#autotoc_md35", null ], + [ "Funding & Acknowledgment", "index.html#autotoc_md36", null ], [ "Docker", "d9/d23/md__home_favreau_git_BioExplorer_DOCKER.html", [ - [ "Prerequisites", "d9/d23/md__home_favreau_git_BioExplorer_DOCKER.html#autotoc_md39", null ], - [ "Setup", "d9/d23/md__home_favreau_git_BioExplorer_DOCKER.html#autotoc_md40", null ], - [ "Usage", "d9/d23/md__home_favreau_git_BioExplorer_DOCKER.html#autotoc_md41", null ] + [ "Prerequisites", "d9/d23/md__home_favreau_git_BioExplorer_DOCKER.html#autotoc_md38", null ], + [ "Setup", "d9/d23/md__home_favreau_git_BioExplorer_DOCKER.html#autotoc_md39", null ], + [ "Usage", "d9/d23/md__home_favreau_git_BioExplorer_DOCKER.html#autotoc_md40", null ] ] ], [ "User guide", "d0/de8/md__home_favreau_git_BioExplorer_bioexplorer_pythonsdk_doc_source_USERGUIDE.html", [ - [ "Protein", "d0/de8/md__home_favreau_git_BioExplorer_bioexplorer_pythonsdk_doc_source_USERGUIDE.html#autotoc_md43", null ], - [ "Glycan", "d0/de8/md__home_favreau_git_BioExplorer_bioexplorer_pythonsdk_doc_source_USERGUIDE.html#autotoc_md44", null ], - [ "RNA sequence", "d0/de8/md__home_favreau_git_BioExplorer_bioexplorer_pythonsdk_doc_source_USERGUIDE.html#autotoc_md45", null ], - [ "Membrane", "d0/de8/md__home_favreau_git_BioExplorer_bioexplorer_pythonsdk_doc_source_USERGUIDE.html#autotoc_md46", null ], - [ "Surfactants", "d0/de8/md__home_favreau_git_BioExplorer_bioexplorer_pythonsdk_doc_source_USERGUIDE.html#autotoc_md47", null ], - [ "Virus", "d0/de8/md__home_favreau_git_BioExplorer_bioexplorer_pythonsdk_doc_source_USERGUIDE.html#autotoc_md48", null ], - [ "Host cell", "d0/de8/md__home_favreau_git_BioExplorer_bioexplorer_pythonsdk_doc_source_USERGUIDE.html#autotoc_md49", null ], - [ "Glycans Models", "d0/de8/md__home_favreau_git_BioExplorer_bioexplorer_pythonsdk_doc_source_USERGUIDE.html#autotoc_md50", null ], - [ "Visualization", "d0/de8/md__home_favreau_git_BioExplorer_bioexplorer_pythonsdk_doc_source_USERGUIDE.html#autotoc_md51", null ] + [ "Protein", "d0/de8/md__home_favreau_git_BioExplorer_bioexplorer_pythonsdk_doc_source_USERGUIDE.html#autotoc_md42", null ], + [ "Glycan", "d0/de8/md__home_favreau_git_BioExplorer_bioexplorer_pythonsdk_doc_source_USERGUIDE.html#autotoc_md43", null ], + [ "RNA sequence", "d0/de8/md__home_favreau_git_BioExplorer_bioexplorer_pythonsdk_doc_source_USERGUIDE.html#autotoc_md44", null ], + [ "Membrane", "d0/de8/md__home_favreau_git_BioExplorer_bioexplorer_pythonsdk_doc_source_USERGUIDE.html#autotoc_md45", null ], + [ "Surfactants", "d0/de8/md__home_favreau_git_BioExplorer_bioexplorer_pythonsdk_doc_source_USERGUIDE.html#autotoc_md46", null ], + [ "Virus", "d0/de8/md__home_favreau_git_BioExplorer_bioexplorer_pythonsdk_doc_source_USERGUIDE.html#autotoc_md47", null ], + [ "Host cell", "d0/de8/md__home_favreau_git_BioExplorer_bioexplorer_pythonsdk_doc_source_USERGUIDE.html#autotoc_md48", null ], + [ "Glycans Models", "d0/de8/md__home_favreau_git_BioExplorer_bioexplorer_pythonsdk_doc_source_USERGUIDE.html#autotoc_md49", null ], + [ "Visualization", "d0/de8/md__home_favreau_git_BioExplorer_bioexplorer_pythonsdk_doc_source_USERGUIDE.html#autotoc_md50", null ] ] ], [ "Architecture", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html", [ - [ "Motivation", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md53", null ], - [ "Design goals", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md54", null ], - [ "Software Architecture", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md55", [ - [ "Modular design", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md56", null ], - [ "Distributed architecture", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md57", null ], - [ "Abstraction", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md58", null ], - [ "Properties", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md59", null ], - [ "Core components", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md60", [ - [ "Blue Brain Brayns", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md61", null ], - [ "Parameter manager", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md62", null ], - [ "Camera manipulators", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md63", null ], - [ "Engine factory", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md64", null ], - [ "Plug-ins", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md65", null ], - [ "Data loaders", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md66", null ], - [ "Engine", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md67", null ], - [ "Scene", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md68", null ], - [ "Model descriptor", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md69", null ], - [ "Model", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md70", null ] + [ "Motivation", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md52", null ], + [ "Design goals", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md53", null ], + [ "Software Architecture", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md54", [ + [ "Modular design", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md55", null ], + [ "Distributed architecture", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md56", null ], + [ "Abstraction", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md57", null ], + [ "Properties", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md58", null ], + [ "Core components", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md59", [ + [ "Blue Brain Brayns", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md60", null ], + [ "Parameter manager", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md61", null ], + [ "Camera manipulators", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md62", null ], + [ "Engine factory", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md63", null ], + [ "Plug-ins", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md64", null ], + [ "Data loaders", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md65", null ], + [ "Engine", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md66", null ], + [ "Scene", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md67", null ], + [ "Model descriptor", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md68", null ], + [ "Model", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md69", null ] ] ], - [ "Application Programming Interface", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md71", [ - [ "Action interface", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md72", null ], - [ "plug-in", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md73", null ], - [ "Loader", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md74", null ] + [ "Application Programming Interface", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md70", [ + [ "Action interface", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md71", null ], + [ "plug-in", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md72", null ], + [ "Loader", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md73", null ] ] ] ] ], - [ "Client software development kits", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md75", [ - [ "Introduction", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md76", null ], - [ "Python SDK", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md77", null ], - [ "Javascript SDK", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md78", null ], - [ "Deflect", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md79", null ], - [ "Rockets", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md80", null ], - [ "VRPN", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md81", null ] + [ "Client software development kits", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md74", [ + [ "Introduction", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md75", null ], + [ "Python SDK", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md76", null ], + [ "Javascript SDK", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md77", null ], + [ "Deflect", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md78", null ], + [ "Rockets", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md79", null ], + [ "VRPN", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md80", null ] ] ], - [ "Applications", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md82", [ - [ "Service", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md83", null ], - [ "Viewer", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md84", null ] + [ "Applications", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md81", [ + [ "Service", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md82", null ], + [ "Viewer", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md83", null ] ] ], - [ "Use-cases", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md85", [ - [ "Visualization of Blue Brain / Sonata datasets", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md86", null ], - [ "MOOC", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md87", null ], - [ "OpenDeck", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md88", [ - [ "Native rendering", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md89", null ], - [ "Remote rendering", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md90", null ] + [ "Use-cases", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md84", [ + [ "Visualization of Blue Brain / Sonata datasets", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md85", null ], + [ "MOOC", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md86", null ], + [ "OpenDeck", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md87", [ + [ "Native rendering", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md88", null ], + [ "Remote rendering", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md89", null ] ] ] ] ], - [ "What next?", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md91", null ] + [ "What next?", "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md90", null ] ] ], [ "Classes", "annotated.html", [ [ "Class List", "annotated.html", "annotated_dup" ], diff --git a/docs/navtreeindex0.js b/docs/navtreeindex0.js index cf7b95cc8..de7f09d74 100644 --- a/docs/navtreeindex0.js +++ b/docs/navtreeindex0.js @@ -77,15 +77,15 @@ var NAVTREEINDEX0 = "d0/ddb/structbioexplorer_1_1details_1_1MembraneDetails.html#aea99d0ba8342492a20a9ad7c17239cc2":[7,0,0,3,27,6], "d0/dde/bioexplorer_2core_2plugin_2common_2Types_8h_source.html":[8,0,2,2,13], "d0/de8/md__home_favreau_git_BioExplorer_bioexplorer_pythonsdk_doc_source_USERGUIDE.html":[5], -"d0/de8/md__home_favreau_git_BioExplorer_bioexplorer_pythonsdk_doc_source_USERGUIDE.html#autotoc_md43":[5,0], -"d0/de8/md__home_favreau_git_BioExplorer_bioexplorer_pythonsdk_doc_source_USERGUIDE.html#autotoc_md44":[5,1], -"d0/de8/md__home_favreau_git_BioExplorer_bioexplorer_pythonsdk_doc_source_USERGUIDE.html#autotoc_md45":[5,2], -"d0/de8/md__home_favreau_git_BioExplorer_bioexplorer_pythonsdk_doc_source_USERGUIDE.html#autotoc_md46":[5,3], -"d0/de8/md__home_favreau_git_BioExplorer_bioexplorer_pythonsdk_doc_source_USERGUIDE.html#autotoc_md47":[5,4], -"d0/de8/md__home_favreau_git_BioExplorer_bioexplorer_pythonsdk_doc_source_USERGUIDE.html#autotoc_md48":[5,5], -"d0/de8/md__home_favreau_git_BioExplorer_bioexplorer_pythonsdk_doc_source_USERGUIDE.html#autotoc_md49":[5,6], -"d0/de8/md__home_favreau_git_BioExplorer_bioexplorer_pythonsdk_doc_source_USERGUIDE.html#autotoc_md50":[5,7], -"d0/de8/md__home_favreau_git_BioExplorer_bioexplorer_pythonsdk_doc_source_USERGUIDE.html#autotoc_md51":[5,8], +"d0/de8/md__home_favreau_git_BioExplorer_bioexplorer_pythonsdk_doc_source_USERGUIDE.html#autotoc_md42":[5,0], +"d0/de8/md__home_favreau_git_BioExplorer_bioexplorer_pythonsdk_doc_source_USERGUIDE.html#autotoc_md43":[5,1], +"d0/de8/md__home_favreau_git_BioExplorer_bioexplorer_pythonsdk_doc_source_USERGUIDE.html#autotoc_md44":[5,2], +"d0/de8/md__home_favreau_git_BioExplorer_bioexplorer_pythonsdk_doc_source_USERGUIDE.html#autotoc_md45":[5,3], +"d0/de8/md__home_favreau_git_BioExplorer_bioexplorer_pythonsdk_doc_source_USERGUIDE.html#autotoc_md46":[5,4], +"d0/de8/md__home_favreau_git_BioExplorer_bioexplorer_pythonsdk_doc_source_USERGUIDE.html#autotoc_md47":[5,5], +"d0/de8/md__home_favreau_git_BioExplorer_bioexplorer_pythonsdk_doc_source_USERGUIDE.html#autotoc_md48":[5,6], +"d0/de8/md__home_favreau_git_BioExplorer_bioexplorer_pythonsdk_doc_source_USERGUIDE.html#autotoc_md49":[5,7], +"d0/de8/md__home_favreau_git_BioExplorer_bioexplorer_pythonsdk_doc_source_USERGUIDE.html#autotoc_md50":[5,8], "d0/df4/structbioexplorer_1_1molecularsystems_1_1ResidueSequence.html":[7,0,0,9,8], "d0/df4/structbioexplorer_1_1molecularsystems_1_1ResidueSequence.html#a41398b0139f99c1bbaa6ef951bb460fd":[7,0,0,9,8,1], "d0/df4/structbioexplorer_1_1molecularsystems_1_1ResidueSequence.html#a954a876636100051625142f2506448ed":[7,0,0,9,8,2], diff --git a/docs/navtreeindex1.js b/docs/navtreeindex1.js index d91ac1eea..bd9b16d6c 100644 --- a/docs/navtreeindex1.js +++ b/docs/navtreeindex1.js @@ -194,45 +194,45 @@ var NAVTREEINDEX1 = "d6/d17/structbioexplorer_1_1morphology_1_1AstrocyteSoma.html#ac8a2a8df581ffe7650d5e082eec5c28d":[7,0,0,10,1,1], "d6/d1c/Glsl_8ispc_source.html":[8,0,0,1,0,0,0,3], "d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html":[6], -"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md53":[6,0], -"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md54":[6,1], -"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md55":[6,2], -"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md56":[6,2,0], -"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md57":[6,2,1], -"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md58":[6,2,2], -"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md59":[6,2,3], -"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md60":[6,2,4], -"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md61":[6,2,4,0], -"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md62":[6,2,4,1], -"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md63":[6,2,4,2], -"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md64":[6,2,4,3], -"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md65":[6,2,4,4], -"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md66":[6,2,4,5], -"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md67":[6,2,4,6], -"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md68":[6,2,4,7], -"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md69":[6,2,4,8], -"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md70":[6,2,4,9], -"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md71":[6,2,5], -"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md72":[6,2,5,0], -"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md73":[6,2,5,1], -"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md74":[6,2,5,2], -"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md75":[6,3], -"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md76":[6,3,0], -"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md77":[6,3,1], -"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md78":[6,3,2], -"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md79":[6,3,3], -"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md80":[6,3,4], -"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md81":[6,3,5], -"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md82":[6,4], -"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md83":[6,4,0], -"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md84":[6,4,1], -"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md85":[6,5], -"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md86":[6,5,0], -"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md87":[6,5,1], -"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md88":[6,5,2], -"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md89":[6,5,2,0], -"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md90":[6,5,2,1], -"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md91":[6,6], +"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md52":[6,0], +"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md53":[6,1], +"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md54":[6,2], +"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md55":[6,2,0], +"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md56":[6,2,1], +"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md57":[6,2,2], +"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md58":[6,2,3], +"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md59":[6,2,4], +"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md60":[6,2,4,0], +"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md61":[6,2,4,1], +"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md62":[6,2,4,2], +"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md63":[6,2,4,3], +"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md64":[6,2,4,4], +"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md65":[6,2,4,5], +"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md66":[6,2,4,6], +"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md67":[6,2,4,7], +"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md68":[6,2,4,8], +"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md69":[6,2,4,9], +"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md70":[6,2,5], +"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md71":[6,2,5,0], +"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md72":[6,2,5,1], +"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md73":[6,2,5,2], +"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md74":[6,3], +"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md75":[6,3,0], +"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md76":[6,3,1], +"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md77":[6,3,2], +"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md78":[6,3,3], +"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md79":[6,3,4], +"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md80":[6,3,5], +"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md81":[6,4], +"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md82":[6,4,0], +"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md83":[6,4,1], +"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md84":[6,5], +"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md85":[6,5,0], +"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md86":[6,5,1], +"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md87":[6,5,2], +"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md88":[6,5,2,0], +"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md89":[6,5,2,1], +"d6/d22/md__home_favreau_git_BioExplorer_ARCHITECTURE.html#autotoc_md90":[6,6], "d6/d26/DepthRenderer_8ispc_source.html":[8,0,0,0,0,0,0,15], "d6/d38/Glsl_8ih_source.html":[8,0,0,1,0,0,0,2], "d6/d45/structbioexplorer_1_1details_1_1Response.html":[7,0,0,3,41], diff --git a/docs/navtreeindex2.js b/docs/navtreeindex2.js index 925390c79..487cfe217 100644 --- a/docs/navtreeindex2.js +++ b/docs/navtreeindex2.js @@ -170,9 +170,9 @@ var NAVTREEINDEX2 = "d8/df9/classbioexplorer_1_1meshing_1_1SurfaceMesher.html#aeb41b4507cdb32ae33421fc395b7e6d0":[7,0,0,7,1,1], "d9/d00/Membrane_8cpp_source.html":[8,0,2,7,4], "d9/d23/md__home_favreau_git_BioExplorer_DOCKER.html":[4], -"d9/d23/md__home_favreau_git_BioExplorer_DOCKER.html#autotoc_md39":[4,0], -"d9/d23/md__home_favreau_git_BioExplorer_DOCKER.html#autotoc_md40":[4,1], -"d9/d23/md__home_favreau_git_BioExplorer_DOCKER.html#autotoc_md41":[4,2], +"d9/d23/md__home_favreau_git_BioExplorer_DOCKER.html#autotoc_md38":[4,0], +"d9/d23/md__home_favreau_git_BioExplorer_DOCKER.html#autotoc_md39":[4,1], +"d9/d23/md__home_favreau_git_BioExplorer_DOCKER.html#autotoc_md40":[4,2], "d9/d24/structbioexplorer_1_1morphology_1_1NeuronSoma.html":[7,0,0,10,7], "d9/d24/structbioexplorer_1_1morphology_1_1NeuronSoma.html#a0b682efedc4bd913443152df8c3378f7":[7,0,0,10,7,5], "d9/d24/structbioexplorer_1_1morphology_1_1NeuronSoma.html#a17a0e7bb0e246241e195afc42fc0292d":[7,0,0,10,7,2], diff --git a/docs/navtreeindex4.js b/docs/navtreeindex4.js index 6dee3c267..e57e73796 100644 --- a/docs/navtreeindex4.js +++ b/docs/navtreeindex4.js @@ -190,15 +190,15 @@ var NAVTREEINDEX4 = "dir_fab7aaf0e213ba606ec01850554c2878.html":[8,0,2,8], "dir_fb887b5514a10a3d1c3cd072660fbb64.html":[8,0,0,1,0], "files.html":[8,0], -"functions.html":[7,3,0], "functions.html":[7,3,0,0], +"functions.html":[7,3,0], "functions_b.html":[7,3,0,1], "functions_c.html":[7,3,0,2], "functions_d.html":[7,3,0,3], "functions_e.html":[7,3,0,4], "functions_f.html":[7,3,0,5], -"functions_func.html":[7,3,1,0], "functions_func.html":[7,3,1], +"functions_func.html":[7,3,1,0], "functions_func_b.html":[7,3,1,1], "functions_func_c.html":[7,3,1,2], "functions_func_d.html":[7,3,1,3], diff --git a/docs/navtreeindex5.js b/docs/navtreeindex5.js index 6eb8bfdaf..a18241db0 100644 --- a/docs/navtreeindex5.js +++ b/docs/navtreeindex5.js @@ -11,32 +11,31 @@ var NAVTREEINDEX5 = "index.html#autotoc_md11":[0,3,6], "index.html#autotoc_md12":[0,3,7], "index.html#autotoc_md13":[0,3,8], -"index.html#autotoc_md14":[0,3,8,0], -"index.html#autotoc_md15":[0,3,8,1], -"index.html#autotoc_md16":[0,3,9], -"index.html#autotoc_md17":[0,3,10], -"index.html#autotoc_md18":[0,3,11], -"index.html#autotoc_md19":[0,3,12], +"index.html#autotoc_md14":[0,3,9], +"index.html#autotoc_md15":[0,3,10], +"index.html#autotoc_md16":[0,3,11], +"index.html#autotoc_md17":[0,3,12], +"index.html#autotoc_md18":[0,3,13], +"index.html#autotoc_md19":[0,3,14], "index.html#autotoc_md2":[0,1], -"index.html#autotoc_md20":[0,3,13], -"index.html#autotoc_md21":[0,3,14], -"index.html#autotoc_md22":[0,4], -"index.html#autotoc_md23":[0,5], -"index.html#autotoc_md24":[0,6], -"index.html#autotoc_md25":[0,6,0], -"index.html#autotoc_md26":[0,6,1], -"index.html#autotoc_md27":[0,6,2], -"index.html#autotoc_md28":[0,6,3], -"index.html#autotoc_md29":[0,7], +"index.html#autotoc_md20":[0,3,15], +"index.html#autotoc_md21":[0,4], +"index.html#autotoc_md22":[0,5], +"index.html#autotoc_md23":[0,6], +"index.html#autotoc_md24":[0,6,0], +"index.html#autotoc_md25":[0,6,1], +"index.html#autotoc_md26":[0,6,2], +"index.html#autotoc_md27":[0,6,3], +"index.html#autotoc_md28":[0,7], +"index.html#autotoc_md29":[0,7,0], "index.html#autotoc_md3":[0,2], -"index.html#autotoc_md30":[0,7,0], -"index.html#autotoc_md31":[0,7,1], -"index.html#autotoc_md32":[0,7,1,0], -"index.html#autotoc_md33":[0,7,1,1], -"index.html#autotoc_md34":[0,8], -"index.html#autotoc_md35":[1], -"index.html#autotoc_md36":[2], -"index.html#autotoc_md37":[3], +"index.html#autotoc_md30":[0,7,1], +"index.html#autotoc_md31":[0,7,1,0], +"index.html#autotoc_md32":[0,7,1,1], +"index.html#autotoc_md33":[0,8], +"index.html#autotoc_md34":[1], +"index.html#autotoc_md35":[2], +"index.html#autotoc_md36":[3], "index.html#autotoc_md4":[0,3], "index.html#autotoc_md5":[0,3,0], "index.html#autotoc_md6":[0,3,1],