def setUp(self): self.a2c = FullAtomModel.Angles2Coords() self.c2tc = FullAtomModel.Coords2TypedCoords() self.c2cc = FullAtomModel.CoordsTransform.Coords2CenteredCoords( rotate=True, translate=True) self.error = 0.0 self.N = 0
def __init__(self, device='cpu', num_sequences=32, seq_length=350): self.module = FullAtomModel.Angles2Coords() self.sequences = [ gen_rand_seq(seq_length) for i in range(num_sequences) ] # print(self.sequences) self.angles = torch.randn(len(self.sequences), 7, len(self.sequences[-1]), dtype=torch.double, device='cpu', requires_grad=True)
import torch from TorchProteinLibrary import FullAtomModel import numpy as np import matplotlib.pylab as plt import mpl_toolkits.mplot3d.axes3d as p3 if __name__ == '__main__': a2c = FullAtomModel.Angles2Coords() sequences = ['GGMLGWAHFGY'] #Setting conformation to alpha-helix angles = torch.zeros(len(sequences), 7, len(sequences[-1]), dtype=torch.double, device='cpu') angles.data[:, 0, :] = -1.047 angles.data[:, 1, :] = -0.698 angles.data[:, 2:, :] = 110.4 * np.pi / 180.0 #Converting angles to coordinates coords, res_names, atom_names, num_atoms = a2c(angles, sequences) #Making a mask on CA, C, N atoms is0C = torch.eq(atom_names[:, :, 0], 67).squeeze() is1A = torch.eq(atom_names[:, :, 1], 65).squeeze() is20 = torch.eq(atom_names[:, :, 2], 0).squeeze() is0N = torch.eq(atom_names[:, :, 0], 78).squeeze() is10 = torch.eq(atom_names[:, :, 1], 0).squeeze() isCA = is0C * is1A * is20 isC = is0C * is10
def setUp(self): self.a2c = FullAtomModel.Angles2Coords() self.c2tc = FullAtomModel.Coords2TypedCoords()
def setUp(self): self.a2c = FullAtomModel.Angles2Coords()