diff --git a/Biopool/APPS/CIF2Seq.cc b/Biopool/APPS/CIF2Seq.cc
new file mode 100644
index 0000000..f409a79
--- /dev/null
+++ b/Biopool/APPS/CIF2Seq.cc
@@ -0,0 +1,128 @@
+/* This file is part of Victor.
+
+ Victor is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Victor is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Victor. If not, see .
+ */
+/**
+ */
+#include
+#include
+#include
+#include
+#include
+
+using namespace Victor;using namespace Victor::Biopool;
+
+void sShowHelp() {
+ cout << "CIF 2 Seq $Revision: 1.0 $ -- converts a CIF file into SEQ\n"
+ << "(torsion angles) protein structure backbone torsion angles\n"
+ << " Options: \n"
+ << "\t-i \t Input CIF file\n"
+ << "\t-o \t Output to file (default stdout)\n"
+ << "\t-c \t Chain identifier to read\n"
+ << "\t--all \t All chains\n"
+ << "\t-m \t Model number to read (NMR only, default is first model)\n"
+ << "\t--chi \t Write Chi angles (default false)\n"
+ << "\t-v \t verbose output\n\n"
+ << "\tIf both -c and --all are missing, only the first chain is processed.\n\n";
+
+}
+
+int main(int argc, char* argv[]) {
+
+ if (getArg("h", argc, argv)) {
+ sShowHelp();
+ return 1;
+ }
+
+ string inputFile, outputFile, chainID;
+ unsigned int modelNum;
+ bool chi, all;
+
+ getArg("i", inputFile, argc, argv, "!");
+ getArg("o", outputFile, argc, argv, "!");
+ getArg("c", chainID, argc, argv, "!");
+ getArg("m", modelNum, argc, argv, 999);
+ all = getArg("-all", argc, argv);
+ chi = getArg("-chi", argc, argv);
+
+ // Check input file
+ if (inputFile == "!") {
+ cout << "Missing input file specification. Aborting. (-h for help)" << endl;
+ return -1;
+ }
+ ifstream inFile(inputFile.c_str());
+ if (!inFile)
+ ERROR("Input file not found.", exception);
+
+
+ CIFLoader cifL(inFile);
+
+ // Set CIFLoader variables
+ cifL.setModel(modelNum);
+ cifL.setNoHAtoms();
+ cifL.setNoHetAtoms();
+ cifL.setNoSecondary();
+ if (!getArg("v", argc, argv)) {
+ cifL.setNoVerbose();
+ }
+
+
+ // Check chain args
+ if ((chainID != "!") && all) {
+ ERROR("You can use --all or -c, not both", error);
+ }
+ // User selected chain
+ if (chainID != "!") {
+ if (chainID.size() > 1)
+ ERROR("You can choose only 1 chain", error);
+ cifL.setChain(chainID[0]);
+ }// All chains
+ else if (all) {
+ cifL.setAllChains();
+ }// First chain
+ else {
+ cifL.setChain(cifL.getAllChains()[0]);
+ }
+
+ // Load the protein object
+ Protein prot;
+ prot.load(cifL);
+
+ // Open the proper output stream (file or stdout)
+ std::ostream* os = &cout;
+ std::ofstream fout;
+ if (outputFile != "!") {
+ fout.open(outputFile.c_str());
+ if (!fout) {
+ ERROR("Could not open file for writing.", exception);
+ } else {
+ os = &fout;
+ }
+ }
+
+
+ Spacer* sp;
+ for (unsigned int i = 0; i < prot.sizeProtein(); i++) {
+
+ sp = prot.getSpacer(i);
+
+ // Write the sequence
+ SeqSaver ss(*os);
+ if (!chi)
+ ss.setWriteChi(false);
+ sp->save(ss);
+ }
+
+ return 0;
+}
diff --git a/Biopool/APPS/CIF2secondary.cc b/Biopool/APPS/CIF2secondary.cc
new file mode 100644
index 0000000..f07dbdb
--- /dev/null
+++ b/Biopool/APPS/CIF2secondary.cc
@@ -0,0 +1,108 @@
+/* This file is part of Victor.
+
+ Victor is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Victor is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Victor. If not, see .
+ */
+/**
+@Description */
+
+#include
+#include
+#include
+#include
+#include
+
+using namespace Victor;using namespace Victor::Biopool;
+
+void sShowHelp() {
+ cout << "CIF 2 Secondary Structure converter\n"
+ << "\t H = helix, \t E = extended (strand, sheet), \t . = other.\n"
+ << " Options: \n"
+ << "\t-i \t\t Input file for CIF structure\n"
+ << "\n";
+}
+
+int main(int nArgs, char* argv[]) {
+ if (getArg("h", nArgs, argv)) {
+ sShowHelp();
+ return 1;
+ };
+ vector allCh;
+ string chainID = "!";
+ string inputFile;
+ getArg("i", inputFile, nArgs, argv, "!");
+
+ if (inputFile == "!") {
+ cout << "Missing file specification. Aborting. (-h for help)" << endl;
+ return -1;
+ }
+
+ Spacer *sp;
+ ifstream inFile(inputFile.c_str());
+ if (!inFile)
+ ERROR("File not found.", exception);
+
+ CIFLoader il(inFile);
+ il.setNoHAtoms();
+ // sp.load(il);
+ allCh = il.getAllChains();
+ for (unsigned int i = 0; i < allCh.size(); i++)
+ cout << "\t," << allCh[i] << ",";
+ cout << "\n";
+
+ /*check on validity of chain:
+ if user select a chain then check validity
+ else select first valid one by default*/
+ if (chainID != "!") {
+ bool validChain = false;
+ for (unsigned int i = 0; i < allCh.size(); i++) {
+ if (allCh[i] == chainID[0]) {
+ il.setChain(chainID[0]);
+ cout << "Loading chain " << chainID << "\n";
+ validChain = true;
+ break;
+ }
+ }
+ if (!validChain) {
+ cout << "Chain " << chainID << " is not available\n";
+ return -1;
+ }
+
+ } else {
+ chainID[0] = allCh[0];
+ cout << "Using chain " << chainID << "\n";
+ }
+ Protein prot;
+ prot.load(il);
+ sp = prot.getSpacer(chainID[0]);
+
+ allCh = il.getAllChains();
+ cout << ">" << inputFile << "\n";
+ for (unsigned int i = 0; i < sp->sizeAmino(); i++) {
+ switch (sp->getAmino(i).getState()) {
+ case HELIX:
+ cout << "H";
+ break;
+ case STRAND:
+ cout << "E";
+ break;
+ default:
+ cout << ".";
+ };
+ if ((i + 1) % 60 == 0)
+ cout << "\n";
+ }
+ cout << "\n";
+
+ return 0;
+}
diff --git a/Biopool/APPS/CIFCorrector.cc b/Biopool/APPS/CIFCorrector.cc
new file mode 100644
index 0000000..96edfc3
--- /dev/null
+++ b/Biopool/APPS/CIFCorrector.cc
@@ -0,0 +1,59 @@
+/* This file is part of Victor.
+
+ Victor is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Victor is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Victor. If not, see .
+ */
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+using namespace Victor;using namespace Victor::Biopool;
+
+int main(int nArgs, char* argv[]) {
+ if (nArgs != 2) {
+ cout << "CIF Corrector $Revision: 1.0 $ -- adds missing oxygen atoms to "
+ << "protein structure backbones" << endl;
+ cout << " Usage: \t\t CIFCorrector \n";
+ return 1;
+ };
+
+ Spacer sp;
+ ifstream inFile(argv[1]);
+ if (!inFile)
+ ERROR("File not found.", exception);
+
+ CIFLoader CIFL(inFile);
+ sp.load(CIFL);
+
+ for (unsigned int i = 0; i < sp.sizeAmino(); i++)
+ sp.getAmino(i).addMissingO();
+
+ ofstream outFile2(argv[1]);
+
+ if (!outFile2)
+ ERROR("Couldn't write file.", exception);
+
+ CIFSaver pss2(outFile2);
+ sp.save(pss2);
+
+ return 0;
+}
diff --git a/Biopool/APPS/CIFEditor.cc b/Biopool/APPS/CIFEditor.cc
new file mode 100644
index 0000000..6380e94
--- /dev/null
+++ b/Biopool/APPS/CIFEditor.cc
@@ -0,0 +1,86 @@
+/* This file is part of Victor.
+
+ Victor is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Victor is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Victor. If not, see .
+ */
+/**
+
+ */
+#include
+#include
+#include
+#include
+
+using namespace Victor;using namespace Victor::Biopool;
+
+int main(int nArgs, char* argv[]) {
+ if (nArgs != 3) {
+ cout << "CIF Editor $Revision: 1.0 $ -- allows sequential manipulation of "
+ << "protein structure backbone torsion angles" << endl;
+ cout << " Usage: \t\t CIFEditor \n";
+ return 1;
+ };
+
+ Spacer sp;
+ ifstream inFile(argv[1]);
+ if (!inFile)
+ ERROR("File not found.", exception);
+
+ CIFLoader il(inFile);
+ sp.load(il);
+
+ cout << "Editing " << argv[1] << " output goes to " << argv[2] << "\n";
+
+ int aaid = -1;
+ do {
+ cout << "Aminoacid# or -1: ";
+ cin >> aaid;
+ if (aaid <= -1) {
+ cout << "Bye.\n";
+ return 0;
+ };
+
+ if (aaid >= (int) sp.sizeAmino()) {
+ cout << "\t Invalid aa#!\n";
+ } else {
+ double newVal = 999;
+ cout << "\t " << aaid << " " << sp.getAmino(aaid).getType() << "\n";
+ cout << "Phi= " << sp.getAmino(aaid).getPhi()
+ << "\t new phi or 999: ";
+ cin >> newVal;
+ if (newVal != 999)
+ sp.getAmino(aaid).setPhi(newVal);
+ cout << "Psi= " << sp.getAmino(aaid).getPsi()
+ << "\t new psi or 999: ";
+ cin >> newVal;
+ if (newVal != 999)
+ sp.getAmino(aaid).setPsi(newVal);
+ cout << "Omega= " << sp.getAmino(aaid).getOmega()
+ << "\t new omega or 999: ";
+ cin >> newVal;
+ if (newVal != 999)
+ sp.getAmino(aaid).setOmega(newVal);
+
+ ofstream outFile2(argv[2]);
+
+ if (!outFile2)
+ ERROR("Couldn't write file.", exception);
+
+ CIFSaver pss2(outFile2);
+
+ sp.save(pss2);
+ };
+ } while (aaid != -1);
+
+ return 0;
+}
diff --git a/Biopool/APPS/CIFMover.cc b/Biopool/APPS/CIFMover.cc
new file mode 100644
index 0000000..f58789b
--- /dev/null
+++ b/Biopool/APPS/CIFMover.cc
@@ -0,0 +1,197 @@
+/* This file is part of Victor.
+
+ Victor is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Victor is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Victor. If not, see .
+ */
+/**
+@Description */
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+using namespace Victor;using namespace Victor::Biopool;
+
+const double LAMBDA = 1.5; // minimum distance between neighbouring CAs
+
+void sShowHelp() {
+ cout << "CIF Shifter\n"
+ << "Allows to move all residues in file by fixed offset.\n"
+ << " Options: \n"
+ << "\t-i \t\t Input CIF file\n"
+ << "\t-o \t\t Output CIF file\n"
+ << "\t[-r ] \t\t Repeat unit length (default = no rotation)\n"
+ << "\t[-l ] \t\t Angle lambda factor (default = 0.1)\n"
+ << "\t[-s ] \t\t Start residue of fragment (default = first)\n"
+ << "\t[-e ] \t\t End residue of fragment (default = last)\n"
+ << "\n";
+}
+
+void sAddLine() {
+ cout << "-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-\n";
+}
+
+int main(int nArgs, char* argv[]) {
+ // --------------------------------------------------
+ // 0. treat options
+ // --------------------------------------------------
+
+ if (getArg("h", nArgs, argv)) {
+ sShowHelp();
+ return 1;
+ };
+
+ string inputFile, outputFile;
+ unsigned int startOffset, endOffset, repeatLength;
+ double lambdaAngle;
+
+ getArg("i", inputFile, nArgs, argv, "!");
+ getArg("o", outputFile, nArgs, argv, "!");
+ getArg("s", startOffset, nArgs, argv, 0);
+ getArg("e", endOffset, nArgs, argv, 9999);
+ getArg("r", repeatLength, nArgs, argv, 9999);
+ getArg("l", lambdaAngle, nArgs, argv, 0.1);
+
+ vgVector3 transOff;
+ for (unsigned int i = 0; i < 3; i++)
+ transOff[i] = 0.0;
+
+ if ((inputFile == "!") || (outputFile == "!")) {
+ cout << "Missing file specification. Aborting. (-h for help)" << endl;
+ return -1;
+ }
+
+ // --------------------------------------------------
+ // 1. read structure
+ // --------------------------------------------------
+
+ Spacer sp;
+
+ ifstream inFile(inputFile.c_str());
+
+ if (!inFile)
+ ERROR("File does not exist.\n", exception);
+
+ CIFLoader CIFL(inFile);
+
+ sp.load(CIFL);
+ inFile.close();
+
+
+ endOffset = sp.getIndexFromPdbNumber(endOffset);
+ if (startOffset > 0)
+ startOffset = sp.getIndexFromPdbNumber(startOffset);
+
+ // --------------------------------------------------
+ // 2. rotate spacer
+ // --------------------------------------------------
+
+ if (repeatLength < 9999) {
+ IntCoordConverter icc;
+
+ // find offset
+ vgVector3 firstA = sp.getAmino(endOffset
+ - (3 * repeatLength / 4))[CA].getCoords()
+ - sp.getAmino(endOffset)[CA].getCoords();
+
+ vgVector3 firstB = sp.getAmino(endOffset
+ - (1 * repeatLength / 4))[CA].getCoords()
+ - sp.getAmino(endOffset)[CA].getCoords();
+
+ vgVector3 firstNorm = (firstA.normalize()).cross(firstB.normalize());
+
+ vgVector3 secondA = sp.getAmino(endOffset + repeatLength
+ - (3 * repeatLength / 4))[CA].getCoords()
+ - sp.getAmino(endOffset)[CA].getCoords();
+
+ vgVector3 secondB = sp.getAmino(endOffset + repeatLength
+ - (1 * repeatLength / 4))[CA].getCoords()
+ - sp.getAmino(endOffset)[CA].getCoords();
+
+ vgVector3 secondNorm = (secondA.normalize()).cross(secondB.normalize());
+
+ firstNorm.normalize();
+ secondNorm.normalize();
+
+ double scalar = icc.getAngle(firstNorm, secondNorm) * lambdaAngle;
+
+ cout << "Scalar = " << setw(5) << setprecision(3)
+ << RAD2DEG * scalar / lambdaAngle << "\n";
+
+
+ vgVector3 axis = (firstNorm.normalize()).cross(secondNorm.normalize());
+ vgMatrix3 res = vgMatrix3::createRotationMatrix(axis, scalar);
+
+ sp.getAmino(startOffset)[N].addRot(res);
+ }
+
+ // --------------------------------------------------
+ // 3. translate spacer
+ // --------------------------------------------------
+
+ if (endOffset < sp.sizeAmino() - 1) {
+ sp.getAmino(endOffset).unbindOut(sp.getAmino(endOffset + 1));
+ sp.getAmino(endOffset)[C].unbindOut(sp.getAmino(endOffset + 1)[N]);
+
+ // find offset
+ vgVector3 first = sp.getAmino(endOffset)[C].getCoords();
+ vgVector3 second = sp.getAmino(endOffset + 1)[N].getCoords();
+
+ double d = sp.getAmino(endOffset)[C].distance(
+ sp.getAmino(endOffset + 1)[N]);
+
+ double frac = (d - LAMBDA) / d;
+
+ for (unsigned int i = 0; i < 3; i++)
+ transOff[i] = (second[i] - first[i]) * frac;
+ } else {
+ if (startOffset != 0)
+ ERROR("Both start and end offset are undefined.", exception);
+
+ endOffset = sp.sizeAmino() - 1;
+
+ // NB: unbind has to be reversed after moving the atoms if the model
+ // is to be used further in the same program
+ sp.getAmino(startOffset - 1).unbindOut(sp.getAmino(startOffset));
+ sp.getAmino(startOffset - 1)[C].unbindOut(sp.getAmino(startOffset)[N]);
+
+ // find offset
+ vgVector3 first = sp.getAmino(startOffset + 1)[N].getCoords();
+ vgVector3 second = sp.getAmino(startOffset)[C].getCoords();
+
+ double d = sp.getAmino(startOffset + 1)[N].distance(
+ sp.getAmino(startOffset)[C]);
+
+ double frac = (d - LAMBDA) / d;
+
+ for (unsigned int i = 0; i < 3; i++)
+ transOff[i] = (second[i] - first[i]) * frac;
+ }
+
+ sp.getAmino(startOffset)[N].addTrans(transOff);
+
+ // --------------------------------------------------
+ // 4. write model to disk
+ // --------------------------------------------------
+
+ ofstream outFile(outputFile.c_str());
+ if (!outFile)
+ ERROR("File not found.", exception);
+ CIFSaver ps(outFile);
+
+ sp.save(ps);
+ outFile.close();
+}
diff --git a/Biopool/APPS/CIFPDBConverter.cc b/Biopool/APPS/CIFPDBConverter.cc
new file mode 100644
index 0000000..016fccd
--- /dev/null
+++ b/Biopool/APPS/CIFPDBConverter.cc
@@ -0,0 +1,133 @@
+/* This file is part of Victor.
+
+ Victor is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Victor is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Victor. If not, see .
+ */
+/**
+ */
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+using namespace std;
+using namespace Victor;
+using namespace Victor::Biopool;
+
+void sShowHelp() {
+ cout << "CIF PDB Converter $Revision: 1.0 $ -- converts a CIF file into a PDB file and vice versa." << endl
+ << "Options:" << endl
+ << "\t-i \t Input file" << endl
+ << "\t-o \t Output file";
+}
+
+int main(int argc, char* argv[]) {
+
+ if (getArg("h", argc, argv)) {
+ sShowHelp();
+ return 1;
+ }
+
+ string inputFile, outputFile;
+
+ getArg("i", inputFile, argc, argv, "!");
+ getArg("o", outputFile, argc, argv, "!");
+
+ // Check input file
+ if (inputFile == "!") {
+ cout << "Missing input file specification. Aborting. (-h for help)" << endl;
+ return -1;
+ }
+ ifstream inFile(inputFile.c_str());
+ if (!inFile)
+ ERROR("Input file not found.", exception);
+
+ // Check output file
+ if (outputFile == "!") {
+ cout << "Missing output file specification. Aborting. (-h for help)" << endl;
+ return -1;
+ }
+
+ inputFile = Trim(inputFile);
+ outputFile = Trim(outputFile);
+
+ string inExt = inputFile.substr((inputFile.size()-3),3);
+ string outExt = outputFile.substr((outputFile.size()-3),3);
+
+ transform(inExt.begin(), inExt.end(), inExt.begin(), ::toupper);
+ transform(outExt.begin(), outExt.end(), outExt.begin(), ::toupper);
+
+ if (inExt != "CIF" && inExt != "PDB")
+ {
+ cout << "Invalid input file format." << endl;
+ return -1;
+ }
+
+ if (outExt != "CIF" && outExt != "PDB")
+ {
+ cout << "Invalid output file format." << endl;
+ return -1;
+ }
+
+ if (inExt == outExt)
+ {
+ cout << "No conversion needed." << endl;
+ return 0;
+ }
+
+ Loader* l;
+ Saver* s;
+ ofstream out(outputFile.c_str());
+ if (!out)
+ {
+ ERROR("Output file not created.", exception);
+ }
+
+
+ if (inExt == "CIF")
+ {
+ l = new CIFLoader(inFile);
+ }
+ else
+ {
+ l = new PdbLoader(inFile);
+ }
+
+ // Load the protein object
+ Protein prot;
+ prot.load(*l);
+
+ if (outExt == "CIF")
+ {
+ s = new CIFSaver(out);
+ }
+ else
+ {
+ s = new PdbSaver(out);
+ }
+
+ prot.save(*s);
+
+ return 0;
+}
diff --git a/Biopool/APPS/CIFSecondary.cc b/Biopool/APPS/CIFSecondary.cc
new file mode 100644
index 0000000..10941f6
--- /dev/null
+++ b/Biopool/APPS/CIFSecondary.cc
@@ -0,0 +1,222 @@
+/* This file is part of Victor.
+
+ Victor is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Victor is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Victor. If not, see .
+ */
+/**
+@Description */
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+using namespace Victor;using namespace Victor::Biopool;
+
+void sShowHelp() {
+ cout << "CIF Secondary $Revision: 1.0 $ -- calculate the secondary structure\n"
+ << "(torsion angles) protein structure backbone torsion angles\n"
+ << "\tOptions: \n"
+ << "\t-i \t Input CIF file\n"
+ << "\t-o \t Output to file(the chain letter is appended)\n"
+ << "\t-c \t Chain identifier to read(default is all chains)\n"
+ << "\t-m \t Model number to read (NMR only, default is first model)\n"
+ << "\t-s <1,2,3> \t SS calculation(default 3): 1 = CIF fields, 2 = torsion angles, 3 = DSSP\n"
+ << "\t \t 1,2:\t H = helix, E = extended(strand,sheet), . = other.\n"
+ << "\t \t 3:\t H = alpha-helix, E = sheet, B = bridge,\n"
+ << "\t \t G = 3-10-helix, I = pi-helix, T = n-Turn, S = bend\n"
+ << "\t--ext \t Extended output (default false). Write the type of aminoacid:\n"
+ << "\t \t N = negative charge, \t P = positive charge\n"
+ << "\t \t h = hydrophilic, \t + = hydrophobic\n"
+ << "\t \t , = neutral (hydrophobic)\n"
+ << "\t-v \t verbose output\n\n"
+ << "\tWhen parsing multiple chains, one file for each chain is created\n\n";
+}
+
+void writeOutput(Spacer* sp, bool ext, int ssType, ostream& os) {
+
+ if (ext) {
+ for (unsigned int i = 0; i <= sp->sizeAmino(); i++) {
+ if ((i + 1) % 10 == 0)
+ os << setw(1) << (((i + 1) % 100) / 10);
+ else
+ os << " ";
+ if ((i + 1) % 60 == 0)
+ os << "\n";
+ }
+ os << "\n";
+
+ for (unsigned int i = 0; i < sp->sizeAmino(); i++) {
+ os << sp->getAmino(i).getType1L();
+ if ((i + 1) % 60 == 0)
+ os << "\n";
+ }
+ os << "\n";
+ for (unsigned int i = 0; i < sp->sizeAmino(); i++) {
+ switch (sp->getAmino(i).getCode()) {
+ case ASP:
+ case GLU:
+ os << "P";
+ break;
+ case LYS:
+ case ARG:
+ os << "N";
+ break;
+ case ASN:
+ case GLN:
+ case SER:
+ case THR:
+ case HIS:
+ os << "h";
+ break;
+ case VAL:
+ case LEU:
+ case ILE:
+ os << "+";
+ break;
+ default:
+ os << ",";
+ };
+ if ((i + 1) % 60 == 0)
+ os << "\n";
+ }
+ os << "\n";
+ }
+ if (ssType != 3) {
+ for (unsigned int i = 0; i < sp->sizeAmino(); i++) {
+ switch (sp->getAmino(i).getState()) {
+ case HELIX:
+ os << "H";
+ break;
+ case STRAND:
+ os << "E";
+ break;
+ default:
+ os << ".";
+ };
+ if ((i + 1) % 60 == 0)
+ os << "\n";
+ }
+ } else {
+ vector > ss = sp->getDSSP();
+ for (unsigned int i = 0; i < ss.size(); i++) {
+ if (!ss[i].empty()) {
+ for (set ::iterator it = ss[i].begin(); it != ss[i].end(); ++it) {
+ os << (*it);
+ }
+ } else {
+ os << ".";
+ }
+ if ((i + 1) % 60 == 0)
+ os << "\n";
+ }
+ }
+ os << "\n";
+}
+
+int main(int argc, char* argv[]) {
+
+ if (getArg("h", argc, argv)) {
+ sShowHelp();
+ return 1;
+ }
+
+ string inputFile, outputFile, chainID;
+ unsigned int modelNum;
+ unsigned int ssType;
+ bool extendedOutput, all;
+
+
+ getArg("i", inputFile, argc, argv, "!");
+ getArg("o", outputFile, argc, argv, "!");
+ getArg("c", chainID, argc, argv, "!");
+ getArg("m", modelNum, argc, argv, 999);
+ getArg("s", ssType, argc, argv, 3);
+ all = getArg("-all", argc, argv);
+ extendedOutput = getArg("-ext", argc, argv);
+
+
+
+
+ // Check input file
+ if (inputFile == "!") {
+ cout << "Missing input file specification. Aborting. (-h for help)" << endl;
+ return -1;
+ }
+ ifstream inFile(inputFile.c_str());
+ if (!inFile)
+ ERROR("Input file not found.", exception);
+
+
+ CIFLoader CIFL(inFile);
+
+ // Set CIFLoader variables
+ CIFL.setModel(modelNum);
+ CIFL.setNoHetAtoms();
+
+ if (!getArg("v", argc, argv)) {
+ CIFL.setNoVerbose();
+ }
+
+ // Check chain args
+ if ((chainID != "!") && all) {
+ ERROR("You can use --all or -c, not both", error);
+ }
+ // User selected chain
+ if (chainID != "!") {
+ if (chainID.size() > 1)
+ ERROR("You can choose only 1 chain", error);
+ CIFL.setChain(chainID[0]);
+ }// All chains
+ else if (all) {
+ CIFL.setAllChains();
+ }// First chain
+ else {
+ CIFL.setChain(CIFL.getAllChains()[0]);
+ }
+
+ // Load the protein object
+ Protein prot;
+ prot.load(CIFL);
+
+ // Open the proper output stream (file or stdout)
+ std::ostream* os = &cout;
+ std::ofstream fout;
+ if (outputFile != "!") {
+ fout.open(outputFile.c_str());
+ if (!fout) {
+ ERROR("Could not open file for writing.", exception);
+ } else {
+ os = &fout;
+ }
+ }
+
+
+
+ Spacer* sp;
+ for (unsigned int i = 0; i < prot.sizeProtein(); i++) {
+
+ sp = prot.getSpacer(i);
+ writeOutput(sp, extendedOutput, ssType, (*os));
+ }
+
+ return 0;
+}
diff --git a/Biopool/APPS/CIFshifter.cc b/Biopool/APPS/CIFshifter.cc
new file mode 100644
index 0000000..bf50dac
--- /dev/null
+++ b/Biopool/APPS/CIFshifter.cc
@@ -0,0 +1,136 @@
+/* This file is part of Victor.
+
+ Victor is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Victor is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Victor. If not, see .
+ */
+/**
+@Description */
+#include
+#include
+#include
+#include
+
+using namespace Victor;using namespace Victor::Biopool;
+
+void sShowHelp() {
+ cout << "CIF Shifter\n"
+ << "Allows to shift all residues in file by fixed offset.\n"
+ << " Options: \n"
+ << "\t-i \t\t Input CIF file\n"
+ << "\t-o \t\t Output CIF file\n"
+ << "\t[-p ] \t\t Positive *residue* offset\n"
+ << "\t[-n ] \t\t Negative *residue* offset\n"
+ << "\t[-P ] \t\t Positive *atom* offset\n"
+ << "\t[-N ] \t\t Negative *atom* offset\n"
+ << "\t[--nohydrogen] \t\t Skip hydrogen atoms\n"
+ << "\t[--renum] \t\t Reset residue numbering starting from 1\n"
+ << "\n";
+}
+
+void sAddLine() {
+ cout << "-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-\n";
+}
+
+void sRenumberAtoms(Spacer& sp) {
+ unsigned int counter = 1;
+ for (unsigned int i = 0; i < sp.sizeAmino(); i++)
+ for (unsigned int j = 0; j < sp.getAmino(i).size(); j++) {
+ sp.getAmino(i)[j].setNumber(counter);
+ counter++;
+ }
+}
+
+int main(int nArgs, char* argv[]) {
+ // --------------------------------------------------
+ // 0. treat options
+ // --------------------------------------------------
+
+ if (getArg("h", nArgs, argv)) {
+ sShowHelp();
+ return 1;
+ };
+
+ string inputFile, outputFile;
+ int offset, offsetAtom, tmp;
+ getArg("i", inputFile, nArgs, argv, "!");
+ getArg("o", outputFile, nArgs, argv, "!");
+
+ getArg("p", offset, nArgs, argv, 0);
+ getArg("n", tmp, nArgs, argv, 0);
+ offset -= tmp;
+ getArg("P", offsetAtom, nArgs, argv, 0);
+ getArg("N", tmp, nArgs, argv, 0);
+ offsetAtom -= tmp;
+
+ bool noHydrogen = getArg("-nohydrogen", nArgs, argv);
+ bool renumber = getArg("-renum", nArgs, argv);
+
+ if ((inputFile == "!") || (outputFile == "!")) {
+ cout << "Missing file specification. Aborting. (-h for help)" << endl;
+ return -1;
+ }
+
+ if ((offset == 0) && (!renumber) && (!noHydrogen)) {
+ cout << "Warning: Offset is zero. Mistake? \n";
+ }
+ // --------------------------------------------------
+ // 1. read structure
+ // --------------------------------------------------
+
+ Spacer sp;
+
+ ifstream inFile(inputFile.c_str());
+
+ if (!inFile)
+ ERROR("File does not exist.\n", exception);
+
+ CIFLoader pl(inFile);
+
+ if (noHydrogen)
+ pl.setNoHAtoms();
+
+ sp.load(pl);
+ inFile.close();
+
+ // --------------------------------------------------
+ // 1.1 renumber residues (if necessary)
+ // --------------------------------------------------
+
+ if (renumber) {
+ cout << "Renumbering...\n";
+ sp.setStartOffset(1);
+ sp.removeAllGaps();
+ sRenumberAtoms(sp);
+ }
+
+ // --------------------------------------------------
+ // 2. shift offset
+ // --------------------------------------------------
+
+ sp.setStartOffset(offset + sp.getStartOffset());
+
+ if (offsetAtom != 0)
+ sp.setAtomStartOffset(offsetAtom + sp.getAtomStartOffset());
+
+ // --------------------------------------------------
+ // 3. write model to disk
+ // --------------------------------------------------
+
+ ofstream outFile(outputFile.c_str());
+ if (!outFile)
+ ERROR("File not found.", exception);
+ CIFSaver ps(outFile);
+
+ sp.save(ps);
+ outFile.close();
+}
diff --git a/Biopool/APPS/Makefile b/Biopool/APPS/Makefile
index cb26b82..21ddd36 100644
--- a/Biopool/APPS/Makefile
+++ b/Biopool/APPS/Makefile
@@ -26,17 +26,20 @@ INC_PATH = -I. -I../../tools/ -I../../Biopool/Sources -I../../Energy/Sources -I.
# Objects and headers
#
-SOURCES = PdbCorrector.cc PdbSecondary.cc PdbEditor.cc Pdb2Seq.cc pdb2secondary.cc pdbshifter.cc \
- pdbMover.cc
+SOURCES = PdbCorrector.cc PdbSecondary.cc PdbEditor.cc Pdb2Seq.cc pdb2secondary.cc pdbshifter.cc pdbMover.cc \
+ CIF2Seq.cc CIF2secondary.cc CIFCorrector.cc CIFEditor.cc CIFMover.cc CIFSecondary.cc CIFshifter.cc CIFPDBConverter.cc
OBJECTS = PdbCorrector.o PdbSecondary.o PdbEditor.o Pdb2Seq.o pdb2secondary.o pdbshifter.o \
- pdbMover.o
+ pdbMover.o \
+ CIF2Seq.o CIF2secondary.o CIFCorrector.o CIFEditor.o CIFMover.o CIFSecondary.o CIFshifter.o CIFPDBConverter.o
TARGETS = PdbCorrector PdbSecondary PdbEditor Pdb2Seq pdb2secondary pdbshifter \
- pdbMover
+ pdbMover \
+ CIF2Seq CIF2secondary CIFCorrector CIFEditor CIFMover CIFSecondary CIFshifter CIFPDBConverter
EXECS = PdbCorrector PdbSecondary PdbEditor Pdb2Seq pdb2secondary pdbshifter \
- pdbMover
+ pdbMover \
+ CIF2Seq CIF2secondary CIFCorrector CIFEditor CIFMover CIFSecondary CIFshifter CIFPDBConverter
LIBRARY = APPSlibBiopool.a
diff --git a/Biopool/Sources/Atom.cc b/Biopool/Sources/Atom.cc
index ebc2f10..e8fee7c 100644
--- a/Biopool/Sources/Atom.cc
+++ b/Biopool/Sources/Atom.cc
@@ -78,8 +78,6 @@ Atom::distance(Atom& other) {
// MODIFIERS:
-
-
/**
* Set the 3D coordinates of the Atom
* @param X, Y and Z (double)
@@ -133,6 +131,7 @@ Atom::copy(const Atom& orig) {
type = orig.type;
coords = orig.coords;
Bfac = orig.Bfac;
+ Occupancy = orig.Occupancy;
trans = orig.trans;
rot = orig.rot;
diff --git a/Biopool/Sources/Atom.h b/Biopool/Sources/Atom.h
index 3df6f47..351fc26 100644
--- a/Biopool/Sources/Atom.h
+++ b/Biopool/Sources/Atom.h
@@ -53,6 +53,10 @@ namespace Victor { namespace Biopool {
double getBFac() {
return Bfac;
}
+
+ double getOccupancy(){
+ return Occupancy;
+ }
double distance(Atom& other);
@@ -83,6 +87,10 @@ namespace Victor { namespace Biopool {
void setBFac(double _b) {
Bfac = _b;
}
+
+ void setOccupancy(double _o){
+ Occupancy = _o;
+ }
void setTrans(vgVector3 t);
void addTrans(vgVector3 t);
@@ -117,6 +125,7 @@ namespace Victor { namespace Biopool {
vgVector3 coords; // xyz-Coords
double Bfac; // B-factor
+ double Occupancy; // Occupancy
vgVector3 trans; // relative translation
vgMatrix3 rot; // relative rotation
diff --git a/Biopool/Sources/CIFDescriptor.h b/Biopool/Sources/CIFDescriptor.h
new file mode 100644
index 0000000..caf74a8
--- /dev/null
+++ b/Biopool/Sources/CIFDescriptor.h
@@ -0,0 +1,59 @@
+/* This file is part of Victor.
+
+ Victor is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Victor is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Victor. If not, see .
+ */
+
+/*
+ * File: CIFDescriptor.h
+ * Author: Francesco Menniti
+ *
+ * Created on 18 dicembre 2015, 16.01
+ * This file contains some CIF names.
+ */
+
+#ifndef CIFDESCRIPTOR_H
+#define CIFDESCRIPTOR_H
+
+using namespace std;
+
+const string AtomSite = "atom_site";
+const string SheetSite = "struct_sheet_range";
+const string HelixSite = "struct_conf";
+
+const string LoopStart = "loop_";
+
+const string AtomID = "id";
+const string AtomPDBModelNumber = "pdbx_PDB_model_num";
+const string AtomChainID = "auth_asym_id";
+const string AtomGroupPDB = "group_PDB";
+const string AtomSeqID = "auth_seq_id";
+const string AtomInsCode = "pdbx_PDB_ins_code";
+const string AtomX = "Cartn_x";
+const string AtomY = "Cartn_y";
+const string AtomZ = "Cartn_z";
+const string AtomBFact = "B_iso_or_equiv";
+const string AtomName = "auth_atom_id";
+const string AtomResidueName = "auth_comp_id";
+const string AtomOccupancy = "occupancy";
+
+const string SheetStart = "beg_auth_seq_id";
+const string SheetEnd = "end_auth_seq_id";
+const string SheetCode = "beg_auth_asym_id";
+
+const string HelixStart = "beg_auth_seq_id";
+const string HelixEnd = "end_auth_seq_id";
+const string HelixCode = "beg_auth_asym_id";
+
+#endif /* CIFDESCRIPTOR_H */
+
diff --git a/Biopool/Sources/CIFFileManager.cc b/Biopool/Sources/CIFFileManager.cc
new file mode 100644
index 0000000..f158ba8
--- /dev/null
+++ b/Biopool/Sources/CIFFileManager.cc
@@ -0,0 +1,102 @@
+/* This file is part of Victor.
+
+ Victor is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Victor is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Victor. If not, see .
+ */
+
+/*
+ * File: CIFFileManager.cc
+ * Author: Francesco Menniti
+ *
+ * Created on 1 dicembre 2015, 9.52
+ */
+
+#include
+
+using namespace std;
+using namespace Victor;
+using namespace Victor::Biopool;
+
+void CIFFileManager::Init() {
+
+ //PrintOut("CIFFileManager::Init");
+
+ input.clear(); // reset file to previous content
+ input.seekg(0);
+
+ while (input) {
+ string atomLine = readLine(input, false);
+
+ if (StartsWith(atomLine, LoopStart))
+ {
+ CIFLoop temp = processLoop();
+ if(temp.GetCategoryGroup() == AtomSite)
+ AtomLoop = temp;
+ else if(temp.GetCategoryGroup() == SheetSite)
+ SheetLoop = temp;
+ else if(temp.GetCategoryGroup() == HelixSite)
+ HelixLoop = temp;
+ else
+ OtherLoops.push_back(temp);
+ }
+ else
+ {
+ if(StartsWith(atomLine, "_"))
+ processLine(atomLine.substr(1));
+ }
+ }
+}
+
+void CIFFileManager::processLine(string line){
+ string key = Trim(SplitOnSpace(line)[0]);
+ string value = Trim(line.substr(key.size()));
+ inLineValues[key] = value;
+}
+
+CIFLoop CIFFileManager::processLoop() {
+
+ //PrintOut("CIFFileManager::processLoop");
+
+ string atomLine = readLine(input, false);
+ if (atomLine.at(0) != '_') {
+ ERROR("Loop don't start with _[definition]", exception);
+ }
+
+ CIFLoop* result = new CIFLoop(CIFLoop::DecodeCategory(atomLine));
+
+ while (input) {
+
+ if (atomLine.at(0) == '_') {
+ result->AddColumn(atomLine);
+ } else {
+ if (atomLine.at(0) == '#')
+ {
+ return *result;
+ }
+ else
+ {
+ result->AddRow(atomLine);
+ }
+ }
+
+ atomLine = readLine(input, false);
+ }
+
+ return *result;
+
+}
+
+string CIFFileManager::GetInLineValue(string key){
+ return inLineValues[key];
+}
+
diff --git a/Biopool/Sources/CIFFileManager.h b/Biopool/Sources/CIFFileManager.h
new file mode 100644
index 0000000..145191d
--- /dev/null
+++ b/Biopool/Sources/CIFFileManager.h
@@ -0,0 +1,122 @@
+/* This file is part of Victor.
+
+ Victor is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Victor is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Victor. If not, see .
+ */
+
+/*
+ * File: CIFFileManager.h
+ * Author: Francesco Menniti
+ *
+ * Created on 1 dicembre 2015, 9.52
+ */
+
+#ifndef CIFFILEMANAGER_H
+#define CIFFILEMANAGER_H
+
+#include
+#include
+#include
+#include
+#include
+#include