Beispiel #1
0
def main():
    """
reads a rosetta output pdbfile and reports residues that have a total Eres  > cutoff
	"""

    parser = OptionParser()
    parser.add_option("-p", dest="pdbfile", help="pdbfile")
    parser.add_option("-P", dest="pdblist", help="pdblist")
    parser.add_option("-o", dest="outfile", help="outfile")
    parser.add_option("-O", dest="outlist", help="outlist")
    parser.add_option("-r",
                      dest="replace",
                      help="replace",
                      action="store_true")
    parser.add_option("-t", dest="type", help="atom type", default="CS1 ")
    parser.add_option("-T", dest="type2", help="atom type", default="CS2 ")
    parser.set_description(main.__doc__)
    (options, args) = parser.parse_args()

    pdbfiles = []
    if options.pdblist:
        pdbfiles = files_from_list(options.pdblist)
    elif options.pdbfile:
        pdbfiles.append(options.pdbfile)
    else:
        parser.print_help()
        sys.exit()

    outfiles = []
    if options.outlist:
        outfiles = files_from_list(options.outlist)
    elif options.outfile:
        outfiles.append(options.outfile)
    elif options.replace:
        for file in pdbfiles:
            outfiles.append(file)
    else:
        parser.print_help()
        sys.exit()

    if len(pdbfiles) != len(outfiles):
        print "number of pdbfiles and output files differ"
        sys.exit()

    mymol = Enzyme()
    for i in range(len(pdbfiles)):
        pdbfile = pdbfiles[i]
        outfile = outfiles[i]
        mymol.readPDB(pdbfile)

        lig = mymol.ligand
        lig.removeAtomsContaining(options.type)
        lig.removeAtomsContaining(options.type2)

        mymol.writePDB(outfile)
        mymol.clear()
Beispiel #2
0
def main():
    """
removes the ligand
	"""

    parser = OptionParser()
    parser.add_option("-p", dest="pdbfile", help="pdbfile")
    parser.add_option("-P", dest="pdblist", help="pdblist")
    parser.add_option("-o", dest="outfile", help="outfile")
    parser.add_option("-O", dest="outlist", help="outlist")
    parser.add_option("-r",
                      dest="replace",
                      help="replace",
                      action="store_true")
    parser.set_description(main.__doc__)
    (options, args) = parser.parse_args()

    pdbfiles = []
    if options.pdblist:
        pdbfiles = files_from_list(options.pdblist)
    elif options.pdbfile:
        pdbfiles.append(options.pdbfile)
    else:
        parser.print_help()
        sys.exit()

    outfiles = []
    if options.outlist:
        outfiles = files_from_list(options.outlist)
    elif options.outfile:
        outfiles.append(options.outfile)
    elif options.replace:
        for file in pdbfiles:
            outfiles.append(file)
    else:
        parser.print_help()
        sys.exit()

    enz = Enzyme()
    for i in range(len(pdbfiles)):
        enz.readPDB(pdbfiles[i])

        for j in range(1, len(enz.chain)):
            enz.chain[j] = 0
        enz.chain.remove(0)

        enz.writePDB(outfiles[i])
        enz.clear()
Beispiel #3
0
def main():
    """
	program that checks to see if histidine binding to ligand is in the right place
	if not it switches the tautomer

	by default the proton is expected to be pointing AWAY from the ligand.
	this behaviour is changed with the -inverse option
	"""

    parser = OptionParser()
    parser.add_option("-p", dest="pdbfile", help="pdbfile")
    parser.add_option("-P", dest="pdblist", help="pdblist")
    parser.add_option("-o", dest="outfile", help="outfile")
    parser.add_option("-O", dest="outlist", help="outlist")
    parser.add_option("-r",
                      dest="replace",
                      help="replace",
                      action="store_true")
    parser.add_option("-i",
                      dest="inverse",
                      help="inverse",
                      action="store_true")
    parser.add_option("-v",
                      dest="virtual",
                      help="virtual",
                      action="store_true")
    parser.add_option("-c", dest="catalytic", help="catalytic")
    parser.set_description(main.__doc__)
    (options, args) = parser.parse_args()

    pdbfiles = []
    if options.pdblist:
        pdbfiles = files_from_list(options.pdblist)
    elif options.pdbfile:
        pdbfiles.append(options.pdbfile)
    else:
        parser.print_help()
        sys.exit()

    outfiles = []
    if options.outlist:
        outfiles = files_from_list(options.outlist)
    elif options.outfile:
        outfiles.append(options.outfile)
    elif options.replace:
        for file in pdbfiles:
            outfiles.append(file)
    else:
        parser.print_help()
        sys.exit()

    if len(outfiles) != len(pdbfiles):
        print "differing number of files"
        sys.exit()

    mycat = None
    for i in range(len(pdbfiles)):
        #protein = Molecule()
        protein = Enzyme()
        protein.readPDB(pdbfiles[i])

        if options.catalytic:
            icat = int(options.catalytic) - 1
            if icat < 0 or icat >= len(protein.catalytic):
                print "accessing catalytic out of bounds"
                sys.exit()

            mycat = protein.catalytic[icat]

        chainB = extractCatResidues(protein)
        if len(chainB) == 0:
            print "NO CATALYTIC RESIDUES FOR", pdbfiles[i]
            sys.exit()

        hislist = []
        for res in chainB:
            if res == None:
                print "missing catalytic residue"
                continue

            if res.name == "HIS":
                if mycat == None:
                    hislist.append(res)
                elif res == mycat:
                    hislist.append(res)
                #his = res

        if len(hislist) == 0:
            print "cannot find histidine in catalytic residues"
            sys.exit()

        for his in hislist:
            print his.file_id

            NDstate = True
            if his.atomExists(" HD1"):
                proton = his.getAtom(" HD1")
            elif his.atomExists(" HE2"):
                proton = his.getAtom(" HE2")
                NDstate = False
            else:
                print "histidine is not protonated"

            hetlist = protein.getHeteroAtoms()
            mind = 1000.0
            for res in hetlist:
                cpres = res.clone()
                cpres.removeAtomsContaining("V")
                dist = closestApproachToResidue(proton, cpres)
                mind = min(mind, dist)

            bPoint = False
            if mind < 4.0:
                bPoint = True

            bChanged = False
            # --- if pointing and we don't want that: --- #
            if bPoint and not options.inverse:
                switchHisTautomer(his)
                bChanged = True

            # --- if not pointing and we don't want that: --- #
            if not bPoint and options.inverse:
                switchHisTautomer(his)
                bChanged = True

            if bChanged:
                print "changed", pdbfiles[i]
                NDstate = not NDstate

            if options.virtual:
                hetatms = protein.getHeteroAtoms()
                for myres in hetatms:
                    for atm in myres:
                        if atm == None:
                            break

                        if atm.name == "VHNE":
                            if not NDstate:
                                atm.name = "VHND"
                                continue

                        if atm.name == "VHND":
                            if NDstate:
                                atm.name = "VHNE"
                                continue

        protein.writePDB(outfiles[i], resRenumber=False, atomRenumber=False)
Beispiel #4
0
def main():
    """
solvates a histidine
	"""

    parser = OptionParser()
    parser.add_option("-p", dest="pdbfile", help="pdbfile")
    parser.add_option("-P", dest="pdblist", help="pdblist")
    parser.add_option("-o", dest="outfile", help="outfile")
    parser.add_option("-O", dest="outlist", help="outlist")
    parser.add_option("-r",
                      dest="replace",
                      help="replace",
                      action="store_true")
    parser.add_option("-c", dest="catalytic", help="catalytic")
    parser.set_description(main.__doc__)
    (options, args) = parser.parse_args()

    pdbfiles = []
    if options.pdblist:
        pdbfiles = files_from_list(options.pdblist)
    elif options.pdbfile:
        pdbfiles.append(options.pdbfile)
    else:
        parser.print_help()
        sys.exit()

    outfiles = []
    if options.outlist:
        outfiles = files_from_list(options.outlist)
    elif options.outfile:
        outfiles.append(options.outfile)
    elif options.replace:
        for file in pdbfiles:
            outfiles.append(file)
    else:
        parser.print_help()
        sys.exit()

    if len(outfiles) != len(pdbfiles):
        print "number of input and output files differ"
        sys.exit()

    if not options.catalytic:
        parser.print_help()
        sys.exit()

    icat = int(options.catalytic) - 1
    protein = Enzyme()
    for i in range(len(pdbfiles)):
        protein.readPDB(pdbfiles[i])
        if icat < 0 or icat >= len(protein.catalytic):
            print "accessing catalytic residue out of bounds"
            sys.exit()

        cat = protein.catalytic[icat]
        if cat.name != "HIS":
            print "catalytic residue is not a histidine"
            sys.exit()

        # check protonation state
        if cat.getAtom(" HD1") != None:
            A = cat.getAtom(" NE2")
            B = cat.getAtom(" CD2")
            C = cat.getAtom(" CG ")
        elif cat.getAtom(" HE2") != None:
            A = cat.getAtom(" ND1")
            B = cat.getAtom(" CE1")
            C = cat.getAtom(" NE2")
        else:
            print "unable to determine protonation state"
            sys.exit()

        if A == None or B == None or C == None:
            print "cannot find all 3 atoms"
            sys.exit()

        length = 2.98
        ang = 125.0
        tor = 180.0

        billder = Builder()
        crd = billder.dbuildAtom(A, B, C, length, ang, tor)
        newres = protein.chain[1].newResidue()
        newres.name = "LG2"

        newatm = newres.newAtom()
        newatm.coord.x = crd[0]
        newatm.coord.y = crd[1]
        newatm.coord.z = crd[2]
        newatm.name = "HOH "
        newatm.kind = "HETATM"

        protein.writePDB(outfiles[i])
        protein.clear()
Beispiel #5
0
def main():
    """
reads a rosetta output pdbfile and reports residues that have a total Eres  > cutoff
	"""

    parser = OptionParser()
    parser.add_option("-p", dest="pdbfile", help="pdbfile")
    parser.add_option("-P", dest="pdblist", help="pdblist")
    parser.add_option("-o", dest="outfile", help="outfile")
    parser.add_option("-O", dest="outlist", help="outlist")
    parser.add_option("-r",
                      dest="replace",
                      help="replace",
                      action="store_true")
    parser.add_option("-s", dest="ids", help="atom ids (comma separated)")
    parser.add_option("-t", dest="type", help="atom type", default="CS1 ")
    parser.set_description(main.__doc__)
    (options, args) = parser.parse_args()

    pdbfiles = []
    if options.pdblist:
        pdbfiles = files_from_list(options.pdblist)
    elif options.pdbfile:
        pdbfiles.append(options.pdbfile)
    else:
        parser.print_help()
        sys.exit()

    outfiles = []
    if options.outlist:
        outfiles = files_from_list(options.outlist)
    elif options.outfile:
        outfiles.append(options.outfile)
    elif options.replace:
        for file in pdbfiles:
            outfiles.append(file)
    else:
        parser.print_help()
        sys.exit()

    if len(pdbfiles) != len(outfiles):
        print "number of pdbfiles and output files differ"
        sys.exit()

    if not options.ids:
        parser.print_help()
        sys.exit()

    ids = []
    cols = options.ids.split(",")
    for id in cols:
        ids.append(int(id))

    mymol = Enzyme()
    for i in range(len(pdbfiles)):
        pdbfile = pdbfiles[i]
        outfile = outfiles[i]
        mymol.readPDB(pdbfile)

        lig = mymol.ligand

        for id in ids:
            myatm = mymol.getAtom(id)
            if myatm == None:
                print "cant find atom:", id

            newatm = myatm.clone()
            newatm.name = options.type

            newatm.coord.x += 0.001
            newatm.coord.y -= 0.001
            newatm.coord.z += 0.001

            lig.addAtom(newatm)

        mymol.writePDB(outfile)
        mymol.clear()
def main():
    """
adds a centroid
	"""

    parser = OptionParser()
    parser.add_option("-p", dest="pdbfile", help="pdbfile")
    parser.add_option("-P", dest="pdblist", help="pdblist")
    parser.add_option("-o", dest="outfile", help="outfile")
    parser.add_option("-O", dest="outlist", help="outlist")
    parser.add_option("-r",
                      dest="replace",
                      help="replace",
                      action="store_true")
    parser.add_option("-t", dest="type", help="atom type", default="CS1 ")
    parser.add_option("-s", dest="selection", help="selection")
    parser.add_option("-w", dest="wobble", help="wobble", action="store_true")
    parser.set_description(main.__doc__)
    (options, args) = parser.parse_args()

    pdbfiles = []
    if options.pdblist:
        pdbfiles = files_from_list(options.pdblist)
    elif options.pdbfile:
        pdbfiles.append(options.pdbfile)
    else:
        parser.print_help()
        sys.exit()

    outfiles = []
    if options.outlist:
        outfiles = files_from_list(options.outlist)
    elif options.outfile:
        outfiles.append(options.outfile)
    elif options.replace:
        for file in pdbfiles:
            outfiles.append(file)
    else:
        parser.print_help()
        sys.exit()

    nfiles = len(pdbfiles)
    if nfiles != len(outfiles):
        print "number of input and output files differ"
        sys.exit()

    if not options.selection:
        parser.print_help()
        sys.exit()

    mymol = Enzyme()
    sele = Selection()
    sele.makeSelection(options.selection)
    for i in range(nfiles):
        pdbfile = pdbfiles[i]
        outfile = outfiles[i]

        mymol.readPDB(pdbfile)
        alist = sele.apply_selection(mymol).atomList()

        if len(alist) == 0:
            print "pdbfile: no atoms"
            continue

        com = vector3d()
        for atm in alist:
            com += atm.coord

        com /= float(len(alist))

        newatm = mymol.ligand.newAtom()
        newatm.name = options.type
        newatm.coord.x = com.x
        newatm.coord.y = com.y
        newatm.coord.z = com.z
        newatm.kind = "HETATM"
        if options.wobble:
            newatm.coord.x += 0.001
            newatm.coord.y -= 0.001
            newatm.coord.z += 0.001

        mymol.writePDB(outfile)
        mymol.clear()
def main():
    """
points hydrogens on H-bond donors (SER and TYR) towards an H-bond acceptor)
	"""

    parser = OptionParser()
    parser.add_option("-p", dest="pdbfile", help="pdbfile")
    parser.add_option("-P", dest="pdblist", help="pdblist")
    parser.add_option("-o", dest="outfile", help="outfile")
    parser.add_option("-r",
                      dest="replace",
                      help="replace",
                      action="store_true")
    parser.add_option("-d", dest="donor", help="donor residue")
    parser.add_option("-c", dest="catalytic", help="catalytic residue")
    parser.add_option("-a", dest="acceptor", help="acceptor atom")
    parser.set_description(main.__doc__)
    (options, args) = parser.parse_args()

    pdbfiles = []
    if options.pdblist:
        pdbfiles = files_from_list(options.pdblist)
    elif options.pdbfile:
        pdbfiles.append(options.pdbfile)
    else:
        parser.print_help()
        sys.exit()

    outfiles = []
    if options.outfile:
        outfiles.append(options.outfile)
    elif options.replace:
        for pdbfile in pdbfiles:
            outfiles.append(pdbfile)
    else:
        parser.print_help()
        sys.exit()

    if len(outfiles) != len(pdbfiles):
        print "number of pdbfiles and outfiles differ"
        sys.exit()

    if not options.acceptor:
        parser.print_help()
        sys.exit()

    if not options.donor and not options.catalytic:
        parser.print_help()
        sys.exit()

    protein = Enzyme()
    sele = Selection()

    dmol = None
    for i in range(len(pdbfiles)):
        protein.readPDB(pdbfiles[i])
        print pdbfiles[i]

        # --- get the donor --- #
        if options.donor:
            sele.makeSelection(options.donor)
            dmol = sele.apply_selection(protein)
            reslist = dmol.residueList()

            if len(reslist) != 1:
                #print "donor selection must specify one donor residue"
                #print reslist
                protein.clear()
                continue
                sys.exit()

            donor = reslist[0]
            sele.clear()
        elif options.catalytic:
            icat = int(options.catalytic) - 1
            donor = protein.catalytic[icat]
            if donor == None:
                print "can't find donor"
                sys.exit()

        # --- get the acceptor --- #
        sele.makeSelection(options.acceptor)
        amol = sele.apply_selection(protein)
        reslist = amol.residueList()
        sele.clear()

        if len(reslist) != 1:
            print "acceptor selection must specify one acceptor atom"
            sys.exit()

        if reslist[0].numAtoms() != 1:
            print "acceptor selection must specify one acceptor atom"
            sys.exit()

        acceptor = reslist[0].atom[0]

        # --- for now donor must be serine or tyrosine --- #
        if donor.name == "SER":
            H = donor.getAtom(" HG ")
            B = donor.getAtom(" OG ")
            C = donor.getAtom(" CB ")
            D = donor.getAtom(" CA ")
        elif donor.name == "TYR":
            H = donor.getAtom(" HH ")
            B = donor.getAtom(" OH ")
            C = donor.getAtom(" CZ ")
            D = donor.getAtom(" CE1")
        elif donor.name == "THR":
            H = donor.getAtom(" HG1")
            B = donor.getAtom(" OG1")
            C = donor.getAtom(" CB ")
            D = donor.getAtom(" CA ")
        elif donor.name == "CYS":
            H = donor.getAtom(" HG ")
            B = donor.getAtom(" SG ")
            C = donor.getAtom(" CB ")
            D = donor.getAtom(" CA ")
        else:
            print "unsupported donor residue"
            sys.exit()

        mytor = vector3d.torsion(acceptor.coord, B.coord, C.coord, D.coord)
        print mytor
        changeDihedral(H, B, C, D, mytor)

        protein.writePDB(outfiles[i], resRenumber=False, atomRenumber=False)
        protein.clear()
        if dmol != None:
            dmol.clear()