FreyrS / dMaSIF

Other
193 stars 45 forks source link

In generate_matchinglabels, is it right that distances between xyz coordinates of p1,p2 were used to define labels? #6

Closed jiyanbio closed 3 years ago

jiyanbio commented 3 years ago

In masif, the label was defined based on descriptor vectors. But in dmasif, labels are defined based on xyz coordinates. Is it right?

`def generate_matchinglabels(args, P1, P2): if args.random_rotation: P1["xyz"] = torch.matmul(P1["rand_rot"].T, P1["xyz"].T).T + P1["atom_center"] P2["xyz"] = torch.matmul(P2["rand_rot"].T, P2["xyz"].T).T + P2["atom_center"] xyz1_i = LazyTensor(P1["xyz"][:, None, :].contiguous()) xyz2_j = LazyTensor(P2["xyz"][None, :, :].contiguous())

xyz_dists = ((xyz1_i - xyz2_j) ** 2).sum(-1).sqrt()
xyz_dists = (1.0 - xyz_dists).step()

p1_iface_labels = (xyz_dists.sum(1) > 1.0).float().view(-1)
p2_iface_labels = (xyz_dists.sum(0) > 1.0).float().view(-1)

P1["labels"] = p1_iface_labels
P2["labels"] = p2_iface_labels`
FreyrS commented 3 years ago

Hi, yes in dmasif the matching labels between two points from two different proteins is based on the distance between their xyz coordinates. This is the same way it was done for masif. The distance between their descriptors gives you the prediction of whether the points are matching or not (both in masif and dmasif).