dsehnal / LiteMol

A library/plugin for handling 3D structural molecular data (not only) in the browser.
Other
157 stars 38 forks source link

Cavity Display Effect #41

Open ye1002551506 opened 5 years ago

ye1002551506 commented 5 years ago

Hello David, I have a question to consult you.

I want the cavity to show its atomic radius, which is similar to the shape of a pipe, but I can only show this effect by selecting VDW Balls in the controller.

default

I want to achieve the effect of example / Channels.

default

There is a data. json file in example / Channels. Is it generated with a PDB file? Should I use some method to generate the JSON file from my PDB file? To achieve the desired effect? Please give me some advice and guidance. @dsehnal Thank you.

dsehnal commented 5 years ago

Hi,

The data for this example was generated by MOLE, including the surface triangulation (which is saved a list of vertices and triangles). It might be a little overkill for you to do this :)

The PrimitivesAndLabels [ source | view live ] example shows how to create custom geometries (you can do spheres, cylinders, arrows, etc). You can encode your centerline and radii say in JSON and then create a transform that map this JSON into a custom visual. How to create a transform that downloads JSON and creates something else (i.e. a custom geometry) is shown for example here https://github.com/dsehnal/LiteMol/blob/master/src/Viewer/PDBe/Validation.ts#L184 (the transform and state action).

Regards, David

ye1002551506 commented 5 years ago

Dear David I spent a lot of time thinking about the solution you gave, but I don't know enough about the structure of the protein. It is too difficult for me to write the algorithm myself. Is there a simpler method? Instead of writing the algorithm yourself, use the existing algorithm to implement the function I want? Thank you @dsehnal

dsehnal commented 5 years ago

But the existing algorithm is there. You can use the primitives and labels example as a base to render spheres with the appropriate radius along your channel's centerline.

ye1002551506 commented 5 years ago

Already implemented this feature, thank you