19 #include <basic/Tracer.hh>
24 #include <utility/exit.hh>
25 #include <utility/io/izstream.hh>
26 #include <utility/file/FileName.hh>
27 #include <utility/pointer/owning_ptr.hh>
35 #include <utility/vector1.hh>
36 #include <ObjexxFCL/format.hh>
42 static basic::Tracer
tr(
"core.sequence.SequenceProfile" );
48 utility::io::izstream input( fn );
79 utility_exit_with_message(
"ERROR: Unable to open file!" );
82 getline( input, line );
83 while( getline( input, line ) ) {
84 if ( line.substr(0,3) ==
"END" )
break;
87 prof_row.resize( order.size() );
89 std::istringstream ls( line );
95 while ( !ls.fail() ) {
97 prof_row[ order[index] ] = aa_prob;
104 new_prof.push_back( prof_row );
139 utility::io::izstream input( fn );
143 "ERROR: Unable to open file " +
144 static_cast< std::string > (fn) +
147 utility_exit_with_message( msg );
151 tr.Debug <<
"reading from " << fn << std::endl;
154 getline( input, line );
155 getline( input, line );
158 getline( input, line );
159 std::istringstream line_stream( line );
160 while ( !line_stream.fail() ) {
163 if ( line_stream.fail() )
continue;
170 while( getline( input, line ) ) {
171 std::istringstream line_stream( line );
176 line_stream >> pos >> aa;
177 if ( line_stream.fail() )
continue;
180 prof_row.resize( order.size() );
183 line_stream >> score;
185 while ( !line_stream.fail() && index <= order.size() ) {
186 prof_row[ order[index] ] = score;
187 line_stream >> score;
196 tr.Debug <<
"Read sequence " << seq <<
" from " << fn << std::endl;
197 tr.Debug <<
"profile dimensions are " <<
profile_.size() <<
"x"
198 <<
profile_.front().size() <<
"." << std::endl;
227 for (
Size ii = 1; ii <=
profile().size(); ++ii ) {
234 tr <<
"Flipping sense of negative_better." << std::endl;
242 for (
Size ii = 1; ii <=
profile().size(); ++ii ) {
245 new_prof.push_back( new_prof_row );
255 if ( maxval < std::abs(
profile_[ii][jj]) ) {
256 maxval = std::abs(
profile_[ii][jj]);
285 if ( i == pos ) new_prof.push_back( zero_col );
286 if ( i >= 1 && i <=
length() ) new_prof.push_back( old_prof[i] );
300 runtime_assert( pos <=
length() );
304 = new_prof.begin() + pos -
start();
306 runtime_assert( it != new_prof.end() );
308 new_prof.erase( it );
324 runtime_assert( pos <=
profile_.size() );
340 it = scores.begin(),
end = scores.end(); it !=
end; ++it
342 if ( negative_better ) {
343 *it = exp( -1 * *it / kT );
345 *it = exp( *it / kT );
353 it = scores.begin(),
end = scores.end(); it !=
end; ++it
355 *it = *it / partition;
365 for (
Size j = 1; j <= p.
width(); ++j ) {
366 out << ObjexxFCL::fmt::F( width, precision, p.
prof_row(i)[j] );