22 #ifndef _LOBO_TOOLS_H_
23 #define _LOBO_TOOLS_H_
25 #include <LoopModel.h>
27 #include <PdbLoader.h>
30 using namespace Victor;
31 using namespace Victor::Lobo;
38 inline void fillLine() {
39 std::cout <<
"---------------------------------------------------\n";
45 inline void showCommonOptions() {
46 char *victor = getenv(
"VICTOR_ROOT");
48 ERROR(
"Environment variable VICTOR_ROOT was not found.\n Use the command:\n export VICTOR_ROOT=......", exception);
49 string path =
"data/aa";
50 std::cout <<
"\t[--sol1 <n-solutions>] \t Number of primary solutions"
51 <<
" (default= " << LoopModel::MAX_ITER_SOL <<
")\n"
52 <<
"\t[--maxWrite <n-sol.>] \t Number of solutions to write out"
53 <<
" (default = sol1)\n"
54 <<
"\t[--scwrl <filename>] \t Sequence output file for SCWRL (-s option)\n"
55 <<
"\t[--table <name>] \t Path and basename of LUT files (default = "
56 << getenv(
"VICTOR_ROOT") + path <<
") \n"
57 <<
"\t[--withOxygen] \t\t Include Oxygen atoms in RMSD calculation\n"
58 <<
"\t[--verbose] \t\t Verbose mode\n"
59 <<
"\t[--silent] \t\t Silent mode\n";
65 inline void showSpecialOptions() {
67 std::cout <<
"\t[--sol2 <n-solutions>] \t Number of secondary solutions"
69 <<
"\t[--endrmsWeigth] \t Choose weigthing of endrms"
70 <<
" (default= " << lm.getENDRMS_WEIGHT() <<
")\n"
71 <<
"\t[--energyWeigth] \t Choose weigthing of energy"
72 <<
" (default= " << LoopModel::ENERGY_WEIGTH <<
")\n"
73 <<
"\t[--secprefWeigth] \t Choose weigthing of secondary preference"
74 <<
" (default= " << LoopModel::SECPREF_WEIGTH <<
")\n"
75 <<
"\t[--secprefTol] \t\t Choose tolerance for secondary preference"
76 <<
" (default= " << LoopModel::SECPREF_TOL <<
")\n"
77 <<
"\t[--packingWeigth] \t Choose weigthing of packing density"
78 <<
" (default= " << LoopModel::PACKING_WEIGTH <<
")\n"
79 <<
"\t[--weigthEP] \t\t Choose weigthing of EP compared to ED & EN"
80 <<
" (default= " << LoopTableEntry::LAMBDA_EP <<
")\n"
81 <<
"\t[--maxSearch] \t\t Choose max fraction of tables to search "
82 <<
"for best result (default= " << LoopTable::MAX_FACTOR <<
")\n"
83 <<
"\t[--vdwLimit] \t\t Choose threshold for VDW filter"
84 <<
" (default= " << LoopModel::VDW_LIMIT <<
")\n"
85 <<
"\t[--energyLimit] \t Choose threshold for energy filter"
86 <<
" (default= " << LoopModel::ENERGY_LIMIT <<
")\n"
87 <<
"\t[--simLimit] \t\t Choose threshold for clustering similarity"
88 <<
" (default= " << LoopModel::SIM_LIMIT <<
")\n"
89 <<
"\t[--interpol] \t\t Use interpolated RAPDF energy\n"
90 <<
"\t[--scatter <filename>] \t Write a scatter plot file.\n";
96 inline void showSpecialOptionsLobo() {
97 std::cout <<
"\t[--cluster] \t\t Cluster results.\n"
98 <<
"\t[--norank] \t\t Do not rank or filter results.\n"
99 <<
"\t[--norankRms] \t\t Do not rank or filter results according "
100 <<
"to end AA RMS.\n"
101 <<
"\t[--noFullModel] \t Do not write full model, write only"
102 <<
" loop instead.\n"
103 <<
"\t[--noWrite]\t\t Do not write output file.\n"
104 <<
"\t[--refine] \t\t Refines the solutions (ie. reduced endRms)\n"
105 <<
"\t[--optimize] \t\t Local optimization of the top solution\n"
106 <<
"\t[--optall] \t\t Local optimization of all solutions pre-ranking\n"
107 <<
"\t[--opt1] \t\t Number of outer iterations for optimization\n"
108 <<
"\t[--opt2] \t\t Number of inner iterations for optimization\n"
109 <<
"\t[--optnum] \t\t Number of solutions to optimize\n"
110 <<
"\t[--test] \t\t Test mode, no optimization\n";
116 static inline void sLoboHelp() {
117 std::cout <<
"LOBO - LOop Building & Optimization\n"
118 <<
"This program generates a model for a single loop or indel.\n"
120 <<
"\t-i <filename> \t\t Input file\n"
121 <<
"\t-c <chain> \t\t pdb chain\n"
122 <<
"\t-s <n-start> \t\t Aminoacid where loop starts\n"
123 <<
"\t-e <n-end> \t\t Aminoacid where loop ends\n"
125 <<
"\t[-o <filename>] \t Output file (default = test.pdb)\n"
126 <<
"\t[--seq <filename>] \t Sequence file (in one letter code)\n";
132 inline void showLoboHelp() {
135 std::cout <<
"\n\t--help \t\t Get detailed help.\n"
142 inline void showMoreLoboHelp() {
145 showSpecialOptions();
146 showSpecialOptionsLobo();
153 static inline void sLoboAutoHelp() {
154 std::cout <<
"LOBO - LOop Building & Optimization\n"
155 <<
"This program generates an automatic model for a single indel.\n"
157 <<
"\t-i <filename> \t\t Input pdb file\n"
158 <<
"\t-c <filename> \t\t pdb chain\n"
159 <<
"\t-s <n-start> \t\t N-terminal aminoacid where indel starts\n"
160 <<
"\t-l <length> \t\t Length of indel\n"
161 <<
"\t--del \t\t Modelling of deletion requested (default)\n"
162 <<
"\t--ins \t\t Modelling of insertion requested\n"
163 <<
"\t--seq <filename> \t Sequence file (in one letter code)\n"
165 <<
"\t[-o <filename>] \t Output file (default = test.pdb)\n";
171 inline void showLoboAutoHelp() {
174 std::cout <<
"\n\t--help \t\t Get detailed help.\n"
181 inline void showMoreLoboAutoHelp() {
184 showSpecialOptions();
185 showSpecialOptionsLobo();
192 static inline void sLoboFullHelp() {
193 std::cout <<
"LOBO FULL - LOop Building & Optimization for full proteins\n"
194 <<
"This program generates all models for every k-mer fragment in "
195 <<
"a single protein over a sliding window.\n"
197 <<
"\t-i <filename> \t\t Input file\n"
198 <<
"\t[-c <chain>] \t\t pdb chain\n"
199 <<
"\t[-o <filename>] \t Output file basename\n"
200 <<
"\t[-s <offset>] \t\t Size of *real* sliding window (default= 5)\n"
202 <<
"\t[--norankRms] \t\t Do not rank or filter results according "
203 <<
"to end AA RMS.\n"
204 <<
"\t[--fullRank] \t\t Write full ranking.\n";
210 inline void showLoboFullHelp() {
213 std::cout <<
"\n\t--help \t\t Get detailed help.\n"
220 inline void showMoreLoboFullHelp() {
223 showSpecialOptions();
232 inline string sGetSequence(
string sequenceFile,
bool silent) {
234 std::cout <<
"seqFile = " << sequenceFile <<
"\n";
236 ifstream seqFile(sequenceFile.c_str());
238 ERROR(
"Sequence file not found.", exception);
250 inline void treatSpecialOptions(
int nArgs,
char* argv[]) {
251 getOption(LoopModel::ENERGY_WEIGTH,
"-energyWeigth", nArgs, argv,
true);
252 getOption(LoopModel::SECPREF_WEIGTH,
"-secprefWeigth", nArgs, argv,
true);
253 getOption(LoopModel::SECPREF_TOL,
"-secprefTol", nArgs, argv,
true);
254 getOption(LoopModel::PACKING_WEIGTH,
"-packingWeigth", nArgs, argv,
true);
255 getOption(LoopTableEntry::LAMBDA_EP,
"-weigthEP", nArgs, argv,
true);
256 getOption(LoopTableEntry::LAMBDA_ED,
"-weigthED", nArgs, argv,
true);
257 getOption(LoopTableEntry::LAMBDA_EN,
"-weigthEN", nArgs, argv,
true);
258 getOption(LoopTable::MAX_FACTOR,
"-maxSearch", nArgs, argv,
true);
259 getOption(LoopModel::VDW_LIMIT,
"-vdwLimit", nArgs, argv,
true);
260 getOption(LoopModel::ENERGY_LIMIT,
"-energyLimit", nArgs, argv,
true);
261 getOption(LoopModel::SIM_LIMIT,
"-simLimit", nArgs, argv,
true);
269 inline void printSeqAndBfactors(
unsigned int index1,
unsigned int index2,
Spacer& sp) {
271 std::cout <<
"Sequence & B-factors:\n";
273 for (
unsigned int i = index1 + 1; i < index2 + 1; i++) {
275 for (
unsigned int j = 0; j < sp.
getAmino(i).sizeBackbone(); j++)
276 std::cout <<
" " << setw(5) << setprecision(3)
287 inline void treatProlineBug(
unsigned int index1,
unsigned int index2,
Spacer& sp) {
289 if (sp.
getAmino(index1 + 1).getCode() == PRO) {
290 if (sp.
getAmino(index1 + 1).getSideChain().isMember(CD))
292 sp.
getAmino(index1 + 1).getSideChain()[CD]);
294 if (sp.
getAmino(index2 + 1).getCode() == PRO) {
295 if (sp.
getAmino(index2 + 1).getSideChain().isMember(CD))
297 sp.
getAmino(index2 + 1).getSideChain()[CD]);
306 inline void printSecStructureAndLoop(
unsigned int index1,
unsigned int index2,
Spacer& sp) {
307 for (
unsigned int i = 0; i < sp.
sizeAmino(); i++) {
308 if (sp.
getAmino(i).getState() == HELIX)
310 else if (sp.
getAmino(i).getState() == STRAND)
314 if ((i + 1) % 60 == 0)
318 for (
unsigned int i = 0; i < sp.
sizeAmino(); i++) {
319 if ((i >= index1) && (i <= index2))
323 if ((i + 1) % 60 == 0)
337 inline void printResults(
unsigned int index1,
unsigned int index2,
338 LoopModel& lm,
Spacer& sp, vector<Spacer>& vsp,
bool withOxygen,
unsigned int maxWrite = 9999) {
340 std::cout <<
" Results: \t\t\t\t\t\t 1.35 121 180\n";
342 maxWrite = (maxWrite < vsp.size() ? maxWrite : vsp.size());
343 for (
unsigned int i = 0; i < maxWrite; i++) {
344 std::cout << setw(3) << i <<
" ";
345 lm.calculateRms(sp, index1, index2, vsp[i],
true, withOxygen);
357 inline void saveLoopEnsemble(
unsigned int index1,
unsigned int index2,
358 LoopModel& lm,
Spacer& sp, vector<Spacer>& vsp,
string outputFile,
359 unsigned int maxWrite,
bool noFullModel) {
360 unsigned int maxW = vsp.size() < maxWrite ? vsp.size() : maxWrite;
361 for (
unsigned int i = 0; i < maxW; i++) {
362 string tmpStr = outputFile +
".";
371 ofstream outFile(tmpStr.c_str());
373 ERROR(
"Could not create file.", exception);
375 ps.setWriteAtomOnly();
378 lm.setStructure(sp, vsp[i], index1, index2);
387 #endif //_LOBOTOOLS_H_
AminoAcid & getAmino(unsigned int n)
Definition: Spacer.cc:962
void removeAtom(Atom &a)
Definition: Group.cc:85
virtual string getType() const
Definition: SimpleBond.h:114
const unsigned int sizeAmino() const
Definition: Spacer.cc:197
Saves components (Atoms, Groups, etc.) in standard PDB format.
Definition: PdbSaver.h:39
void save(Saver &s)
Definition: Spacer.h:241
Implements a "Spacer" for a protein chain. Includes methods to obtain values from the atoms and its p...
Definition: Spacer.h:42