IMP  2.0.0
The Integrative Modeling Platform
models.py
1 #!/usr/bin/env python
2 
3 __doc__ = "Write output models as PDB files."
4 
5 #analyse the ensemble, first we will do the rmsd stuff
6 import IMP.multifit
7 from optparse import OptionParser
8 
9 def parse_args():
10  usage = """%prog [options] <asmb.input> <proteomics.input>
11  <mapping.input> <combinations> <model prefix>
12 
13 Write output models.
14 """
15  parser = OptionParser(usage)
16  parser.add_option("-m", "--max", type="int", dest="max", default=None,
17  help="maximum number of models to write")
18  (options, args) = parser.parse_args()
19  if len(args) != 5:
20  parser.error("incorrect number of arguments")
21  return options,args
22 
23 def run(asmb_fn,proteomics_fn,mapping_fn,combs_fn,model_output,max_comb):
24  #get rmsd for subunits
25  mdl=IMP.Model()
26  combs=IMP.multifit.read_paths(combs_fn)
27  sd=IMP.multifit.read_settings(asmb_fn)
28  sd.set_was_used(True)
29  prot_data=IMP.multifit.read_proteomics_data(proteomics_fn)
30  mapping_data=IMP.multifit.read_protein_anchors_mapping(prot_data,
31  mapping_fn)
32  ensmb=IMP.multifit.load_ensemble(sd,mdl,mapping_data)
33  mhs=ensmb.get_molecules()
34  print "number of combinations:",len(combs),max_comb
35  for i,comb in enumerate(combs[:max_comb]):
36  if i%500==0:
37  print i
38  ensmb.load_combination(comb)
39  print model_output+"."+str(i)+".pdb"
40  IMP.atom.write_pdb(mhs,model_output+"."+str(i)+".pdb")
41  ensmb.unload_combination(comb)
42 
43 def main():
44  options,args = parse_args()
45  run(args[0],args[1],args[2],args[3],args[4],options.max)
46 
47 if __name__ == "__main__":
48  main()