Commit 44cfa2c1 by Maarten L. Hekkelman

further optimisation

parent 6dd9522b
...@@ -131,7 +131,7 @@ class Atom ...@@ -131,7 +131,7 @@ class Atom
std::string authAtomID() const; std::string authAtomID() const;
std::string authCompID() const; std::string authCompID() const;
std::string authAsymID() const; std::string authAsymID() const;
std::string authSeqID() const; const std::string& authSeqID() const { return mAuthSeqID; }
std::string pdbxAuthInsCode() const; std::string pdbxAuthInsCode() const;
std::string pdbxAuthAltID() const; std::string pdbxAuthAltID() const;
...@@ -164,6 +164,7 @@ class Atom ...@@ -164,6 +164,7 @@ class Atom
std::swap(mAsymID, b.mAsymID); std::swap(mAsymID, b.mAsymID);
std::swap(mSeqID, b.mSeqID); std::swap(mSeqID, b.mSeqID);
std::swap(mAltID, b.mAltID); std::swap(mAltID, b.mAltID);
std::swap(mAuthSeqID, b.mAuthSeqID);
} }
int compare(const Atom &b) const; int compare(const Atom &b) const;
...@@ -190,6 +191,7 @@ class Atom ...@@ -190,6 +191,7 @@ class Atom
std::string mAsymID; std::string mAsymID;
int mSeqID; int mSeqID;
std::string mAltID; std::string mAltID;
std::string mAuthSeqID;
}; };
inline void swap(mmcif::Atom &a, mmcif::Atom &b) inline void swap(mmcif::Atom &a, mmcif::Atom &b)
......
...@@ -208,11 +208,6 @@ struct AtomImpl ...@@ -208,11 +208,6 @@ struct AtomImpl
: mDb(i.mDb) : mDb(i.mDb)
, mID(i.mID) , mID(i.mID)
, mType(i.mType) , mType(i.mType)
// , mAtomID(i.mAtomID)
// , mCompID(i.mCompID)
// , mAsymID(i.mAsymID)
// , mSeqID(i.mSeqID)
// , mAltID(i.mAltID)
, mLocation(i.mLocation) , mLocation(i.mLocation)
, mRefcount(1) , mRefcount(1)
, mRow(i.mRow) , mRow(i.mRow)
...@@ -221,7 +216,6 @@ struct AtomImpl ...@@ -221,7 +216,6 @@ struct AtomImpl
, mRadius(i.mRadius) , mRadius(i.mRadius)
, mSymmetryCopy(i.mSymmetryCopy) , mSymmetryCopy(i.mSymmetryCopy)
, mClone(true) , mClone(true)
// , mRTop(i.mRTop), mD(i.mD)
{ {
} }
...@@ -234,8 +228,6 @@ struct AtomImpl ...@@ -234,8 +228,6 @@ struct AtomImpl
auto &cat = db["atom_site"]; auto &cat = db["atom_site"];
mRow = cat[cif::Key("id") == mID]; mRow = cat[cif::Key("id") == mID];
// prefetch();
} }
AtomImpl(cif::Datablock &db, cif::Row &row) AtomImpl(cif::Datablock &db, cif::Row &row)
...@@ -245,7 +237,6 @@ struct AtomImpl ...@@ -245,7 +237,6 @@ struct AtomImpl
, mRow(row) , mRow(row)
, mCompound(nullptr) , mCompound(nullptr)
{ {
// prefetch();
} }
AtomImpl(cif::Datablock &db, const std::string &id, cif::Row row) AtomImpl(cif::Datablock &db, const std::string &id, cif::Row row)
...@@ -255,18 +246,12 @@ struct AtomImpl ...@@ -255,18 +246,12 @@ struct AtomImpl
, mRow(row) , mRow(row)
, mCompound(nullptr) , mCompound(nullptr)
{ {
// prefetch();
} }
AtomImpl(const AtomImpl &impl, const Point &loc, const std::string &sym_op) AtomImpl(const AtomImpl &impl, const Point &loc, const std::string &sym_op)
: mDb(impl.mDb) : mDb(impl.mDb)
, mID(impl.mID) , mID(impl.mID)
, mType(impl.mType) , mType(impl.mType)
// , mAtomID(impl.mAtomID)
// , mCompID(impl.mCompID)
// , mAsymID(impl.mAsymID)
// , mSeqID(impl.mSeqID)
// , mAltID(impl.mAltID)
, mLocation(loc) , mLocation(loc)
, mRefcount(1) , mRefcount(1)
, mRow(impl.mRow) , mRow(impl.mRow)
...@@ -278,12 +263,12 @@ struct AtomImpl ...@@ -278,12 +263,12 @@ struct AtomImpl
{ {
} }
void prefetch(std::string &atomID, std::string &compID, std::string &asymID, int &seqID, std::string &altID) void prefetch(std::string &atomID, std::string &compID, std::string &asymID, int &seqID, std::string &altID, std::string &authSeqID)
{ {
// Prefetch some data // Prefetch some data
std::string symbol; std::string symbol;
cif::tie(symbol, atomID, compID, asymID, seqID, altID) = cif::tie(symbol, atomID, compID, asymID, seqID, altID, authSeqID) =
mRow.get("type_symbol", "label_atom_id", "label_comp_id", "label_asym_id", "label_seq_id", "label_alt_id"); mRow.get("type_symbol", "label_atom_id", "label_comp_id", "label_asym_id", "label_seq_id", "label_alt_id", "auth_seq_id");
if (symbol != "X") if (symbol != "X")
mType = AtomTypeTraits(symbol).type(); mType = AtomTypeTraits(symbol).type();
...@@ -404,12 +389,6 @@ struct AtomImpl ...@@ -404,12 +389,6 @@ struct AtomImpl
std::string mID; std::string mID;
AtomType mType; AtomType mType;
// std::string mAtomID;
// std::string mCompID;
// std::string mAsymID;
// int mSeqID;
// std::string mAltID;
Point mLocation; Point mLocation;
int mRefcount; int mRefcount;
cif::Row mRow; cif::Row mRow;
...@@ -443,7 +422,7 @@ Atom::Atom(AtomImpl *impl) ...@@ -443,7 +422,7 @@ Atom::Atom(AtomImpl *impl)
: mImpl_(impl) : mImpl_(impl)
{ {
if (mImpl_) if (mImpl_)
mImpl_->prefetch(mAtomID, mCompID, mAsymID, mSeqID, mAltID); mImpl_->prefetch(mAtomID, mCompID, mAsymID, mSeqID, mAltID, mAuthSeqID);
} }
Atom::Atom(cif::Datablock &db, cif::Row &row) Atom::Atom(cif::Datablock &db, cif::Row &row)
...@@ -463,6 +442,7 @@ Atom::Atom(const Atom &rhs) ...@@ -463,6 +442,7 @@ Atom::Atom(const Atom &rhs)
, mAsymID(rhs.mAsymID) , mAsymID(rhs.mAsymID)
, mSeqID(rhs.mSeqID) , mSeqID(rhs.mSeqID)
, mAltID(rhs.mAltID) , mAltID(rhs.mAltID)
, mAuthSeqID(rhs.mAuthSeqID)
{ {
if (mImpl_) if (mImpl_)
mImpl_->reference(); mImpl_->reference();
...@@ -506,6 +486,7 @@ Atom &Atom::operator=(const Atom &rhs) ...@@ -506,6 +486,7 @@ Atom &Atom::operator=(const Atom &rhs)
mAsymID = rhs.mAsymID; mAsymID = rhs.mAsymID;
mSeqID = rhs.mSeqID; mSeqID = rhs.mSeqID;
mAltID = rhs.mAltID; mAltID = rhs.mAltID;
mAuthSeqID = rhs.mAuthSeqID;
if (mImpl_) if (mImpl_)
mImpl_->reference(); mImpl_->reference();
...@@ -612,21 +593,6 @@ std::string Atom::labelEntityID() const ...@@ -612,21 +593,6 @@ std::string Atom::labelEntityID() const
return property<std::string>("label_entity_id"); return property<std::string>("label_entity_id");
} }
// const std::string& Atom::labelAltID() const
// {
// return impl()->mAltID;
// }
// bool Atom::isAlternate() const
// {
// return not impl()->mAltID.empty();
// }
// int Atom::labelSeqID() const
// {
// return impl()->mSeqID;
// }
std::string Atom::authAsymID() const std::string Atom::authAsymID() const
{ {
return property<std::string>("auth_asym_id"); return property<std::string>("auth_asym_id");
...@@ -652,11 +618,6 @@ std::string Atom::authCompID() const ...@@ -652,11 +618,6 @@ std::string Atom::authCompID() const
return property<std::string>("auth_comp_id"); return property<std::string>("auth_comp_id");
} }
std::string Atom::authSeqID() const
{
return property<std::string>("auth_seq_id");
}
std::string Atom::labelID() const std::string Atom::labelID() const
{ {
return mCompID + '_' + mAsymID + '_' + std::to_string(mSeqID) + ':' + mAtomID; return mCompID + '_' + mAsymID + '_' + std::to_string(mSeqID) + ':' + mAtomID;
...@@ -768,6 +729,8 @@ int Atom::compare(const Atom &b) const ...@@ -768,6 +729,8 @@ int Atom::compare(const Atom &b) const
d = mSeqID - b.mSeqID; d = mSeqID - b.mSeqID;
if (d == 0) if (d == 0)
d = mAtomID.compare(b.mAtomID); d = mAtomID.compare(b.mAtomID);
if (d == 0)
d = mAuthSeqID.compare(b.mAuthSeqID);
return d; return d;
} }
......
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