def superimpose_coordinates(all_coordsets, iterpose = True):
    all_superimposed_coordsets = []
    for coordsets in all_coordsets:
        calculator = RMSDCalculator(calculatorType = "QTRFIT_OMP_CALCULATOR",
                                fittingCoordsets = coordsets)
        calculator.setNumberOfOpenMPThreads(4)
        
        if iterpose:
            print "\t- Using iterposition on trajectory (shape ", coordsets.shape, ")"
            calculator.iterativeSuperposition()
            all_superimposed_coordsets.append(coordsets)
        else:
            print "\t- Superimposing with first trajectory frame (shape ", coordsets.shape, ")"
            _, superimposed_coordsets = calculator.oneVsTheOthers(0, get_superposed_coordinates = True)
            all_superimposed_coordsets.append(superimposed_coordsets)
    return all_superimposed_coordsets
예제 #2
0
def superimpose_coordinates(all_coordsets, iterpose=True):
    all_superimposed_coordsets = []
    for coordsets in all_coordsets:
        calculator = RMSDCalculator(calculatorType="QTRFIT_OMP_CALCULATOR",
                                    fittingCoordsets=coordsets)
        calculator.setNumberOfOpenMPThreads(4)

        if iterpose:
            print "\t- Using iterposition on trajectory (shape ", coordsets.shape, ")"
            calculator.iterativeSuperposition()
            all_superimposed_coordsets.append(coordsets)
        else:
            print "\t- Superimposing with first trajectory frame (shape ", coordsets.shape, ")"
            _, superimposed_coordsets = calculator.oneVsTheOthers(
                0, get_superposed_coordinates=True)
            all_superimposed_coordsets.append(superimposed_coordsets)
    return all_superimposed_coordsets
def process_after_perturb_max_and_mean_disp(data):
    number_of_sets = len(data["coords_before"])
    num_coords = len(data["coords_before"][0])
    
    coordsets_before = numpy.array(data["coords_before"])
    coordsets_before = numpy.reshape(coordsets_before, (number_of_sets, num_coords/3, 3))
    coordsets_after = numpy.array(data["coords_after"])
    coordsets_after = numpy.reshape(coordsets_after, (number_of_sets, num_coords/3, 3))
    
    superimposed_translations = []
    for i in range(number_of_sets):
        coords = numpy.array([coordsets_before[i], coordsets_after[i]])
        
        calculator = RMSDCalculator(calculatorType = "QTRFIT_OMP_CALCULATOR",
                                    fittingCoordsets = coords)
        _, rearranged_coords = calculator.oneVsTheOthers(0, get_superposed_coordinates = True)
        superimposed_translations.append(rearranged_coords[1]-rearranged_coords[0])
    translations = numpy.array(superimposed_translations)
    norms = numpy.array([norm(t) for t in translations])
    return numpy.max(norms, axis = 1), numpy.mean(norms, axis = 1)
    selections = {}
    for selection in datum["selection"]:
        print selection
        selections[selection] = pdb.select(datum["selection"][selection])
        prody.writePDB(os.path.join("selections", selection), selections[selection])

    #############################
    # Motif VS Helix Distance
    #############################
    calculator = RMSDCalculator(
        calculatorType="QCP_OMP_CALCULATOR",
        fittingCoordsets=selections["motif_all"].getCoordsets(),
        calculationCoordsets=selections["motif_backbone"].getCoordsets(),
    )

    motif_rmsd = calculator.oneVsTheOthers(conformation_number=0, get_superposed_coordinates=False)

    residue_distances = []
    for conf in selections["arg131_leu272"].getCoordsets():
        arg131 = conf[0]
        leu272 = conf[1]
        residue_distances.append(distance(arg131, leu272))
    exp_motif_rmsd = [0] + list(motif_rmsd)
    matplotlib.pyplot.scatter(residue_distances, exp_motif_rmsd)
    matplotlib.pyplot.savefig(os.path.join("plots", "motif_vs_helix_dist.svg"))
    matplotlib.pyplot.close()

    ###########################################
    # Backbone of ser 207 rmsd Vs ser to ligand distance
    ###########################################