33 #include <ObjexxFCL/FArray1D.hh>
37 #include <basic/Tracer.hh>
39 #include <numeric/random/random.hh>
40 #include <numeric/xyzVector.hh>
51 #include <utility/vector1.hh>
52 #include <utility/io/izstream.hh>
58 static basic::Tracer
TR(
"protocols.coarse_rna.coarse_rna_fragment_mover" ) ;
60 static numeric::random::RandomGenerator
RG(22811440);
63 namespace coarse_rna {
65 SourcePositions::~SourcePositions() {}
67 CoarseRNA_Fragments::~CoarseRNA_Fragments() {}
76 CoarseRNA_Fragments::CoarseRNA_Fragments(
std::string const & frag_source_file ):
78 frag_source_file_( frag_source_file )
87 using namespace core::chemical;
88 using namespace core::pose;
89 using namespace core::kinematics;
104 for(
Size i = 1; i <= rsd_type->natoms(); i++ ){
115 while ( getline( coords_in, line) ){
117 std::istringstream line_stream( line );
118 line_stream >> dummy_char;
119 sequence += dummy_char;
121 line_stream >> dummy_char;
125 while ( line_stream.good() ) {
126 line_stream >> x >> y >> z;
127 res_coords.push_back(
Vector( x,y,z) );
129 if ( res_coords.size() !=
coarse_rna_name_to_num_.size() ) utility_exit_with_message(
"Should only have 5? atoms in mini ppose file.");
130 all_res_coords.push_back( res_coords );
146 Size const & insert_res,
147 Size const & source_res,
148 Size const & frag_size,
151 using namespace core::id;
153 std::map< Size, Size > res_map;
155 for (
Size offset = 0; offset < frag_size; offset ++ ) {
157 Size const insert_offset = insert_res + offset;
158 Size const source_offset = source_res + offset;
163 res_map[ insert_offset ] = source_offset;
168 std::map< AtomID, AtomID > atom_id_map;
169 allow_insert->calculate_atom_id_map( pose, res_map,
frag_source_pose_->fold_tree(), atom_id_map );
178 using namespace protocols::rna;
183 std::string const RNA_secstruct_string = key.second;
185 Size const size = RNA_string.length();
186 static Distance const DIST_CUTOFF( 10.0 );
188 runtime_assert( RNA_string.length() == RNA_secstruct_string.length() );
192 std::string vall_current_secstruct( RNA_secstruct_string );
197 for (
Size i = 1; i <= source_sequence.size() -
size + 1; i++ ){
201 for (
Size offset = 0; offset <
size; offset++ ){
202 vall_current_sequence [offset] = source_sequence[ i - 1 + offset ];
203 vall_current_secstruct[offset] = source_secstruct[ i - 1 + offset ];
219 source_positions->push_back( i );
224 std::cout <<
"Picked Fragment Library for sequence " << RNA_string <<
" " <<
225 " and sec. struct " << RNA_secstruct_string <<
" ... found " <<
226 source_positions->size() <<
" potential fragments" << std::endl;
249 Size const num_frags = source_positions->size();
251 if (num_frags == 0) {
252 std::cout <<
"Fragment Library: zero fragments found for " << RNA_string_local << std::endl;
253 std::cerr <<
"Fragment Library: zero fragments found for " << RNA_string_local << std::endl;
254 utility::exit( EXIT_FAILURE, __FILE__, __LINE__);
257 Size const which_frag = static_cast <
Size> (
RG.uniform() * num_frags) + 1;
259 return (*source_positions)[ which_frag ];
273 std::string const & RNA_string = RNA_sequence.substr( position - 1, size );
276 std::string const & RNA_secstruct_string = RNA_secstruct.substr( position - 1, size );