22 #include <utility/vector0.hh>
23 #include <utility/vector1.hh>
24 #include <utility/io/ozstream.hh>
25 #include <utility/tag/Tag.hh>
27 #include <numeric/xyz.functions.hh>
28 #include <numeric/color_util.hh>
30 #include <utility/excn/Exceptions.hh>
53 return "RenderGridsToKinemage";
68 protocols::moves::Mover(
"RenderGridsToKinemage"),
81 protocols::moves::Mover(mover),
82 filename_(mover.filename_),
83 color_mode_(mover.color_mode_),
84 gradient_bins_(mover.gradient_bins_),
85 stride_(mover.stride_),
86 grid_name_(mover.grid_name_),
88 low_color_(mover.low_color_),
89 zero_color_(mover.zero_color_),
90 high_color_(mover.high_color_),
91 color_data_(mover.color_data_),
109 return "RenderGridsToKinemage";
119 utility::io::izstream infile;
122 infile >> first_word;
125 utility::io::ozstream outfile;
126 if(first_word ==
"@kinemage")
150 if(!tag->hasOption(
"grid_name"))
152 throw utility::excn::EXCN_RosettaScriptsOption(
"RenderGridsToKinemage requires the'grid name' option");
159 throw utility::excn::EXCN_RosettaScriptsOption(
"RenderGridsToKinemage is currently unable to output the contents of a metagrid. Sorry.");
162 if(!tag->hasOption(
"file_name"))
164 throw utility::excn::EXCN_RosettaScriptsOption(
"RenderGridsToKinemage requires the 'file_name' option");
168 if(!tag->hasOption(
"low_color") && !tag->hasOption(
"zero_color") && !tag->hasOption(
"high_color"))
170 if(tag->hasOption(
"color"))
174 color_ = numeric::comma_seperated_string_to_xyz<core::Real>(tag->getOption<
std::string>(
"color"));
178 throw utility::excn::EXCN_RosettaScriptsOption(
"To use RenderGridsToKinemage you must specify color for a 1 color grid plot, "
179 "high_color and low_color for a two color gradient, or high_color, low_color and "
180 "zero_color for a three color gradient centered at zero");
182 }
else if(tag->hasOption(
"low_color") && tag->hasOption(
"zero_color") && tag->hasOption(
"high_color"))
186 low_color_ = numeric::comma_seperated_string_to_xyz<core::Real>(tag->getOption<
std::string>(
"low_color"));
187 zero_color_ = numeric::comma_seperated_string_to_xyz<core::Real>(tag->getOption<
std::string>(
"zero_color"));
188 high_color_ = numeric::comma_seperated_string_to_xyz<core::Real>(tag->getOption<
std::string>(
"high_color"));
190 }
else if(tag->hasOption(
"low_color")&& tag->hasOption(
"high_color"))
194 low_color_ = numeric::comma_seperated_string_to_xyz<core::Real>(tag->getOption<
std::string>(
"low_color"));
195 high_color_ = numeric::comma_seperated_string_to_xyz<core::Real>(tag->getOption<
std::string>(
"high_color"));
198 throw utility::excn::EXCN_RosettaScriptsOption(
"To use RenderGridsToKinemage you must specify color for a 1 color grid plot, "
199 "high_color and low_color for a two color gradient, or high_color, low_color and "
200 "zero_color for a three color gradient centered at zero");
205 std::cout << stride_ <<std::endl;
251 core::Real current_high = current_low+value_step;
254 current_color.x(current_color.x()+red_step);
255 current_color.y(current_color.y()+green_step);
256 current_color.z(current_color.z()+blue_step);
257 std::string color_bin_string(utility::to_string<core::Size>(bin));
259 ColorGradient new_color(current_color,current_low,current_high,color_name);
261 current_low = current_high;
262 current_high = current_low+value_step;
273 utility_exit_with_message(
"This grid does not have any scores greater than 0, a three color gradient makes no sense here");
291 core::Real current_high = current_low+low_value_step;
293 for(
core::Size bin = 1; bin <= half_bins; ++bin)
295 current_color.x(current_color.x()+red_step_low);
296 current_color.y(current_color.y()+green_step_low);
297 current_color.z(current_color.z()+blue_step_low);
298 std::string color_bin_string(utility::to_string<core::Size>(bin));
300 ColorGradient new_color(current_color,current_low,current_high,color_name);
302 current_low = current_high;
303 current_high = current_low+low_value_step;
310 current_high = current_low+high_value_step;
312 for(
core::Size bin = 1; bin <= half_bins;++bin)
314 current_color.x(current_color.x()+red_step_high);
315 current_color.y(current_color.y()+green_step_high);
316 current_color.z(current_color.z()+blue_step_high);
317 std::string color_bin_string(utility::to_string<core::Size>(bin));
320 current_low = current_high;
321 current_high = current_low+high_value_step;
330 kin_file <<
"@master {" << master_name <<
"}" <<std::endl;
332 kin_file <<
"@dotlist {" << master_name <<
" dots} color=white master={" <<master_name <<
"}" <<std::endl;
339 std::list<std::pair<core::Vector, core::Real> > point_list(
342 std::list<std::pair<core::Vector, core::Real> >::iterator point_iterator = point_list.begin();
343 for(; point_iterator != point_list.end(); ++point_iterator)
351 kin_file <<
"{" << master_name <<
"_points} " << current_color.
color_name <<
" " <<
352 coords.x() <<
" " << coords.y() <<
" " << coords.z() <<std::endl;
366 kin_file <<
"@hsvcolor {" << current_color.
color_name <<
"} " <<
367 hsv_color.x() <<
" "<< hsv_color.y()*100 <<
" " << hsv_color.z()*100 << std::endl;
373 kin_file <<
"@kinemage 1" <<std::endl;
374 kin_file <<
"@group dominant {dots}" <<std::endl;