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."""
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"
60 def get_symmetry_data(cn_units, dn_units):
61 msg =
"\n[symmetry]\n"
62 msg +=
"; Cyclic symmetry (trimer=3, tetramer=4, etc.)\n"
63 msg +=
"cn = " + str(cn_units) +
"\n"
64 msg +=
"; Dihedral symmetry\n"
65 msg +=
"dn = " + str(dn_units) +
"\n"
69 def get_scoring_data(liberal=True):
76 ; the ratio of the low scoring transforms to be removed
77 small_interface_ratio = 0.1
78 ; maximal allowed penetration between molecule surfaces
80 ; normal score threshold
82 ; scoring weights for ranges [-5.0,-3.6], [-3.6,-2.2], [-2.2,-1.0],
83 ; [-1.0,1.0], [1.0-up] respectively
93 def get_density_data(density_map_fn, resolution, spacing,
94 threshold, pca_matching_thr, origin):
97 ; the density map in MRC format
99 ; the resolution of the density map in A
101 ; the voxel spacing of the density in A
103 ; the origin of the map
107 ; the threshold of the density map, used for PCA matching
109 ; corresponding principal components whose eigenvalues differ in less than
110 ; pca_matching_threshold are considered to be a match
111 pca_matching_threshold = %s
112 """ % (density_map_fn, resolution, spacing, origin[0], origin[1], origin[2],
113 threshold, pca_matching_thr)
117 def get_clustering_data():
121 axis_angle_threshold = 18
123 ; distance between centers of mass
148 def get_surface_data():
151 ; threshold for surface pruning, i.e. no 2 points with distance below this
152 ; value are left for matching
158 def get_fitting_data(num_sols):
161 ; number of solutions to fit
168 options, args = usage()
169 cn_units = int(args[0])
173 unit_pdb_fn = args[1]
174 density_map_fn = args[2]
175 resolution = float(args[3])
180 pca_matching_thr = 15
182 pca_matching_thr = resolution * 0.75
183 params_fn = options.params
184 intermediate_fn = options.med
185 log_fn =
"multifit.log"
186 output_fn = options.out
187 model_fn = options.model
188 f = open(params_fn,
"w")
189 f.write(get_files_data(unit_pdb_fn, intermediate_fn, output_fn, model_fn))
190 f.write(get_symmetry_data(cn_units, dn_units))
191 f.write(get_scoring_data(liberal))
192 f.write(get_density_data(density_map_fn, resolution, spacing, threshold,
193 pca_matching_thr, origin))
194 f.write(
"\n\n; ####### Advanced Parameters #######\n")
195 f.write(get_clustering_data())
196 f.write(get_base_data())
197 f.write(get_grid_data())
198 f.write(get_surface_data())
199 f.write(get_fitting_data(options.numsols))
202 if __name__ ==
"__main__":
See IMP.multifit for more information.
std::string get_data_path(std::string file_name)
Return the full path to installed data.
IMP::kernel::OptionParser OptionParser