29 #include <utility/tag/Tag.hh>
31 #include <basic/options/option.hh>
32 #include <basic/options/keys/in.OptionKeys.gen.hh>
33 #include <basic/Tracer.hh>
35 #include <utility/string_util.hh>
36 #include <utility/exit.hh>
38 #include <utility/vector0.hh>
39 #include <utility/excn/Exceptions.hh>
40 #include <utility/vector1.hh>
48 namespace simple_moves {
52 using namespace core::scoring;
54 static basic::Tracer
TR(
"protocols.simple_moves.FavorSequenceProfile" );
68 return "FavorSequenceProfile";
73 protocols::moves::
Mover(
"FavorSequenceProfile" ),
89 TR.Warning <<
"Overwriting existing profile in FavorSequenceProfile." << std::endl;
98 TR.Warning <<
"Overwriting existing profile in FavorSequenceProfile." << std::endl;
105 if( scaling !=
"prob" && scaling !=
"none" && scaling !=
"global" ) {
106 utility_exit_with_message(
"Scaling in FavorSequenceProfile must be one of 'prob', 'none', or 'global'.");
118 profile->generate_from_sequence(seq,
matrix_);
125 profile->convert_profile_to_probs( 1.0 );
129 profile->global_auto_rescale();
131 utility_exit_with_message(
"Unrecognized scaling type '" +
scaling_ +
"' in FavorSequenceProfile.");
146 for(
core::Size seqpos( start_seq ),
end( stop_seq ); seqpos <=
end; ++seqpos ) {
156 if ( tag->hasOption(
"scorefxns") ) {
159 StringVec
const sf_keys( utility::string_split( sf_val,
',' ) );
160 for ( StringVec::const_iterator it( sf_keys.begin() ),
end( sf_keys.end() ); it !=
end; ++it ) {
164 TR<<
"Turning on res_type_constraint weight in scorefxn "<<*it<<std::endl;
170 if( tag->getOption<
bool >(
"use_native",
false ) ) ++num_struct;
171 if( tag->getOption<
bool >(
"use_fasta",
false ) ) ++num_struct;
172 if( tag->getOption<
bool >(
"use_starting",
false ) ) ++num_struct;
173 if( tag->getOption<
bool >(
"use_current",
false ) ) ++num_struct;
174 if( tag->hasOption(
"pdbname") ) ++num_struct;
176 if( ! num_struct && ! tag->hasOption(
"pssm") ) {
177 throw utility::excn::EXCN_RosettaScriptsOption(
"Must set one of 'pssm', 'use_native', 'use_fasta', 'use_starting', 'use_current', or 'pdbname' in FavorSequenceProfile");
179 if( num_struct && tag->hasOption(
"pssm") ) {
180 throw utility::excn::EXCN_RosettaScriptsOption(
"Cannot set both 'pssm' and one of 'use_native', 'use_fasta', 'use_starting', 'use_current', or 'pdbname' in FavorSequenceProfile");
182 if( num_struct > 1 ) {
183 throw utility::excn::EXCN_RosettaScriptsOption(
"Can only set one of 'use_native', 'use_fasta', 'use_starting', 'use_current', or 'pdbname' in FavorSequenceProfile");
185 if( tag->hasOption(
"matrix") && tag->hasOption(
"pssm") ) {
186 TR.Warning <<
"WARNING In option matrix not used with pssm specification." << std::endl;
188 if( tag->hasOption(
"chain"))
194 if( tag->getOption<
bool >(
"use_native",
false ) ) {
200 if( tag->getOption<
bool >(
"use_fasta",
false ) ) {
204 std::cout << seq << std::endl;
207 if( tag->getOption<
bool >(
"use_starting",
false ) ) {
211 if( tag->getOption<
bool >(
"use_current",
false ) ) {
214 if( tag->hasOption(
"pdbname") ) {
220 if( tag->hasOption(
"pssm") ) {
227 utility::lua::LuaObject
const & ,
228 utility::lua::LuaObject
const & ,
234 if( def[
"use_native"] && def[
"use_native"].to<bool>() ) ++num_struct;
235 if( def[
"use_fasta"] && def[
"use_fasta"].to<bool>() ) ++num_struct;
236 if( def[
"use_starting"] && def[
"use_starting"].to<bool>() ) ++num_struct;
237 if( def[
"use_current"] && def[
"use_current"].to<bool>() ) ++num_struct;
238 if( def[
"pdbname"]) ++num_struct;
240 if( ! num_struct && ! def[
"pssm"] ) {
241 utility_exit_with_message(
"Must set one of 'pssm', 'use_native', 'use_fasta', 'use_starting', 'use_current', or 'pdbname' in FavorSequenceProfile");
243 if( num_struct && def[
"pssm"] ) {
244 utility_exit_with_message(
"Cannot set both 'pssm' and one of 'use_native', 'use_fasta', 'use_starting', 'use_current', or 'pdbname' in FavorSequenceProfile");
246 if( num_struct > 1 ) {
247 utility_exit_with_message(
"Can only set one of 'use_native', 'use_fasta', 'use_starting', 'use_current', or 'pdbname' in FavorSequenceProfile");
249 if( def[
"matrix"] && def[
"pssm"] ) {
250 TR.Warning <<
"WARNING In option matrix not used with pssm specification." << std::endl;
255 set_scaling( def[
"set_scaling"] ? def[
"set_scaling" ].to<std::string>() :
"prob" );
258 if( def[
"use_native"] && def[
"use_native"].to<bool>() ) {
264 if( def[
"use_fasta"] && def[
"use_fasta"].to<bool>() ) {
268 std::cout << seq << std::endl;
277 if( def[
"use_current"] && def[
"use_current"].to<bool>() ) {
280 if( def[
"pdbname"] ) {
288 ref_profile_->read_from_file( def[
"pssm"].to<std::string>() );