-
Notifications
You must be signed in to change notification settings - Fork 32
CreateAPeptide
dstoeckel edited this page Mar 16, 2015
·
2 revisions
This is a short example on how to create a peptide. For each amino acid we define the torsion angles in an amino acid descriptor, push it into a sequence, create a builder and tell him to construct the peptide.
#include <BALL/FORMAT/PDBFile.h>
#include <BALL/MATHS/angle.h>
#include <BALL/COMMON/constants.h>
#include <BALL/STRUCTURE/peptideBuilder.h>
#include <BALL/STRUCTURE/fragmentDB.h>
#include <vector>
using namespace BALL;
using namespace std;
int main(int argc, char** argv)
{
// we need to define the peptid's AA sequence as a vector of descriptors
vector<BALL::Peptides::AminoAcidDescriptor> descriptor_seq;
// each aminoacid is represented by a descriptor
BALL::Peptides::AminoAcidDescriptor* aad = new BALL::Peptides::AminoAcidDescriptor;
// define a glycin
aad->setAminoAcidType("GLY");
aad->setPhi(Angle(-47., false));
aad->setPsi(Angle(-77., false));
// add it to the sequence
descriptor_seq.push_back(*aad);
// create a builder using the sequence
BALL::Peptides::PeptideBuilder* pb = new BALL::Peptides::PeptideBuilder(descriptor_seq);
// "link" the fragment db for adding missing information
FragmentDB fdb("");
pb->setFragmentDB(&fdb);
// now build the peptide
Protein* prot = pb->construct();
// give sensible names
pb->setChainName("new_glycin");
pb->setProteinName("new_protein");
// check what is done
ResidueIterator res_it = prot->beginResidue();
cout << "# res:" << prot->countResidues() << endl;
for ( ; +res_it; ++res_it)
{
cout << res_it->getTorsionPhi() << " " << res_it->getTorsionPsi() << " " << endl;
}
return 0;
}
Please note that BALL offers a special class handling angles and physical constants.
For more convenient handling try:
BALL::Peptides::PeptideBuilder* pb2 = new BALL::Peptides::PeptideBuilder;
FragmentDB fdb("");
pb->setFragmentDB(&fdb);
pb2->addAminoAcid("SER", Angle(M_PI, true), Angle(M_PI, true));
pb2->setChainName("my_new_chain");
pb2->setProteinName("my_new_protein");
Protein* prot2 = pb->construct();
from BALL import *
import math
fdb = FragmentDB("")
PB = PeptideBuilder()
PB.addAminoAcid("A", Angle(math.pi), Angle(math.pi))
PB.addAminoAcid(Peptides.OneLetterCode(r), Angle(math.pi), Angle(math.pi))
PB.addAminoAcid("A", Angle(math.pi), Angle(math.pi))
PB.setFragmentDB(fdb)
protein = PB.construct()
print protein.countAtoms()