IMP logo
IMP Reference Guide  2.21.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 ArgumentParser
6 
7 __doc__ = "Write output models as PDB files."
8 
9 # analyse the ensemble, first we will do the rmsd stuff
10 
11 
12 def parse_args():
13  desc = """Write output models."""
14  p = ArgumentParser(description=desc)
15  p.add_argument("-m", "--max", type=int, dest="max", default=None,
16  help="maximum number of models to write")
17  p.add_argument("assembly_file", help="assembly file name")
18  p.add_argument("proteomics_file", help="proteomics file name")
19  p.add_argument("mapping_file", help="mapping file name")
20  p.add_argument("combinations_file", help="combinations file name")
21  p.add_argument("model_prefix", help="model output file name prefix")
22  return p.parse_args()
23 
24 
25 def run(asmb_fn, proteomics_fn, mapping_fn, combs_fn, model_output, max_comb):
26  # get rmsd for subunits
27  mdl = IMP.Model()
28  combs = IMP.multifit.read_paths(combs_fn)
29  sd = IMP.multifit.read_settings(asmb_fn)
30  sd.set_was_used(True)
31  prot_data = IMP.multifit.read_proteomics_data(proteomics_fn)
32  mapping_data = IMP.multifit.read_protein_anchors_mapping(prot_data,
33  mapping_fn)
34  ensmb = IMP.multifit.load_ensemble(sd, mdl, mapping_data)
35  mhs = ensmb.get_molecules()
36  print("number of combinations:", len(combs), max_comb)
37  for i, comb in enumerate(combs[:max_comb]):
38  if i % 500 == 0:
39  print(i)
40  ensmb.load_combination(comb)
41  print(model_output + "." + str(i) + ".pdb")
42  IMP.atom.write_pdb(mhs, model_output + "." + str(i) + ".pdb")
43  ensmb.unload_combination(comb)
44 
45 
46 def main():
47  args = parse_args()
48  run(args.assembly_file, args.proteomics_file, args.mapping_file,
49  args.combinations_file, args.model_prefix, args.max)
50 
51 
52 if __name__ == "__main__":
53  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:86
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.