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
...@@ -5458,6 +5458,9 @@ int PDBFileParser::PDBChain::AlignResToSeqRes() ...@@ -5458,6 +5458,9 @@ int PDBFileParser::PDBChain::AlignResToSeqRes()
throw; throw;
} }
if (VERBOSE > 1)
printAlignment();
// assign numbers to the residues that don't have them yet // assign numbers to the residues that don't have them yet
stack<int> unnumbered; stack<int> unnumbered;
for (x = 0; x < dimX; ++x) for (x = 0; x < dimX; ++x)
......
...@@ -55,8 +55,9 @@ const map<string,char> kBaseMap{ ...@@ -55,8 +55,9 @@ const map<string,char> kBaseMap{
// -------------------------------------------------------------------- // --------------------------------------------------------------------
struct PeptideDBImpl class PeptideDBImpl
{ {
public:
PeptideDBImpl(istream& data, PeptideDBImpl* next); PeptideDBImpl(istream& data, PeptideDBImpl* next);
~PeptideDBImpl() ~PeptideDBImpl()
...@@ -64,11 +65,13 @@ struct PeptideDBImpl ...@@ -64,11 +65,13 @@ struct PeptideDBImpl
delete mNext; delete mNext;
} }
/*unordered_*/set<string> mKnownPeptides; PeptideDBImpl* pop()
set<string> mKnownBases; {
cif::File mFile; auto result = mNext;
cif::Category& mChemComp; mNext = nullptr;
PeptideDBImpl* mNext; delete this;
return result;
}
string nameFor(const string& resName) const string nameFor(const string& resName) const
{ {
...@@ -113,6 +116,25 @@ struct PeptideDBImpl ...@@ -113,6 +116,25 @@ struct PeptideDBImpl
return result; 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) PeptideDBImpl::PeptideDBImpl(istream& data, PeptideDBImpl* next)
...@@ -252,12 +274,7 @@ void PeptideDB::pushDictionary(boost::filesystem::path dict) ...@@ -252,12 +274,7 @@ void PeptideDB::pushDictionary(boost::filesystem::path dict)
void PeptideDB::popDictionary() void PeptideDB::popDictionary()
{ {
if (mImpl != nullptr) if (mImpl != nullptr)
{ mImpl = mImpl->pop();
auto i = mImpl;
mImpl = i->mNext;
i->mNext = nullptr;
delete i;
}
} }
PeptideDB::~PeptideDB() PeptideDB::~PeptideDB()
...@@ -267,12 +284,12 @@ PeptideDB::~PeptideDB() ...@@ -267,12 +284,12 @@ PeptideDB::~PeptideDB()
bool PeptideDB::isKnownPeptide(const string& resName) const bool PeptideDB::isKnownPeptide(const string& resName) const
{ {
return mImpl->mKnownPeptides.count(resName) > 0; return mImpl->isKnownPeptide(resName);
} }
bool PeptideDB::isKnownBase(const string& resName) const bool PeptideDB::isKnownBase(const string& resName) const
{ {
return mImpl->mKnownBases.count(resName) > 0; return mImpl->isKnownBase(resName);
} }
string PeptideDB::nameForResidue(const string& resName) const 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