marrink-lab / bentopy

Packs stuff in boxes
4 stars 0 forks source link

Input of compartments #7

Closed ma3ke closed 4 months ago

ma3ke commented 5 months ago

To pack non-trivial systems, it is necessary to be able to express different compartments and their constituents. For instance, one may want to pack multiple adjacent volumes with different concentrations of some segments, or systems with multiple vesicles with different contents.

Compartments

What follows is a proposal for how this may be expressed in the input file. The system that is described here would be whole (described by a built-in spherical analytic function), which contains vesicles ves1 and ves2 (which are both described by some voxel map stored as a file).

{
    "space": {
        "size": [161, 161, 161],
        "resolution": 0.5,
        "compartments": [
            {
                "id": "whole",
                "shape": "spherical",
            },
            {
                "id": "ves1",
                "voxels": { 
                    "path": "masks/vesicle1.vox",
                    "resolution": 1.0,
                    "position": [ 80, 80, 40 ]
                }
            },
            {
                "id": "ves2",
                "voxels": { 
                    "path": "masks/vesicle2.vox",
                    "resolution": 1.0
                    "position": [ 80, 80, 120 ]
                }
            },
        ]
    },
    "output": {
        ...
    }
    "segments": [
        {
            "name": "3lyz",
            "number": "5172",
            "path": "structures/3lyz.pdb",
            "compartments": ["ves1"]
        },
        {
            "name": "1ubq",
            "number": "0820",
            "path": "structures/1ubq.pdb",
            "compartments": ["ves2"]
        },
        {
            "name": "atp",
            "number": "1995",
            "path": "structures/1ubq.pdb",
            "compartments": ["whole", "!ves1", "!ves2"]
        }
    ]

In this example, a .vox file is some voxel bitmap file we assume exists.

Note the syntax for defining the compartments. In what I have drawn up here, they will be evaluated as conditions for an and chain. (That is, the placement of a segment occurs iff the containment check for each of the listed compartment expressions is true.) In the example, the whole compartment includes the vec1 and vec2 compartments, so to prevent the placement of the ATP segment into the vesicles, they are negated using the ! operator. This is something I would like to receive some thoughts on.

Again, this is a mere proposal, and I expect us to change our minds on this numerous times.

Heterogeneous concentrations

This work would serve towards making it possible to express heterogeneous concentrations throughout the different compartments. This will be described in a later issue.

ma3ke commented 4 months ago

Re-opening to start work on properly supporting multiple compartments. Not that I can start the work immediately, but useful to keep this issue open in the meantime.