5 def readParameters(parameterFileName):
8 parameterFh = open(parameterFileName)
9 blankRe = re.compile(
r'^\s*$')
10 skipRe = re.compile(
r'^\#')
11 for line
in parameterFh:
13 blankLine = blankRe.search(line)
16 skipLine = skipRe.search(line)
20 line = line.rstrip(
"\n\r")
21 [paramName, paramValue] = line.split(
'\t')
22 print(
"parameter %s:\t%s" % (paramName, paramValue))
23 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
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):
94 ps = r.get_input_particles()
97 if (isAtomParticle(p) == 0):
99 name = quickParticleName(p)
101 particleDict[name] = 1
104 restrainedParticles = []
105 for name
in particleDict.keys():
106 p = namesToParticles[name]
107 restrainedParticles.append(p)
109 return restrainedParticles
112 def getMdIntervalFrames(rh, interval, protein):
115 frameCount = IMP.rmf.get_number_of_frames(rh, protein)
116 for i
in range(1, frameCount, interval):
Chain get_chain(Hierarchy h)
Get the containing chain or Chain() if there is none.
A decorator for a particle representing an atom.
RestraintsTemp get_restraints(It b, It e)
Residue get_residue(Atom d, bool nothrow=false)
Return the Residue containing this atom.
Hierarchies get_leaves(const Selection &h)