7 def readParameters(parameterFileName):
10 parameterFh = open(parameterFileName)
11 blankRe = re.compile(
'^\s*$')
12 skipRe = re.compile(
'^\#')
13 for line
in parameterFh:
15 blankLine = blankRe.search(line)
18 skipLine = skipRe.search(line)
22 line = line.rstrip(
"\n\r")
23 [paramName, paramValue] = line.split(
'\t')
24 print "parameter %s:\t%s" % (paramName, paramValue)
25 parameters[paramName] = paramValue
35 def quickParticleName(particle):
37 atomName = atomDecorator.get_atom_type()
41 residueNumber = residue.get_index()
44 chainId = chain.get_id()
46 name =
"%s_%s_%s" % (chainId, residueNumber, atomName)
47 nameFinal = name.replace(
'"',
'')
54 def makeNamesToParticles(protein):
59 name = quickParticleName(leaf)
60 namesToParticles[name] = leaf
62 return namesToParticles
67 def getAtomInfoFromName(particleName):
68 [chain, residue, atom] = particleName.split(
"_")
69 return [chain, residue, atom]
74 def makeParticleName(chain, residueNumber, atomName):
75 return "%s_%s_%s" % (chain, residueNumber, atomName)
79 def isAtomParticle(p):
81 if (p.get_name().find(
'_') == -1):
88 def getRestrainedParticles(protein, model, namesToParticles):
93 for r
in IMP.get_restraints([model.get_root_restraint_set()]):
95 ps = r.get_input_particles()
98 if (isAtomParticle(p) == 0):
100 name = quickParticleName(p)
102 particleDict[name] = 1
103 score = r.evaluate(0)
105 restrainedParticles = []
106 for name
in particleDict.keys():
107 p = namesToParticles[name]
108 restrainedParticles.append(p)
110 return restrainedParticles
113 def getMdIntervalFrames(rh, interval, protein):
116 frameCount = IMP.rmf.get_number_of_frames(rh, protein)
117 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.
static Atom decorate_particle(::IMP::kernel::Particle *p)
Hierarchies get_leaves(const Selection &h)