33 #include <ObjexxFCL/FArray1D.hh>
34 #include <ObjexxFCL/FArray2D.hh>
35 #include <ObjexxFCL/StaticIndexRange.hh>
37 #include <ObjexxFCL/format.hh>
39 #include <utility/io/izstream.hh>
40 #include <utility/exit.hh>
43 #include <numeric/xyzVector.hh>
51 #include <utility/vector1.hh>
52 #include <utility/options/BooleanVectorOption.hh>
53 #include <numeric/random/random.fwd.hh>
56 namespace ObjexxFCL {
namespace fmt { } }
using namespace ObjexxFCL::fmt;
65 FragmentLibrary::~FragmentLibrary() {}
75 torsion_source_name.dimension( SRange(0, size),
std::string( 4,
' ' ) );
76 secstruct.dimension( SRange(0, size),
'L' );
77 non_main_chain_sugar_coords_defined =
false;
83 TorsionSet::operator =(
88 for (
Size offset = 0; offset < size_; offset++){
90 torsions( j, offset) = src.
torsions( j, offset);
93 secstruct( offset ) = src.
secstruct( offset );
98 if (non_main_chain_sugar_coords_defined) {
99 non_main_chain_sugar_coords.dimension( SRange(0,size_), 3, 3 );
100 for (
Size offset = 0; offset < size_; offset++){
101 for (
Size j = 1; j <= 3; j++ ) {
102 for (
Size k = 1; k <= 3; k++ ) {
103 non_main_chain_sugar_coords( offset, j, k ) =
116 Real FragmentLibrary::get_fragment_torsion(
Size const num_torsion,
Size const which_frag,
Size const offset ){
117 return align_torsions_[ which_frag - 1 ].torsions( num_torsion, offset) ;
121 TorsionSet const FragmentLibrary::get_fragment_torsion_set(
Size const which_frag ){
122 return align_torsions_[ which_frag - 1 ];
126 void FragmentLibrary::add_torsion(
TorsionSet const torsion_set ){
127 align_torsions_.push_back( torsion_set );
131 void FragmentLibrary::add_torsion(
139 for (
Size offset = 0; offset <
size; offset++){
150 for (
Size j = 1; j <= 3; j++ ){
151 for (
Size k = 1; k <= 3; k++ ){
162 align_torsions_.push_back( torsion_set );
168 Size FragmentLibrary::get_align_depth() {
169 return align_torsions_.size();
190 std::string const RNA_secstruct_string = key.second;
192 Size const size = RNA_string.length();
194 runtime_assert( RNA_string.length() == RNA_secstruct_string.length() );
198 std::string vall_current_secstruct( RNA_secstruct_string );
204 for (
Size offset = 0; offset <
size; offset++ ){
217 fragment_library_p->add_torsion( *
this, i, size );
223 if ( fragment_library_p->get_align_depth() == 0 ) {
229 for (
Size offset = 0; offset <
size; offset++ ){
232 if ( !
compare_RNA_char( vall_current_sequence[offset], RNA_string[ offset ] ) ) {
239 fragment_library_p->add_torsion( *
this, i, size );
246 std::cout <<
"Picked Fragment Library for sequence " << RNA_string <<
" " <<
247 " and sec. struct " << RNA_secstruct_string <<
" ... found " <<
248 fragment_library_p->get_align_depth() <<
" potential fragments" << std::endl;
273 Size const num_frags = fragment_library_pointer->get_align_depth();
275 if (num_frags == 0) {
276 std::cout <<
"Fragment Library: zero fragments found for " << RNA_string_local << std::endl;
277 std::cerr <<
"Fragment Library: zero fragments found for " << RNA_string_local << std::endl;
278 utility::exit( EXIT_FAILURE, __FILE__, __LINE__);
281 Size const which_frag = static_cast <
Size> ( numeric::random::uniform() * num_frags) + 1;
283 torsion_set = fragment_library_pointer->get_fragment_torsion_set( which_frag );
298 std::string const & RNA_string = RNA_sequence.substr( position - 1, size );
304 std::string const & RNA_secstruct_string = RNA_secstruct.substr( position - 1, size );
334 using namespace core::scoring::rna;
338 for (
Size offset = 0; offset <
size; offset++){
340 Size const position_offset = position + offset;
348 if ( !allow_insert->get( rna_torsion_id , pose.
conformation() ) )
continue;
353 torsion_set.
torsions( j, offset ) );
367 for (
Size offset = 0; offset <
size; offset++){
369 Size const position_offset = position + offset;
371 bool change_sugar(
true );
380 if ( !allow_insert->get( sugar_atom_id ) ){
381 change_sugar =
false;
break;
385 if (!change_sugar)
continue;
400 static bool init (
false );
420 std::cout <<
"Reading in vall_torsions file: " << filename << std::endl;
423 utility::io::izstream vall_in( filename.c_str() );
424 if ( vall_in.fail() ){
425 utility_exit_with_message(
"Bad vall torsions file? " + filename );
436 while ( getline( vall_in, line) ){
438 std::istringstream line_stream( line );
442 line_stream >> dummy_char;
443 vall_sequence.push_back( dummy_char );
447 line_stream >> dummy_real;
448 dummy_vec.push_back( dummy_real );
450 vall_torsions.push_back( dummy_vec );
452 line_stream >> dummy_char;
456 if ( dummy_char ==
'S' ) {
460 for (
Size n = 1; n <= 3; n++ ) {
461 line_stream >> x >> y >> z;
462 vecs.push_back(
Vector( x,y,z) );
464 vall_non_main_chain_sugar_coords.push_back( vecs );
465 line_stream >> dummy_char;
468 vall_secstruct.push_back( dummy_char );
472 line_stream >> dummy_bool;
473 dummy_vec2.push_back( dummy_bool );
475 vall_edge_is_base_pairing.push_back( dummy_vec2 );
478 line_stream >> dummy_bool;
479 vall_is_chainbreak.push_back( dummy_bool );
484 vall_name.push_back( I( 4, count ) );
492 std::cout <<
"Lines read from vall_torsions file: " <<
vall_size_ << std::endl;
512 for (
Size i = 1; i <= 3; i++ ) {