IMP logo
IMP Reference Guide  2.5.0
The Integrative Modeling Platform
models.py
1 #!/usr/bin/env python
2 
3 from __future__ import print_function
4 import IMP.multifit
5 from IMP import OptionParser
6 
7 __doc__ = "Write output models as PDB files."
8 
9 # analyse the ensemble, first we will do the rmsd stuff
10 
11 def parse_args():
12  usage = """%prog [options] <asmb.input> <proteomics.input>
13  <mapping.input> <combinations> <model prefix>
14 
15 Write output models.
16 """
17  parser = OptionParser(usage)
18  parser.add_option("-m", "--max", type="int", dest="max", default=None,
19  help="maximum number of models to write")
20  (options, args) = parser.parse_args()
21  if len(args) != 5:
22  parser.error("incorrect number of arguments")
23  return options, args
24 
25 
26 def run(asmb_fn, proteomics_fn, mapping_fn, combs_fn, model_output, max_comb):
27  # get rmsd for subunits
28  mdl = IMP.Model()
29  combs = IMP.multifit.read_paths(combs_fn)
30  sd = IMP.multifit.read_settings(asmb_fn)
31  sd.set_was_used(True)
32  prot_data = IMP.multifit.read_proteomics_data(proteomics_fn)
33  mapping_data = IMP.multifit.read_protein_anchors_mapping(prot_data,
34  mapping_fn)
35  ensmb = IMP.multifit.load_ensemble(sd, mdl, mapping_data)
36  mhs = ensmb.get_molecules()
37  print("number of combinations:", len(combs), max_comb)
38  for i, comb in enumerate(combs[:max_comb]):
39  if i % 500 == 0:
40  print(i)
41  ensmb.load_combination(comb)
42  print(model_output + "." + str(i) + ".pdb")
43  IMP.atom.write_pdb(mhs, model_output + "." + str(i) + ".pdb")
44  ensmb.unload_combination(comb)
45 
46 
47 def main():
48  options, args = parse_args()
49  run(args[0], args[1], args[2], args[3], args[4], options.max)
50 
51 if __name__ == "__main__":
52  main()
void write_pdb(const Selection &mhd, TextOutput out, unsigned int model=1)
SettingsData * read_settings(const char *filename)
ProteinsAnchorsSamplingSpace read_protein_anchors_mapping(multifit::ProteomicsData *prots, const std::string &anchors_prot_map_fn, int max_paths=INT_MAX)
Class for storing model, its restraints, constraints, and particles.
Definition: Model.h:72
Ensemble * load_ensemble(multifit::SettingsData *sd, Model *mdl, const ProteinsAnchorsSamplingSpace &mapping_data)
Fitting atomic structures into a cryo-electron microscopy density map.
ProteomicsData * read_proteomics_data(const char *proteomics_fn)
Proteomics reader.
IntsList read_paths(const char *txt_filename, int max_paths=INT_MAX)
Read paths.