1 from __future__
import print_function
6 def readParameters(parameterFileName):
9 parameterFh = open(parameterFileName)
10 blankRe = re.compile(
r'^\s*$')
11 skipRe = re.compile(
r'^\#')
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
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
69 def getAtomInfoFromName(particleName):
70 [chain, residue, atom] = particleName.split(
"_")
71 return [chain, residue, atom]
76 def makeParticleName(chain, residueNumber, atomName):
77 return "%s_%s_%s" % (chain, residueNumber, atomName)
81 def isAtomParticle(p):
83 if (p.get_name().find(
'_') == -1):
90 def getRestrainedParticles(protein, model, namesToParticles):
95 ps = r.get_input_particles()
98 if (isAtomParticle(p) == 0):
100 name = quickParticleName(p)
102 particleDict[name] = 1
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)
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)