Commit 679a15b6 by maarten

fix in peptidedb

git-svn-id: svn+ssh://gitlab/srv/svn-repos/pdb-redo/trunk@209 a1961a4f-ab94-4bcc-80e8-33b5a54de466
parent b4a52806
......@@ -5457,6 +5457,9 @@ int PDBFileParser::PDBChain::AlignResToSeqRes()
throw;
}
if (VERBOSE > 1)
printAlignment();
// assign numbers to the residues that don't have them yet
stack<int> unnumbered;
......
......@@ -55,20 +55,23 @@ const map<string,char> kBaseMap{
// --------------------------------------------------------------------
struct PeptideDBImpl
class PeptideDBImpl
{
public:
PeptideDBImpl(istream& data, PeptideDBImpl* next);
~PeptideDBImpl()
{
delete mNext;
}
/*unordered_*/set<string> mKnownPeptides;
set<string> mKnownBases;
cif::File mFile;
cif::Category& mChemComp;
PeptideDBImpl* mNext;
PeptideDBImpl* pop()
{
auto result = mNext;
mNext = nullptr;
delete this;
return result;
}
string nameFor(const string& resName) const
{
......@@ -113,6 +116,25 @@ struct PeptideDBImpl
return result;
}
bool isKnownPeptide(const string& resName)
{
return mKnownPeptides.count(resName) or
(mNext != nullptr and mNext->isKnownPeptide(resName));
}
bool isKnownBase(const string& resName)
{
return mKnownBases.count(resName) or
(mNext != nullptr and mNext->isKnownBase(resName));
}
private:
/*unordered_*/set<string> mKnownPeptides;
set<string> mKnownBases;
cif::File mFile;
cif::Category& mChemComp;
PeptideDBImpl* mNext;
};
PeptideDBImpl::PeptideDBImpl(istream& data, PeptideDBImpl* next)
......@@ -252,12 +274,7 @@ void PeptideDB::pushDictionary(boost::filesystem::path dict)
void PeptideDB::popDictionary()
{
if (mImpl != nullptr)
{
auto i = mImpl;
mImpl = i->mNext;
i->mNext = nullptr;
delete i;
}
mImpl = mImpl->pop();
}
PeptideDB::~PeptideDB()
......@@ -267,12 +284,12 @@ PeptideDB::~PeptideDB()
bool PeptideDB::isKnownPeptide(const string& resName) const
{
return mImpl->mKnownPeptides.count(resName) > 0;
return mImpl->isKnownPeptide(resName);
}
bool PeptideDB::isKnownBase(const string& resName) const
{
return mImpl->mKnownBases.count(resName) > 0;
return mImpl->isKnownBase(resName);
}
string PeptideDB::nameForResidue(const string& resName) const
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment