How to use the lightdock.structure.residue.Residue function in lightdock

To help you get started, we’ve selected a few lightdock examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github brianjimenez / lightdock / lightdock / structure / residue.py View on Github external
    @staticmethod
    def dummy(x=0., y=0., z=0.):
        atom = Atom(atom_name='CA', residue_name='DUM', x=x, y=y, z=z)
        return Residue(residue_name='DUM', residue_number=0, atoms=[atom])

    def __str__ (self):
        if len(self.atoms):
            representation = []
            for atom in self.atoms:
                representation.append("%s.%s  %s" % (self.name, self.number, str(atom)))
            return '\n'.join(representation)
        else:    
            return "%s.%s" % (self.name, self.number) 


class AminoAcid(Residue):
    """Amino acid residue type"""
    pass


class Cofactor(Residue):
    """Non-protein chemical compound type"""
    pass


class Ion(Residue):
    """Charged chemical compound type"""
    pass
github brianjimenez / lightdock / lightdock / prep / poses.py View on Github external
# We select one of the closest residue restraints to point the quaternion
            rec_residue = receptor_restraints[closest_residues[number_generator.randint(0, len(closest_residues)-1)]]
            # Random restraint on the ligand to use for pre-orientation
            lig_residue = ligand_restraints[number_generator.randint(0, len(ligand_restraints)-1)]
            # Calculate the quaternion which rotates the ligand to point to the given receptor restraint
            q = get_quaternion_for_restraint(rec_residue, lig_residue, tx, ty, tz,
                                             rec_translation, lig_translation)

        # Only restraints in the ligand partner
        elif ligand_restraints and not receptor_restraints:
            # The strategy is similar to previous but for the receptor side we will use a simulated point
            # over the receptor surface to point out the quaternion
            coef = norm(center) / ligand_diameter
            # It is important to keep the coordinates as in the original complex without
            # moving to the center of coordinates (applying translation)
            rec_residue = Residue.dummy(center[0]*coef-rec_translation[0], 
                                        center[1]*coef-rec_translation[1], 
                                        center[2]*coef-rec_translation[2])
            lig_residue = ligand_restraints[number_generator.randint(0, len(ligand_restraints)-1)]
            q = get_quaternion_for_restraint(rec_residue, lig_residue, tx, ty, tz,
                                             rec_translation, lig_translation)
        # No restraints at all
        else:
            q = Quaternion.random(number_generator)

        # Glowworm's optimization vector
        op_vector = [tx, ty, tz, q.w, q.x, q.y, q.z]

        # If ANM is enabled, we need to create random components for the extents
        if rng_nm:
            if rec_nm > 0:
                op_vector.extend([rng_nm() for _ in xrange(rec_nm)])
github brianjimenez / lightdock / lightdock / structure / residue.py View on Github external
def clone(self):
        """Creates a copy of the current residue"""
        return Residue(self.name,
                       self.number,
                       [atom.clone() for atom in self.atoms],
                       self.index)
github brianjimenez / lightdock / lightdock / structure / residue.py View on Github external
def is_standard(self):
        """Checks if residue is standard"""
        return self.name in Residue.STANDARD_TYPES.keys()
github brianjimenez / lightdock / lightdock / structure / residue.py View on Github external
def __str__ (self):
        if len(self.atoms):
            representation = []
            for atom in self.atoms:
                representation.append("%s.%s  %s" % (self.name, self.number, str(atom)))
            return '\n'.join(representation)
        else:    
            return "%s.%s" % (self.name, self.number) 


class AminoAcid(Residue):
    """Amino acid residue type"""
    pass


class Cofactor(Residue):
    """Non-protein chemical compound type"""
    pass


class Ion(Residue):
    """Charged chemical compound type"""
    pass
github brianjimenez / lightdock / lightdock / pdbutil / PDBIO.py View on Github external
try:
                    atom = read_atom_line(line, line_type, atoms_to_ignore)
                    atoms.append(atom)
                except PDBParsingWarning, warning:
                    if verbose:
                        print warning
                    continue

                if last_chain_id != atom.chain_id:
                    last_chain_id = atom.chain_id
                    current_chain = Chain(last_chain_id)
                    chains.append(current_chain)
                if last_residue_name != atom.residue_name or last_residue_number != atom.residue_number:
                    last_residue_name = atom.residue_name
                    last_residue_number = atom.residue_number
                    current_residue = Residue(atom.residue_name, atom.residue_number)
                    residues.append(current_residue)
                    current_chain.residues.append(current_residue)
                current_residue.atoms.append(atom)

    # Set backbone and side-chain atoms
    for residue in residues:
        residue.set_backbone_and_sidechain()
        try:
            residue.check()
        except Exception, e:
            log.warning("Possible problem: %s" % str(e))

    return atoms, residues, chains
github brianjimenez / lightdock / lightdock / structure / residue.py View on Github external
def dummy(x=0., y=0., z=0.):
        atom = Atom(atom_name='CA', residue_name='DUM', x=x, y=y, z=z)
        return Residue(residue_name='DUM', residue_number=0, atoms=[atom])
github brianjimenez / lightdock / lightdock / structure / residue.py View on Github external
return '\n'.join(representation)
        else:    
            return "%s.%s" % (self.name, self.number) 


class AminoAcid(Residue):
    """Amino acid residue type"""
    pass


class Cofactor(Residue):
    """Non-protein chemical compound type"""
    pass


class Ion(Residue):
    """Charged chemical compound type"""
    pass
github brianjimenez / lightdock / lightdock / structure / residue.py View on Github external
def is_dummy(self):
        """Checks if residue is a dummy bead"""
        return self.name in Residue.DUMMY_TYPES