6 def readParameters(parameterFileName):
9 parameterFh = open(parameterFileName)
10 blankRe = re.compile(
'^\s*$')
11 skipRe = re.compile(
'^\#')
12 for line
in parameterFh:
14 blankLine = blankRe.search(line)
17 skipLine = skipRe.search(line)
21 line = line.rstrip(
"\n\r")
22 [paramName, paramValue] = line.split(
'\t')
23 print "parameter %s:\t%s" % (paramName, paramValue)
24 parameters[paramName] = paramValue
32 def quickParticleName(particle):
34 atomName = atomDecorator.get_atom_type()
38 residueNumber = residue.get_index()
41 chainId = chain.get_id()
43 name =
"%s_%s_%s" % (chainId, residueNumber, atomName)
44 nameFinal = name.replace(
'"',
'')
49 def makeNamesToParticles(protein):
54 name = quickParticleName(leaf)
55 namesToParticles[name] = leaf
57 return namesToParticles
62 def getAtomInfoFromName(particleName):
63 [chain, residue, atom] = particleName.split(
"_")
64 return [chain, residue, atom]
67 def makeParticleName(chain, residueNumber, atomName):
68 return "%s_%s_%s" % (chain, residueNumber, atomName)
72 def isAtomParticle(p):
73 if (p.get_name().find(
'_') == -1):
80 def getRestrainedParticles(protein, model, namesToParticles):
85 for r
in IMP.get_restraints([model.get_root_restraint_set()]):
87 ps = r.get_input_particles()
90 if (isAtomParticle(p) == 0):
92 name = quickParticleName(p)
93 particleDict[name] = 1
96 restrainedParticles = []
97 for name
in particleDict.keys():
98 p = namesToParticles[name]
99 restrainedParticles.append(p)
101 return restrainedParticles
103 def getMdIntervalFrames(rh, interval, protein):
106 frameCount = IMP.rmf.get_number_of_frames(rh, protein)
107 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)