Ejemplo n.º 1
0
def main():
    if len(sys.argv) != 4:  # if no input
        print "ERORR: there needs to be 3 inputs: sph inputfilename, max random value, outputfilename."
        return

    fileinputsph = sys.argv[1]
    maxval = float(sys.argv[2])
    fileoutput = sys.argv[3]

    print 'input_sph =' + fileinputsph
    print 'output =' + fileoutput

    list = sph.read_sph(fileinputsph, 'A', 'A')
    list2 = randomomize_sph(list, maxval)
    sph.write_sph(fileoutput, list2)
Ejemplo n.º 2
0
def main():
    if len(sys.argv) != 4:  # if no input
        print "ERORR: there needs to be 3 inputs: sph inputfilename, max random value, outputfilename."
        print "spheres with radius of  0.5 (0.0 are changed to 0.5) (ligand atoms) will not be perturbed.  Change radius to zero or 0.5 to not move. "
        return

    fileinputsph = sys.argv[1]
    maxval = float(sys.argv[2])
    fileoutput = sys.argv[3]

    print 'input_sph =' + fileinputsph
    print 'output =' + fileoutput

    list = sph.read_sph(fileinputsph, 'A', 'A')  # when we read in the
    list2 = randomomize_sph(list, maxval)
    sph.write_sph(fileoutput, list2)
Ejemplo n.º 3
0
def main():
    if len(sys.argv) != 4:  # if no input
        print "ERORR: there need to be 3 inputs: sph inputfilename, pdb inputfilename, outputfilename."
        return

    fileinputsph = sys.argv[1]
    fileinputpdb = sys.argv[2]
    fileoutput = sys.argv[3]

    print 'input_sph =' + fileinputsph
    print 'input_pdb =' + fileinputpdb
    print 'output =' + fileoutput

    list = sph.read_sph(fileinputsph, "A", "A")
    pdblist = pdb.read_pdb(fileinputpdb)[0]
    list2 = distance_sph_pdb(list, pdblist, 5)
    sph.write_sph(fileoutput, list2)
Ejemplo n.º 4
0
def main():
    if len(sys.argv) != 5: # if no input
       print "ERORR: there need to be 4 inputs: sph inputfilename, pdb inputfilename, outputfilename, distance."
       return

    fileinputsph = sys.argv[1]
    fileinputpdb = sys.argv[2]
    fileoutput   = sys.argv[3]
    distance     = float(sys.argv[4])

    print 'input_sph =' + fileinputsph
    print 'input_pdb =' + fileinputpdb
    print 'output =' + fileoutput
    print 'distance = %6.3f'%distance

    list = sph.read_sph(fileinputsph,"A","A")
    pdblist = pdb.read_pdb(fileinputpdb)[0]    
    list2 = distance_sph_pdb(list, pdblist,distance)
    sph.write_sph(fileoutput,list2)
def main():
    #if len(sys.argv) != 5: # if no input
    #   print "ERORR: there need to be 4 inputs: sph inputfilename, pdb inputfilename, outputfilename, distance."
    #   return
    if len(sys.argv) != 4:  # if no input
        print "ERORR: there need to be 3 inputs: sph inputfilename, pdb inputfilename, outputfilename"
        return

    fileinputsph = sys.argv[1]
    fileinputpdb = sys.argv[2]
    fileoutput = sys.argv[3]
    #distance     = float(sys.argv[4])

    print 'input_sph =' + fileinputsph
    print 'input_pdb =' + fileinputpdb
    print 'output =' + fileoutput
    #print 'distance = %6.3f'%distance

    sph_cluster_list = sph.read_sph_cluster_list(fileinputsph)
    pdblist = pdb.read_pdb(fileinputpdb)[0]
    #list2 = distance_sph_pdb(sph_cluster_list, pdblist, distance)
    list2 = distance_sph_pdb(sph_cluster_list, pdblist)
    sph.write_sph(fileoutput, list2)
Ejemplo n.º 6
0
def main():
    if len(sys.argv) != 4:  # if no input
        print "ERORR: there need to be 3 inputs: pdb inputfilename,  residuelist, outputfileprefix."
        return

    fileinputpdb = sys.argv[1]
    #fileinputsph = sys.argv[2]
    #res_string = sys.argv[3]
    #fileoutput   = sys.argv[4]
    res_string = sys.argv[2]
    fileoutput = sys.argv[3]

    splitname = fileinputpdb.split('\\')[-1].split('.')
    if len(splitname) != 2:
        print "error pdb file is weird. "
        exit()
    prefix = splitname[0]

    print 'input_pdb =' + fileinputpdb
    print 'sph prefix =' + prefix
    print 'residue string =' + res_string
    print 'output =' + fileoutput

    residlist = []
    res_string_split = res_string.split(',')
    print res_string_split
    #   if len(res_string_split) == 1:
    #       residlist.append(int(res_string_split[0]))
    #   else:
    #print res_string_split
    for s in res_string_split:
        if ('-' in s):
            s_split = s.split('-')
            if (len(s_split) != 2):
                print "something is wrong with residue string."
            else:
                start = int(s_split[0])
                stop = int(s_split[1]) + 1
                for i in range(start, stop):
                    residlist.append(i)
        else:
            residlist.append(int(s))

    for i in range(1, len(residlist)):
        if residlist[i - 1] > residlist[i]:
            print "uhoh. list is not monotonic"
            exit()

    print residlist
    #exit()

    run_dms_sph(fileinputpdb, prefix)
    list1 = sph.read_sph(prefix + ".sph", "A", "A")

    pdblist = pdb.read_pdb(fileinputpdb)
    center = centre_of_mass(pdblist, residlist)
    print center
    list2 = closest_sphs_to_center(list1, center, 4)
    sph.write_sph(fileoutput + ".sph", list2)
    # add center to list and write agian to new file
    #tmp_sphere = sphere(index,x,y,z,r,atomnum,clust,col)
    tmp_sphere = sph.sphere(2, center[0], center[1], center[2], 0.7, 2, 0, 0)
    list2.append(tmp_sphere)
    sph.write_sph(fileoutput + "_and_center.sph", list2)
    convert_sph_to_pdb(fileoutput + ".sph", fileoutput)
Ejemplo n.º 7
0
def run_spheregen(num, maxradius, minradius, proberadius):
    #DOCKPATH = "/nfs/home/tbalius/zzz.github/DOCK"
    DOCKPATH = "/home/baliuste/zzz.github/DOCK"
    ligfile = "xtal-lig.mol2"
    recdms = "rec.dms"
    recpdb = "rec.pdb"
    recsph = "rec.sph"
    recsphp = "rec_mod.sph"
    #recsphpdb = "rec.sph.pdb"
    recsphpdb = "rec.sph"
    name = "rec"

    if not (os.path.isfile("./rec_ori.pdb")):
        os.system('cp rec.pdb rec_ori.pdb')

    #step one generate molecular surface.
    #DMS = DOCKPATH+"/proteins/dms/bin/dms"
    #flags = " "+recpdb+" -a -n -w 1.0 -v -o "+recdms
    #dmscmd = DMS + flags
    # -w is the probe radius
    #proberadius = 1.2
    dmscmd = DOCKPATH + "/proteins/dms/bin/dms " + recpdb + " -a -d 0.2 -g dms.log -p -n -w " + str(
        proberadius) + " -o " + recdms
    print "Run dms \n " + dmscmd
    os.system(dmscmd)

    # step one generate spheres.
    os.system(
        "rm -rf OUTSPH temp1.ms temp2* temp3.atc rec.sph rec.sph.pdb* showshere.in"
    )

    SPH = DOCKPATH + "/proteins/sphgen/bin/sphgen"

    #maxradius = 1.8
    #minradius = 1.2

    file1 = open('INSPH', 'w')
    #file1.write("%s\nR\nX\n0.0\n%3.1f\n%3.1f\n%s\n"%(recdms,maxradius,minradius,recsph))
    file1.write("%s\nR\nX\n-0.1\n%3.1f\n%3.1f\n%s\n" %
                (recdms, maxradius, minradius, recsph))
    file1.close()
    print "Run Sphgen"
    os.system(SPH)

    print "Process Spheres"
    sphlist = sph_lib.read_sph(recsph, 'A', 'A')
    sphlist_processed = []
    for sph in sphlist:
        if sph.radius < maxradius and sph.radius > minradius:
            sphlist_processed.append(sph)
    sph_lib.write_sph(recsphp, sphlist_processed)

    file2 = open("showshere.in", 'w')
    file2.write(recsphp + "\n-1\nN \n" + recsphpdb + '\nN \n')
    file2.close()

    #  Enter name of sphere cluster file: adfds
    #  Enter cluster number to process (<0 = all): -1
    #  Generate surfaces as well as pdb files (<N>/Y)? N
    #  Enter name for output file prefix: adafdsf
    #  Process clu0 (ALL spheres) (<N>/Y)? N

    ShSPH = DOCKPATH + "/proteins/showsphere/bin/showsphere < showshere.in"
    os.system(ShSPH)

    os.system("cp rec.pdb rec.pdb_num" + str(num))
    #os.system("cat "+recsphpdb+"_1.pdb | sed -e 's/C/O/g' -e 's/SPH/HOH/g' | grep -v 'TER' >> rec.pdb")
    num_waters = int(
        os.popen(
            "cat " + recsphpdb +
            "_1.pdb | sed -e 's/C/O/g' -e 's/SPH/HOH/g' | grep -v 'TER' | wc -l "
        ).readlines()[0])
    #print num_waters
    os.system("touch waters.pdb")
    os.system(
        "cat " + recsphpdb +
        "_1.pdb | sed -e 's/C/O/g' -e 's/SPH/HOH/g' | grep -v 'TER' >> waters.pdb"
    )
    os.system("cat waters.pdb >> rec.pdb")
    os.system("mkdir dir%d ; mv %s*.pdb dir%d/;cp rec* dir%d/" %
              (num, recsphpdb, num, num))
    os.system("mv INSPH OUTSPH dir%d" % (num))

    #SPHSEL = DOCKPATH+"/bin/sphere_selector"
    #os.system(SPHSEL + " "+recsph+" " +ligfile+" 5.0")
    #shutil.copyfile("selected_spheres.sph", "rec.5.0.sph")
    return num_waters