FreyrS / dMaSIF

Other
191 stars 44 forks source link

faces of the protein surface #51

Open lindafei01 opened 5 months ago

lindafei01 commented 5 months ago

Hi, thanks for sharing this code repository and this impressive work!

I understand that dMASIF can calculate the coordinates and normal vectors of protein surface vertices as below.

def preprocess_surface(self, P):
    P["xyz"], P["normals"], P["batch"] = atoms_to_points_normals(
        P["atoms"],
        P["batch_atoms"],
        atomtypes=P["atomtypes"],
        resolution=self.args.resolution,
        sup_sampling=self.args.sup_sampling,
        distance=self.args.distance,
    )
    if P['mesh_labels'] is not None:
        project_iface_labels(P)

I would like to know whether dMASIF can provide information about the faces of the protein surface. If dMASIF does not have a direct interface to calculate the faces of proteins, do you know of any methods (e.g., python packages) that can be used to compute the protein's faces based on P[“xyz”]? Thanks in advance!

BJWiley233 commented 3 weeks ago

You need to run some sort of Delaunay triangulation (DT) algorithm to get faces which are only derived after Voroni tesselation. In their original code base MaSIF they run MSMS and use some code with pymesh to reduce and fix the mesh. dMaSIF does't really use the mesh, they create an locally oriented orthonormal basis set from the points normals based on Pixar's algorithm. dMaSIF's curvature is over a Gaussian window in space while MaSIF's curvature is an average over the Gaussian curvature as implemented by PyMesh.

https://github.com/LPDI-EPFL/masif/blob/master/source/data_preparation/01b-helix_extract_and_triangulate.py

# Compute MSMS of surface w/hydrogens, 
        vertices1, faces1, normals1, names1, areas1 = computeMSMS(out_filename1+".pdb",\
            protonate=True)

# dont really need to do this
        vertices2 = vertices1
        faces2 = faces1

 # Fix the mesh.
        mesh = pymesh.form_mesh(vertices2, faces2)
        regular_mesh = fix_mesh(mesh, masif_opts['mesh_res'])

See also I posted on this here https://github.com/FreyrS/dMaSIF/issues/7#issuecomment-2307719331

image