Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
main.cc
Go to the documentation of this file.
1 /* */
2 /* ---- SPARTA ---- */
3 /* Shifts Prediction from Analogue of Residue type and Torsion Angle */
4 /* Yang Shen and Ad Bax */
5 /* J. Biomol. NMR, 38, 289-302 (2007) */
6 /* NIH, NIDDK, Laboratory of Chemical Physics */
7 /* version, 1.00 (build 2010.0607.00) */
8 /* */
9 /* for any problem, please contact */
10 /* shenyang@niddk.nih.gov */
11 /* */
12 /******************************************************************************/
13 
14 #include "SPARTA.h"
15 #include "time.h"
16 #include <sys/timeb.h>
17 
18 
19 int main( int argc, char ** argv )
20 {
21  string argList;
22  bool time = true;
23  SPARTA sparta;
24 
25  if(argc == 1) {
26  sparta.printSyntax();
27  }
28 
29  for(int i = 1; i < argc; i++){
30  argList+= (" ");
31  argList+= (argv[i]);
32  }
33 
34  vector<string> fields = GDB::split(" -", argList);
35 
36 
37  map<string, string> argments;
38  for(int i = 0; i < fields.size(); i++)
39  {
40  vector<string> temp;
41  int pos = fields[i].find_first_of(' ');
42  temp.push_back( fields[i].substr(0,pos) );
43  temp.push_back( fields[i].substr(pos+1,fields[i].length()-pos-1 ));
44  string arg = PDB::simplifyWhiteSpace(temp[1]);
45 
46  vector<string>::iterator it = find(sparta.argList.begin(), sparta.argList.end(), temp[0]);
47  if( it == sparta.argList.end() ) //not an valid argument
48  {
49  cerr << "Invaid arg name -" << temp[0] << endl;
50  exit(0);
51  }
52 
53  if( temp[0] == "oldsparta" ) arg = "true";
54  else if( temp[0] == "notime" ) time = false;
55 
56  argments[ temp[0] ] = arg;
57 
58  }
59 
60  clock_t start, finish;
61  start = clock();
62 
63  sparta.setArgs(argments);
64 
65  if( argments["oldsparta"].length() > 0 )
66  sparta.runPredict();
67  else if( argments["ins"].length() > 0 )
68  sparta.runANN_Predictions();
69  else
70  sparta.runANN_Prediction();
71 
72  finish = clock();
73  if( time )
74  cout << "\tRunning time: " << (float)(finish - start)/ CLOCKS_PER_SEC << " seconds" << endl;
75 }