1 from __future__
import print_function
8 def readParameters(parameterFileName):
11 parameterFh = open(parameterFileName)
12 blankRe = re.compile(
'^\s*$')
13 skipRe = re.compile(
'^\#')
14 for line
in parameterFh:
16 blankLine = blankRe.search(line)
19 skipLine = skipRe.search(line)
23 line = line.rstrip(
"\n\r")
24 [paramName, paramValue] = line.split(
'\t')
25 print(
"parameter %s:\t%s" % (paramName, paramValue))
26 parameters[paramName] = paramValue
36 def quickParticleName(particle):
38 atomName = atomDecorator.get_atom_type()
42 residueNumber = residue.get_index()
45 chainId = chain.get_id()
47 name =
"%s_%s_%s" % (chainId, residueNumber, atomName)
48 nameFinal = name.replace(
'"',
'')
55 def makeNamesToParticles(protein):
60 name = quickParticleName(leaf)
61 namesToParticles[name] = leaf
63 return namesToParticles
68 def getAtomInfoFromName(particleName):
69 [chain, residue, atom] = particleName.split(
"_")
70 return [chain, residue, atom]
75 def makeParticleName(chain, residueNumber, atomName):
76 return "%s_%s_%s" % (chain, residueNumber, atomName)
80 def isAtomParticle(p):
82 if (p.get_name().find(
'_') == -1):
89 def getRestrainedParticles(protein, model, namesToParticles):
96 ps = r.get_input_particles()
99 if (isAtomParticle(p) == 0):
101 name = quickParticleName(p)
103 particleDict[name] = 1
104 score = r.evaluate(0)
106 restrainedParticles = []
107 for name
in particleDict.keys():
108 p = namesToParticles[name]
109 restrainedParticles.append(p)
111 return restrainedParticles
114 def getMdIntervalFrames(rh, interval, protein):
117 frameCount = IMP.rmf.get_number_of_frames(rh, protein)
118 for i
in range(1, frameCount, interval):
Chain get_chain(Hierarchy h)
Hierarchy get_residue(Hierarchy mhd, unsigned int index)
Get the residue with the specified index.
A decorator for a particle representing an atom.
RestraintsTemp get_restraints(It b, It e)
Hierarchies get_leaves(const Selection &h)