3 __doc__ =
"Generate a suitable parameter file for build_models."
6 from IMP
import OptionParser
10 usage =
"""%prog [options] <cyclic symmetry degree>
11 <monomer PDB file> <density map> <resolution> <spacing>
12 <density threshold> <origin X> <origin Y> <origin Z>
14 A script that builds the parameters file for symmetric MultiFit.
16 Notice: If you have negative numbers as input, add -- as the first parameter,
17 so that the numbers are not treated as options."""
19 parser = OptionParser(usage)
20 parser.add_option(
"-o",
"--out", dest=
"out", default=
"multifit.output",
22 help=
"the name of the MultiFit output file. The default "
23 "filename is multifit.output")
24 parser.add_option(
"-i",
"--med", dest=
"med", metavar=
"FILE", default=
"",
25 help=
"Print intermediate results to the named file.")
27 "-p",
"--params", dest=
"params", default=
"multifit.param",
28 help=
"the name of the MultiFit parameters file. The "
29 "default filename is multifit.params")
30 parser.add_option(
"-m",
"--model", dest=
"model", default=
"asmb.model",
31 help=
"the base filename of the solutions output by "
32 "MultiFit (.X.pdb, where X is the solution number, "
33 "is suffixed to create each output file name). "
34 "The default filename is asmb.model")
36 "-n",
"--numsols", dest=
"numsols", default=10, type=
"int",
37 help=
"the number of solutions(fits) to report; "
39 (options, args) = parser.parse_args()
41 parser.error(
"incorrect number of arguments")
45 def get_files_data(monomer_fn, intermediate_fn, output_fn, model_fn):
46 monomer_ms_fn = monomer_fn +
".ms"
48 msg +=
"monomer = " + monomer_fn +
"\n"
49 msg +=
"surface = " + monomer_ms_fn +
"\n"
51 msg +=
"output = " + output_fn +
"\n"
52 msg +=
"model = " + model_fn +
"\n"
53 if intermediate_fn !=
"":
54 msg +=
"intermediate = " + intermediate_fn +
"\n"
58 def get_symmetry_data(cn_units, dn_units):
59 msg =
"\n[symmetry]\n"
60 msg +=
"; Cyclic symmetry (trimer=3, tetramer=4, etc.)\n"
61 msg +=
"cn = " + str(cn_units) +
"\n"
62 msg +=
"; Dihedral symmetry\n"
63 msg +=
"dn = " + str(dn_units) +
"\n"
67 def get_scoring_data(liberal=True):
74 ; the ratio of the low scoring transforms to be removed
75 small_interface_ratio = 0.1
76 ; maximal allowed penetration between molecule surfaces
78 ; normal score threshold
80 ; scoring weights for ranges [-5.0,-3.6], [-3.6,-2.2], [-2.2,-1.0],
81 ; [-1.0,1.0], [1.0-up] respectively
91 def get_density_data(density_map_fn, resolution, spacing,
92 threshold, pca_matching_thr, origin):
95 ; the density map in MRC format
97 ; the resolution of the density map in A
99 ; the voxel spacing of the density in A
101 ; the origin of the map
105 ; the threshold of the density map, used for PCA matching
107 ; corresponding principal components whose eigenvalues differ in less than
108 ; pca_matching_threshold are considered to be a match
109 pca_matching_threshold = %s
110 """ % (density_map_fn, resolution, spacing, origin[0], origin[1], origin[2],
111 threshold, pca_matching_thr)
115 def get_clustering_data():
119 axis_angle_threshold = 18
121 ; distance between centers of mass
146 def get_surface_data():
149 ; threshold for surface pruning, i.e. no 2 points with distance below this
150 ; value are left for matching
156 def get_fitting_data(num_sols):
159 ; number of solutions to fit
166 options, args = usage()
167 cn_units = int(args[0])
171 unit_pdb_fn = args[1]
172 density_map_fn = args[2]
173 resolution = float(args[3])
178 pca_matching_thr = 15
180 pca_matching_thr = resolution * 0.75
181 params_fn = options.params
182 intermediate_fn = options.med
183 log_fn =
"multifit.log"
184 output_fn = options.out
185 model_fn = options.model
186 f = open(params_fn,
"w")
187 f.write(get_files_data(unit_pdb_fn, intermediate_fn, output_fn, model_fn))
188 f.write(get_symmetry_data(cn_units, dn_units))
189 f.write(get_scoring_data(liberal))
190 f.write(get_density_data(density_map_fn, resolution, spacing, threshold,
191 pca_matching_thr, origin))
192 f.write(
"\n\n; ####### Advanced Parameters #######\n")
193 f.write(get_clustering_data())
194 f.write(get_base_data())
195 f.write(get_grid_data())
196 f.write(get_surface_data())
197 f.write(get_fitting_data(options.numsols))
200 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.