예제 #1
0
Options setupOptions(int theArgc, char * theArgv[]){
	Options opt;

	OptionParser OP;

	OP.readArgv(theArgc, theArgv);
	OP.setRequired(opt.required);
	OP.setAllowed(opt.optional);

	if (OP.countOptions() == 0){
		cout << "Usage:" << endl;
		cout << endl;
		cout << "generateCoiledBundles --symmetry SYM --superHelicalRadius LOW HIGH STEP --alphaHelicalPhaseAngle LOW HIGH STEP --superHelicalPitchAngle LOW HIGH STEP --numberOfResidues NUM [ --d2zTranslation LOW HIGH STEP --superHelicalPhaseAngle LOW HIGH STEP --name OUTFILE]\n";
		cout << "Recommended parameters:" << endl;
		cout << "--symmetry: C2, C3, D2, D3, etc." << endl;
		cout << "--superHelicalRadius: radius from center in Angstroms" << endl;
		cout << "--alphaHelicalPhaseAngle: phase angle of the helices (0-360 degrees)" << endl;
		cout << "--superHelicalPitchAngle: often 5-20 degrees, but depends on the coil (average around 12)" << endl;
		cout << "--d2zTranslation: z offset between D_N symmetric coils, usually small" << endl;
		cout << "--superHelicalPhaseAngle: angle in degrees.  Value of 90/N for D_N typically works well, but larger and smaller values are possible" << endl;
		exit(0);
	}

	opt.symmetry = OP.getString("symmetry");
	if (OP.fail()){
		cerr << "ERROR 1111 symmetry not specified.\n";
		exit(1111);
	}
	opt.superHelicalRadius = OP.getDoubleVector("superHelicalRadius");
	if (OP.fail()){		   
		cerr << "ERROR 1111 superHelicalRadius not specified.\n";
		exit(1111);
	}

	opt.alphaHelicalPhaseAngle = OP.getDoubleVector("alphaHelicalPhaseAngle");
	if (OP.fail()){		   
		cerr << "ERROR 1111 alphaHelicalPhaseAngle not specified.\n";
		exit(1111);
	}

	opt.superHelicalPitchAngle = OP.getDoubleVector("superHelicalPitchAngle");
	if (OP.fail()){		   
		cerr << "ERROR 1111 superHelicalPitchAngle not specified.\n";
		exit(1111);
	}

	opt.numberOfResidues = OP.getInt("numberOfResidues");
	if (OP.fail()){		   
		cerr << "ERROR 1111 numberOfResidues not specified.\n";
		exit(1111);
	}

	opt.d2zTranslation         = OP.getDoubleVector("d2zTranslation");
	opt.superHelicalPhaseAngle = OP.getDoubleVector("superHelicalPhaseAngle");
	if (opt.d2zTranslation.size() == 0) { vector<double> tmp; tmp.push_back(0.0); tmp.push_back(1.0); tmp.push_back(100.0); opt.d2zTranslation = tmp; cerr << "Warning,  d2zTranslation not defined (required for D2, D3)" << endl; }
	if (opt.superHelicalPhaseAngle.size() == 0) {
		int _N = atoi(opt.symmetry.substr(1,(opt.symmetry.length()-1)).c_str());
		double recommendedValue = 90./double(_N);
		vector<double> tmp; tmp.push_back(recommendedValue); tmp.push_back((recommendedValue + 1.)); tmp.push_back(100.0); opt.superHelicalPhaseAngle = tmp; cerr << "Warning,  superHelicalPhaseAngle not defined (required for D2, D3)" << endl;
	}

	opt.name = OP.getString("name");
	if (OP.fail()){
		opt.name = "CoiledBundle";
	}

	return opt;
}