32 #include <utility/io/izstream.hh>
33 #include <utility/string_util.hh>
35 #include <basic/options/option.hh>
36 #include <basic/options/keys/score.OptionKeys.gen.hh>
38 #include <utility/vector1.hh>
40 static basic::Tracer
TR(
"core.scoring.methods.NMerRefEnergy" );
73 using namespace basic::options;
90 for ( std::map< std::string, Real >::const_iterator it = nmer_ref_energies_in.begin(); it != nmer_ref_energies_in.end(); ++it ) {
99 using namespace basic::options;
101 TR <<
"checking for NMerRefEnergy Ref list" << std::endl;
104 if ( option[ OptionKeys::score::nmer_ref_energies_list ].user() ) {
105 std::string const ref_list_fname( option[ OptionKeys::score::nmer_ref_energies_list ] );
109 if( option[ OptionKeys::score::nmer_ref_energies ].user() ){
110 std::string const ref_fname( option[ OptionKeys::score::nmer_ref_energies ] );
118 TR <<
"reading NMerRefEnergy list from " << ref_list_fname << std::endl;
119 utility::io::izstream in_stream( ref_list_fname );
120 if (!in_stream.good()) {
121 utility_exit_with_message(
"[ERROR] Error opening NMerRefEnergy list file" );
125 while( getline( in_stream, ref_fname ) ){
128 if( tokens[ 1 ][ 0 ] ==
'#' )
continue;
135 TR <<
"checking for NMerRefEnergy scores" << std::endl;
137 TR <<
"reading NMerRefEnergy scores from " << ref_fname << std::endl;
138 utility::io::izstream in_stream( ref_fname );
139 if (!in_stream.good()) {
140 utility_exit_with_message(
"[ERROR] Error opening NMerRefEnergy file" );
143 while( getline( in_stream, line) ) {
146 if( tokens[ 1 ][ 0 ] ==
'#' )
continue;
147 if( tokens.size() != 2 ) utility_exit_with_message(
"[ERROR] NMer ref energy database file "
148 + ref_fname +
" does not have 2 entries at line " + line );
150 if( sequence.size() !=
nmer_length_ ) utility_exit_with_message(
"[ERROR] NMer ref energy database file "
151 + ref_fname +
" has wrong length nmer at line " + line
152 +
"\n\texpected: " + utility::to_string(
nmer_length_ ) +
" found: " + utility::to_string( sequence.size() ) );
154 Real const energy( atof( tokens[ 2 ].c_str() ) );
160 TR <<
"[WARNING]: NMer ref energy database file "
161 + ref_fname +
" has double entry for sequence " + sequence +
" Summing with prev value..." << std::endl ;
185 using namespace chemical;