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
{
std::string atomID[2];
CompoundBondType type;
bool aromatic;
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
Compound(const std::string& id, const std::string& name,
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)
, mAtoms(std::move(atoms)), mBonds(std::move(bonds))
, mAngles(std::move(angles))
, mChiralCentres(std::move(chiralCentres))
{
}
~Compound();
// factory method, create a Compound based on the three letter code
// (for amino acids) or the one-letter code (for bases) or the
// code as it is known in the CCP4 monomer library.
......@@ -101,12 +112,13 @@ class Compound
static void addMonomerLibraryPath(const std::string& dir);
// accessors
std::string id() const { return mId; }
std::string name() const { return mName; }
std::string id() const { return mId; }
std::string name() const { return mName; }
std::string type() const;
std::string group() const { return mGroup; }
std::vector<CompoundAtom> atoms() const { return mAtoms; }
std::vector<CompoundBond> bonds() const { return mBonds; }
std::string group() const { return mGroup; }
std::vector<CompoundAtom> atoms() const { return mAtoms; }
std::vector<CompoundBond> bonds() const { return mBonds; }
std::vector<CompoundAngle> angles() const { return mAngles; }
CompoundAtom getAtomById(const std::string& atomId) const;
......@@ -126,12 +138,16 @@ class Compound
std::vector<std::tuple<std::string,std::string>> mapToIsomer(const Compound& c) const;
private:
~Compound();
// Entity& mEntity;
std::string mId;
std::string mName;
std::string mGroup;
std::vector<CompoundAtom> mAtoms;
std::vector<CompoundBond> mBonds;
std::vector<CompoundAngle> mAngles;
std::vector<ChiralCentre> mChiralCentres;
};
......
......@@ -155,7 +155,7 @@ class Residue
: mStructure(&structure), mCompoundID(compoundID)
, mAsymID(asymID), mAltID(altID), mSeqID(seqID) {}
const Compound& comp() const;
const Compound& compound() const;
AtomView atoms() const;
Atom atomByID(const std::string& atomID) const;
......
......@@ -582,8 +582,8 @@ const Compound* CompoundFactory::create(std::string id)
CompoundBond b;
string type, aromatic;
cif::tie(b.atomID[0], b.atomID[1], type, b.distance, aromatic) =
row.get("atom_id_1", "atom_id_2", "type", "distance", "aromatic");
cif::tie(b.atomID[0], b.atomID[1], type, b.distance, b.esd) =
row.get("atom_id_1", "atom_id_2", "type", "value_dist", "value_dist_esd");
using cif::iequals;
......@@ -606,6 +606,19 @@ const Compound* CompoundFactory::create(std::string id)
}
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"];
vector<ChiralCentre> chiralCentres;
......@@ -636,7 +649,7 @@ const Compound* CompoundFactory::create(std::string id)
}
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);
mCompounds.push_back(result);
......
......@@ -4662,7 +4662,7 @@ void PDBFileParser::ParseConnectivtyAnnotation()
if (mRec->is("CISPEP"))
{
// 1 - 6 Record name "CISPEP"
int serNum = vI(8, 10); // 8 - 10 Integer serNum Record serial number.
int serNum = vI(8, 10); // 8 - 10 Integer serNum Record serial number.
string pep1 = vS(12, 14); // 12 - 14 LString(3) pep1 Residue name.
char chainID1 = vC(16); // 16 Character chainID1 Chain identifier.
int seqNum1 = vI(18, 21); // 18 - 21 Integer seqNum1 Residue sequence number.
......
......@@ -508,12 +508,12 @@ Residue& Residue::operator=(const Residue& rhs)
return *this;
}
const Compound& Residue::comp() const
const Compound& Residue::compound() const
{
auto compound = Compound::create(mCompoundID);
if (compound == nullptr)
auto result = Compound::create(mCompoundID);
if (result == nullptr)
throw runtime_error("Failed to create compound " + mCompoundID);
return *compound;
return *result;
}
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