26 #include <basic/options/option.hh>
27 #include <basic/options/keys/OptionKeys.hh>
28 #include <basic/options/keys/frags.OptionKeys.gen.hh>
31 #include <basic/database/open.hh>
32 #include <utility/io/izstream.hh>
33 #include <utility/io/ozstream.hh>
34 #include <ObjexxFCL/string.functions.hh>
37 namespace frag_picker {
40 using namespace basic::options;
41 using namespace basic::options::OptionKeys;
44 CachingScoringMethod(priority, lowest_acceptable_value, use_lowest,
"RamaScore"), query_(fastaQuery),prediction_name_(prediction_name) {
47 std::cout <<
"QUERY" << fastaQuery <<
" " <<
query_.size() << std::endl;
48 default_ss->extend(
query_.size());
51 default_ss->set_fractions(i, 1.0, 1.0, 1.0 );
61 CachingScoringMethod(priority, lowest_acceptable_value, use_lowest,
"RamaScore"), query_(fastaQuery), query_ss_(query_prediction), prediction_name_(prediction_name)
75 for(
Size i = 2; i <=
query_.size() -1; ++i ) {
80 ss_weight[1] =
query_ss_->helix_fraction(i);
81 ss_weight[2] =
query_ss_->strand_fraction(i);
82 ss_weight[3] =
query_ss_->loop_fraction(i);
84 if ( ( ss_weight[1] + ss_weight[2] + ss_weight[3]) == 0) {
100 if ( curr_aa ==
"c" ) {
107 if ( next_aa ==
"P" ) {
108 aa_type = curr_aa+next_aa;
117 for(
Size s = 1; s <= 3; ++s ) {
118 if ( ss_weight[s] > 0.0 ) {
120 std::string db_location(
"sampling/fragpicker_rama_tables/"+ss_types[s]+
"_"+aa_type+
".counts");
121 utility::io::izstream table_file;
122 basic::database::open(table_file, db_location);
127 while ( getline(table_file, line) ) {
128 if ( line.length() != 0 ) {
129 std::istringstream line_stream(line);
133 line_stream >> x >> y >> count;
134 temp[i][x+1][y+1] += ss_weight[s] * count;
141 utility::io::ozstream outtable;
142 if (option[frags::write_rama_tables].user()) {
144 outtable.open(
"res"+res+
"_"+aa_type+
".rama_table");
149 float const A( option[frags::rama_norm] );
152 for(
Size x = 1; x <= 37; ++x ) {
153 for(
Size y = 1; y <= 37; ++y ) {
154 total += temp[i][x][y];
157 runtime_assert( total != 0.0 );
158 for(
Size x = 1; x <= 37; ++x ) {
159 for(
Size y = 1; y <= 37; ++y ) {
160 temp[i][x][y] = (temp[i][x][y] / total) * A;
165 float const C( option[frags::rama_C] );
166 float const B( option[frags::rama_B] );
170 for(
Size x = 1; x <= 37; ++x ) {
171 for(
Size y = 1; y <= 37; ++y ) {
172 temp[i][x][y] += 0.000000000000000000000000001;
173 temp[i][x][y] = std::log(temp[i][x][y]);
174 temp[i][x][y] = 1.0 / ( 1 + std::exp( C + B*temp[i][x][y] ) );
176 if (option[frags::write_rama_tables].user()) {
177 float xf( static_cast< float >( x ));
178 float yf( static_cast< float >( y ));
179 outtable << ((xf-1)*10)-175 <<
" " << ((yf-1)*10)-175 <<
" " << temp[i][x][y] << std::endl;
183 if (option[frags::write_rama_tables].user()) outtable << std::endl;
203 runtime_assert( query_sequence_length > 0 );
205 for (
Size r = 2; r <= query_sequence_length - 1; ++r) {
207 for (
Size i = 1; i <= current_chunk->size(); ++i) {
214 if ( phi > 180 ) phi = -180 + (phi - 180);
215 if ( psi > 180 ) psi = -180 + (psi - 180);
216 if ( phi < -180 ) phi = 180 + (phi + 180);
217 if ( psi < -180 ) psi = 180 + (psi + 180);
219 Size i_phi =
static_cast< Size > (((phi + 180)/10)+1);
220 Size i_psi =
static_cast< Size > (((psi + 180)/10)+1);
222 runtime_assert( (i_phi >= 1) && (i_phi <= 37) );
223 runtime_assert( (i_psi >= 1) && (i_psi <= 37) );
243 std::string & tmp = fragment->get_chunk()->chunk_key();
248 Real totalScore = 0.0;
250 for (
Size i = 1; i <= fragment->get_length(); i++) {
254 Real tmp =
scores_[fragment->get_first_index_in_vall() + i - 1]
255 [fragment->get_first_index_in_query() + i - 1];
260 totalScore /= (
Real) fragment->get_length();
262 scores->set_score_component(totalScore,
id_);