Ejemplo n.º 1
0
  def __init__(self, net, pose, k=15, fix=None, dropout=0.1, steps=100):
    self.k = k
    self.fix = fix or []
    self.fix = torch.tensor(self.fix, dtype=torch.long)
    self.net = net
    self.tertiary, self.angles, _, self.mask = pose_to_net(pose)
    rotations, indices = nearest_neighbours(self.tertiary, k=self.k)

    self.tertiary = self.tertiary.permute(2, 0, 1)
    self.distances = self.tertiary[:, 1]
    self.angles = self.angles.permute(1, 0)

    orientations = orientation(
      self.tertiary[:, 1].permute(1, 0)
    ).permute(2, 0, 1).view(self.tertiary.size(0), -1)
    positions = torch.arange(0, self.tertiary.size(0)).float()[:, None]

    self.orientations = torch.cat((self.distances, orientations, positions), dim=1)
    self.structure = ts.ConstantStructure(0, 0, indices)
    sin = torch.sin(self.angles)
    cos = torch.cos(self.angles)
    self.angle_features = torch.cat((sin, cos), dim=1)
    self.sequence = pose.sequence()
    self.best = 0.0
    self.steps = steps
    self.lookup = sorted(list(AA_ID_DICT.keys()), key=AA_ID_DICT.get)
 def __init__(self, path, num_neighbours=20, n_jobs=1, cache=True):
     ProteinNetKNN.__init__(self,
                            path,
                            num_neighbours=num_neighbours,
                            n_jobs=n_jobs,
                            cache=cache)
     self.ors = torch.tensor(orientation(self.ters[1].numpy() /
                                         100).transpose(2, 0, 1),
                             dtype=torch.float)
Ejemplo n.º 3
0
 def __init__(self, path, num_neighbours=20, n_jobs=1, N=64, cache=True):
     ProteinNetKNN.__init__(self,
                            path,
                            num_neighbours=num_neighbours,
                            n_jobs=n_jobs,
                            cache=cache)
     self.backrub = Backrub(n_moves=0)
     self.ors = torch.tensor(orientation(self.ters[1].numpy() /
                                         100).transpose(2, 0, 1),
                             dtype=torch.float)
     self.N = N
     self.valid_indices = [
         index for index in range(len(self.index) - 1)
         if self.index[index + 1] - self.index[index] >= N
     ]
Ejemplo n.º 4
0
 def __init__(self, path, num_neighbours=20, n_jobs=1, n_backrub=10, N=200,
              phi=0.2 * np.pi, psi=0.2 * np.pi, tau=0.2 * np.pi, cache=True,
              pass_mask=False):
   super(FoldNet, self).__init__(
     path,
     num_neighbours=num_neighbours,
     n_jobs=n_jobs, cache=cache
   )
   self.pass_mask = pass_mask
   self.N = N
   self.backrub = Backrub(n_moves=n_backrub, phi=phi, psi=psi, tau=tau)
   self.ors = torch.tensor(
     orientation(self.ters[1].numpy() / 100).transpose(2, 0, 1),
     dtype=torch.float
   )
Ejemplo n.º 5
0
 def __init__(self,
              path,
              radius=8,
              num_neighbours=15,
              n_jobs=1,
              cache=True):
     ProteinNetKNN.__init__(self,
                            path,
                            num_neighbours=num_neighbours,
                            n_jobs=n_jobs,
                            cache=cache)
     self.radius = radius
     self.backrub = Backrub(n_moves=0)  #10, phi=0.3, psi=0.3, tau=0.3)
     self.ors = torch.tensor(orientation(self.ters[1].numpy() /
                                         100).transpose(2, 0, 1),
                             dtype=torch.float)
 def orientations(self, tertiary):
   ors = orientation(tertiary.permute(1, 0)).permute(2, 0, 1).contiguous()
   return ors.view(tertiary.size(0), 3, 3)
Ejemplo n.º 7
0
 def orientations(self, tertiary):
     ors = orientation(tertiary[:, 1].permute(1, 0)).permute(2, 0, 1)
     return ors.view(tertiary.size(0), -1)