本文整理汇总了Python中restraints.EDrestraint.setScatRad方法的典型用法代码示例。如果您正苦于以下问题:Python EDrestraint.setScatRad方法的具体用法?Python EDrestraint.setScatRad怎么用?Python EDrestraint.setScatRad使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类restraints.EDrestraint
的用法示例。
在下文中一共展示了EDrestraint.setScatRad方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from restraints import EDrestraint [as 别名]
# 或者: from restraints.EDrestraint import setScatRad [as 别名]
def main() :
import optparse ; parser = optparse.OptionParser()
parser.add_option("--scratchdir", action='store', type='string', dest='scratchdir', help='to create all the files during refinement. it shdnt be already present.')
parser.add_option("--pdb", action='store', type='string', dest='pdbfile', help='starting pdb containing a model of pdb-ligand complex')
parser.add_option("--offset", action='store', type='int', dest='offset', help='a +/- integer that describes the sequence shift to apply', default=0)
parser.add_option("--truncateN", action='store', type='int', dest='truncateN', help='remove residues from Nterm', default=None)
parser.add_option("--truncateC", action='store', type='int', dest='truncateC', help='remove residues from Cterm', default=None)
parser.add_option("--delres", action='store', type='string', dest='delres', help='filename containing residues to be deleted. truncate and this option shdnt be used together', default=None)
parser.add_option("--sf", action='store', type='string', dest='sf', help='structure factors file')
parser.add_option("--a", action='store', type='float', dest='a', help='cell dimension a')
parser.add_option("--b", action='store', type='float', dest='b', help='cell dimension b')
parser.add_option("--c", action='store', type='float', dest='c', help='cell dimension c')
parser.add_option("--alpha", action='store', type='float', dest='alpha', help='cell angle alpha')
parser.add_option("--beta", action='store', type='float', dest='beta', help='cell angle beta')
parser.add_option("--gamma", action='store', type='float', dest='gamma', help='cell angle gamma')
parser.add_option("--sg", action='store', type='string', dest='sg', help='cell spacegroup, in CCP4 notation')
parser.add_option("--resolution", action='store', type='float', dest='resolution', help='resolution of the data')
parser.add_option("--extraTOP", action='store', type='string', dest='extraTOP', help='ligand CNS topology file')
parser.add_option("--extraPAR", action='store', type='string', dest='extraPAR', help='ligand CNS params file')
parser.add_option("--ca-restraint-radius", action='store', type='float', dest='caRad', help='radius of spherical restraint on CA position', default=1)
parser.add_option("--sc-centroid-restraint-radius", action='store', type='float', dest='scRad', help='radius of spherical restraint on sidechain centroid', default=2)
parser.add_option("--sidechain-vdw-reduction", action='store', type='float', dest='scReduction', help='factor to reduce effective vdw dist in case of sidechains', default=1)
parser.add_option("--population-size", action='store', type='int', dest='popsize', help='population size for PopulationStrategy', default=100)
parser.add_option("--verbose", action='store', type='int', dest='verbose', help='0 means least verbosity etc.', default=0)
parser.add_option("--backtrack", action='store', type='string', dest='backtrack', help='use backtracking version of PopulationStrategy. eg 4X5 will set backtrack numsteps and stepsize to 4,5 respectively. not used by default.', default=None)
parser.add_option("--noRTK", action='store', type='int', dest='noRTK', help='dont rebuild bad-fits with rtk', default=None)
parser.add_option("--uselowres", action='store', type='int', dest='uselowres', help='lower the resolution artificially to have argument*numatoms reflections', default=None)
parser.add_option("--randomize", action='store', type='int', dest='randomize', help='seed for randomizing', default=None)
(options, args) = parser.parse_args()
import misc
misc.setVerbosity(options.verbose)
from scplacement import SCplacement
from loopbuild import Multiloop
import prepareChain
from restraints import EDrestraint ; EDrestraint.setPenalty(5.) ; EDrestraint.setScatRad(1.) ;
esmin, esmax = 0.1, 1
randomize(options.randomize)
if options.delres != None :
resdel = parseDelres(options.pdbfile, options.delres)
print resdel
## amk sommmented
#for l in open(options.delres, 'r').readlines() :
# if l[0] == '#' : continue
# l = re.sub("\n", "", l)
# resdel.append( re.sub( "]", "", re.sub("\[", "", l) ) )
#import sys; sys.exit(0)
if not os.path.isdir(options.scratchdir) : os.mkdir(options.scratchdir)
shutil.copyfile(options.sf, "%s/strfactors.mtz" % options.scratchdir)
shutil.copyfile(options.pdbfile, "%s/%s" % (options.scratchdir,options.pdbfile))
firstmodel = "%s/model0.pdb" % options.scratchdir
if not os.path.isfile(firstmodel) :
if options.caRad < 0.49 : shutil.copyfile(options.pdbfile, firstmodel)
else :
mlPrepC = prepareChain.PrepareChain("PRL")
Multiloop(options.pdbfile, None, None, options.caRad, options.scRad, options.scReduction, None, options.popsize, options.backtrack, 1, firstmodel, None, mlPrepC).run()
if options.delres != None :
deleteResidues(firstmodel, resdel) #; sys.exit(0)
os.chdir(options.scratchdir)
shutil.copyfile("model0.pdb", "model0.AA.pdb")
numRefCycles = 10
cif2mtz("strfactors.mtz", "base.mtz", options.a, options.b, options.c, options.alpha, options.beta, options.gamma, options.sg)
uniqueify("base.mtz", "rfree.mtz")
if options.noRTK :
removeRElines("model0.AA.pdb", ["^MODEL", "^ENDMDL"])
copyNonprotein(options.pdbfile, "model0.AA.pdb")
for cycle in range(numRefCycles) :
modelIn = "model%d.AA.pdb" % cycle
phasedmtz = "phased%d.mtz" % cycle # phase the str factors with current model
sfall(modelIn, "rfree.mtz", phasedmtz)
modelOut = "model%d.AA.pdb" % (cycle+1) # model to be generated in this cycle
mtzout = "phased%d.mtz" % (cycle+1) # model to be generated in this cycle
cnsRefinement(phasedmtz, modelIn, mtzout, modelOut,
options.a, options.b, options.c, options.alpha, options.beta, options.gamma, options.sg, options.resolution,
cnsArgs, cycle, options.extraTOP, options.extraPAR)
sys.exit(0)
keepMClinesOnly("model0.pdb")
if options.offset != None : ## offset=0 by default, not None
prot = protein("model0.pdb", read_hydrogens=0, read_waters=0, read_hets=0)
res, resids, resnums, resns, chids, inscodes, pts = prot2res.readProtRes(prot)
keys = list(resns.keys()) ; keys.sort()
newresns = {}
allAA = [ "GLY", "ALA", "VAL", "LEU", "ILE", "PRO", "PHE", "TYR", "TRP", "ASP", "GLU", "HIS", "LYS", "ARG", "CYS", "MET", "SER", "THR", "ASN", "GLN", ]
if options.offset > 0 :
for ki in range(options.offset, len(keys)) : newresns[ keys[ki] ] = resns[ keys[ki-options.offset] ]
for ki in range(options.offset) : newresns[ keys[ki] ] = allAA[ int(len(allAA)*random.random()) ]
elif options.offset < 0 :
#.........这里部分代码省略.........
示例2: main
# 需要导入模块: from restraints import EDrestraint [as 别名]
# 或者: from restraints.EDrestraint import setScatRad [as 别名]
#.........这里部分代码省略.........
l = "--gamma = %s "%str(options.gamma) ; print >> fp, l
l = "--sg = %s "%str(options.sg) ; print >> fp, l
l = "--resolution = %s "%str(options.resolution) ; print >> fp, l
l = "--ca-restraint-radius = %s "%str(options.caRad) ; print >> fp, l
l = "--sc-centroid-restraint-radius = %s "%str(options.scRad) ; print >> fp, l
l = "--sidechain-vdw-reduction = %s "%str(options.scReduction) ; print >> fp, l
l = "--population-size = %s "%str(options.popsize) ; print >> fp, l
l = "--verbose = %s "%str(options.verbose) ; print >> fp, l
l = "--backtrack = %s "%str(options.backtrack) ; print >> fp, l
l = "--randomize = %s "%str(options.randomize) ; print >> fp, l
l = "--loopres = %s "%str(options.loopres) ; print >> fp, l
l = "--framework = %s "%str(options.framework) ; print >> fp, l
l = "--framework-ca-threshold = %s "%str(options.fcarad) ; print >> fp, l
l = "--framework-sc-threshold = %s "%str(options.fscrad) ; print >> fp, l
l = "--rebuild-poor-regions-only = %s "%str(options.poorOnly) ; print >> fp, l
l = "--poor-fit-threshold = %s "%str(options.poorThreshold) ; print >> fp, l
l = "--mconly = %s "%str(options.mconly) ; print >> fp, l
l = "--sconly = %s "%str(options.sconly) ; print >> fp, l
l = "--default-mainchain-b-factor = %s "%str(options.mcBfac) ; print >> fp, l
l = "--default-sidechain-b-factor = %s "%str(options.scBfac) ; print >> fp, l
l = "--models-get-native-bfactors = %s "%str(options.nativeBfac) ; print >> fp, l
l = "--dontusesc = %s "%str(options.dontusesc) ; print >> fp, l
l = "--num-models = %s "%str(options.nmodels) ; print >> fp, l
l = "--f1label = %s "%str(options.f1label) ; print >> fp, l
l = "--f2label = %s "%str(options.f2label) ; print >> fp, l
l = "--philabel = %s "%str(options.philabel) ; print >> fp, l
l = "--maptype = %s "%str(options.maptype) ; print >> fp, l
l = "--cacaCutoff = %s "%str(options.cacaCutoff) ; print >> fp, l
l = "--make-ed-optional = %s "%str(options.edOpt) ; print >> fp, l
# l = "--chids = %s "%str(options.chids) ; print >> fp, l
fp.close()
guidedsampling = None
from restraints import EDrestraint ; EDrestraint.setPenalty(2.) ; EDrestraint.setScatRad(1.) ;
esmin, esmax, esmean, rcmult, xscoreCutoff = .000, 5., .0, 5, options.poorThreshold
multiPrepC = prepareChain.PrepareChain("SCL1.0")
xscorer = XrayScorer(None, xscoreCutoff)
modelIn = options.pdbfile
rtkmodel = options.pdbout # rappertk model to be generated in this cycle
if options.mapfn1 == None and options.mtzfn == None:
print "Warning no mtz or map input, no electron density restraints will be used"
if options.poorOnly == 1 :
if options.mtzfn == None and options.mapfn1 == None and options.mapfn2 == None:
print "No mapfn1,mapfn2 or mtzfn set"
sys.exit()
if options.mapfn2 == None and options.mapfn1 !=None and options.mtzfn == None:
print "Both mapfn1 and mapfn2 need to be set"
sys.exit()
if options.mapfn1 == None and options.mapfn2 !=None and options.mtzfn == None :
print "Both mapfn1 and mapfn2 need to be set"
sys.exit()
if options.mtzfn != None :
badmcsc = xscorer.score(modelIn, options.mtzfn, options.f1label, options.f2label, options.philabel, options.maptype, "mcsc")
badmc = xscorer.score(modelIn, options.mtzfn, options.f1label, options.f2label, options.philabel, options.maptype, "mc")
badpept = xscorer.score(modelIn, options.mtzfn, options.f1label, options.f2label, options.philabel, options.maptype,"pept")
badscs = xscorer.score(modelIn, options.mtzfn, options.f1label, options.f2label, options.philabel, options.maptype,"sc")
elif options.mapfn1 !=None and options.mapfn2 != None :
示例3: main
# 需要导入模块: from restraints import EDrestraint [as 别名]
# 或者: from restraints.EDrestraint import setScatRad [as 别名]
def main() :
import optparse ; parser = optparse.OptionParser()
parser.add_option("--scratchdir", action='store', type='string', dest='scratchdir', help='to create all the files during refinement. it shdnt be already present.')
parser.add_option("--pdb", action='store', type='string', dest='pdbfile', help='starting pdb containing a model of pdb-ligand complex')
parser.add_option("--sf", action='store', type='string', dest='sf', help='structure factors file')
parser.add_option("--a", action='store', type='float', dest='a', help='cell dimension a')
parser.add_option("--b", action='store', type='float', dest='b', help='cell dimension b')
parser.add_option("--c", action='store', type='float', dest='c', help='cell dimension c')
parser.add_option("--alpha", action='store', type='float', dest='alpha', help='cell angle alpha')
parser.add_option("--beta", action='store', type='float', dest='beta', help='cell angle beta')
parser.add_option("--gamma", action='store', type='float', dest='gamma', help='cell angle gamma')
parser.add_option("--sg", action='store', type='string', dest='sg', help='cell spacegroup, in CCP4 notation')
parser.add_option("--resolution", action='store', type='float', dest='resolution', help='resolution of the data')
parser.add_option("--ca-restraint-radius", action='store', type='float', dest='caRad', help='radius of spherical restraint on CA position', default=1)
parser.add_option("--sc-centroid-restraint-radius", action='store', type='float', dest='scRad', help='radius of spherical restraint on sidechain centroid', default=2)
parser.add_option("--sidechain-vdw-reduction", action='store', type='float', dest='scReduction', help='factor to reduce effective vdw dist in case of sidechains', default=1)
parser.add_option("--population-size", action='store', type='int', dest='popsize', help='population size for PopulationStrategy', default=100)
parser.add_option("--verbose", action='store', type='int', dest='verbose', help='0 means least verbosity etc.', default=0)
parser.add_option("--backtrack", action='store', type='string', dest='backtrack', help='use backtracking version of PopulationStrategy. eg 4X5 will set backtrack numsteps and stepsize to 4,5 respectively. not used by default.', default=None)
parser.add_option("--noRTK", action='store', type='int', dest='noRTK', help='dont rebuild bad-fits with rtk', default=0)
parser.add_option("--randomize", action='store', type='int', dest='randomize', help='seed for randomizing', default=None)
parser.add_option("--loopres", action='store', type='string', dest='loopres', help='filename containing resids for starting perturbation', default=None)
parser.add_option("--framework", action='store', type='int', dest='framework', help='to be used in conjunction with loopres. it puts a 1/3 ca/sc pos restr on non-loopres and perturbs them too', default=None)
(options, args) = parser.parse_args()
assert options.framework in [None, 1]
import misc
misc.setVerbosity(options.verbose)
randomize(options.randomize)
if options.loopres != None :
## expecting resids in [RSNcRESIa] format, one per line
#shutil.copyfile(options.pdbfile, "temp.pdb" )
#removeChainId("temp.pdb")
loopresids = parseLoopres(options.pdbfile,options.loopres)
## amk commented
#for l in open(options.loopres, 'r').readlines() :
# if l[0] == "#" : continue
# lres = l[1:len(l)-2]
# loopresids.append(lres)
options.loopres = loopresids #[ "VAL 47 ", "GLN 48 ", "GLY 49 ", "GLU 50 ", "GLU 51 ", "SER 52 ", "ASN 53 ", "ASP 54 ", "LYS 55 ", ]
print "Do i come herer "
print options.loopres
#import sys ; sys.exit()
if not os.path.isdir(options.scratchdir) : os.mkdir(options.scratchdir)
shutil.copyfile(options.pdbfile, "%s/model0.pdb" % options.scratchdir)
shutil.copyfile(options.sf, "%s/strfactors.mtz" % options.scratchdir)
os.chdir(options.scratchdir)
cif2mtz("strfactors.mtz", "base.mtz", options.a, options.b, options.c, options.alpha, options.beta, options.gamma, options.sg)
uniqueify("base.mtz", "rfree.mtz")
from scplacement import SCplacement
from loopbuild import Multiloop
import prepareChain
from restraints import EDrestraint ; EDrestraint.setPenalty(2.) ; EDrestraint.setScatRad(1.) ;
esmin, esmax, esmean, rcmult, xscoreCutoff = .000, 5., .0, 5, 0.9
guidedsampling = None
multiPrepC = prepareChain.PrepareChain("SCL1.0")
xscorer = XrayScorer(None, xscoreCutoff)
numRefCycles = 20 ; startCycle = 0
for cycle in range(startCycle, numRefCycles) :
print "***********************************************"
print "********************CYCLE %d*******************" % cycle
print "***********************************************"
modelIn = "model%d.pdb" % cycle
cnsout = "cns%d.pdb" % cycle
rtkmodel = "model%d.pdb" % (cycle+1) # rappertk model to be generated in this cycle
sfall(modelIn, "rfree.mtz", "phased.mtz")
phasedmtz = "phased%d.mtz" % cycle # phase the str factors with current model
if cycle > 3 :
toRemove = "phased%d.mtz" %(cycle-2)
if os.path.exists(toRemove) :
os.remove(toRemove)
toRemove = "phased%d.mtzfc.map"%(cycle-2)
if os.path.exists(toRemove) :
#.........这里部分代码省略.........
示例4: main
# 需要导入模块: from restraints import EDrestraint [as 别名]
# 或者: from restraints.EDrestraint import setScatRad [as 别名]
def main() :
import optparse ; parser = optparse.OptionParser()
parser.add_option("--scratchdir", action='store', type='string', dest='scratchdir', help='to create all the files during refinement.')
parser.add_option("--pdb", action='store', type='string', dest='pdbfile', help='starting pdb containing a model of pdb-ligand complex')
parser.add_option("--sf", action='store', type='string', dest='sf', help='structure factors file')
parser.add_option("--a", action='store', type='float', dest='a', help='cell dimension a')
parser.add_option("--b", action='store', type='float', dest='b', help='cell dimension b')
parser.add_option("--c", action='store', type='float', dest='c', help='cell dimension c')
parser.add_option("--alpha", action='store', type='float', dest='alpha', help='cell angle alpha')
parser.add_option("--beta", action='store', type='float', dest='beta', help='cell angle beta')
parser.add_option("--gamma", action='store', type='float', dest='gamma', help='cell angle gamma')
parser.add_option("--sg", action='store', type='string', dest='sg', help='cell spacegroup, in CCP4 notation')
parser.add_option("--resolution", action='store', type='float', dest='resolution', help='resolution in angstroms')
parser.add_option("--percent-r-free", action='store', type='string', dest='prfree', help='percentage R-free to take must be at least 500 reflections', default=0.05)
parser.add_option("--n-models", action='store', type='int', dest='nmodel', help='the number of models required to make up the ensemble')
parser.add_option("--restart-n", action='store', type='int', dest='restart', help='the CNS round to restart from', default=0)
parser.add_option("--restart-n-mod", action='store', type='int', dest='restart_mod', help='the model round to restart from', default=0)
parser.add_option("--refine-prog", action='store', type='string', dest='refinetype', help='Use CNS or PHENIX', default="CNS")
parser.add_option("--multichain", action='store', type='int', dest='multichain', help='Does the target have more than one chain if so then use 1', default=0)
parser.add_option("--ca-restraint-radius", action='store', type='float', dest='caRad', help='radius of spherical restraint on CA position', default=1)
parser.add_option("--sc-centroid-restraint-radius", action='store', type='float', dest='scRad', help='radius of spherical restraint on sidechain centroid', default=2)
parser.add_option("--sidechain-vdw-reduction", action='store', type='float', dest='scReduction', help='factor to reduce effective vdw dist in case of sidechains', default=1)
parser.add_option("--population-size", action='store', type='int', dest='popsize', help='population size for PopulationStrategy', default=100)
parser.add_option("--verbose", action='store', type='int', dest='verbose', help='0 means least verbosity etc.', default=0)
parser.add_option("--ranseed", action='store', type='float', dest='ranseed', help='Explicitly set the random seed.', default=1)
parser.add_option("--backtrack", action='store', type='string', dest='backtrack', help='use backtracking version of PopulationStrategy. eg 4X5 will set backtrack numsteps and stepsize to 4,5 respectively. not used by default.', default=None)
parser.add_option("--noRTK", action='store', type='int', dest='noRTK',help='dont rebuild bad-fits with rtk', default=0)
(options, args) = parser.parse_args()
import misc
misc.setVerbosity(options.verbose)
misc.RanGen.instance().seedme( int(-1000 * options.ranseed) )
#import sys; sys.exit(0)
if not os.path.isdir(options.scratchdir) :
os.mkdir(options.scratchdir)
shutil.copyfile(options.pdbfile, "%s/PDB.pdb" % options.scratchdir)
shutil.copyfile(options.sf, "%s/strfactors.mtz" % options.scratchdir)
os.chdir(options.scratchdir)
from xcheck import main as xcheckMain
from loopbuild import Multiloop
from scplacement import SCplacement
import prepareChain
from restraints import EDrestraint ; EDrestraint.setPenalty(5.) ; EDrestraint.setScatRad(1.) ;
esmin, esmax, esmean, rcmult = 0.0001, 5.0, .1, 10
EDrestraint.setScatRad(.5) ;
multiPrepC = prepareChain.PrepareChain("PRL1.0") ##here we can pass sc lib option
if options.restart == 0 and options.restart_mod == 0:
Multiloop("PDB.pdb", None, None, options.caRad, options.scRad, options.scReduction, None , options.popsize, options.backtrack, options.nmodel, "model.pdb", None, multiPrepC).run()
## change to remove n models requested NDF 15/01/07 ###
for mod_num in range(options.nmodel):
print "Model file manipulation on %d .pdb" %mod_num
removeMODEL_multi("model", mod_num)
mod_file_num = mod_num + 1
mfn_st = "%d" % mod_file_num
copyNonprotein("PDB.pdb", "model"+mfn_st+".pdb")
cif2mtz("strfactors.mtz", "base.mtz", options.a, options.b, options.c, options.alpha, options.beta, options.gamma, options.sg)
uniqueify("base.mtz", "rfree.mtz", options.prfree) ## add here the percentage need to generate r-free - note for low res need to be 10% otherwise 5%
## for each model generate a subdir and copy in model then run script in each sub file NDF 15/01/07 ##
for mod_dir in range(options.restart_mod, options.nmodel):
mod_num_st = "%d" % (mod_dir + 1)
if not os.path.isdir("model_"+mod_num_st+"_refine"):
os.mkdir("model_"+mod_num_st+"_refine")
shutil.copyfile("model"+mod_num_st+".pdb", "model_"+mod_num_st+"_refine/model"+mod_num_st+"_0.pdb")
shutil.copyfile("../"+options.sf, "model_"+mod_num_st+"_refine/strfactors.mtz")
shutil.copyfile("rfree.mtz", "model_"+mod_num_st+"_refine/rfree.mtz")
shutil.copyfile("base.mtz", "model_"+mod_num_st+"_refine/base.mtz")
##if we get a cluster working here we want to paralalise the job NDF 17/01/2007 ##
os.chdir("model_"+mod_num_st+"_refine")
print "HAVE MOVED TO model_"+mod_num_st+"_refine"
justcns = None
numRefCycles = 10
for cycle in range(options.restart, numRefCycles):
print "***********************************************"
print "**************** CNS CYCLE %d*******************" % cycle
print "***********************************************"
xscorer = XrayScorer(None, 0.90)
model_stem = "model"+mod_num_st+"_%d" % cycle
modelIn = "model"+mod_num_st+"_%d.pdb" % cycle
cnsout = "ref%d.pdb" % cycle
rtkmodel = "model"+mod_num_st+"_%d.pdb" % (cycle+1) # rappertk model to be generated in this cycle
cnsdiffmap = "cns%ddiff.map" % cycle
if cycle >= 8:
multiPrepC = prepareChain.PrepareChain("SCL0.5")
else:
multiPrepC = prepareChain.PrepareChain("PRL1.0")
sfall(modelIn, "rfree.mtz", "phased.mtz")
#.........这里部分代码省略.........
示例5: main
# 需要导入模块: from restraints import EDrestraint [as 别名]
# 或者: from restraints.EDrestraint import setScatRad [as 别名]
def main():
import optparse ; parser = optparse.OptionParser()
parser.add_option("--scratchdir", action='store', type='string', dest='scratchdir', help='to create all the files during refinement. it shdnt be already present.')
parser.add_option("--pdb", action='store', type='string', dest='pdbfile', help='starting pdb containing a mainchain-only fragment')
parser.add_option("--mtz", action='store', type='string', dest='mtz', help='str factors as mtz file')
parser.add_option("--a", action='store', type='float', dest='a', help='cell dimension a')
parser.add_option("--b", action='store', type='float', dest='b', help='cell dimension b')
parser.add_option("--c", action='store', type='float', dest='c', help='cell dimension c')
parser.add_option("--alpha", action='store', type='float', dest='alpha', help='cell angle alpha')
parser.add_option("--beta", action='store', type='float', dest='beta', help='cell angle beta')
parser.add_option("--gamma", action='store', type='float', dest='gamma', help='cell angle gamma')
parser.add_option("--sg", action='store', type='string', dest='sg', help='cell spacegroup, in CCP4 notation')
parser.add_option("--resolution", action='store', type='float', dest='resolution', help='resolution of the data')
parser.add_option("--ca-restraint-radius", action='store', type='float', dest='caRad', help='radius of spherical restraint on CA position', default=1)
parser.add_option("--sc-centroid-restraint-radius", action='store', type='float', dest='scRad', help='radius of spherical restraint on sidechain centroid', default=2)
parser.add_option("--sidechain-vdw-reduction", action='store', type='float', dest='scReduction', help='factor to reduce effective vdw dist in case of sidechains', default=1)
parser.add_option("--population-size", action='store', type='int', dest='popsize', help='population size for PopulationStrategy', default=100)
parser.add_option("--backtrack", action='store', type='string', dest='backtrack', help='use backtracking version of PopulationStrategy. eg 4X5 will set backtrack numsteps and stepsize to 4,5 respectively. not used by default.', default=None)
parser.add_option("--verbose", action='store', type='int', dest='verbose', help='0 means least verbosity etc.', default=0)
parser.add_option("--randomize", action='store', type='int', dest='randomize', help='seed for randomizing', default=None)
parser.add_option("--sequence", action='store', type='string', dest='sequence', help='seq to slide over the given fragment', default=None)
parser.add_option("--slideres", action='store', type='string', dest='slideres', help='file containing resids over which sequence is to be slided', default=None)
(options, args) = parser.parse_args()
if not os.path.isdir(options.scratchdir) : os.mkdir(options.scratchdir)
os.chdir(options.scratchdir)
misc.setVerbosity(options.verbose)
randomize(options.randomize)
slideres = []
for l in open(options.slideres, 'r').readlines() :
l = re.sub("\n", "", re.sub("#.*", "", l))
if len(l) == 0 : continue
if not l[0] == "#" : slideres.append( l[1:len(l)-1] )
print "SLIDERES", slideres
options.slideres = slideres
refprot = protein(options.pdbfile, read_hydrogens=0, read_waters=0, read_hets=0)
refres, refresids, refresnums, refresns, refchids, refinscodes, refpts = prot2res.readProtRes(refprot)
for ri in range(len(refres)) :
assert refresns[ri] == "GLY"
for an in refres[ri].keys() : assert an in [" N "," CA "," C "," O "]
from restraints import EDrestraint ; EDrestraint.setPenalty(0.) ; EDrestraint.setScatRad(1.) ;
esmin, esmax, esmean, rcmult, xscoreCutoff = .000, 5., .0, 5, 0.9
## make a SA-weighted 2FoFc map based on given given mconly fragment
cnsArgs = {}
for cycle in range(20) : cnsArgs[cycle] = {} ; cnsArgs[cycle]["num_cycles"] = 1 ; cnsArgs[cycle]["temperature"] = 50 ; cnsArgs[cycle]["harmCA"] = 1
cnsArgs[1]["num_cycles"] = 2 ; cnsArgs[1]["temperature"] = 3000
sfall(options.pdbfile, options.mtz, "rfree.mtz")
cnsRefinement("rfree.mtz", options.pdbfile, "phased0.mtz", "dontcare.pdb",
options.a, options.b, options.c, options.alpha, options.beta, options.gamma, options.sg, options.resolution,
cnsArgs, 0)
restoreChainids("dontcare.pdb", options.pdbfile)
#refprot = protein("dontcare.pdb", read_hydrogens=0, read_waters=0, read_hets=0)
#refres, refresids, refresnums, refresns, refchids, refinscodes, refpts = prot2res.readProtRes(refprot)
#res, resids, resnums, resns, chids, inscodes, pts = makeFrag( options.sequence[si:si+len(refres)] )
for si in range( len(options.sequence)-len(options.slideres)+1 ) :
prot = protein("dontcare.pdb", read_hydrogens=0, read_waters=0, read_hets=0)
res, resids, resnums, resns, chids, inscodes, pts = prot2res.readProtRes(prot)
mutmap = {}
for resid in options.slideres :
for k,v in resids.items() :
if v == resid : mutmap[k] = options.sequence[ si + options.slideres.index(resid) ]
from data import resAtoms
from pdbr import makeResid
from protinfo import AA13
for ri,aa1 in mutmap.items() :
print "mutate %5d [%s] -> %s" % (k, resids[ri], aa1)
for an in resAtoms[ AA13[aa1] ] :
if an in [" N "," CA "," C "," O "] : continue
assert not an in res[ri].keys()
res[ri][an] = len(pts)
pts.append( [-999., -999., -999.] )
resns[ri] = AA13[aa1]
resids[ri] = makeResid( resns[ri], chids[ri], resnums[ri], inscodes[ri] )
badresids = []
for ri,aa1 in mutmap.items() : badresids.append( resids[ri] )
print "badresids", badresids
ModelRenderer(res, resns, chids, resnums, inscodes, [], "start.pdb").render(pts)
multiPrepC = prepareChain.PrepareChain("SCL1.0")
xrayRestGen = [ prepareChain.XrayRestraintsGenerator("phased0.mtz2fofc.map", "map", "FC", "PHIC", "2F1-F2", esmin, esmax, esmean, ["SCLbuilder","ChiBuilder","CBbuilder"], ) ]
ml = Multiloop("start.pdb", badresids, None, options.caRad, options.scRad, options.scReduction, None, options.popsize,
options.backtrack, 1, "end.pdb", xrayRestGen, multiPrepC)
ml.ranker = XrayRanker("phased0.mtz2fofc.map", "map", "FC", "PHIC", "2F1-F2", esmin, esmax)
ml.ranker.rankChildren = rcmult ; ml.ranker.rankRecurse = 1
ml.ranker.rankLeaderBuilderOnly = None ; ml.ranker.rankGivenEnsemble = None
ml.cellsym = [ options.a, options.b, options.c, options.alpha, options.beta, options.gamma, sgtable[options.sg][0] ]
ml.run()
#.........这里部分代码省略.........
示例6: main
# 需要导入模块: from restraints import EDrestraint [as 别名]
# 或者: from restraints.EDrestraint import setScatRad [as 别名]
def main() :
import optparse ; parser = optparse.OptionParser()
parser.add_option("--scratchdir", action='store', type='string', dest='scratchdir', help='to create all the files during refinement. it shdnt be already present.')
parser.add_option("--pdb", action='store', type='string', dest='pdbfile', help='starting pdb containing a model of pdb-ligand complex')
parser.add_option("--outpdb", action='store', type='string', dest='outpdb', help='starting pdb containing a model of pdb-ligand complex')
parser.add_option("--ca-restraint-radius", action='store', type='float', dest='caRad', help='radius of spherical restraint on CA position', default=1)
parser.add_option("--sc-centroid-restraint-radius", action='store', type='float', dest='scRad', help='radius of spherical restraint on sidechain centroid', default=2)
parser.add_option("--sidechain-vdw-reduction", action='store', type='float', dest='scReduction', help='factor to reduce effective vdw dist in case of sidechains', default=1)
parser.add_option("--population-size", action='store', type='int', dest='popsize', help='population size for PopulationStrategy', default=100)
parser.add_option("--verbose", action='store', type='int', dest='verbose', help='0 means least verbosity etc.', default=0)
parser.add_option("--backtrack", action='store', type='string', dest='backtrack', help='use backtracking version of PopulationStrategy. eg 4X5 will set backtrack numsteps and stepsize to 4,5 respectively. not used by default.', default=None)
parser.add_option("--noRTK", action='store', type='int', dest='noRTK', help='dont rebuild bad-fits with rtk', default=0)
parser.add_option("--randomize", action='store', type='int', dest='randomize', help='seed for randomizing', default=None)
parser.add_option("--num-models-wanted", action='store', type='int', dest='nmodels', help='seed for randomizing', default=None)
parser.add_option("--loopres", action='store', type='string', dest='loopres', help='filename containing resids for starting perturbation', default=None)
parser.add_option("--framework", action='store', type='int', dest='framework', help='to be used in conjunction with loopres. it puts a 1/3 ca/sc pos restr on non-loopres and perturbs them too', default=None)
(options, args) = parser.parse_args()
assert options.framework in [None, 1]
import misc
misc.setVerbosity(options.verbose)
randomize(options.randomize)
if options.loopres != None :
## expecting resids in [RSNcRESIa] format, one per line
#removeChainId("temp.pdb")
loopresids = parseLoopres(options.pdbfile,options.loopres)
## amk commented
#for l in open(options.loopres, 'r').readlines() :
# if l[0] == "#" : continue
# lres = l[1:len(l)-2]
# loopresids.append(lres)
options.loopres = loopresids #[ "VAL 47 ", "GLN 48 ", "GLY 49 ", "GLU 50 ", "GLU 51 ", "SER 52 ", "ASN 53 ", "ASP 54 ", "LYS 55 ", ]
print "Do i come herer "
print options.loopres
#import sys ; sys.exit()
if not os.path.isdir(options.scratchdir) : os.mkdir(options.scratchdir)
shutil.copyfile(options.pdbfile, "%s/%s" % (options.scratchdir,options.pdbfile))
os.chdir(options.scratchdir)
from scplacement import SCplacement
from loopbuild import Multiloop
import prepareChain
from restraints import EDrestraint ; EDrestraint.setPenalty(2.) ; EDrestraint.setScatRad(1.) ;
esmin, esmax, esmean, rcmult, xscoreCutoff = .000, 5., .0, 5, 0.9
guidedsampling = None
multiPrepC = prepareChain.PrepareChain("SCL1.0")
badresids = None
badresids = options.loopres
scvdwr = options.scReduction ;
popsize = options.popsize
xrayRestGen = None
ml = Multiloop(options.pdbfile, badresids, None, options.caRad, options.scRad, scvdwr, guidedsampling, popsize,
options.backtrack, options.nmodels, options.outpdb, xrayRestGen, multiPrepC)
nb = ml.run()
示例7: main
# 需要导入模块: from restraints import EDrestraint [as 别名]
# 或者: from restraints.EDrestraint import setScatRad [as 别名]
def main() :
import optparse ; parser = optparse.OptionParser()
parser.add_option("--scratchdir", action='store', type='string', dest='scratchdir', help='to create all the files during refinement. it shdnt be already present.')
parser.add_option("--pdb", action='store', type='string', dest='pdbfile', help='starting pdb')
parser.add_option("--ensembleSize", action='store', type='int', dest='esize', help='number of conformers in a multiconformer model', default=1)
parser.add_option("--sf", action='store', type='string', dest='sf', help='structure factors file')
parser.add_option("--a", action='store', type='float', dest='a', help='cell dimension a')
parser.add_option("--b", action='store', type='float', dest='b', help='cell dimension b')
parser.add_option("--c", action='store', type='float', dest='c', help='cell dimension c')
parser.add_option("--alpha", action='store', type='float', dest='alpha', help='cell angle alpha')
parser.add_option("--beta", action='store', type='float', dest='beta', help='cell angle beta')
parser.add_option("--gamma", action='store', type='float', dest='gamma', help='cell angle gamma')
parser.add_option("--sg", action='store', type='string', dest='sg', help='cell spacegroup, in CCP4 notation')
parser.add_option("--resolution", action='store', type='float', dest='resolution', help='resolution of the data')
parser.add_option("--ca-restraint-radius", action='store', type='float', dest='caRad', help='radius of spherical restraint on CA position', default=1)
parser.add_option("--sc-centroid-restraint-radius", action='store', type='float', dest='scRad', help='radius of spherical restraint on sidechain centroid', default=2)
parser.add_option("--sidechain-vdw-reduction", action='store', type='float', dest='scReduction', help='factor to reduce effective vdw dist in case of sidechains', default=1)
parser.add_option("--population-size", action='store', type='int', dest='popsize', help='population size for PopulationStrategy', default=100)
parser.add_option("--verbose", action='store', type='int', dest='verbose', help='0 means least verbosity etc.', default=0)
parser.add_option("--backtrack", action='store', type='string', dest='backtrack', help='use backtracking version of PopulationStrategy. eg 4X5 will set backtrack numsteps and stepsize to 4,5 respectively. not used by default.', default=None)
parser.add_option("--randomize", action='store', type='int', dest='randomize', help='randomize will produce a different refinement trajectory by seeding rtk randomly', default=None)
(options, args) = parser.parse_args()
from loopbuild import Multiloop
from scplacement import SCplacement
import prepareChain
import misc
misc.setVerbosity(options.verbose)
pref.randomize(options.randomize)
if not os.path.isdir(options.scratchdir) : os.mkdir(options.scratchdir)
for mi in range(options.esize) :
shutil.copyfile(options.pdbfile, "%s/c0m%d.pdb" % (options.scratchdir,mi))
shutil.copyfile(options.sf, "%s/strfactors.mtz" % options.scratchdir)
os.chdir(options.scratchdir)
cif2mtz("strfactors.mtz", "base.mtz", options.a, options.b, options.c, options.alpha, options.beta, options.gamma, options.sg)
uniqueify("base.mtz", "rfree.mtz")
from restraints import EDrestraint ; EDrestraint.setPenalty(5.) ; EDrestraint.setScatRad(1.) ;
esmin, esmax, esmean, rcmult = 0.0001, 5.0, 0.05, 10
from builders import PeptideBridgeBuilder ; PeptideBridgeBuilder.setCTtrials(25); PeptideBridgeBuilder.setThetastep(5);
from data import consts ; consts.set("TAU_QUALITY", 40.)
mconly, guidedsampling = None, None
xscorer = XrayScorer(None, 0.9)
startcycle, endcycle = 0, 10
for cycle in range(startcycle, endcycle) :
badresids, xrayRestGen, xranker = None, None, None
multiPrepC = prepareChain.PrepareChain("PRL")
rtkmodel, joinpdbs = "r%d.pdb"%(cycle), []
for mi in range(options.esize) :
cnsin = "c%dm%d.pdb" % (cycle,mi) ; rtkout = "r%dm%d.pdb" % (cycle,mi)
if cycle > 0 :
badresids = xscorer.score(cnsin, phasedmtz, "FP", "FC", "PHIC", "2F1-F2") ## assess bad fit
#xrayRestGen = [ prepareChain.XrayRestraintsGenerator(phasedmtz, "FP", "FC", "PHIC", "2F1-F2", esmin, esmax, esmean ) ]
xranker = XrayRanker(phasedmtz, "FP", "FC", "PHIC", "2F1-F2", esmin, esmax)
xranker.rankChildren = 10 ; xranker.rankRecurse = 1 ; xranker.rankGivenEnsemble = None
ml = Multiloop(cnsin, badresids, mconly, options.caRad, options.scRad, options.scReduction, guidedsampling, options.popsize,
options.backtrack, 1, "pre."+rtkout, xrayRestGen, multiPrepC)
ml.ranker = xranker
nb = ml.run()
print mi, "multiloop built", nb, "model/s" ; assert nb > 0
if cycle == 0 : os.rename("pre."+rtkout, rtkout)
else :
badresids = findChangedSC(cnsin, "pre."+rtkout)
scPrepC = prepareChain.PrepareChain("PRL")
SCplacement("pre."+rtkout, options.scReduction, rtkout, "dotfile", None, phasedmtz, "FP", "FC", "PHIC", "2F1-F2", esmin, esmax, None, 1, badresids, scPrepC).run()
adjustBfac(rtkout, cnsin)
removeRElines(rtkout, ["^MODEL", "^ENDMDL",])
copyNonprotein(cnsin, rtkout)
joinpdbs.append(rtkout)
joinPDBs(rtkmodel, joinpdbs) ## all models pasted together, with occupancy fractionalized, extra ENDs removed, segids corrected
sfall(rtkmodel, "rfree.mtz", "phased.mtz")
phasedmtz, cnsout = "phased%d.mtz"%(cycle+1), "c%d.pdb"%(cycle+1),
cnsRefinement("phased.mtz", rtkmodel, phasedmtz, cnsout,
options.a, options.b, options.c, options.alpha, options.beta, options.gamma, options.sg, options.resolution, None,cycle)
newpdbs = []
for mi in range(options.esize) : newpdbs.append("c%dm%d.pdb" % (cycle+1,mi))
splitPDBs(cnsout, newpdbs)
for newpdb in newpdbs : restoreChainids(newpdb, "c0m0.pdb")
示例8: main
# 需要导入模块: from restraints import EDrestraint [as 别名]
# 或者: from restraints.EDrestraint import setScatRad [as 别名]
def main() :
import optparse ; parser = optparse.OptionParser()
parser.add_option("--scratchdir", action='store', type='string', dest='scratchdir', help='to create all the files during refinement. it shdnt be already present.')
parser.add_option("--pdb", action='store', type='string', dest='pdbfile', help='starting pdb containing a model of pdb-ligand complex')
parser.add_option("--debug", action='store', type='int', dest='debug', help='starting pdb containing a model of pdb-ligand complex')
parser.add_option("--hbdfile", action='store', type='string', dest='hbdfile', help='Hbond restraints to enfirce SS structure')
parser.add_option("--buildN2C", action='store', type='int', dest='buildN2C', help='by default, build from N to C terminal. build C->N if 0.', default=1)
parser.add_option("--map", action='store', type='string', dest='map', help='structure factors file')
parser.add_option("--init-map", action='store', type='string', dest='inimap', help='structure factors file',default=None)
parser.add_option("--resolution", action='store', type='float', dest='resolution', help='resolution of the data')
parser.add_option("--test", action='store', type='float', dest='test', help='resolution of the data',default =1.)
parser.add_option("--startcycle", action='store', type='int', dest='startcycle', help='Total number of RTK cycles',default=1)
parser.add_option("--stopcycle", action='store', type='int', dest='stopcycle', help='Total number of RTK cycles',default=50)
parser.add_option("--num-models-wanted", action='store', type='int', dest='nmodels', help='number of models desired, 100 attempts per model. DEFAULT 100', default=100)
parser.add_option("--sidechain-vdw-reduction", action='store', type='float', dest='scReduction', help='factor to reduce effective vdw dist in case of sidechains', default=1)
parser.add_option("--optional", action='store', type='int', dest='opt', help='Optional:0 , Not optional:1',default=0)
parser.add_option("--population-size", action='store', type='int', dest='popsize', help='population size for PopulationStrategy', default=100)
parser.add_option("--verbose", action='store', type='int', dest='verbose', help='0 means least verbosity etc.', default=0)
parser.add_option("--backtrack", action='store', type='string', dest='backtrack', help='use backtracking version of PopulationStrategy. eg 4X5 will set backtrack numsteps and stepsize to 4,5 respectively. not used by default.', default=None)
parser.add_option("--ca-restraint-radius", action='store', type='float', dest='caRad', help='radius of spherical restraint on CA position', default=1)
parser.add_option("--sc-centroid-restraint-radius", action='store', type='float', dest='scRad', help='radius of spherical restraint on sidechain centroid', default=2)
parser.add_option("--randomize", action='store', type='int', dest='randomize', help='seed for randomizing', default=None)
parser.add_option("--start", action='store', type='int', dest='start', help='start', default=None)
parser.add_option("--stop", action='store', type='int', dest='stop', help='stop', default=None)
parser.add_option("--mconly", action='store', type='int', dest='mconly', help='mconly:1', default=None)
parser.add_option("--ssfile", action='store', type='string', dest='ssfile', help='list of secondary structures, see applications/ssfile for example')
parser.add_option("--modelAll", action='store', type='int', dest='modelAll', help='Rebuiild only loop,set tp 1',default=0)
parser.add_option("--cutoff", action='store', type='float', dest='cutoff', help='CC cut off for flagginf mis-fit regions',default=None)
parser.add_option("--loopOnly", action='store', type='int', dest='loopOnly', help='Rebuiild only loop,set tp 1',default=0)
parser.add_option("--helicesOnly", action='store', type='int', dest='helicesOnly', help='Rebuiild only helices',default=0)
parser.add_option("--pre-process", action='store', type='int', dest='preProcess', help='Preprocessing bad regions to overcome possible local minima True:1 , False:0',default=0)
parser.add_option("--restoreSS", action='store', type='int', dest='restoreSS', help='Restore SS ? ',default=0)
parser.add_option("--use-midloop", action='store', type='int', dest='midloop', help='Use bridge building, True:1 , False:0',default=1)
parser.add_option("--rank", action='store', type='int', dest='ranker', help='Rank, True:1 , False:0',default=1)
### Additional homo infor
parser.add_option("--pir", action='store', type='string', dest='pirfile', help='pir file')
parser.add_option("--ensemble", action='store', type='string', dest='ensemble', help='make Ensemble',default=1)
parser.add_option("--clr", action='store', type='string', dest='clrfile', help='clr file')
parser.add_option("--use-choral", action='store', type='int', dest='choral', help='use choral',default=0)
parser.add_option("--pdbext", action='store', type='str', dest='pdbext', help='extension of template files [atm/ brk / pdb ] ?? ',default="pdb")
parser.add_option("--pdb-path", action='store', type='str', dest='pdbpath', help='directory containning the pdb files ',default='/home/anjum/')
parser.add_option("--band", action='store', type='int', dest='band', help='band ss elements ? ? ', default=None)
parser.add_option("--short_sidechain_restraint_threshold", action='store', type='float', dest='ssc_threshold', help='Restraint radii on short side chain atoms', default=1.5)
parser.add_option("--mainchain_restraint_threshold", action='store', type='float', dest='mc_threshold', help='Restraint radii on MC atoms', default=1.5)
parser.add_option("--params", action='store', type='string', dest='paramfile', help='parameter file')
parser.add_option("--modelfrag", action='store', type='string', dest='modelfrag', help='modelfrag?')
(options, args) = parser.parse_args()
import misc
misc.setVerbosity(options.verbose)
randomize(options.randomize)
if not os.path.isdir(options.scratchdir) : os.mkdir(options.scratchdir)
if options.ssfile !=None:
shutil.copyfile(options.ssfile,"%s/ssfile" % (options.scratchdir))
if options.hbdfile !=None:
shutil.copyfile(options.hbdfile,"%s/%s" % (options.scratchdir,options.hbdfile))
shutil.copyfile(options.pdbfile, "%s/model%d.pdb" % (options.scratchdir,options.startcycle-1))
ssList = [] ; resList = []
if options.clrfile !=None or options.pirfile !=None :
from homologyEM import main as homologymain
print options.clrfile
res, resids, resnums, resns, chids, inscodes, pts , resList ,start ,stop, params , msa = homologymain(options.scratchdir, options.pirfile , options.clrfile, options.paramfile, None, None , options.choral, None, None , options.verbose , options.mconly , options.pdbext , options.pdbpath , None , None , None , None , None , options.mc_threshold,options.ssc_threshold,None, 1)
else:
os.chdir(options.scratchdir)
### Values of params and i/o file names
guidedsampling = None
multiPrepC = prepareChain.PrepareChain("PRL")
popsize = options.popsize
#totcycles = options.totcycles
if options.cutoff == None:
if options.resolution == 10.0:
options.cutoff = 0.98
if options.resolution == 6.0:
options.cutoff = 0.97
from restraints import EDrestraint ; EDrestraint.setPenalty(5.) ; EDrestraint.setScatRad(1.) ;
esmin, esmax, esmean, rcmult, xscoreCutoff = .000, 5., .0, 1, options.cutoff
ranker = XrayRanker(options.map, "map", "FC", "PHIC", "F1", esmin, esmax)
xrayRestGen = []
#xrayRestGen.append( prepareChain.XrayRestraintsGenerator(options.map, "map", "FC", "PHIC", "F1", esmin, esmax, esmean, ["SCLbuilder","ChiBuilder","CBbuilder"], ) )
xrayRestGen.append( prepareChain.XrayRestraintsGenerator(options.map, "map", "FC", "PHIC", "F1", esmin, esmax, esmean, [], ) )
## make working directory and copy files over
#.........这里部分代码省略.........
示例9: main
# 需要导入模块: from restraints import EDrestraint [as 别名]
# 或者: from restraints.EDrestraint import setScatRad [as 别名]
def main() :
import optparse ; parser = optparse.OptionParser()
parser.add_option("--scratchdir", action='store', type='string', dest='scratchdir', help='to create all the files during refinement. it shdnt be already present.')
parser.add_option("--pdb", action='store', type='string', dest='pdbfile', help='starting pdb containing a model of pdb-ligand complex')
parser.add_option("--sf", action='store', type='string', dest='sf', help='structure factors file')
parser.add_option("--a", action='store', type='float', dest='a', help='cell dimension a')
parser.add_option("--b", action='store', type='float', dest='b', help='cell dimension b')
parser.add_option("--c", action='store', type='float', dest='c', help='cell dimension c')
parser.add_option("--alpha", action='store', type='float', dest='alpha', help='cell angle alpha')
parser.add_option("--beta", action='store', type='float', dest='beta', help='cell angle beta')
parser.add_option("--gamma", action='store', type='float', dest='gamma', help='cell angle gamma')
parser.add_option("--sg", action='store', type='string', dest='sg', help='cell spacegroup, in CCP4 notation')
parser.add_option("--resolution", action='store', type='float', dest='resolution', help='resolution of the data')
parser.add_option("--ca-restraint-radius", action='store', type='float', dest='caRad', help='radius of spherical restraint on CA position', default=1)
parser.add_option("--sc-centroid-restraint-radius", action='store', type='float', dest='scRad', help='radius of spherical restraint on sidechain centroid', default=2)
parser.add_option("--sidechain-vdw-reduction", action='store', type='float', dest='scReduction', help='factor to reduce effective vdw dist in case of sidechains', default=1)
parser.add_option("--population-size", action='store', type='int', dest='popsize', help='population size for PopulationStrategy', default=100)
parser.add_option("--verbose", action='store', type='int', dest='verbose', help='0 means least verbosity etc.', default=0)
parser.add_option("--backtrack", action='store', type='string', dest='backtrack', help='use backtracking version of PopulationStrategy. eg 4X5 will set backtrack numsteps and stepsize to 4,5 respectively. not used by default.', default=None)
parser.add_option("--noRTK", action='store', type='int', dest='noRTK', help='dont rebuild bad-fits with rtk', default=0)
parser.add_option("--randomize", action='store', type='int', dest='randomize', help='seed for randomizing', default=None)
parser.add_option("--loopres", action='store', type='string', dest='loopres', help='filename containing resids for starting perturbation', default=None)
parser.add_option("--framework", action='store', type='int', dest='framework', help='to be used in conjunction with loopres. it puts a 1/3 ca/sc pos restr on non-loopres and perturbs them too', default=None)
(options, args) = parser.parse_args()
import misc; misc.setVerbosity(options.verbose)
randomize(options.randomize)
if not os.path.isdir(options.scratchdir) : os.mkdir(options.scratchdir)
shutil.copyfile(options.pdbfile, "%s/model0.pdb" % options.scratchdir)
shutil.copyfile(options.sf, "%s/rfree.mtz" % options.scratchdir)
os.chdir(options.scratchdir)
#cif2mtz("strfactors.mtz", "base.mtz", options.a, options.b, options.c, options.alpha, options.beta, options.gamma, options.sg)
#uniqueify("base.mtz", "rfree.mtz")
esmin, esmax, esmean, rcmult, xscoreCutoff = .000, 5., .0, 5, 0.9
guidedsampling = None
multiPrepC = prepareChain.PrepareChain("SCL1.0")
numRefCycles = 10 ; startCycle = 0
from stump import getCRYST , getRESO
if (options.a == None or options.b == None or options.c == None or options.alpha == None or options.beta == None or options.gamma == None) :
print "Getting cell paramters from coordinate file....."
options.a,options.b,options.c,options.alpha , options.beta , options.gamma,d1 = getCRYST(options.pdbfile)
if (options.a == None or options.b == None or options.c == None or options.alpha== None or options.beta==None or options.gamma == None ):
print "CRYST card cannot be read from coordinate file. Please input cell paramater a, b , c , alpha, beta , gamma = ",options.a , options.b , options.c , options.alpha , options.beta , options.gamma
import sys ; sys.exit()
print "Found a b c alpha beta gamma ", options.a , options.b , options.c , options.alpha , options.beta , options.gamma
if options.sg == None :
print "Getting space group from coordinate file....."
d1,d2,d3,d4 , d5 , d6, options.sg = getCRYST(options.pdbfile)
if options.sg == None :
print "Please input space group " , options.sg ; import sys ; sys.exit()
ss = ""
for sg1 in options.sg:
if sg1 in ["\n","\t","\s"]:
continue
else :
ss = ss+sg1
options.sg = ss
print "Space Group ",options.sg
if options.sg in long2shortHM.keys():
shortsg = long2shortHM[options.sg]
options.sg = shortsg
if options.sg not in sgtable.keys():
print "Check --sg , Not recognised [%s][%d]"%( options.sg, len(options.sg))
import sys ; sys.exit()
if options.resolution == None :
print "Getting resolution limit from coordinate file........"
options.resolution = getRESO(options.pdbfile)
if (options.resolution == None):
print "Please input resolution " , options.resolution
import sys ; sys.exit()
print "Resolution = [ " , options.resolution, " ] "
from restraints import EDrestraint ; EDrestraint.setPenalty(2.) ; EDrestraint.setScatRad(1.) ;
for cycle in range(startCycle, numRefCycles) :
if cycle < 10 :
xscoreCutoff = 0.8
else :
xscoreCutoff = 0.9
xscorer = XrayScorer(None, xscoreCutoff) ; xrayRestGen = []
#.........这里部分代码省略.........