Пример #1
0
def createRMSDdata(CASFyear, dockingMethod, scorFunc="para"):
    proteinDir    = os.path.join(OUTPUT_DIR, "RMSD", CASF_VERSION[CASFyear], dockingMethod)
    if dockingMethod == "gold":
        proteinDir    = os.path.join(proteinDir, scorFunc)

    for proteinID in os.listdir(proteinDir):
        RMSDfile =  os.path.join(OUTPUT_DIR, "RMSD", CASF_VERSION[CASFyear], "_pool", "{0}_RMSD.csv".format(proteinID))
        # find reference ligand location (mol2)
        refLigandPath = os.path.join(PDBBIND_DIR, CASF_VERSION[CASFyear], proteinID)
        refLigandFile = proteinID+"_complex_prep_lig.mol2"
        refLigand = os.path.join(refLigandPath, refLigandFile)
        # only calculate the RMSD if its data still doesn't exist
        if (not os.path.exists(RMSDfile)) or (not libRMSD.IsPoseExistsFromCSV(RMSDfile, typeOfPose=scorFunc)):
            # spitting some outputs
            print("Calculating RMSDs poses for {0} {1} {2}...".format(proteinID, scorFunc, dockingMethod))
            poseDir = os.path.join(proteinDir, proteinID)
            suffix = ".mol2"
            if dockingMethod == "gold":
                prefix = "gold_soln"
            elif dockingMethod == "glide":
                poseDir = os.path.join(poseDir, scorFunc)
                #prefix = "_{0}".format(proteinID)
                prefix = ""
            elif dockingMethod == "paradocks":
                prefix = "paradocks"
            if os.path.exists(poseDir):
                RMSDs = libRMSD.calcRMSDPoses(refLigand, poseDir, prefix, suffix)
                libRMSD.writeRMSD2CSV(RMSDs, RMSDfile)
Пример #2
0
def samplingRMSDdata(CASFyear, numSamples = 100):
    RMSDpath =  os.path.join(OUTPUT_DIR, "RMSD", CASF_VERSION[CASFyear], "_pool")
    samplingPath =  os.path.join(OUTPUT_DIR, "RMSD", CASF_VERSION[CASFyear], "_sampling")
    for RMSDfile in os.listdir(RMSDpath):
        if os.path.getsize(os.path.join(RMSDpath, RMSDfile)) > 0:
            baseFileName, ext = os.path.splitext(RMSDfile)
            samplingFile = "{0}_sampling_clusters10.csv".format(baseFileName)
            samplesRMSD = samplingRMSDtoCluster(os.path.join(RMSDpath, RMSDfile), numSamples=numSamples)
            libRMSD.writeRMSD2CSV(samplesRMSD, os.path.join(samplingPath, samplingFile))
            samplingFile = "{0}_sampling_100.csv".format(baseFileName)
            samplesRMSD = samplingRMSDmixing(os.path.join(RMSDpath, RMSDfile), numSamples=numSamples)
            libRMSD.writeRMSD2CSV(samplesRMSD, os.path.join(samplingPath, samplingFile))