Пример #1
0
def rotate_a_nucleic_group(this_group, rotate_type, residue_to_rotate, angle,
                           theta, backward, residues_in_group,
                           segnames_in_group, seg_type_in_group, txtOutput):

    if (rotate_type == 'protein_backbone_dihedral'):
        rotate_a_group(this_group, rotate_type, residue_to_rotate, angle,
                       theta, backward)
    if (rotate_type == 'ds_nucleic'):
        theta = theta * 180 / numpy.pi
        # cg the group to rotate
        assert seg_type_in_group[0] == seg_type_in_group[
            1] == 'nucleic', 'flexible DNA should be first two segments in the group'
        flex_resids = [residues_in_group[0]]
        dna_resids = [[residues_in_group[0][0], residues_in_group[0][-1]],
                      [residues_in_group[1][-1], residues_in_group[1][0]]]
        dna_segnames = [segnames_in_group[0], segnames_in_group[1]]
        rigid_group = [segnames_in_group[2:]]

        bp_per_bead = 1

        (cg_dna, aa_dna, rigid_mol, vecXYZ, trialbeads, beadgroups,
         rigid_move_masks, all_beads, dna_bead_masks, rigid_group_masks,
         rigid_group_mols, aa_all, rigid_mask, aa_dna_mask, bp_per_bead_array,
         pkl_file) = ddmc.get_cg_parameters(flex_resids,
                                            dna_resids,
                                            dna_segnames,
                                            'this_group.dcd',
                                            'this_group.pdb',
                                            bp_per_bead,
                                            txtOutput,
                                            rigid_groups=rigid_group,
                                            rm_pkl=True)

        # determine which bead contains the residue to rotate
        trial_bead = int(numpy.ceil(residue_to_rotate / float(bp_per_bead)))

        # perform the rotation on that bead and subsequent DNA
        d_coor = numpy.copy(cg_dna.coor()[0])
        thetaXYZ = [theta, 0, 0]
        r_coor = numpy.copy(rigid_mol.coor()[0])

        (d_coor[trial_bead:], vecXYZ[:, trial_bead:],
         r_coor) = ddmc.beadRotate(d_coor[trial_bead - 1:],
                                   vecXYZ[:,
                                          trial_bead - 1:], thetaXYZ, r_coor)
        cg_dna.setCoor(numpy.array([d_coor]))
        rigid_mol.setCoor(numpy.array([r_coor]))

        # reverse cg the DNA
        error = ddmc.recover_aaDNA_model(cg_dna, aa_dna, vecXYZ, all_beads,
                                         dna_bead_masks)
        aa_all.set_coor_using_mask(aa_dna, 0, aa_dna_mask)
        aa_all.set_coor_using_mask(rigid_mol, 0, rigid_mask)
        this_group.setCoor(aa_all.coor())

    return
Пример #2
0
def rotate_a_nucleic_group(this_group, rotate_type, residue_to_rotate, angle,
                           theta, backward, residues_in_group,
                           segnames_in_group, seg_type_in_group, txtOutput):

    if(rotate_type == 'protein_backbone_dihedral'):
        rotate_a_group(
            this_group, rotate_type, residue_to_rotate, angle, theta, backward)
    if(rotate_type == 'ds_nucleic'):
        theta = theta * 180 / numpy.pi
        # cg the group to rotate
        assert seg_type_in_group[0] == seg_type_in_group[
            1] == 'nucleic', 'flexible DNA should be first two segments in the group'
        flex_resids = [residues_in_group[0]]
        dna_resids = [[residues_in_group[0][0], residues_in_group[0][-1]],
                      [residues_in_group[1][-1], residues_in_group[1][0]]]
        dna_segnames = [segnames_in_group[0], segnames_in_group[1]]
        rigid_group = [segnames_in_group[2:]]

        bp_per_bead = 1

        (cg_dna, aa_dna, rigid_mol, vecXYZ, trialbeads, beadgroups,
         rigid_move_masks, all_beads, dna_bead_masks, rigid_group_masks,
         rigid_group_mols, aa_all, rigid_mask, aa_dna_mask,
         bp_per_bead_array, pkl_file) = ddmc.get_cg_parameters(flex_resids,
                                                               dna_resids, dna_segnames, 'this_group.dcd', 'this_group.pdb',
                                                               bp_per_bead, txtOutput, rigid_groups=rigid_group, rm_pkl=True)

        # determine which bead contains the residue to rotate
        trial_bead = int(numpy.ceil(residue_to_rotate / float(bp_per_bead)))

        # perform the rotation on that bead and subsequent DNA
        d_coor = numpy.copy(cg_dna.coor()[0])
        thetaXYZ = [theta, 0, 0]
        r_coor = numpy.copy(rigid_mol.coor()[0])

        (d_coor[trial_bead:], vecXYZ[:, trial_bead:], r_coor) = ddmc.beadRotate(
            d_coor[trial_bead - 1:], vecXYZ[:, trial_bead - 1:], thetaXYZ, r_coor)
        cg_dna.setCoor(numpy.array([d_coor]))
        rigid_mol.setCoor(numpy.array([r_coor]))

        # reverse cg the DNA
        error = ddmc.recover_aaDNA_model(
            cg_dna, aa_dna, vecXYZ, all_beads, dna_bead_masks)
        aa_all.set_coor_using_mask(aa_dna, 0, aa_dna_mask)
        aa_all.set_coor_using_mask(rigid_mol, 0, rigid_mask)
        this_group.setCoor(aa_all.coor())

    return
Пример #3
0
def dna_main(pdb_file_name, number_of_groups, residues_in_groups, rotate_type,
             group_to_rotate, residue_to_rotate, angle, theta, backward,
             dna_segnames, dna_resids, bp_per_bead):

    if rotate_type == 'ds_dna':

        # determine which bead has the 'residue_to_rotate' in it
        bead_to_rotate = 9

        for i in xrange(100):
            # treating this as thetaX
            theta = theta + (5.0 * numpy.pi / 180.0)
            thetaXYZ = [theta, 0, 0]

            # rotate that bead
            rotate_a_group_2(this_group, rotate_type, residue_to_rotate, angle,
                             theta, backward)

            (cg_dna.coor()[0][bead_to_rotate:], vecXYZ[:, bead_to_rotate:],
             dummy) = ddmc.beadRotate(cg_dna.coor()[0][bead_to_rotate - 1:],
                                      vecXYZ[:, bead_to_rotate - 1:], thetaXYZ,
                                      numpy.zeros((0, 3)))

            # s rotate_dna_group(this_group, rotate_type, residue_to_rotate,
            # angle, theta, backward)

    else:
        mol = sasmol.SasMol(0)
        mol.read_pdb(pdb_file_name)
        groups, group_masks = make_groups(mol, number_of_groups,
                                          residues_in_groups)

        this_group = groups[group_to_rotate]

        itheta = theta

        for i in xrange(100):
            theta = theta + (5.0 * numpy.pi / 180.0)
            rotate_a_group(this_group, rotate_type, residue_to_rotate, angle,
                           theta, backward)

    return
Пример #4
0
def dna_main(pdb_file_name, number_of_groups, residues_in_groups,
             rotate_type, group_to_rotate, residue_to_rotate, angle, theta,
             backward, dna_segnames, dna_resids, bp_per_bead):

    if rotate_type == 'ds_dna':

        # determine which bead has the 'residue_to_rotate' in it
        bead_to_rotate = 9

        for i in xrange(100):
            # treating this as thetaX
            theta = theta + (5.0 * numpy.pi / 180.0)
            thetaXYZ = [theta, 0, 0]

            # rotate that bead
            rotate_a_group_2(
                this_group, rotate_type, residue_to_rotate, angle, theta, backward)

            (cg_dna.coor()[0][bead_to_rotate:], vecXYZ[:, bead_to_rotate:], dummy
             ) = ddmc.beadRotate(cg_dna.coor()[0][bead_to_rotate - 1:],
                                 vecXYZ[:, bead_to_rotate - 1:], thetaXYZ,
                                 numpy.zeros((0, 3)))

            # s rotate_dna_group(this_group, rotate_type, residue_to_rotate,
            # angle, theta, backward)

    else:
        mol = sasmol.SasMol(0)
        mol.read_pdb(pdb_file_name)
        groups, group_masks = make_groups(
            mol, number_of_groups, residues_in_groups)

        this_group = groups[group_to_rotate]

        itheta = theta

        for i in xrange(100):
            theta = theta + (5.0 * numpy.pi / 180.0)
            rotate_a_group(
                this_group, rotate_type, residue_to_rotate, angle, theta, backward)

    return