19 #include <utility/io/izstream.hh>
20 #include <utility/exit.hh>
22 #include <numeric/random/random.hh>
25 #include <basic/Tracer.hh>
31 #include <utility/vector1.hh>
44 static numeric::random::RandomGenerator
RG(144621);
46 static basic::Tracer
tr(
"protocols.rna.rna_jump_library" ) ;
55 atom_name1_( atom_name1 ),
56 atom_name2_( atom_name2 )
67 atom_name1_( atom_name1 ),
68 atom_name2_( atom_name2 )
76 utility::io::izstream data( jump_library_filename );
77 tr <<
"Reading RNA jump library: " << jump_library_filename << std::endl;
80 utility_exit_with_message(
"Bad jumpdata file? " + jump_library_filename );
86 char reschar1,reschar2,edgechar1,edgechar2,orientation;
91 while ( getline( data,line ) ) {
92 std::istringstream is( line );
95 pos1 >> edgechar1 >> pos2 >> edgechar2 >>
96 orientation >> reschar1 >> reschar2;
100 is.read( tmpbuf, 1 );
101 is.read( tmpbuf, 4 );
103 for (
int n=0; n <4;n++) atom_name1 += tmpbuf[n];
105 is.read( tmpbuf, 1 );
106 is.read( tmpbuf, 4 );
108 for (
int n=0; n <4;n++) atom_name2 += tmpbuf[n];
112 if ( is.fail() || tag !=
"PAIR" )
continue;
116 if ( edgechar1 ==
'P' || edgechar2 ==
'P' ) {
123 edgechar1, edgechar2,
125 atom_name1, atom_name2,
132 edgechar2, edgechar1,
134 atom_name2, atom_name1,
150 if (atom_name ==
" ? " ) {
155 j = t->jump_backward();
168 char const orientation,
172 bool const forward1 ,
173 bool const forward2 )
const
182 std::cout <<
"Can't seem to find a pairing inside database with aa1: " << aa1 <<
" aa2: " << aa2 <<
" edge1: " << edge1 <<
" edge2: " << edge2 <<
" orientation: " << orientation << std::endl;
184 std::cerr <<
"Can't seem to find a pairing inside database with aa1: " << aa1 <<
" aa2: " << aa2 <<
" edge1: " << edge1 <<
" edge2: " << edge2 <<
" orientation: " << orientation << std::endl;
196 ntemplates = templates.size();
198 if( ntemplates < 1 ){
200 std::cout <<
"Can't seem to find a pairing inside database with aa1: " << aa1 <<
" aa2: " << aa2 <<
" edge1: " << edge1 <<
" edge2: " << edge2 <<
" orientation: " << orientation << std::endl;
202 std::cerr <<
"Can't seem to find a pairing inside database with aa1: " << aa1 <<
" aa2: " << aa2 <<
" edge1: " << edge1 <<
" edge2: " << edge2 <<
" orientation: " << orientation << std::endl;
212 Size const index( static_cast<Size>(
RG.uniform() * ntemplates ) + 1 );
215 atom_name1 = templates[ index ]->atom_name1();
216 atom_name2 = templates[ index ]->atom_name2();
227 runtime_assert( edge1 !=
'P' || edge2 !=
'P' );
228 if ( edge1 ==
'P' && !forward1 ) j = templates[ index ]->jump_backward();
229 if ( edge2 ==
'P' && !forward2 ) j = templates[ index ]->jump_backward();
239 Size const reschar1,
Size const reschar2,
240 char const edgechar1,
char const edgechar2,
241 char const orientation,
260 for (
Size i = 0; i <= 1; i++ ) {
262 char const edgechar1_temp = i ? edgechar1:
'X';
264 for (
Size j = 0; j <= 1; j++ ) {
266 char const edgechar2_temp = j ? edgechar2:
'X';
268 for (
Size k = 0; k <= 1; k++ ) {
270 char const orientation_temp = k ? orientation:
'X';
272 BasePairType base_pair_type( reschar1, reschar2, edgechar1_temp, edgechar2_temp, orientation_temp);