45 #include <basic/Tracer.hh>
46 #include <utility/vector1.hh>
47 #include <utility/vector0.hh>
66 #include <basic/options/option.hh>
67 #include <basic/options/keys/evaluation.OptionKeys.gen.hh>
68 #include <basic/database/open.hh>
70 #include <numeric/NumericTraits.hh>
75 static basic::Tracer
tr(
"protocols.sparta");
80 using namespace basic::options;
81 using namespace basic::options::OptionKeys;
97 if( getenv(
"SPARTA_DIR" ) == NULL ) {
100 SPARTA_DIR = getenv(
"SPARTA_DIR" );
103 using namespace basic::options;
104 using namespace basic::options::OptionKeys;
107 SPARTA_DIR=basic::database::full_name(
"external/SPARTA+" );
108 if ( option[ OptionKeys::evaluation::sparta_dir ].user() ) SPARTA_DIR=option[ OptionKeys::evaluation::sparta_dir ]();
110 if ( SPARTA_DIR.find(
"/") != string::npos ) slash_char =
"/";
111 else if ( SPARTA_DIR.find(
"\\") != string::npos ) slash_char =
"\\";
112 else SPARTA_DIR =
".";
115 if( getenv(
"PATH" ) != NULL ) {
116 temp = getenv(
"PATH" );
117 if(temp.find(
"/") != string::npos ) slash_char =
"/";
118 else if(temp.find(
"\\") != string::npos ) slash_char =
"\\";
121 aN[1]=
"N"; aN[2]=
"HA"; aN[3]=
"C"; aN[4]=
"CA"; aN[5]=
"CB"; aN[6]=
"HN";
133 REF_CS_Tab( cs_file ),
134 bCreateOutput_( false )
159 tr.Info <<
"run ANN Sparta for pose with " <<
rN-
r1+1 <<
" residues " << std::endl;
184 TAB_DIR = SPARTA_DIR + slash_char+
"tab";
185 SHIFT_DIR = SPARTA_DIR + slash_char+
"shifts";
186 PDB_DIR = SPARTA_DIR + slash_char+
"pdb";
194 tripFileName = TAB_DIR + slash_char+
"sparta.tab";
195 weightFileName = TAB_DIR + slash_char +
"weight.tab";
196 homoFileName = TAB_DIR + slash_char +
"homology.tab";
197 fitFileName = TAB_DIR + slash_char +
"fitting.tab";
198 sumName = PRED_DIR + slash_char +
"pred.tab";
202 rcFileName = TAB_DIR + slash_char +
"randcoil.tab";
203 adjFileName = TAB_DIR + slash_char +
"rcadj.tab";
204 prevFileName = TAB_DIR + slash_char +
"rcprev.tab";
205 nextFileName = TAB_DIR + slash_char +
"rcnext.tab";
234 tr.Info <<
"Reading Random Coil Shifts from " << rcFileName << endl;
235 RC_Tab.loadGDB( rcFileName );
237 tr.Info <<
"Reading RC Adjustments from " << adjFileName << endl;
238 ADJ_Tab.loadGDB( adjFileName );
241 AAlist =
"A C D E F G H I K L M N P Q R S T V W Y";
243 string B62_fname = TAB_DIR + slash_char+
"BLOSUM62.tab";
244 tr.Info <<
"Reading BLOSUM62 Table from " << B62_fname << endl;
246 boost::unordered_map< string, string >::iterator itS;
249 string aa = (it->second)[
"RESNAME"];
251 for ( itS = (it->second).begin(); itS != (it->second).
end(); itS++ ) {
252 if(AAlist.find(itS->first) != string::npos) {
253 BLOSUM_62[aa].push_back( atof( (itS->second).c_str() )/10.0 );
259 tr.Info <<
"Load ANN parameters ... ";
260 for(itN = aN.begin(); itN != aN.end(); itN++) {
261 string atomName = itN->second;
262 if( atomName ==
"H" ) atomName=
"HN";
264 SPARTA_ANN[atomName].init(113,30,1,9,6,3,TAB_DIR,atomName);
266 init_PredErrorSurface();
267 tr.Info <<
"done " << std::endl;
274 const Real SPARTA_PI = numeric::NumericTraits<Real>::pi();
275 const Real SPARTA_RADS_PER_DEG = SPARTA_PI / 180.0;
276 const Real SIN_PI = sin(SPARTA_PI);
277 const Real COS_PI = cos(SPARTA_PI);
279 inTab.Entries.clear();
282 int n = rN-r1+1, m = 10;
283 U_ANGLES =
new float* [n];
284 U_ANGLES[0] =
new float [n*m];
285 for(
int i = 1; i < n; ++i)
286 U_ANGLES[i] = U_ANGLES[i-1] + m;
288 U_RING_SHIFTS =
new float* [n];
289 U_RING_SHIFTS[0] =
new float [n*(aN.size()+1)];
290 for(
int i = 1; i < n; ++i)
291 U_RING_SHIFTS[i] = U_RING_SHIFTS[i-1] + aN.size()+1;
294 U_NAME =
new string* [n];
295 U_NAME[0] =
new string [n*m];
296 for(
int i = 1; i < n; ++i)
297 U_NAME[i] = U_NAME[i-1] + m;
299 U_HN_HB =
new float [n];
300 U_HA_HB =
new float [n];
301 U_CO_HB =
new float [n];
303 int pos0 = inName.find_last_of(slash_char)+1;
304 int pos1 = inName.find_last_of(
".");
306 sourceName=inName.substr(pos0,pos1-pos0);
308 std::map<int, string >::iterator itN;
312 for(itN = residList.begin(); itN != residList.end(); itN++){
313 sequence += itN->second;
315 if( cnt%10 == 0 ) sequence +=
" ";
318 if(itN != residList.end()) {
322 for(
int i = 1; i< j - itN->first; i++) {
324 sequence +=
"?"; cnt++;
325 if( cnt%10 == 0 ) sequence +=
" ";
334 inPDB.initOrbitalShift();
340 inPDB.collect_HN_S2_and_EF();
345 inTab.setData(
"SEQUENCE", sequence);
346 inTab.VARS_str_parser(
" RESID_R1 RESNAME_R1 PHI_R1 PSI_R1 CHI1_R1 RESID_R2 RESNAME_R2 PHI_R2 PSI_R2 CHI1_R2 RESID_R3 RESNAME_R3 PHI_R3 PSI_R3 CHI1_R3 N_HM HA_HM C_HM CA_HM CB_HM H_HM H_HB HA_HB CO_HB SOURCE");
347 inTab.FORMAT_str_parser(
"%4d %s %8.3f %8.3f %8.3f %4d %s %8.3f %8.3f %8.3f %4d %s %8.3f %8.3f %8.3f %8.3f %8.3f %8.3f %8.3f %8.3f %8.3f %8.3f %8.3f %8.3f %s");
350 float dist = inPDB.HBDistList[r1][
"HN"];
352 dist = inPDB.HBDistList[r1][
"HA"];
354 dist = inPDB.HBDistList[r1][
"O"];
358 for (
int i = r1; i <= rN; i++ ) {
359 CHI2_ANGLES[i] = inPDB.getChi2(1,i);
365 for (
int i = r1+1; i < rN; i++ ) {
368 if( residList.find(i-1) == residList.end() ||
369 residList.find(i) == residList.end() ||
370 residList.find(i+1) == residList.end())
continue;
373 shift = inPDB.getPhi(1,i+1);
374 U_ANGLES[index][7] = shift;
375 shift = inPDB.getPsi(1,i+1);
376 U_ANGLES[index][8] = shift;
377 shift = inPDB.getChi1(1,i+1);
378 U_ANGLES[index][9] = shift;
380 U_NAME[index][3] = residList[i+1];
382 inTab.Entries[index][
"PHI_R3"] =
ftoa(U_ANGLES[index][7], buf);
383 inTab.Entries[index][
"PSI_R3"] =
ftoa(U_ANGLES[index][8], buf);
384 inTab.Entries[index][
"CHI1_R3"] =
ftoa(U_ANGLES[index][9], buf);
385 inTab.Entries[index][
"RESID_R3"] =
itoa(i+1, buf);
386 inTab.Entries[index][
"RESNAME_R3"] = residList[i+1];
387 inTab.Entries[index][
"SOURCE"] = inName.substr(pos0,pos1-pos0);
390 boost::unordered_map< int, string >::iterator itN_unordered;
392 for(itN_unordered = aN.begin(); itN_unordered != aN.end(); itN_unordered++) {
393 string name = itN_unordered->second;
396 if( residList[i] ==
"P" )
continue;
397 }
else if( name ==
"HA" && residList[i] ==
"G" ) {
398 U_RING_SHIFTS[index][7-1] = inPDB.getOrbitalShift(1,i,
"HA3");
400 }
else if( name ==
"CB" && residList[i] ==
"G" )
continue;
402 U_RING_SHIFTS[index][itN_unordered->first-1] = inPDB.getOrbitalShift(1,i,name) ;
403 inTab.Entries[index][itN_unordered->second+
"_HM"] =
ftoa(U_RING_SHIFTS[index][itN_unordered->first-1], buf);
407 dist = inPDB.HBDistList[i][
"HN"];
408 inTab.Entries[index][
"H_HB"] =
ftoa(dist, buf);
409 U_HN_HB[index] = dist;
411 dist = inPDB.HBDistList[i][
"HA"];
412 inTab.Entries[index][
"HA_HB"] =
ftoa(dist, buf);
413 U_HA_HB[index] = dist;
415 dist = inPDB.HBDistList[i][
"O"];
416 inTab.Entries[index][
"CO_HB"] =
ftoa(dist, buf);
417 U_CO_HB[index] = dist;
419 if( inTab.Entries.find(index-1) != inTab.Entries.end() ) {
422 U_ANGLES[index][1] = U_ANGLES[index-1][4];
423 U_ANGLES[index][2] = U_ANGLES[index-1][5];
424 U_ANGLES[index][3] = U_ANGLES[index-1][6];
425 U_ANGLES[index][4] = U_ANGLES[index-1][7];
426 U_ANGLES[index][5] = U_ANGLES[index-1][8];
427 U_ANGLES[index][6] = U_ANGLES[index-1][9];
428 U_NAME[index][1] = U_NAME[index-1][2];
429 U_NAME[index][2] = U_NAME[index-1][3];
431 inTab.Entries[index][
"PHI_R1"] = inTab.Entries[index-1][
"PHI_R2"];
432 inTab.Entries[index][
"PSI_R1"] = inTab.Entries[index-1][
"PSI_R2"];
433 inTab.Entries[index][
"CHI1_R1"] = inTab.Entries[index-1][
"CHI1_R2"];
434 inTab.Entries[index][
"RESID_R1"] = inTab.Entries[index-1][
"RESID_R2"];
435 inTab.Entries[index][
"RESNAME_R1"] = inTab.Entries[index-1][
"RESNAME_R2"];
437 inTab.Entries[index][
"PHI_R2"] = inTab.Entries[index-1][
"PHI_R3"];
438 inTab.Entries[index][
"PSI_R2"] = inTab.Entries[index-1][
"PSI_R3"];
439 inTab.Entries[index][
"CHI1_R2"] = inTab.Entries[index-1][
"CHI1_R3"];
440 inTab.Entries[index][
"RESID_R2"] = inTab.Entries[index-1][
"RESID_R3"];
441 inTab.Entries[index][
"RESNAME_R2"] = inTab.Entries[index-1][
"RESNAME_R3"];
445 shift = inPDB.getPhi(1,i-1);
446 U_ANGLES[index][1] = shift;
447 shift = inPDB.getPsi(1,i-1);
448 U_ANGLES[index][2] = shift;
449 shift = inPDB.getChi1(1,i-1);
450 U_ANGLES[index][3] = shift;
451 U_NAME[index][1] = residList[i-1];
453 inTab.setEntry(index,
"PHI_R1",
ftoa(U_ANGLES[index][1], buf) );
454 inTab.setEntry(index,
"PSI_R1",
ftoa(U_ANGLES[index][2], buf) );
455 inTab.setEntry(index,
"CHI1_R1",
ftoa(U_ANGLES[index][3], buf) );
456 inTab.setEntry(index,
"RESID_R1",
itoa(i-1, buf) );
457 inTab.setEntry(index,
"RESNAME_R1", residList[i-1] );
459 shift = inPDB.getPhi(1,i);
460 U_ANGLES[index][4] = shift;
461 shift = inPDB.getPsi(1,i);
462 U_ANGLES[index][5] = shift;
463 shift = inPDB.getChi1(1,i);
464 U_ANGLES[index][6] = shift;
465 U_NAME[index][2] = residList[i];
467 inTab.Entries[index][
"PHI_R2"] =
ftoa(U_ANGLES[index][4], buf);
468 inTab.Entries[index][
"PSI_R2"] =
ftoa(U_ANGLES[index][5], buf);
469 inTab.Entries[index][
"CHI1_R2"] =
ftoa(U_ANGLES[index][6], buf);
470 inTab.Entries[index][
"RESID_R2"] =
itoa(i, buf);
471 inTab.Entries[index][
"RESNAME_R2"] = residList[i];
473 if (
tr.Trace.visible() ) {
474 tr.Trace << std::endl;
483 string resName=residList[i-1];
if(resName==
"c") resName=
"C";
484 temp.insert(temp.end(), BLOSUM_62[resName].begin(), BLOSUM_62[resName].end());
485 float phi = U_ANGLES[index][1],
psi = U_ANGLES[index][2], chi1 = U_ANGLES[index][3], chi2 = CHI2_ANGLES[i-1];
486 if( phi<999 ) { temp.push_back(sin(phi*SPARTA_RADS_PER_DEG)); temp.push_back(cos(phi*SPARTA_RADS_PER_DEG));}
487 else { temp.push_back(SIN_PI); temp.push_back(COS_PI);}
488 if( psi<999 ) { temp.push_back(sin(psi*SPARTA_RADS_PER_DEG)); temp.push_back(cos(psi*SPARTA_RADS_PER_DEG));}
489 else { temp.push_back(SIN_PI); temp.push_back(COS_PI);}
490 if( chi1<999 ) { temp.push_back(sin(chi1*SPARTA_RADS_PER_DEG)); temp.push_back(cos(chi1*SPARTA_RADS_PER_DEG));}
491 else { temp.push_back(0); temp.push_back(0);}
492 temp.push_back(chi1<999);
493 if( chi2<999 ) { temp.push_back(sin(chi2*SPARTA_RADS_PER_DEG)); temp.push_back(cos(chi2*SPARTA_RADS_PER_DEG));}
494 else { temp.push_back(0); temp.push_back(0);}
495 temp.push_back(chi2<999);
498 resName=residList[i];
if(resName==
"c") resName=
"C";
499 temp.insert(temp.end(), BLOSUM_62[resName].begin(), BLOSUM_62[resName].end());
500 phi = U_ANGLES[index][4]; psi = U_ANGLES[index][5]; chi1 = U_ANGLES[index][6]; chi2 = CHI2_ANGLES[i];
501 if( phi<999 ) { temp.push_back(sin(phi*SPARTA_RADS_PER_DEG)); temp.push_back(cos(phi*SPARTA_RADS_PER_DEG));}
502 else { temp.push_back(SIN_PI); temp.push_back(COS_PI);}
503 if( psi<999 ) { temp.push_back(sin(psi*SPARTA_RADS_PER_DEG)); temp.push_back(cos(psi*SPARTA_RADS_PER_DEG));}
504 else { temp.push_back(SIN_PI); temp.push_back(COS_PI);}
505 if( chi1<999 ) { temp.push_back(sin(chi1*SPARTA_RADS_PER_DEG)); temp.push_back(cos(chi1*SPARTA_RADS_PER_DEG));}
506 else { temp.push_back(0); temp.push_back(0);}
507 temp.push_back(chi1<999);
508 if( chi2<999 ) { temp.push_back(sin(chi2*SPARTA_RADS_PER_DEG)); temp.push_back(cos(chi2*SPARTA_RADS_PER_DEG));}
509 else { temp.push_back(0); temp.push_back(0);}
510 temp.push_back(chi2<999);
513 resName=residList[i+1];
if(resName==
"c") resName=
"C";
514 temp.insert(temp.end(), BLOSUM_62[resName].begin(), BLOSUM_62[resName].end());
515 phi = U_ANGLES[index][7]; psi = U_ANGLES[index][8]; chi1 = U_ANGLES[index][9]; chi2 = CHI2_ANGLES[i+1];
516 if( phi<999 ) { temp.push_back(sin(phi*SPARTA_RADS_PER_DEG)); temp.push_back(cos(phi*SPARTA_RADS_PER_DEG));}
517 else { temp.push_back(SIN_PI); temp.push_back(COS_PI);}
518 if( psi<999 ) { temp.push_back(sin(psi*SPARTA_RADS_PER_DEG)); temp.push_back(cos(psi*SPARTA_RADS_PER_DEG));}
519 else { temp.push_back(SIN_PI); temp.push_back(COS_PI);}
520 if( chi1<999 ) { temp.push_back(sin(chi1*SPARTA_RADS_PER_DEG)); temp.push_back(cos(chi1*SPARTA_RADS_PER_DEG));}
521 else { temp.push_back(0); temp.push_back(0);}
522 temp.push_back(chi1<999);
523 if( chi2<999 ) { temp.push_back(sin(chi2*SPARTA_RADS_PER_DEG)); temp.push_back(cos(chi2*SPARTA_RADS_PER_DEG));}
524 else { temp.push_back(0); temp.push_back(0);}
525 temp.push_back(chi2<999);
528 float hb = inPDB.HBDistList[i-1][
"O"];
530 temp.push_back(1.0); temp.push_back(hb); temp.push_back( cos(inPDB.HB_DHO_AngleList[i-1][
"O"]*SPARTA_RADS_PER_DEG) ); temp.push_back( cos(inPDB.HB_HOA_AngleList[i-1][
"O"]*SPARTA_RADS_PER_DEG) );
532 else {temp.push_back(0.0); temp.push_back(0.0); temp.push_back(0.0); temp.push_back(0.0);}
533 hb = inPDB.HBDistList[i][
"HN"];
535 temp.push_back(1.0); temp.push_back(hb); temp.push_back( cos(inPDB.HB_DHO_AngleList[i][
"HN"]*SPARTA_RADS_PER_DEG) ); temp.push_back( cos(inPDB.HB_HOA_AngleList[i][
"HN"]*SPARTA_RADS_PER_DEG) );
537 else {temp.push_back(0.0); temp.push_back(0.0); temp.push_back(0.0); temp.push_back(0.0);}
538 hb = inPDB.HBDistList[i][
"HA"];
540 temp.push_back(1.0); temp.push_back(hb); temp.push_back( cos(inPDB.HB_DHO_AngleList[i][
"HA"]*SPARTA_RADS_PER_DEG) ); temp.push_back( cos(inPDB.HB_HOA_AngleList[i][
"HA"]*SPARTA_RADS_PER_DEG) );
542 else {temp.push_back(0.0); temp.push_back(0.0); temp.push_back(0.0); temp.push_back(0.0);}
543 hb = inPDB.HBDistList[i][
"O"];
545 temp.push_back(1.0); temp.push_back(hb); temp.push_back( cos(inPDB.HB_DHO_AngleList[i][
"O"]*SPARTA_RADS_PER_DEG) ); temp.push_back( cos(inPDB.HB_HOA_AngleList[i][
"O"]*SPARTA_RADS_PER_DEG) );
547 else {temp.push_back(0.0); temp.push_back(0.0); temp.push_back(0.0); temp.push_back(0.0);}
548 hb = inPDB.HBDistList[i+1][
"HN"];
550 temp.push_back(1.0); temp.push_back(hb); temp.push_back( cos(inPDB.HB_DHO_AngleList[i+1][
"HN"]*SPARTA_RADS_PER_DEG) ); temp.push_back( cos(inPDB.HB_HOA_AngleList[i+1][
"HN"]*SPARTA_RADS_PER_DEG) );
551 }
else {temp.push_back(0.0); temp.push_back(0.0); temp.push_back(0.0); temp.push_back(0.0);}
553 temp.push_back(inPDB.HN_S2[i-1]);
554 temp.push_back(inPDB.HN_S2[i]);
555 temp.push_back(inPDB.HN_S2[i+1]);
557 if( temp.size() == 113) ANN_IN_MTX[i]=temp;
562 dist = inPDB.HBDistList[rN][
"HN"];
563 U_HN_HB[rN-r1] = dist;
564 dist = inPDB.HBDistList[rN][
"HA"];
565 U_HA_HB[rN-r1] = dist;
566 dist = inPDB.HBDistList[rN][
"O"];
567 U_CO_HB[rN-r1] = dist;
569 if ( create_output ) inTab.saveGDB(PRED_DIR+slash_char+inName.substr(pos0,pos1-pos0) +
"_in.tab");
571 if (
tr.Trace.visible() ) {
572 boost::unordered_map<int, utility::vector0<float> >::iterator itX;
573 for(itX = ANN_IN_MTX.begin(); itX != ANN_IN_MTX.end(); itX++) {
574 for(
int i=0; i< (
int)(itX->second).size();i++)
575 tr.Trace << (itX->first) <<
" " << (itX->second)[i] << std::endl;
640 delete [] U_ANGLES[0];
644 delete [] U_RING_SHIFTS[0];
645 delete [] U_RING_SHIFTS;
657 tr.Info <<
"Analyzing " << inName <<
" " ;
658 getResInfo( create_output );
659 tr.Info << residList.size() <<
" residues read " << endl;
665 tr.Info <<
"ANN prediction ..." << endl;
666 for(itN = aN.begin(); itN != aN.end(); itN++) {
667 string atomName = itN->second;
668 if( atomName ==
"H" ) atomName=
"HN";
670 SPARTA_ANN[atomName].ANN_OUT_MTX_LEVEL1.clear();
671 SPARTA_ANN[atomName].runSpartaANN(ANN_IN_MTX);
673 ANN_CS_OUTPUT_FULL[atomName] = SPARTA_ANN[atomName].ANN_OUT_MTX_LEVEL1;
680 PRED_SUM.
VARS_str_parser(
" RESID RESNAME ATOMNAME SS_SHIFT SHIFT RC_SHIFT HM_SHIFT EF_SHIFT SIGMA SOURCE");
681 PRED_SUM.
FORMAT_str_parser(
" %4d %4s %4s %9.3f %9.3f %9.3f %9.3f %9.3f %9.3f %s");
683 PRED_SUM.
setData(
"FIRST_RESID", str+
"\n");
684 PRED_SUM.
setData(
"SEQUENCE", sequence);
686 float RC, RCadj, pred_2nd_shift, pred_shift;
687 for (
int i = r1+1; i <= rN-1; i++ ) {
688 for(itN = aN.begin(); itN != aN.end(); itN++) {
689 string atomName = itN->second;
690 if( atomName ==
"H" ) atomName=
"HN";
691 int index = PRED_SUM.
Entries.size()+1;
693 if( residList[i].empty() )
continue;
694 if( residList[i] ==
"P" && (atomName ==
"HN" || atomName ==
"N") )
continue;
695 if( residList[i] ==
"G" && atomName ==
"CB" )
continue;
696 if( i==r1 && (atomName ==
"HN"|| atomName ==
"N") )
continue;
697 if( i==rN && atomName ==
"C" )
continue;
700 PRED_SUM.
setEntry(index,
"RESNAME", residList[i]);
701 if (atomName==
"HA" && residList[i] ==
"G") PRED_SUM.
setEntry(index,
"ATOMNAME",
"HA2");
702 else PRED_SUM.
setEntry(index,
"ATOMNAME", atomName);
705 RC = getRC(residList[i],atomName);
706 RCadj = getRCadj(residList[i],atomName);
707 if (i==r1 || i==rN) {
708 pred_2nd_shift = 0.0;
710 pred_2nd_shift = 0.0;
711 if ( ANN_CS_OUTPUT_FULL[atomName].
size() >= static_cast< Size > (i) ) {
712 pred_2nd_shift = ANN_CS_OUTPUT_FULL[atomName][i][0];
715 if (atomName ==
"HA") pred_2nd_shift /= 4.0;
716 else if (atomName ==
"HN") pred_2nd_shift /= 2.0;
717 else if (atomName ==
"N") pred_2nd_shift *= 2.5;
719 if ( pred_2nd_shift > 20.0 || pred_2nd_shift < -20.0 ) pred_shift = 0.0;
730 pred_shift = pred_2nd_shift + RC + RCadj;
734 PRED_SUM.
setEntry(index,
"SS_SHIFT",
ftoa(pred_2nd_shift,buf));
736 pred_shift += 0.6*atof(inTab.Entries[i-r1][atomName+
"_HM"].c_str());
737 if(atomName ==
"HN" || atomName ==
"HA" ) pred_shift-= inPDB.ElectricField[i][atomName];
738 PRED_SUM.
setEntry(index,
"SHIFT",
ftoa(pred_shift,buf));
740 PRED_SUM.
setEntry(index,
"RC_SHIFT",
ftoa(RC+RCadj ,buf) );
741 PRED_SUM.
setEntry(index,
"SOURCE", sourceName );
742 PRED_SUM.
setEntry(index,
"SIGMA",
ftoa(getANN_PredError(U_ANGLES[i-r1][4],U_ANGLES[i-r1][5],residList[i],atomName),buf) );
744 PRED_SUM.
setEntry(index,
"HM_SHIFT", inTab.Entries[i-r1][atomName+
"_HM"] );
745 PRED_SUM.
setEntry(index,
"EF_SHIFT",
ftoa(inPDB.ElectricField[i][atomName],buf) );
747 if(atomName==
"HA" && residList[i] ==
"G") {
750 PRED_SUM.
setEntry(index,
"RESNAME", residList[i]);
751 PRED_SUM.
setEntry(index,
"ATOMNAME",
"HA3");
752 PRED_SUM.
setEntry(index,
"SS_SHIFT",
ftoa(pred_2nd_shift,buf));
753 pred_shift = pred_2nd_shift + RC + RCadj + 0.6*U_RING_SHIFTS[i-r1][0];
754 pred_shift-= inPDB.ElectricField[i][
"HA"];
755 PRED_SUM.
setEntry(index,
"SHIFT",
ftoa(pred_shift,buf));
756 PRED_SUM.
setEntry(index,
"RC_SHIFT",
ftoa(RC+RCadj ,buf) );
757 PRED_SUM.
setEntry(index,
"SOURCE", sourceName );
758 PRED_SUM.
setEntry(index,
"SIGMA",
ftoa(getANN_PredError(U_ANGLES[i-r1][4],U_ANGLES[i-r1][5],residList[i],atomName),buf) );
759 PRED_SUM.
setEntry(index,
"HM_SHIFT",
ftoa(U_RING_SHIFTS[i-r1][0],buf) );
760 PRED_SUM.
setEntry(index,
"EF_SHIFT",
ftoa(inPDB.ElectricField[i][
"HA"],buf) );
765 if (
tr.Debug.visible() ) {
766 tr.Debug <<
" ============== PRED_SUM ==================== " << std::endl;
768 tr.Debug <<
" ============== END_ PRED_SUM ==================== " << std::endl;
772 if ( create_output ) {
776 int pos = sumName.find_last_of(
".");
777 PRED_SUM.
saveGDB( sumName.substr(0, pos) +
"_full.tab" );
866 for(itN = aN.begin(); itN != aN.end(); itN++) {
867 string atomName = itN->second;
868 if( atomName ==
"H" ) atomName=
"HN";
870 for(
Size i=0; i<AAlist.length();i++) {
871 string AA = AAlist.substr(i,1);
872 if( AA ==
" " )
continue;
874 if( AA ==
"G" && atomName ==
"CB" )
continue;
875 if( AA ==
"P" && atomName ==
"HN" )
continue;
877 string surfName = TAB_DIR + slash_char +
"errorSurface" + slash_char + atomName + slash_char + AA +
"..A450.S5.RMS.tab";
881 int phi = atoi( it->second[
"PHI"].c_str() );
882 for(
int y=-180; y<180; y+=step) {
884 SPARTA_ERR_SURF[
AA][atomName][
phi][y] = atof( it->second[psi].c_str() );
895 return SPARTA_ERR_SURF[aa][aName][5*
int(phi/5)][5*
int(psi/5)];
903 GDB_Entry temp = RC_Tab.getEntry(
"RESNAME",resName,1);
905 if(temp.size() != 0)
return atof( temp[aName].c_str() );
914 GDB_Entry temp = ADJ_Tab.getEntry(
"RESNAME",resName,1);
916 if(temp.size() != 0)
return atof( temp[aName].c_str() );
925 GDB_Entry temp = PREV_Tab.getEntry(
"RESNAME",prev_rName,1);
927 if(temp.size() != 0)
return atof( temp[aName].c_str() );
936 GDB_Entry temp = NEXT_Tab.getEntry(
"RESNAME",next_rName,1);
938 if(temp.size() != 0)
return atof( temp[aName].c_str() );
945 GDB_Entry temp = WEIGHT_Tab.getEntry(
"RESNAME",Name,1);
947 if(temp.size() != 0)
return atof( temp[aName].c_str() );
956 int i =
MKDIR(d.c_str())+1;
958 string parentD = d.substr(0,d.find_last_of(slash_char)+1);
959 mkdir_pred(parentD.c_str());
960 if ( !(
MKDIR(d.c_str())+1) ) {
961 string msg(
"\tCan't create prediction directory " + d);
962 utility_exit_with_message(msg);