Commit 65f17a7b by maarten

re-ref en pep-shuffle

git-svn-id: svn+ssh://gitlab/srv/svn-repos/pdb-redo/trunk@238 a1961a4f-ab94-4bcc-80e8-33b5a54de466
parent d2716b4e
...@@ -47,8 +47,19 @@ struct CompoundBond ...@@ -47,8 +47,19 @@ struct CompoundBond
{ {
std::string atomID[2]; std::string atomID[2];
CompoundBondType type; CompoundBondType type;
bool aromatic;
float distance; float distance;
float esd;
};
// --------------------------------------------------------------------
// struct containing information about the bond-angles
// This information comes from the CCP4 monomer library.
struct CompoundAngle
{
std::string atomID[3];
float angle;
float esd;
}; };
// -------------------------------------------------------------------- // --------------------------------------------------------------------
...@@ -76,15 +87,15 @@ class Compound ...@@ -76,15 +87,15 @@ class Compound
Compound(const std::string& id, const std::string& name, Compound(const std::string& id, const std::string& name,
const std::string& group, std::vector<CompoundAtom>&& atoms, const std::string& group, std::vector<CompoundAtom>&& atoms,
std::vector<CompoundBond>&& bonds, std::vector<ChiralCentre>&& chiralCentres) std::vector<CompoundBond>&& bonds, std::vector<CompoundAngle>&& angles,
std::vector<ChiralCentre>&& chiralCentres)
: mId(id), mName(name), mGroup(group) : mId(id), mName(name), mGroup(group)
, mAtoms(std::move(atoms)), mBonds(std::move(bonds)) , mAtoms(std::move(atoms)), mBonds(std::move(bonds))
, mAngles(std::move(angles))
, mChiralCentres(std::move(chiralCentres)) , mChiralCentres(std::move(chiralCentres))
{ {
} }
~Compound();
// factory method, create a Compound based on the three letter code // factory method, create a Compound based on the three letter code
// (for amino acids) or the one-letter code (for bases) or the // (for amino acids) or the one-letter code (for bases) or the
// code as it is known in the CCP4 monomer library. // code as it is known in the CCP4 monomer library.
...@@ -107,6 +118,7 @@ class Compound ...@@ -107,6 +118,7 @@ class Compound
std::string group() const { return mGroup; } std::string group() const { return mGroup; }
std::vector<CompoundAtom> atoms() const { return mAtoms; } std::vector<CompoundAtom> atoms() const { return mAtoms; }
std::vector<CompoundBond> bonds() const { return mBonds; } std::vector<CompoundBond> bonds() const { return mBonds; }
std::vector<CompoundAngle> angles() const { return mAngles; }
CompoundAtom getAtomById(const std::string& atomId) const; CompoundAtom getAtomById(const std::string& atomId) const;
...@@ -126,12 +138,16 @@ class Compound ...@@ -126,12 +138,16 @@ class Compound
std::vector<std::tuple<std::string,std::string>> mapToIsomer(const Compound& c) const; std::vector<std::tuple<std::string,std::string>> mapToIsomer(const Compound& c) const;
private: private:
~Compound();
// Entity& mEntity; // Entity& mEntity;
std::string mId; std::string mId;
std::string mName; std::string mName;
std::string mGroup; std::string mGroup;
std::vector<CompoundAtom> mAtoms; std::vector<CompoundAtom> mAtoms;
std::vector<CompoundBond> mBonds; std::vector<CompoundBond> mBonds;
std::vector<CompoundAngle> mAngles;
std::vector<ChiralCentre> mChiralCentres; std::vector<ChiralCentre> mChiralCentres;
}; };
......
...@@ -155,7 +155,7 @@ class Residue ...@@ -155,7 +155,7 @@ class Residue
: mStructure(&structure), mCompoundID(compoundID) : mStructure(&structure), mCompoundID(compoundID)
, mAsymID(asymID), mAltID(altID), mSeqID(seqID) {} , mAsymID(asymID), mAltID(altID), mSeqID(seqID) {}
const Compound& comp() const; const Compound& compound() const;
AtomView atoms() const; AtomView atoms() const;
Atom atomByID(const std::string& atomID) const; Atom atomByID(const std::string& atomID) const;
......
...@@ -582,8 +582,8 @@ const Compound* CompoundFactory::create(std::string id) ...@@ -582,8 +582,8 @@ const Compound* CompoundFactory::create(std::string id)
CompoundBond b; CompoundBond b;
string type, aromatic; string type, aromatic;
cif::tie(b.atomID[0], b.atomID[1], type, b.distance, aromatic) = cif::tie(b.atomID[0], b.atomID[1], type, b.distance, b.esd) =
row.get("atom_id_1", "atom_id_2", "type", "distance", "aromatic"); row.get("atom_id_1", "atom_id_2", "type", "value_dist", "value_dist_esd");
using cif::iequals; using cif::iequals;
...@@ -606,6 +606,19 @@ const Compound* CompoundFactory::create(std::string id) ...@@ -606,6 +606,19 @@ const Compound* CompoundFactory::create(std::string id)
} }
sort(bonds.begin(), bonds.end(), CompoundBondLess()); sort(bonds.begin(), bonds.end(), CompoundBondLess());
auto& compAngles = cf["comp_" + id]["chem_comp_angle"];
vector<CompoundAngle> angles;
for (auto row: compAngles)
{
CompoundAngle a;
cif::tie(a.atomID[0], a.atomID[1], a.atomID[2], a.angle, a.esd) =
row.get("atom_id_1", "atom_id_2", "atom_id_3", "value_angle", "value_angle_esd");
angles.push_back(a);
}
auto& compChir = cf["comp_" + id]["chem_comp_chir"]; auto& compChir = cf["comp_" + id]["chem_comp_chir"];
vector<ChiralCentre> chiralCentres; vector<ChiralCentre> chiralCentres;
...@@ -636,7 +649,7 @@ const Compound* CompoundFactory::create(std::string id) ...@@ -636,7 +649,7 @@ const Compound* CompoundFactory::create(std::string id)
} }
result = new Compound(id, name, group, move(atoms), move(bonds), result = new Compound(id, name, group, move(atoms), move(bonds),
move(chiralCentres)); move(angles), move(chiralCentres));
boost::upgrade_to_unique_lock<boost::shared_mutex> uniqueLock(lock); boost::upgrade_to_unique_lock<boost::shared_mutex> uniqueLock(lock);
mCompounds.push_back(result); mCompounds.push_back(result);
......
...@@ -508,12 +508,12 @@ Residue& Residue::operator=(const Residue& rhs) ...@@ -508,12 +508,12 @@ Residue& Residue::operator=(const Residue& rhs)
return *this; return *this;
} }
const Compound& Residue::comp() const const Compound& Residue::compound() const
{ {
auto compound = Compound::create(mCompoundID); auto result = Compound::create(mCompoundID);
if (compound == nullptr) if (result == nullptr)
throw runtime_error("Failed to create compound " + mCompoundID); throw runtime_error("Failed to create compound " + mCompoundID);
return *compound; return *result;
} }
AtomView Residue::atoms() const AtomView Residue::atoms() 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