28 #include <basic/database/open.hh>
31 #include <utility/io/izstream.hh>
38 #include <utility/vector1.hh>
57 for (
int x=0; x<9; x++)
59 for (
int y=0; y<9; y++)
61 for (
int z=0; z<4; z++)
74 for (
int x_bin=0; x_bin<9; x_bin++)
76 for (
int y_bin=0; y_bin<9; y_bin++)
78 for (
int z_bin=0; z_bin<4; z_bin++)
80 for (
int p=0; p<20; p++)
82 for (
int d=0; d<4; d++)
85 A_bins[x_bin][y_bin][z_bin].length() +
86 C_bins[x_bin][y_bin][z_bin].length() +
87 G_bins[x_bin][y_bin][z_bin].length() +
88 T_bins[x_bin][y_bin][z_bin].length();
95 if (d==0) { lib_aa_list=
G_bins[x_bin][y_bin][z_bin]; }
96 else if (d==1) { lib_aa_list=
A_bins[x_bin][y_bin][z_bin]; }
97 else if (d==2) { lib_aa_list=
C_bins[x_bin][y_bin][z_bin]; }
98 else { lib_aa_list=
T_bins[x_bin][y_bin][z_bin]; }
100 for (
Size i=0; i<lib_aa_list.length(); i++)
103 if ( aa == p ) { num_of_aa++; }
108 Real fabs = fs/(1 + mab*
wt) + (mab*
wt*gabs)/(1+mab*
wt);
109 if (fs!=0) { fscore = fabs/fs; }
111 if (fscore!=0) { d_eab = -
RT*log(fscore); }
114 score[x_bin][y_bin][z_bin][p][d]=d_eab;
129 Vector const origin( AG ? rsd2.
xyz(
"N9") : rsd2.
xyz(
"N1") );
131 Vector const x( ( p - origin ).normalized() );
134 y = ( z.cross( x ) );
135 Vector const calpha( rsd1.
xyz(
"CA") - origin );
136 Real const xx = dot(calpha,x);
137 Real const yy = dot(calpha,y);
138 Real const zz = dot(calpha,z);
140 if ( ( xx >= -13.5 && xx <= 13.5 ) &&
141 ( yy >= -13.5 && yy <= 13.5 ) &&
142 ( zz >= -6.0 && zz <= 6.0 ) ) {
143 int const aa_bin = rsd1.
aa() - 1;
149 assert( aa_bin >= 0 && aa_bin < 20 && na_bin >= 0 && na_bin < 4 );
150 return score[x_bin][y_bin][z_bin][aa_bin][na_bin];
161 utility::io::izstream myfile;
165 basic::database::open( myfile, bins_filename );
167 if ( !myfile.good() ) utility_exit_with_message(
"Unable to open file: "+bins_filename );
169 for (
int i=0; i<9; ++i ) {
170 for (
int j=0; j<9; ++j ) {
171 for (
int k=0; k<4; ++k ) {
174 getline( myfile, line );
175 std::istringstream l( line );
176 l >> x >> y >> z >> aas;
177 assert( x == i && y == j && z == k );
179 my_array[x][y][z]=
"";
181 my_array[x][y][z]= aas;
193 utility::io::izstream myfile;
194 basic::database::open( myfile,
"scoring/dna/m_pairs.txt" );
196 if ( !myfile.good() ) utility_exit_with_message(
"Unable to open m_pairs.txt" );
198 for (
Size i=0; i<4; ++i ) {
199 for (
Size j=0; j<20; ++j ) {
201 getline( myfile, line );
202 std::istringstream l(line );
205 assert( itmp == i && jtmp == j && !l.fail() );
214 if (coord <= -13.5 || coord >= 13.5) {
return -99; }
215 Real c = coord - ( -13.5 );
216 int bin =
int(floor( c/3 ));
223 if (coord <= -6 || coord >= 6) {
return -99; }
224 Real c = coord - ( -6 );
225 int bin =
int(floor( c/3 ));