3 __doc__ =
"Generate a suitable parameter file for build_models."
6 from IMP
import ArgumentParser
11 A script that builds the parameters file for symmetric MultiFit.
13 Notice: If you have negative numbers as input, add -- as the first parameter,
14 so that the numbers are not treated as options."""
16 p = ArgumentParser(description=desc)
17 p.add_argument(
"-o",
"--out", dest=
"out", default=
"multifit.output",
19 help=
"the name of the MultiFit output file. The default "
20 "filename is multifit.output")
21 p.add_argument(
"-i",
"--med", dest=
"med", metavar=
"FILE", default=
"",
22 help=
"Print intermediate results to the named file.")
23 p.add_argument(
"-p",
"--params", dest=
"params", default=
"multifit.param",
24 help=
"the name of the MultiFit parameters file. The "
25 "default filename is multifit.param")
26 p.add_argument(
"-m",
"--model", dest=
"model", default=
"asmb.model",
27 help=
"the base filename of the solutions output by "
28 "MultiFit (.X.pdb, where X is the solution number, "
29 "is suffixed to create each output file name). "
30 "The default filename is asmb.model")
31 p.add_argument(
"-n",
"--numsols", dest=
"numsols", default=10, type=int,
32 help=
"the number of solutions(fits) to report; "
34 p.add_argument(
"degree", type=int, help=
"cyclic symmetry degree")
35 p.add_argument(
"monomer", help=
"monomer PDB file name")
36 p.add_argument(
"density", help=
"density map file name")
37 p.add_argument(
"resolution", type=float,
38 help=
"density map resolution, in angstroms")
39 p.add_argument(
"spacing", type=float,
40 help=
"density map voxel spacing, in angstroms")
41 p.add_argument(
"threshold", type=float,
42 help=
"the threshold of the density map, used for "
44 p.add_argument(
"origin_x", type=float,
45 help=
"density map origin X coordinate")
46 p.add_argument(
"origin_y", type=float,
47 help=
"density map origin Y coordinate")
48 p.add_argument(
"origin_z", type=float,
49 help=
"density map origin Z coordinate")
53 def get_files_data(monomer_fn, intermediate_fn, output_fn, model_fn):
54 monomer_ms_fn = monomer_fn +
".ms"
56 msg +=
"monomer = " + monomer_fn +
"\n"
57 msg +=
"surface = " + monomer_ms_fn +
"\n"
59 msg +=
"output = " + output_fn +
"\n"
60 msg +=
"model = " + model_fn +
"\n"
61 if intermediate_fn !=
"":
62 msg +=
"intermediate = " + intermediate_fn +
"\n"
66 def get_symmetry_data(cn_units, dn_units):
67 msg =
"\n[symmetry]\n"
68 msg +=
"; Cyclic symmetry (trimer=3, tetramer=4, etc.)\n"
69 msg +=
"cn = " + str(cn_units) +
"\n"
70 msg +=
"; Dihedral symmetry\n"
71 msg +=
"dn = " + str(dn_units) +
"\n"
75 def get_scoring_data(liberal=True):
82 ; the ratio of the low scoring transforms to be removed
83 small_interface_ratio = 0.1
84 ; maximal allowed penetration between molecule surfaces
86 ; normal score threshold
88 ; scoring weights for ranges [-5.0,-3.6], [-3.6,-2.2], [-2.2,-1.0],
89 ; [-1.0,1.0], [1.0-up] respectively
99 def get_density_data(density_map_fn, resolution, spacing,
100 threshold, pca_matching_thr, origin):
103 ; the density map in MRC format
105 ; the resolution of the density map in A
107 ; the voxel spacing of the density in A
109 ; the origin of the map
113 ; the threshold of the density map, used for PCA matching
115 ; corresponding principal components whose eigenvalues differ in less than
116 ; pca_matching_threshold are considered to be a match
117 pca_matching_threshold = %s
118 """ % (density_map_fn, resolution, spacing, origin[0], origin[1], origin[2],
119 threshold, pca_matching_thr)
123 def get_clustering_data():
127 axis_angle_threshold = 18
129 ; distance between centers of mass
154 def get_surface_data():
157 ; threshold for surface pruning, i.e. no 2 points with distance below this
158 ; value are left for matching
164 def get_fitting_data(num_sols):
167 ; number of solutions to fit
175 cn_units = args.degree
179 unit_pdb_fn = args.monomer
180 density_map_fn = args.density
181 resolution = args.resolution
182 spacing = args.spacing
183 threshold = args.threshold
184 origin = [args.origin_x, args.origin_y, args.origin_z]
186 pca_matching_thr = 15
188 pca_matching_thr = resolution * 0.75
189 params_fn = args.params
190 intermediate_fn = args.med
192 model_fn = args.model
193 f = open(params_fn,
"w")
194 f.write(get_files_data(unit_pdb_fn, intermediate_fn, output_fn, model_fn))
195 f.write(get_symmetry_data(cn_units, dn_units))
196 f.write(get_scoring_data(liberal))
197 f.write(get_density_data(density_map_fn, resolution, spacing, threshold,
198 pca_matching_thr, origin))
199 f.write(
"\n\n; ####### Advanced Parameters #######\n")
200 f.write(get_clustering_data())
201 f.write(get_base_data())
202 f.write(get_grid_data())
203 f.write(get_surface_data())
204 f.write(get_fitting_data(args.numsols))
208 if __name__ ==
"__main__":
Fitting atomic structures into a cryo-electron microscopy density map.
std::string get_data_path(std::string file_name)
Return the full path to one of this module's data files.