예제 #1
0
파일: pipeline.py 프로젝트: dkyu/mmtools
def protonate(inpdbfile, outpdbfile, pH):
    """Generate a protonated PDB file from a template PDB using MCCE."""

    thisdir = os.path.abspath(os.curdir)
    mcceOut = os.path.abspath(outpdbfile)
    prmFile = '../mccetools/prmfiles/run.prm.quick'
    prmFile = os.path.abspath(prmFile)
    mcce.protonatePDB(inpdbfile, mcceOut, pH, os.environ['MCCE_LOCATION'], cleanup=True, prmfile=prmFile, labeledPDBOnly=False)
    os.chdir(thisdir)
예제 #2
0
def shoveItThrough(protein):

    # determine base name
    print "PDB File: " + protein.pdbfile
    print "Sequence File: " + protein.seqfile
    extInd = protein.seqfile.rindex(".")
    baseName = protein.seqfile[0:extInd]

    # run modelPDB
    if (1):
        modelPDBOut = baseName + "_modelPDB_out.pdb"
        myModel = modelPDB.ModelPDB()
        myModel.makeModel(protein.pdbfile, protein.seqfile, modelPDBOut)

    # run mcce
    if (1):
        mcceOut = baseName + "_mcce_out.pdb"
        mcceOut = os.path.abspath(mcceOut)
        prmFile = '../../mccetools/prmfiles/run.prm.quick'
        prmFile = os.path.abspath(prmFile)
        params = mcce.read_paramfile(prmFile)
        mcce.print_prm(params)
        mcce.protonatePDB(modelPDBOut,
                          mcceOut,
                          protein.pH,
                          os.environ['MCCE_LOCATION'],
                          cleanup=True,
                          prmfile=prmFile)

    # run gromacs setup
    if (1):
        gromacsOut = baseName + "_final.pdb"
        forcefield = 'ffamber99p'
        # g = system.GromacsSystem(mcceOut, useff=forcefield)    # the old gromacstools way
        g = System(mcceOut, useff=forcefield)
        g.setup.setSaltConditions(protein.salt, protein.saltconc)
        g.setup.set_boxSoluteDistance(
            0.9
        )  # <--- ***Greg!!!*** <--- periodic box margin distance, in nanometers
        thisOutDir = os.path.join(thisdir, baseName)
        print 'Writing equilibration directory to', thisOutDir, '...'
        if os.path.exists(thisOutDir) == False:
            os.mkdir(thisOutDir)

        g.prepare(outname=gromacsOut,
                  outdir=thisOutDir,
                  verbose=True,
                  cleanup=False,
                  debug=DEBUG,
                  protocol='racecar2',
                  checkForFatalErrors=True)

    # cleanup
    if not DEBUG:
        os.remove(modelPDBOut)
        os.remove(mcceOut)
예제 #3
0
def shoveItThrough(protein):

    # determine base name
    print "PDB File: " + protein.pdbfile
    print "Sequence File: " + protein.seqfile
    extInd = protein.seqfile.rindex(".")
    baseName = protein.seqfile[0:extInd]

    # run modelPDB
    if 1:
        modelPDBOut = baseName + "_modelPDB_out.pdb"
        myModel = modelPDB.ModelPDB()
        myModel.makeModel(protein.pdbfile, protein.seqfile, modelPDBOut)

    # run mcce
    if 1:
        mcceOut = baseName + "_mcce_out.pdb"
        mcceOut = os.path.abspath(mcceOut)
        prmFile = "../../mccetools/prmfiles/run.prm.quick"
        prmFile = os.path.abspath(prmFile)
        params = mcce.read_paramfile(prmFile)
        mcce.print_prm(params)
        mcce.protonatePDB(modelPDBOut, mcceOut, protein.pH, os.environ["MCCE_LOCATION"], cleanup=True, prmfile=prmFile)

    # run gromacs setup
    if 1:
        gromacsOut = baseName + "_final.pdb"
        forcefield = "ffamber99p"
        # g = system.GromacsSystem(mcceOut, useff=forcefield)    # the old gromacstools way
        g = System(mcceOut, useff=forcefield)
        g.setup.setSaltConditions(protein.salt, protein.saltconc)
        g.setup.set_boxSoluteDistance(0.9)  # <--- ***Greg!!!*** <--- periodic box margin distance, in nanometers
        thisOutDir = os.path.join(thisdir, baseName)
        print "Writing equilibration directory to", thisOutDir, "..."
        if os.path.exists(thisOutDir) == False:
            os.mkdir(thisOutDir)

        g.prepare(
            outname=gromacsOut,
            outdir=thisOutDir,
            verbose=True,
            cleanup=False,
            debug=DEBUG,
            protocol="racecar2",
            checkForFatalErrors=True,
        )

    # cleanup
    if not DEBUG:
        os.remove(modelPDBOut)
        os.remove(mcceOut)
예제 #4
0
파일: pipeline.py 프로젝트: zhenglz/mmtools
def protonate(inpdbfile, outpdbfile, pH):
    """Generate a protonated PDB file from a template PDB using MCCE."""

    thisdir = os.path.abspath(os.curdir)
    mcceOut = os.path.abspath(outpdbfile)
    prmFile = '../mccetools/prmfiles/run.prm.quick'
    prmFile = os.path.abspath(prmFile)
    mcce.protonatePDB(inpdbfile,
                      mcceOut,
                      pH,
                      os.environ['MCCE_LOCATION'],
                      cleanup=True,
                      prmfile=prmFile,
                      labeledPDBOnly=False)
    os.chdir(thisdir)
예제 #5
0
파일: pipeline.py 프로젝트: zhenglz/mmtools
def shoveit(protein,
            outdir,
            forcefield='ffamber99p',
            protocol='racecar2',
            captermini=False,
            debug=False,
            verbose=True,
            cleanup=False,
            implicitOptions=None,
            useTable=None,
            MultiChain=False,
            SkipMCCE=False):
    """Shoves a pipelineProtein object through the entire MODELLER -> MCCE --> gromacs pipeline.

    For capping the termini with ACE and NH2:
    
    The Modeller program has a nice way of doing
    residue 'patches', so this will be used for adding the caps.  The program will do the following:

    1. Thread the sequence via Modeller, which will patch the termini caps--> PDB
    2. Calculate the protonation state via MCCE (which will know how to handle ACE and NH2 residues because
       of the patches ace.tpl and nh2.tpl in param04 and param08 --> PDB with ffamber-named residues
    3. feed through gromacstools in normal fashion

    OPTIONS

    MultiChain     If set to True, will thread a multichain model.  NOTE: the sequence of the 
                   mutiple chains (in the protein object) must be demarcated by '/'.  Example:
                   AKEEFWVY/AWEKKLELEQVID

    """

    thisdir = '%s' % os.path.abspath(os.curdir)
    protein.setup(
        outdir
    )  # Set up modelPDBout filenames and such using the basename of the outdir
    protein.print_info()

    # Build a PDB model from the pdbTemplate using MODELLER
    if MultiChain:
        thread_model(protein.pdbfile,
                     protein.seqfile,
                     protein.modelPDBout,
                     captermini=captermini)
    else:
        thread_model(protein.pdbfile,
                     protein.seqfile,
                     protein.modelPDBout,
                     captermini=captermini)

    # run mcce
    mcceOut = os.path.abspath(protein.mccePDBout)
    if SkipMCCE:
        # reformat the MODELLER PDB with the right names
        fin = open(protein.modelPDBout, 'r')
        modelPDBlines = fin.readlines()
        fin.close()
        npdb = mcce.rename.nest_pdb(modelPDBlines)
        outlines = mcce.rename.unnest_pdb(
            mcce.rename.rename_MODELLER_termini(npdb))
        fout = open(mcceOut, 'w')
        fout.writelines(outlines)
        fout.close()
        print 'Writing PDB to', mcceOut
    else:
        prmFile = '../../mccetools/prmfiles/run.prm.quick'
        prmFile = os.path.abspath(prmFile)
        if (captermini):
            mcce.protonatePDB(protein.modelPDBout,
                              mcceOut,
                              protein.pH,
                              os.environ['MCCE_LOCATION'],
                              cleanup=cleanup,
                              prmfile=prmFile,
                              renameTermini=False)
        else:
            mcce.protonatePDB(protein.modelPDBout,
                              mcceOut,
                              protein.pH,
                              os.environ['MCCE_LOCATION'],
                              cleanup=cleanup,
                              prmfile=prmFile)

    # run gromacs setup
    if (1):
        gromacsOut = protein.basename + "_final.pdb"
        # g = system.GromacsSystem(mcceOut, useff=forcefield)    # the old gromacstools way
        g = System(mcceOut,
                   finalOutputDir=outdir,
                   finalOutputName=protein.basename,
                   useff=forcefield)
        g.setup.setSaltConditions(protein.salt, protein.saltconc)
        if protein.cosolvent != None:
            g.setup.setCosolventConditions(protein.cosolvent,
                                           protein.cosolventconc)

        if protein.boxProtocol == 'small':
            g.setup.set_boxType = 'octahedron'
            g.setup.set_boxSoluteDistance(
                1.5)  # periodic box margin distance, in nanometers
        elif protein.boxProtocol == 'big':
            g.setup.set_boxType = 'octahedron'
            g.setup.setUseAbsBoxSize(True)
            g.setup.setAbsBoxSize(
                '7.0')  # periodic box absolute size, in nanometers (string)
        elif protein.boxProtocol[0:3] == 'unf':
            g.setup.set_boxType = 'octahedron'
            g.setup.setUseAbsBoxSize(True)
            if protein.boxProtocol == 'unf100':
                g.setup.setAbsBoxSize('10.0')
            if protein.boxProtocol == 'unf110':
                g.setup.setAbsBoxSize('11.0')
            if protein.boxProtocol == 'unf120':
                g.setup.setAbsBoxSize('12.0')

        thisOutDir = os.path.join(thisdir, protein.basename)
        print 'Writing equilibration directory to', thisOutDir, '...'
        if os.path.exists(thisOutDir) == False:
            os.mkdir(thisOutDir)
        os.chdir(thisOutDir)
        g.prepare(verbose=verbose,
                  cleanup=cleanup,
                  debug=debug,
                  protocol=protocol,
                  checkForFatalErrors=True,
                  implicitOptions=implicitOptions,
                  useTable=useTable)

    if (1):
        # cleanup
        if not DEBUG:
            if os.path.exists(protein.modelPDBout):
                os.remove(protein.modelPDBout)
            if os.path.exists(protein.mccePDBout):
                os.remove(protein.mccePDBout)

    os.chdir(thisdir)
예제 #6
0
파일: pipeline.py 프로젝트: dkyu/mmtools
def shoveit(protein, outdir, forcefield='ffamber99p', protocol='racecar2', captermini=False, debug=False, verbose=True, cleanup=False, implicitOptions=None, useTable=None, MultiChain=False, SkipMCCE=False):
    """Shoves a pipelineProtein object through the entire MODELLER -> MCCE --> gromacs pipeline.

    For capping the termini with ACE and NH2:
    
    The Modeller program has a nice way of doing
    residue 'patches', so this will be used for adding the caps.  The program will do the following:

    1. Thread the sequence via Modeller, which will patch the termini caps--> PDB
    2. Calculate the protonation state via MCCE (which will know how to handle ACE and NH2 residues because
       of the patches ace.tpl and nh2.tpl in param04 and param08 --> PDB with ffamber-named residues
    3. feed through gromacstools in normal fashion

    OPTIONS

    MultiChain     If set to True, will thread a multichain model.  NOTE: the sequence of the 
                   mutiple chains (in the protein object) must be demarcated by '/'.  Example:
                   AKEEFWVY/AWEKKLELEQVID

    """

    thisdir = '%s'%os.path.abspath(os.curdir)
    protein.setup(outdir)    # Set up modelPDBout filenames and such using the basename of the outdir
    protein.print_info()

    # Build a PDB model from the pdbTemplate using MODELLER
    if MultiChain:
        thread_model(protein.pdbfile, protein.seqfile, protein.modelPDBout, captermini=captermini)
    else:
        thread_model(protein.pdbfile, protein.seqfile, protein.modelPDBout, captermini=captermini)
    

    # run mcce
    mcceOut = os.path.abspath(protein.mccePDBout)
    if SkipMCCE:
        # reformat the MODELLER PDB with the right names
        fin = open(protein.modelPDBout,'r')
        modelPDBlines = fin.readlines()
        fin.close()
        npdb = mcce.rename.nest_pdb(modelPDBlines)
        outlines = mcce.rename.unnest_pdb(mcce.rename.rename_MODELLER_termini(npdb))
        fout = open(mcceOut,'w')
        fout.writelines(outlines)
        fout.close() 
        print 'Writing PDB to', mcceOut
    else:
        prmFile = '../../mccetools/prmfiles/run.prm.quick'
        prmFile = os.path.abspath(prmFile)
        if (captermini):
            mcce.protonatePDB(protein.modelPDBout, mcceOut, protein.pH, os.environ['MCCE_LOCATION'], cleanup=cleanup, prmfile=prmFile, renameTermini=False)
        else:
            mcce.protonatePDB(protein.modelPDBout, mcceOut, protein.pH, os.environ['MCCE_LOCATION'], cleanup=cleanup, prmfile=prmFile)
       
    # run gromacs setup
    if (1):
        gromacsOut = protein.basename + "_final.pdb"
        # g = system.GromacsSystem(mcceOut, useff=forcefield)    # the old gromacstools way
        g = System(mcceOut, finalOutputDir=outdir, finalOutputName=protein.basename, useff=forcefield)
        g.setup.setSaltConditions(protein.salt, protein.saltconc)
        if protein.cosolvent != None:
            g.setup.setCosolventConditions(protein.cosolvent, protein.cosolventconc)
 
        if protein.boxProtocol == 'small':
            g.setup.set_boxType = 'octahedron'
            g.setup.set_boxSoluteDistance(1.5)   # periodic box margin distance, in nanometers
        elif protein.boxProtocol == 'big':
            g.setup.set_boxType = 'octahedron'
            g.setup.setUseAbsBoxSize(True)
            g.setup.setAbsBoxSize('7.0')   # periodic box absolute size, in nanometers (string)
        elif protein.boxProtocol[0:3] == 'unf':
            g.setup.set_boxType = 'octahedron'
            g.setup.setUseAbsBoxSize(True)
            if protein.boxProtocol == 'unf100':
                g.setup.setAbsBoxSize('10.0') 
            if protein.boxProtocol == 'unf110':
                g.setup.setAbsBoxSize('11.0')
            if protein.boxProtocol == 'unf120':
                g.setup.setAbsBoxSize('12.0')

        thisOutDir = os.path.join(thisdir, protein.basename)
        print 'Writing equilibration directory to',thisOutDir,'...'
        if os.path.exists(thisOutDir) == False:
            os.mkdir(thisOutDir)
        os.chdir(thisOutDir)
        g.prepare(verbose=verbose, cleanup=cleanup, debug=debug, protocol=protocol, checkForFatalErrors=True, implicitOptions=implicitOptions, useTable=useTable)
     

    if(1):
        # cleanup
        if not DEBUG:
            if os.path.exists(protein.modelPDBout):
                os.remove(protein.modelPDBout)
            if os.path.exists(protein.mccePDBout):
                os.remove(protein.mccePDBout)

    os.chdir(thisdir) 
예제 #7
0
#
# The parameters used in the MCCE run can be found in the prmfile specified below
#
# Vincent Voelz
# May 19 2007
#

import mmtools.mccetools.mcce as mcce
import os, sys

### INPUT LINES ####
#
# Specify the input and output PDB filenames
# NOTE: pdbfile and outpdbfile should be local (not absolute) paths for this project  
pdbfile = '3gb1_testing.pdb'
outpdbfile = os.path.join(os.curdir,'3gb1_testing_protonated.pdb')

# Specify the pH
pH = 7.0

# Specify a MCCE parameter file with the desired set of parameters for calculating the pKa 
prmfile = '../prmfiles/run.prm.quick'
prmfile = os.path.abspath(prmfile)

# Specify additional or different parameters than prmfile,  if desired.
# xtraprms = {'TITR_PH0':'3.0'}

# Perform titration.
### work is done in a temporary dir; Setting cleanup=True will erase these temporary files 
mcce.protonatePDB(pdbfile, outpdbfile, pH, os.environ['MCCE_LOCATION'], cleanup=False, prmfile=prmfile)
예제 #8
0
#

import mmtools.mccetools.mcce as mcce
import os, sys

### INPUT LINES ####
#
# Specify the input and output PDB filenames
# NOTE: pdbfile and outpdbfile should be local (not absolute) paths for this project
pdbfile = '3gb1_testing.pdb'
outpdbfile = os.path.join(os.curdir, '3gb1_testing_protonated.pdb')

# Specify the pH
pH = 7.0

# Specify a MCCE parameter file with the desired set of parameters for calculating the pKa
prmfile = '../prmfiles/run.prm.quick'
prmfile = os.path.abspath(prmfile)

# Specify additional or different parameters than prmfile,  if desired.
# xtraprms = {'TITR_PH0':'3.0'}

# Perform titration.
### work is done in a temporary dir; Setting cleanup=True will erase these temporary files
mcce.protonatePDB(pdbfile,
                  outpdbfile,
                  pH,
                  os.environ['MCCE_LOCATION'],
                  cleanup=False,
                  prmfile=prmfile)