-
Notifications
You must be signed in to change notification settings - Fork 36
Translate3LetterTo1Letter
cschaerfe edited this page Feb 20, 2015
·
3 revisions
#include <BALL/KERNEL/chain.h>
#include <BALL/KERNEL/protein.h>
#include <BALL/KERNEL/system.h>
#include <BALL/STRUCTURE/peptides.h> //for change of 3 letter code to 1 letter code
#include <BALL/FORMAT/PDBFile.h>
using namespace BALL;
//read in .pdb file containing protein
PDBFile infile("system.pdb");
System S;
infile >> S;
infile.close();
// get the BALL sequence
String ball_seq= "";
// get the protein
if (RTTI::isKindOf<Protein>(*(S.getMolecule(0))))
{
//we take the first chain for illustration
Protein* protein = RTTI::castTo<Protein>(*(S.getMolecule(0)));
ChainIterator ch_it = protein->beginChain();
for (ResidueIterator r_it = ch_it->beginResidue(); +r_it; r_it++)
{
if ((Peptides::OneLetterCode(r_it->isAminoAcid())) && (r_it->getName() != String("ACE")))
{
ball_seq += Peptides::OneLetterCode(r_it->getName());
}
}
}
cout << "One letter code: " << ball_seq << endl;