sidechainnet/structure/StructureBuilder.py
def build(self):
        """Construct all of the atoms for a residue.

        Special care must be taken for the first residue in the sequence in
        order to place its CB, if present.

        Returns:
            (numpy.ndarray, torch.Tensor): An array or tensor of the generated coordinates
            with shape ((L X NUM_COORDS_PER_RES) X 3).
        """
        # If a StructureBuilder does not have angles, build returns its coordinates
        if self.ang is None:
            return self.coords

        # Build the first and second residues, a special case
        first, second = self._build_first_two_residues()

        # Combine the coordinates and build the rest of the protein
        self.coords = first._stack_coords() + second._stack_coords()

        # Build the rest of the structure
        prev_res = second
        for i, (resname, ang) in enumerate(self._iter_resname_angs(start=2)):
            res = ResidueBuilder(resname,
                                 ang,
                                 prev_res=prev_res,
                                 next_res=None,
                                 is_last_res=i + 2 == len(self.seq_as_str) - 1)
            self.coords += res.build()
            prev_res = res

        if self.data_type == 'torch':
            self.coords = torch.stack(self.coords)
        else:
            self.coords = np.stack(self.coords)

        return self.coords
Construct all of the atoms for a residue.

        Special care must be taken for the first residue in the sequence in
        order to place its CB, if present.

        Returns:
            (numpy.ndarray, torch.Tensor): An array or tensor of the generated coordinates
            with shape ((L X NUM_COORDS_PER_RES) X 3).
        
Construct all of the atoms for a residue.
Special care must be taken for the first residue in the sequence in
order to place its CB, if present.
Construct all of the atoms for a residue . Special care must be taken for the first residue in the sequence in order to place its CB if present .
def build(self):
        if self.ang is None:
            return self.coords
        first, second = self._build_first_two_residues()
        self.coords = first._stack_coords() + second._stack_coords()
        prev_res = second
        for i, (resname, ang) in enumerate(self._iter_resname_angs(start=2)):
            res = ResidueBuilder(resname,
                                 ang,
                                 prev_res=prev_res,
                                 next_res=None,
                                 is_last_res=i + 2 == len(self.seq_as_str) - 1)
            self.coords += res.build()
            prev_res = res
        if self.data_type == 'torch':
            self.coords = torch.stack(self.coords)
        else:
            self.coords = np.stack(self.coords)
        return self.coords
def build ( self ) : if self . ang is None : return self . coords first , second = self . _build_first_two_residues ( ) self . coords = first . _stack_coords ( ) + second . _stack_coords ( ) prev_res = second for i , ( resname , ang ) in enumerate ( self . _iter_resname_angs ( start = 2 ) ) : res = ResidueBuilder ( resname , ang , prev_res = prev_res , next_res = None , is_last_res = i + 2 == len ( self . seq_as_str ) - 1 ) self . coords += res . build ( ) prev_res = res if self . data_type == 'torch' : self . coords = torch . stack ( self . coords ) else : self . coords = np . stack ( self . coords ) return self . coords
Construct all of the atoms for a residue.
Construct all of the atoms for a residue .
"""Construct all of the atoms for a residue.

        Special care must be taken for the first residue in the sequence in
        order to place its CB, if present.

        Returns:
            (numpy.ndarray, torch.Tensor): An array or tensor of the generated coordinates
            with shape ((L X NUM_COORDS_PER_RES) X 3).
        """ # If a StructureBuilder does not have angles, build returns its coordinates # Build the first and second residues, a special case # Combine the coordinates and build the rest of the protein # Build the rest of the structure
(numpy.ndarray, torch.Tensor): An array or tensor of the generated coordinates
with shape ((L X NUM_COORDS_PER_RES) X 3).
( numpy . ndarray torch . Tensor ) : An array or tensor of the generated coordinates with shape (( L X NUM_COORDS_PER_RES ) X 3 ) .
self