3 __doc__ =
'Build initial parameters files.'
7 from IMP
import OptionParser
11 usage =
"""%prog [options] <assembly name> <subunits file>
12 <coarse level> <density map> <resolution> <spacing> <density threshold>
13 <origin X> <origin Y> <origin Z>
15 Build the parameters files for MultiFit.
17 Notice: If you have negative numbers as input, add -- as the first parameter,
18 so that the numbers are not treated as options."""
21 parser.add_option(
"-i",
"--asmb_input", dest=
"asmb_input",
23 help=
"the name of the MultiFit input file. The default "
24 "filename is asmb.input")
25 parser.add_option(
"-m",
"--model", dest=
"model", default=
"asmb.model",
26 help=
"the base filename of the solutions output by "
27 "MultiFit (.X.pdb, where X is the solution number, "
28 "is suffixed to create each output file name). "
29 "The default filename is asmb.model")
30 parser.add_option(
"-a",
"--anchor_dir", dest=
"anchor_dir", default=
"./",
31 help=
"the name of the directory to store anchor points. "
33 parser.add_option(
"-f",
"--fit_dir", dest=
"fit_dir", default=
"./",
34 help=
"the name of the directory to store fitting "
35 "solutions. The default is ./")
36 (options, args) = parser.parse_args()
38 parser.error(
"incorrect number of arguments")
42 def get_density_data(name, density_fn, resolution, spacing, threshold,
43 origin, anchor_dir_name, fit_dir_name):
46 msg = sd.get_density_header_line()
47 msg += density_fn +
"|" + str(resolution) +
"|" + str(spacing) +
"|" + str(
48 threshold) +
"|" + str(origin[0]) +
"|" + str(origin[1]) +
"|" + str(origin[2])
49 msg +=
"|" + anchor_dir_name + name +
"_em_coarse_anchors.txt|" + \
50 anchor_dir_name + name +
"_em_coarse_anchors_FINE.txt|"
51 msg += anchor_dir_name + name +
"_em_fine_anchors.txt|" + \
52 anchor_dir_name + name +
"_em_fine_anchors_FINE.txt|\n"
65 msg = sd.get_component_header_line()
67 for i, fnn
in enumerate(open(pdb_list)):
68 name = fnn[:-1].split()[0]
69 fn = fnn[:-1].split()[1]
70 surface_fn = fnn[:-1].split()[1] +
".ms"
75 IMP.atom.RESIDUE_TYPE)) / coarse_level
76 msg += name +
"|" + fn +
"|" + surface_fn +
"|" + anchor_dir_name + \
77 name +
"_anchors.txt|" + str(num_anchors) +
"|"
78 msg += anchor_dir_name + name +
"_fine_anchors.txt|" + \
80 msg +=
"|" + fit_dir_name + name + fit_fn_header +
"|"
82 msg = msg + fn +
"|\n"
88 def create_alignment_param_file(asmb_name, coarse_level):
91 asmb_name +
".alignment.param")
93 asmb_name +
".alignment.param.refined")
96 def create_assembly_input_file(
97 pdb_list, coarse_level, anchor_dir, fit_dir, asmb_name,
98 density_map_fn, resolution, spacing, threshold,
101 fit_fn_header=
"_fitting.txt",
102 add_reference_fn=
False):
105 msg = msg + get_protein_data(
112 msg = msg + get_density_data(
113 asmb_name, density_map_fn, resolution, spacing,
114 threshold, origin, anchor_dir, fit_dir)
115 f = open(asmb_input_fn,
"w")
120 msg = msg + get_protein_data(
125 fit_fn_header +
".refined",
127 msg = msg + get_density_data(
128 asmb_name, density_map_fn, resolution, spacing,
129 threshold, origin, anchor_dir, fit_dir)
130 f = open(asmb_input_fn +
".refined",
"w")
136 options, args = parse_args()
139 coarse_level = int(args[2])
140 anchor_dir = options.anchor_dir
141 fit_dir = options.fit_dir
142 if not anchor_dir[-1] ==
"/":
144 if not fit_dir[-1] ==
"/":
147 density_map_fn = args[3]
148 resolution = float(args[4])
151 origin = [float(args[7]), float(args[8]), float(args[9])]
152 create_assembly_input_file(
153 pdb_list, coarse_level, anchor_dir, fit_dir, asmb_name,
154 density_map_fn, resolution, spacing, threshold,
155 origin, options.asmb_input)
157 create_alignment_param_file(asmb_name, coarse_level)
160 if __name__ ==
"__main__":
Hierarchies get_by_type(Hierarchy mhd, GetByType t)
See IMP.multifit for more information.
Holds header data for optimization.
std::string get_data_path(std::string file_name)
Return the full path to installed data.
IMP::kernel::OptionParser OptionParser
void read_pdb(base::TextInput input, int model, Hierarchy h)
Class for storing model, its restraints, constraints, and particles.