Example #1
0
    def generateBuildingBlockXYZ(self):

        # create the first residue in the BB
        if self.seedResidue == None:
            strand = self.startResidue()
        else:
            strand = self.seedResidue

        # tally the number of residues we added to strand
        numResidues = 1

        # loop until we've added the right number of residues
        while numResidues < self.numResidues:

            # create new residue from the last three points
            residue = self.generateResidue(strand[-3:])

            # add the new Residues to the strandVec list
            [strand.append(monomer) for monomer in residue]

            numResidues += 1

        # perform final orientation depending on whether or not a seed residue was provided.
        # If seed was provided then don't fiddle with orientation at all.
        # if seed wasn't provided then return the strand with it's centre of mass
        # at the origin and it's helical axis pointing along the z-axis
        if self.seedResidue == None and self.numResidues > 3:
            # This structure was created in such a way that the first two atoms are
            # aligned with Z vector. We want the structure to be returned so it is at it's
            # centre of mass and also with the helical axis pointing up the z axis.
            # We will use the transformation from Lab to Block to achieve this,
            # with a little bit of hacking of the member variables.

            # find the helix axis and the centre of mass of the construct
            # as it is right now.
            currentDirector = coords.axisFromHelix(strand)
            currentDirectorHat = currentDirector / np.linalg.norm(
                currentDirector)
            currentCOM = cart.getCentreOfMass(strand)

            # Now specify the orientation and position that we want to map to.
            # store the refPoint as a member variable.
            targetRefPoint = np.array([0.0, 0.0, 0.0])
            targetDirectorHat = np.array([0.0, 0.0, 1.0])

            # modify the strand accordingly with the universal transformation function
            strand = coords.transformFromBlockFrameToLabFrame(
                targetDirectorHat, targetRefPoint, 0.0, currentDirectorHat,
                currentCOM, strand)

        return list(
            np.around(strand, 12)
        )  # round the positions to 12.dp - cleans up machine precision noise on zeroes
Example #2
0
 def generateBuildingBlockRefPoint(self):
     # TODO overload this function defining a principal reference point in the backbone
     return cart.getCentreOfMass(self.buildingBlockXYZ)
Example #3
0
 def generateBuildingBlockRefPoint(self):
     return cart.getCentreOfMass(self.buildingBlockXYZ)
Example #4
0
 def getCOM(self):
     return cart.getCentreOfMass(self.blockXYZVals)