3 __doc__ =
"Generate a suitable parameter file for build_models."
6 from IMP
import OptionParser
9 usage =
"""%prog [options] <cyclic symmetry degree>
10 <monomer PDB file> <density map> <resolution> <spacing>
11 <density threshold> <origin X> <origin Y> <origin Z>
13 A script that builds the parameters file for symmetric MultiFit.
15 Notice: If you have negative numbers as input, add -- as the first parameter,
16 so that the numbers are not treated as options."""
19 parser.add_option(
"-o",
"--out", dest=
"out",default=
"multifit.output",
21 help=
"the name of the MultiFit output file. The default "
22 "filename is multifit.output")
23 parser.add_option(
"-i",
"--med", dest=
"med", metavar=
"FILE", default=
"",
24 help=
"Print intermediate results to the named file.")
25 parser.add_option(
"-p",
"--params", dest=
"params",default=
"multifit.param",
26 help=
"the name of the MultiFit parameters file. The "
27 "default filename is multifit.params")
28 parser.add_option(
"-m",
"--model", dest=
"model",default=
"asmb.model",
29 help=
"the base filename of the solutions output by "
30 "MultiFit (.X.pdb, where X is the solution number, "
31 "is suffixed to create each output file name). "
32 "The default filename is asmb.model")
33 parser.add_option(
"-n",
"--numsols", dest=
"numsols",default=10, type=
"int",
34 help=
"the number of solutions(fits) to report; "
36 (options, args) = parser.parse_args()
38 parser.error(
"incorrect number of arguments")
41 def get_files_data(monomer_fn, intermediate_fn, output_fn, model_fn):
42 monomer_ms_fn=monomer_fn+
".ms"
44 msg+=
"monomer = "+monomer_fn+
"\n"
45 msg+=
"surface = "+monomer_ms_fn+
"\n"
47 msg +=
"output = "+output_fn+
"\n"
48 msg +=
"model = "+model_fn+
"\n"
49 if intermediate_fn !=
"":
50 msg +=
"intermediate = "+intermediate_fn+
"\n"
55 def get_symmetry_data(cn_units,dn_units):
57 msg+=
"; Cyclic symmetry (trimer=3, tetramer=4, etc.)\n"
58 msg+=
"cn = "+str(cn_units)+
"\n"
59 msg+=
"; Dihedral symmetry\n"
60 msg+=
"dn = "+str(dn_units)+
"\n"
63 def get_scoring_data(liberal=True):
70 ; the ratio of the low scoring transforms to be removed
71 small_interface_ratio = 0.1
72 ; maximal allowed penetration between molecule surfaces
74 ; normal score threshold
76 ; scoring weights for ranges [-5.0,-3.6], [-3.6,-2.2], [-2.2,-1.0],
77 ; [-1.0,1.0], [1.0-up] respectively
86 def get_density_data(density_map_fn,resolution,spacing,
87 threshold,pca_matching_thr,origin):
90 ; the density map in MRC format
92 ; the resolution of the density map in A
94 ; the voxel spacing of the density in A
96 ; the origin of the map
100 ; the threshold of the density map, used for PCA matching
102 ; corresponding principal components whose eigenvalues differ in less than
103 ; pca_matching_threshold are considered to be a match
104 pca_matching_threshold = %s
105 """ % (density_map_fn, resolution, spacing, origin[0], origin[1], origin[2],
106 threshold, pca_matching_thr)
109 def get_clustering_data():
113 axis_angle_threshold = 18
115 ; distance between centers of mass
137 def get_surface_data():
140 ; threshold for surface pruning, i.e. no 2 points with distance below this
141 ; value are left for matching
146 def get_fitting_data(num_sols):
149 ; number of solutions to fit
155 options,args = usage()
156 cn_units = int(args[0])
160 unit_pdb_fn = args[1]
161 density_map_fn = args[2]
162 resolution=float(args[3])
169 pca_matching_thr=resolution*0.75
170 params_fn=options.params
171 intermediate_fn=options.med
172 log_fn=
"multifit.log"
173 output_fn=options.out
174 model_fn=options.model
175 f=open(params_fn,
"w")
176 f.write(get_files_data(unit_pdb_fn, intermediate_fn, output_fn, model_fn))
177 f.write(get_symmetry_data(cn_units,dn_units))
178 f.write(get_scoring_data(liberal))
179 f.write(get_density_data(density_map_fn,resolution,spacing,threshold,
180 pca_matching_thr,origin))
181 f.write(
"\n\n; ####### Advanced Parameters #######\n")
182 f.write(get_clustering_data())
183 f.write(get_base_data())
184 f.write(get_grid_data())
185 f.write(get_surface_data())
186 f.write(get_fitting_data(options.numsols))
189 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