Commit 80bb24f3 by Maarten L. Hekkelman

- changed Id to ID in all code

- change ItemReference::as to work with std::optional as well
- changed some DSSP related code
parent 34c7fd3f
...@@ -251,6 +251,10 @@ namespace detail ...@@ -251,6 +251,10 @@ namespace detail
{ {
public: public:
// some conversion helper classes
template<typename T, typename = void>
struct item_value_as;
template<typename T> template<typename T>
ItemReference& operator=(const T& value) ItemReference& operator=(const T& value)
{ {
...@@ -262,10 +266,13 @@ namespace detail ...@@ -262,10 +266,13 @@ namespace detail
// operator string() const { return c_str(); } // operator string() const { return c_str(); }
// template<typename T, typename = void>
// T as() const;
template<typename T> template<typename T>
T as() const T as() const
{ {
return boost::lexical_cast<T>(c_str("0")); return item_value_as<T>::convert(*this);
} }
template<typename T> template<typename T>
...@@ -292,6 +299,7 @@ namespace detail ...@@ -292,6 +299,7 @@ namespace detail
// empty means either null or unknown // empty means either null or unknown
bool empty() const; bool empty() const;
explicit operator bool() const { return not empty(); }
// is_null means the field contains '.' // is_null means the field contains '.'
bool is_null() const; bool is_null() const;
...@@ -325,19 +333,47 @@ namespace detail ...@@ -325,19 +333,47 @@ namespace detail
bool mConst = false; bool mConst = false;
}; };
template<typename T>
struct ItemReference::item_value_as<T, std::enable_if_t<std::is_arithmetic_v<T>>>
{
static T convert(const ItemReference& ref)
{
T result = {};
if (not ref.empty())
result = boost::lexical_cast<T>(ref.c_str());
return result;
}
};
template<typename T>
struct ItemReference::item_value_as<std::optional<T>>
{
static std::optional<T> convert(const ItemReference& ref)
{
std::optional<T> result;
if (ref)
result = ref.as<T>();
return result;
}
};
template<> template<>
inline struct ItemReference::item_value_as<const char*>
string ItemReference::as<string>() const
{ {
return string(c_str("")); static const char* convert(const ItemReference& ref)
{
return ref.c_str();
} }
};
template<> template<>
inline struct ItemReference::item_value_as<std::string>
const char* ItemReference::as<const char*>() const
{ {
return c_str(""); static std::string convert(const ItemReference& ref)
{
return ref.c_str();
} }
};
template<> template<>
inline inline
......
...@@ -112,7 +112,7 @@ struct ValidateCategory ...@@ -112,7 +112,7 @@ struct ValidateCategory
struct ValidateLink struct ValidateLink
{ {
int mLinkGroupId; int mLinkGroupID;
std::string mParentCategory; std::string mParentCategory;
std::vector<std::string> mParentKeys; std::vector<std::string> mParentKeys;
std::string mChildCategory; std::string mChildCategory;
......
...@@ -127,7 +127,7 @@ class Compound ...@@ -127,7 +127,7 @@ class Compound
static void addMonomerLibraryPath(const std::string& dir); static void addMonomerLibraryPath(const std::string& dir);
// accessors // accessors
std::string id() const { return mId; } std::string id() const { return mID; }
std::string name() const { return mName; } std::string name() const { return mName; }
std::string type() const; std::string type() const;
std::string group() const { return mGroup; } std::string group() const { return mGroup; }
...@@ -139,7 +139,7 @@ class Compound ...@@ -139,7 +139,7 @@ class Compound
std::vector<CompoundPlane> planes() const { return mPlanes; } std::vector<CompoundPlane> planes() const { return mPlanes; }
std::vector<CompoundTorsion> torsions() const { return mTorsions; } std::vector<CompoundTorsion> torsions() const { return mTorsions; }
CompoundAtom getAtomById(const std::string& atomId) const; CompoundAtom getAtomByID(const std::string& atomID) const;
bool atomsBonded(const std::string& atomId_1, const std::string& atomId_2) const; bool atomsBonded(const std::string& atomId_1, const std::string& atomId_2) const;
float atomBondValue(const std::string& atomId_1, const std::string& atomId_2) const; float atomBondValue(const std::string& atomId_1, const std::string& atomId_2) const;
...@@ -162,7 +162,7 @@ class Compound ...@@ -162,7 +162,7 @@ class Compound
cif::File mCF; cif::File mCF;
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;
...@@ -254,7 +254,7 @@ class Link ...@@ -254,7 +254,7 @@ class Link
static const Link& create(const std::string& id); static const Link& create(const std::string& id);
// accessors // accessors
std::string id() const { return mId; } std::string id() const { return mID; }
std::vector<LinkBond> bonds() const { return mBonds; } std::vector<LinkBond> bonds() const { return mBonds; }
std::vector<LinkAngle> angles() const { return mAngles; } std::vector<LinkAngle> angles() const { return mAngles; }
std::vector<LinkChiralCentre> chiralCentres() const { return mChiralCentres; } std::vector<LinkChiralCentre> chiralCentres() const { return mChiralCentres; }
...@@ -269,7 +269,7 @@ class Link ...@@ -269,7 +269,7 @@ class Link
~Link(); ~Link();
std::string mId; std::string mID;
std::vector<LinkBond> mBonds; std::vector<LinkBond> mBonds;
std::vector<LinkAngle> mAngles; std::vector<LinkAngle> mAngles;
std::vector<LinkTorsion> mTorsions; std::vector<LinkTorsion> mTorsions;
......
...@@ -5,10 +5,6 @@ ...@@ -5,10 +5,6 @@
#include <string> #include <string>
#include <cstdint> #include <cstdint>
#define HAVE_CPP0X_TEMPLATE_ALIASES 1
#define HAVE_CPP0X_VARIADIC_TEMPLATES 1
#define HAVE_CPP0X_INITIALIZER_LISTS 1
#if defined(_MSC_VER) #if defined(_MSC_VER)
// These are Microsoft Visual C++ special settings // These are Microsoft Visual C++ special settings
......
...@@ -38,27 +38,6 @@ class Polymer; ...@@ -38,27 +38,6 @@ class Polymer;
class Structure; class Structure;
class File; class File;
struct SecondaryStructure;
// --------------------------------------------------------------------
// We do not want to introduce a dependency on cif++ here, we might want
// to change the backend storage in the future.
// So, in order to access the data we use properties based on boost::any
// Eventually this should be moved to std::variant, but that's only when
// c++17 is acceptable.
struct Property
{
Property() {}
Property(const std::string& name, const boost::any& value)
: name(name), value(value) {}
std::string name;
boost::any value;
};
typedef std::vector<Property> PropertyList;
// -------------------------------------------------------------------- // --------------------------------------------------------------------
class Atom class Atom
...@@ -101,18 +80,18 @@ class Atom ...@@ -101,18 +80,18 @@ class Atom
void property(const std::string& name, const T& value); void property(const std::string& name, const T& value);
// specifications // specifications
std::string labelAtomId() const; std::string labelAtomID() const;
std::string labelCompId() const; std::string labelCompID() const;
std::string labelAsymId() const; std::string labelAsymID() const;
int labelSeqId() const; int labelSeqID() const;
std::string labelAltId() const; std::string labelAltID() const;
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; std::string authSeqID() const;
std::string pdbxAuthInsCode() const; std::string pdbxAuthInsCode() const;
std::string pdbxAuthAltId() const; std::string pdbxAuthAltID() const;
std::string labelID() const;// label_comp_id + '_' + label_asym_id + '_' + label_seq_id std::string labelID() const;// label_comp_id + '_' + label_asym_id + '_' + label_seq_id
std::string pdbID() const; // auth_comp_id + '_' + auth_asym_id + '_' + auth_seq_id + pdbx_PDB_ins_code std::string pdbID() const; // auth_comp_id + '_' + auth_asym_id + '_' + auth_seq_id + pdbx_PDB_ins_code
...@@ -134,8 +113,8 @@ class Atom ...@@ -134,8 +113,8 @@ class Atom
// convenience routine // convenience routine
bool isBackBone() const bool isBackBone() const
{ {
return labelAtomId() == "N" or labelAtomId() == "O" or return labelAtomID() == "N" or labelAtomID() == "O" or
labelAtomId() == "C" or labelAtomId() == "CA"; labelAtomID() == "C" or labelAtomID() == "CA";
} }
void swap(Atom& b) void swap(Atom& b)
...@@ -199,6 +178,7 @@ class Residue ...@@ -199,6 +178,7 @@ class Residue
const std::string& asymID() const { return mAsymID; } const std::string& asymID() const { return mAsymID; }
int seqID() const { return mSeqID; } int seqID() const { return mSeqID; }
std::string authAsymID() const;
std::string authSeqID() const; std::string authSeqID() const;
std::string authInsCode() const; std::string authInsCode() const;
...@@ -354,10 +334,24 @@ class File : public std::enable_shared_from_this<File> ...@@ -354,10 +334,24 @@ class File : public std::enable_shared_from_this<File>
// -------------------------------------------------------------------- // --------------------------------------------------------------------
enum class StructureOpenOptions
{
SkipHydrogen = 1 << 0
};
inline bool operator&(StructureOpenOptions a, StructureOpenOptions b)
{
return static_cast<int>(a) bitand static_cast<int>(b);
}
// --------------------------------------------------------------------
class Structure class Structure
{ {
public: public:
Structure(File& p, uint32_t modelNr = 1); Structure(File& p, StructureOpenOptions options = {})
: Structure(p, 1, options) {}
Structure(File& p, uint32_t modelNr = 1, StructureOpenOptions options = {});
Structure& operator=(const Structure&) = delete; Structure& operator=(const Structure&) = delete;
~Structure(); ~Structure();
...@@ -372,35 +366,35 @@ class Structure ...@@ -372,35 +366,35 @@ class Structure
const std::list<Polymer>& polymers() const { return mPolymers; } const std::list<Polymer>& polymers() const { return mPolymers; }
const std::vector<Residue>& nonPolymers() const { return mNonPolymers; } const std::vector<Residue>& nonPolymers() const { return mNonPolymers; }
Atom getAtomById(std::string id) const; Atom getAtomByID(std::string id) const;
// Atom getAtomByLocation(Point pt, float maxDistance) const; // Atom getAtomByLocation(Point pt, float maxDistance) const;
Atom getAtomByLabel(const std::string& atomId, const std::string& asymId, Atom getAtomByLabel(const std::string& atomID, const std::string& asymID,
const std::string& compId, int seqId, const std::string& altId = ""); const std::string& compID, int seqID, const std::string& altID = "");
// Atom getAtomByAuth(const std::string& atomId, const std::string& asymId, // Atom getAtomByAuth(const std::string& atomID, const std::string& asymID,
// const std::string& compId, int seqId, const std::string& altId = "", // const std::string& compID, int seqID, const std::string& altID = "",
// const std::string& pdbxAuthInsCode = ""); // const std::string& pdbxAuthInsCode = "");
// map between auth and label locations // map between auth and label locations
std::tuple<std::string,int,std::string> MapAuthToLabel(const std::string& asymId, std::tuple<std::string,int,std::string> MapAuthToLabel(const std::string& asymID,
const std::string& seqId, const std::string& compId, const std::string& insCode = ""); const std::string& seqID, const std::string& compID, const std::string& insCode = "");
std::tuple<std::string,std::string,std::string,std::string> MapLabelToAuth( std::tuple<std::string,std::string,std::string,std::string> MapLabelToAuth(
const std::string& asymId, int seqId, const std::string& compId); const std::string& asymID, int seqID, const std::string& compID);
// returns chain, seqnr, icode // returns chain, seqnr, icode
std::tuple<char,int,char> MapLabelToAuth( std::tuple<char,int,char> MapLabelToAuth(
const std::string& asymId, int seqId) const; const std::string& asymID, int seqID) const;
// returns chain,seqnr,comp,iCode // returns chain,seqnr,comp,iCode
std::tuple<std::string,int,std::string,std::string> MapLabelToPDB( std::tuple<std::string,int,std::string,std::string> MapLabelToPDB(
const std::string& asymId, int seqId, const std::string& compId, const std::string& asymID, int seqID, const std::string& compID,
const std::string& authSeqID) const; const std::string& authSeqID) const;
std::tuple<std::string,int,std::string> MapPDBToLabel( std::tuple<std::string,int,std::string> MapPDBToLabel(
const std::string& asymId, int seqId, const std::string& compId, const std::string& iCode) const; const std::string& asymID, int seqID, const std::string& compID, const std::string& iCode) const;
// Actions // Actions
void removeAtom(Atom& a); void removeAtom(Atom& a);
......
...@@ -68,7 +68,7 @@ BondMap::BondMap(const Structure& p) ...@@ -68,7 +68,7 @@ BondMap::BondMap(const Structure& p)
map<tuple<string,int,string>,string> atomMapByAsymSeqAndAtom; map<tuple<string,int,string>,string> atomMapByAsymSeqAndAtom;
for (auto& a: p.atoms()) for (auto& a: p.atoms())
{ {
auto key = make_tuple(a.labelAsymId(), a.labelSeqId(), a.labelAtomId()); auto key = make_tuple(a.labelAsymID(), a.labelSeqID(), a.labelAtomID());
atomMapByAsymSeqAndAtom[key] = a.id(); atomMapByAsymSeqAndAtom[key] = a.id();
} }
...@@ -78,28 +78,28 @@ BondMap::BondMap(const Structure& p) ...@@ -78,28 +78,28 @@ BondMap::BondMap(const Structure& p)
int lastSeqID = 0; int lastSeqID = 0;
for (auto r: db["pdbx_poly_seq_scheme"]) for (auto r: db["pdbx_poly_seq_scheme"])
{ {
string asymId; string asymID;
int seqId; int seqID;
cif::tie(asymId, seqId) = r.get("asym_id", "seq_id"); cif::tie(asymID, seqID) = r.get("asym_id", "seq_id");
if (asymId != lastAsymID) // first in a new sequece if (asymID != lastAsymID) // first in a new sequece
{ {
lastAsymID = asymId; lastAsymID = asymID;
lastSeqID = seqId; lastSeqID = seqID;
continue; continue;
} }
auto c = atomMapByAsymSeqAndAtom[make_tuple(asymId, lastSeqID, "C")]; auto c = atomMapByAsymSeqAndAtom[make_tuple(asymID, lastSeqID, "C")];
auto n = atomMapByAsymSeqAndAtom[make_tuple(asymId, seqId, "N")]; auto n = atomMapByAsymSeqAndAtom[make_tuple(asymID, seqID, "N")];
// auto c = db["atom_site"].find(cif::Key("label_asym_id") == asymId and cif::Key("label_seq_id") == lastSeqID and cif::Key("label_atom_id") == "C"); // auto c = db["atom_site"].find(cif::Key("label_asym_id") == asymID and cif::Key("label_seq_id") == lastSeqID and cif::Key("label_atom_id") == "C");
// if (c.size() != 1 and VERBOSE > 1) // if (c.size() != 1 and VERBOSE > 1)
// cerr << "Unexpected number (" << c.size() << ") of atoms with atom ID C in asym_id " << asymId << " with seq id " << lastSeqID << endl; // cerr << "Unexpected number (" << c.size() << ") of atoms with atom ID C in asym_id " << asymID << " with seq id " << lastSeqID << endl;
// //
// auto n = db["atom_site"].find(cif::Key("label_asym_id") == asymId and cif::Key("label_seq_id") == seqId and cif::Key("label_atom_id") == "N"); // auto n = db["atom_site"].find(cif::Key("label_asym_id") == asymID and cif::Key("label_seq_id") == seqID and cif::Key("label_atom_id") == "N");
// if (n.size() != 1 and VERBOSE > 1) // if (n.size() != 1 and VERBOSE > 1)
// cerr << "Unexpected number (" << n.size() << ") of atoms with atom ID N in asym_id " << asymId << " with seq id " << seqId << endl; // cerr << "Unexpected number (" << n.size() << ") of atoms with atom ID N in asym_id " << asymID << " with seq id " << seqID << endl;
// //
// if (not (c.empty() or n.empty())) // if (not (c.empty() or n.empty()))
// bindAtoms(c.front()["id"].as<string>(), n.front()["id"].as<string>()); // bindAtoms(c.front()["id"].as<string>(), n.front()["id"].as<string>());
...@@ -107,7 +107,7 @@ BondMap::BondMap(const Structure& p) ...@@ -107,7 +107,7 @@ BondMap::BondMap(const Structure& p)
if (not (c.empty() or n.empty())) if (not (c.empty() or n.empty()))
bindAtoms(c, n); bindAtoms(c, n);
lastSeqID = seqId; lastSeqID = seqID;
} }
for (auto l: db["struct_conn"]) for (auto l: db["struct_conn"])
...@@ -166,19 +166,19 @@ BondMap::BondMap(const Structure& p) ...@@ -166,19 +166,19 @@ BondMap::BondMap(const Structure& p)
// loop over poly_seq_scheme // loop over poly_seq_scheme
for (auto r: db["pdbx_poly_seq_scheme"].find(cif::Key("mon_id") == c)) for (auto r: db["pdbx_poly_seq_scheme"].find(cif::Key("mon_id") == c))
{ {
string asymId; string asymID;
int seqId; int seqID;
cif::tie(asymId, seqId) = r.get("asym_id", "seq_id"); cif::tie(asymID, seqID) = r.get("asym_id", "seq_id");
vector<Atom> rAtoms; vector<Atom> rAtoms;
copy_if(atoms.begin(), atoms.end(), back_inserter(rAtoms), copy_if(atoms.begin(), atoms.end(), back_inserter(rAtoms),
[&](auto& a) { return a.labelAsymId() == asymId and a.labelSeqId() == seqId; }); [&](auto& a) { return a.labelAsymID() == asymID and a.labelSeqID() == seqID; });
for (uint32_t i = 0; i + 1 < rAtoms.size(); ++i) for (uint32_t i = 0; i + 1 < rAtoms.size(); ++i)
{ {
for (uint32_t j = i + 1; j < rAtoms.size(); ++j) for (uint32_t j = i + 1; j < rAtoms.size(); ++j)
{ {
if (compound->atomsBonded(rAtoms[i].labelAtomId(), rAtoms[j].labelAtomId())) if (compound->atomsBonded(rAtoms[i].labelAtomID(), rAtoms[j].labelAtomID()))
bindAtoms(rAtoms[i].id(), rAtoms[j].id()); bindAtoms(rAtoms[i].id(), rAtoms[j].id());
} }
} }
...@@ -187,20 +187,20 @@ BondMap::BondMap(const Structure& p) ...@@ -187,20 +187,20 @@ BondMap::BondMap(const Structure& p)
// loop over pdbx_nonpoly_scheme // loop over pdbx_nonpoly_scheme
for (auto r: db["pdbx_nonpoly_scheme"].find(cif::Key("mon_id") == c)) for (auto r: db["pdbx_nonpoly_scheme"].find(cif::Key("mon_id") == c))
{ {
string asymId; string asymID;
cif::tie(asymId) = r.get("asym_id"); cif::tie(asymID) = r.get("asym_id");
vector<Atom> rAtoms; vector<Atom> rAtoms;
copy_if(atoms.begin(), atoms.end(), back_inserter(rAtoms), copy_if(atoms.begin(), atoms.end(), back_inserter(rAtoms),
[&](auto& a) { return a.labelAsymId() == asymId; }); [&](auto& a) { return a.labelAsymID() == asymID; });
// for (auto a: db["atom_site"].find(cif::Key("label_asym_id") == asymId)) // for (auto a: db["atom_site"].find(cif::Key("label_asym_id") == asymID))
// rAtoms.push_back(p.getAtomById(a["id"].as<string>())); // rAtoms.push_back(p.getAtomByID(a["id"].as<string>()));
for (uint32_t i = 0; i + 1 < rAtoms.size(); ++i) for (uint32_t i = 0; i + 1 < rAtoms.size(); ++i)
{ {
for (uint32_t j = i + 1; j < rAtoms.size(); ++j) for (uint32_t j = i + 1; j < rAtoms.size(); ++j)
{ {
if (compound->atomsBonded(rAtoms[i].labelAtomId(), rAtoms[j].labelAtomId())) if (compound->atomsBonded(rAtoms[i].labelAtomID(), rAtoms[j].labelAtomID()))
{ {
uint32_t ixa = index[rAtoms[i].id()]; uint32_t ixa = index[rAtoms[i].id()];
uint32_t ixb = index[rAtoms[j].id()]; uint32_t ixb = index[rAtoms[j].id()];
......
...@@ -352,9 +352,8 @@ void WriteHeaderLines(ostream& pdbFile, Datablock& db) ...@@ -352,9 +352,8 @@ void WriteHeaderLines(ostream& pdbFile, Datablock& db)
for (auto r: cat1) for (auto r: cat1)
{ {
keywords = r["keywords"].as<string>();
if (keywords.empty())
keywords = r["pdbx_keywords"].as<string>(); keywords = r["pdbx_keywords"].as<string>();
break;
} }
string date; string date;
...@@ -404,7 +403,7 @@ void WriteHeaderLines(ostream& pdbFile, Datablock& db) ...@@ -404,7 +403,7 @@ void WriteHeaderLines(ostream& pdbFile, Datablock& db)
if (r["type"] != "polymer") if (r["type"] != "polymer")
continue; continue;
string entityId = r["id"].as<string>(); string entityID = r["id"].as<string>();
++molID; ++molID;
cmpnd.push_back("MOL_ID: " + to_string(molID)); cmpnd.push_back("MOL_ID: " + to_string(molID));
...@@ -412,7 +411,7 @@ void WriteHeaderLines(ostream& pdbFile, Datablock& db) ...@@ -412,7 +411,7 @@ void WriteHeaderLines(ostream& pdbFile, Datablock& db)
string molecule = r["pdbx_description"].as<string>(); string molecule = r["pdbx_description"].as<string>();
cmpnd.push_back("MOLECULE: " + molecule); cmpnd.push_back("MOLECULE: " + molecule);
auto poly = db["entity_poly"].find(cif::Key("entity_id") == entityId); auto poly = db["entity_poly"].find(cif::Key("entity_id") == entityID);
if (not poly.empty()) if (not poly.empty())
{ {
string chains = poly.front()["pdbx_strand_id"].as<string>(); string chains = poly.front()["pdbx_strand_id"].as<string>();
...@@ -424,7 +423,7 @@ void WriteHeaderLines(ostream& pdbFile, Datablock& db) ...@@ -424,7 +423,7 @@ void WriteHeaderLines(ostream& pdbFile, Datablock& db)
if (not fragment.empty()) if (not fragment.empty())
cmpnd.push_back("FRAGMENT: " + fragment); cmpnd.push_back("FRAGMENT: " + fragment);
for (auto sr: db["entity_name_com"].find(cif::Key("entity_id") == entityId)) for (auto sr: db["entity_name_com"].find(cif::Key("entity_id") == entityID))
{ {
string syn = sr["name"].as<string>(); string syn = sr["name"].as<string>();
if (not syn.empty()) if (not syn.empty())
...@@ -459,7 +458,7 @@ void WriteHeaderLines(ostream& pdbFile, Datablock& db) ...@@ -459,7 +458,7 @@ void WriteHeaderLines(ostream& pdbFile, Datablock& db)
if (r["type"] != "polymer") if (r["type"] != "polymer")
continue; continue;
string entityId = r["id"].as<string>(); string entityID = r["id"].as<string>();
++molID; ++molID;
source.push_back("MOL_ID: " + to_string(molID)); source.push_back("MOL_ID: " + to_string(molID));
...@@ -489,7 +488,7 @@ void WriteHeaderLines(ostream& pdbFile, Datablock& db) ...@@ -489,7 +488,7 @@ void WriteHeaderLines(ostream& pdbFile, Datablock& db)
{ "details", "OTHER_DETAILS" } { "details", "OTHER_DETAILS" }
}; };
for (auto gr: gen.find(cif::Key("entity_id") == entityId)) for (auto gr: gen.find(cif::Key("entity_id") == entityID))
{ {
for (auto m: kGenSourceMapping) for (auto m: kGenSourceMapping)
{ {
...@@ -514,7 +513,7 @@ void WriteHeaderLines(ostream& pdbFile, Datablock& db) ...@@ -514,7 +513,7 @@ void WriteHeaderLines(ostream& pdbFile, Datablock& db)
{ "details", "OTHER_DETAILS" } { "details", "OTHER_DETAILS" }
}; };
for (auto nr: nat.find(cif::Key("entity_id") == entityId)) for (auto nr: nat.find(cif::Key("entity_id") == entityID))
{ {
for (auto m: kNatSourceMapping) for (auto m: kNatSourceMapping)
{ {
...@@ -3189,7 +3188,7 @@ tuple<int,int> WriteSecondaryStructure(ostream& pdbFile, Datablock& db) ...@@ -3189,7 +3188,7 @@ tuple<int,int> WriteSecondaryStructure(ostream& pdbFile, Datablock& db)
first = false; first = false;
} }
string initResName, initChainID, initICode, endResName, endChainID, endICode, curAtom, curResName, curChainId, curICode, prevAtom, prevResName, prevChainId, prevICode; string initResName, initChainID, initICode, endResName, endChainID, endICode, curAtom, curResName, curChainID, curICode, prevAtom, prevResName, prevChainID, prevICode;
int initSeqNum, endSeqNum, curResSeq, prevResSeq; int initSeqNum, endSeqNum, curResSeq, prevResSeq;
auto r2 = db["struct_sheet_range"][cif::Key("sheet_id") == sheetID and cif::Key("id") == rangeID2]; auto r2 = db["struct_sheet_range"][cif::Key("sheet_id") == sheetID and cif::Key("id") == rangeID2];
...@@ -3223,7 +3222,7 @@ tuple<int,int> WriteSecondaryStructure(ostream& pdbFile, Datablock& db) ...@@ -3223,7 +3222,7 @@ tuple<int,int> WriteSecondaryStructure(ostream& pdbFile, Datablock& db)
string compID[2]; string compID[2];
cif::tie(compID[0], compID[1]) = h.front().get("range_2_label_comp_id", "range_1_label_comp_id"); cif::tie(compID[0], compID[1]) = h.front().get("range_2_label_comp_id", "range_1_label_comp_id");
cif::tie(curAtom, curResName, curResSeq, curChainId, curICode, prevAtom, prevResName, prevResSeq, prevChainId, prevICode) cif::tie(curAtom, curResName, curResSeq, curChainID, curICode, prevAtom, prevResName, prevResSeq, prevChainID, prevICode)
= h.front().get("range_2_auth_atom_id", "range_2_auth_comp_id", "range_2_auth_seq_id", "range_2_auth_asym_id", "range_2_PDB_ins_code", = h.front().get("range_2_auth_atom_id", "range_2_auth_comp_id", "range_2_auth_seq_id", "range_2_auth_asym_id", "range_2_PDB_ins_code",
"range_1_auth_atom_id", "range_1_auth_comp_id", "range_1_auth_seq_id", "range_1_auth_asym_id", "range_1_PDB_ins_code"); "range_1_auth_atom_id", "range_1_auth_comp_id", "range_1_auth_seq_id", "range_1_auth_asym_id", "range_1_PDB_ins_code");
...@@ -3245,12 +3244,12 @@ tuple<int,int> WriteSecondaryStructure(ostream& pdbFile, Datablock& db) ...@@ -3245,12 +3244,12 @@ tuple<int,int> WriteSecondaryStructure(ostream& pdbFile, Datablock& db)
% sense % sense
% curAtom % curAtom
% curResName % curResName
% curChainId % curChainID
% curResSeq % curResSeq
% curICode % curICode
% prevAtom % prevAtom
% prevResName % prevResName
% prevChainId % prevChainID
% prevResSeq % prevResSeq
% prevICode) << endl; % prevICode) << endl;
} }
...@@ -3727,12 +3726,12 @@ void WritePDBFile(ostream& pdbFile, cif::File& cifFile) ...@@ -3727,12 +3726,12 @@ void WritePDBFile(ostream& pdbFile, cif::File& cifFile)
void WritePDBHeaderLines(std::ostream& os, cif::File& cifFile) void WritePDBHeaderLines(std::ostream& os, cif::File& cifFile)
{ {
io::filtering_ostream out; // io::filtering_ostream out;
out.push(FillOutLineFilter()); // out.push(FillOutLineFilter());
out.push(os); // out.push(os);
auto filter = out.component<FillOutLineFilter>(0); // auto filter = out.component<FillOutLineFilter>(0);
assert(filter); // assert(filter);
auto& db = cifFile.firstDatablock(); auto& db = cifFile.firstDatablock();
...@@ -3767,8 +3766,6 @@ std::string GetPDBHEADERLine(cif::File& cifFile, int truncate_at) ...@@ -3767,8 +3766,6 @@ std::string GetPDBHEADERLine(cif::File& cifFile, int truncate_at)
for (auto r: cat1) for (auto r: cat1)
{ {
keywords = r["keywords"].as<string>();
if (keywords.empty())
keywords = r["pdbx_keywords"].as<string>(); keywords = r["pdbx_keywords"].as<string>();
if (keywords.length() > truncate_at - 40) if (keywords.length() > truncate_at - 40)
keywords = keywords.substr(0, truncate_at - 44) + " ..."; keywords = keywords.substr(0, truncate_at - 44) + " ...";
...@@ -3814,7 +3811,7 @@ std::string GetPDBCOMPNDLine(cif::File& cifFile, int truncate_at) ...@@ -3814,7 +3811,7 @@ std::string GetPDBCOMPNDLine(cif::File& cifFile, int truncate_at)
if (r["type"] != "polymer") if (r["type"] != "polymer")
continue; continue;
string entityId = r["id"].as<string>(); string entityID = r["id"].as<string>();
++molID; ++molID;
cmpnd.push_back("MOL_ID: " + to_string(molID)); cmpnd.push_back("MOL_ID: " + to_string(molID));
...@@ -3822,7 +3819,7 @@ std::string GetPDBCOMPNDLine(cif::File& cifFile, int truncate_at) ...@@ -3822,7 +3819,7 @@ std::string GetPDBCOMPNDLine(cif::File& cifFile, int truncate_at)
string molecule = r["pdbx_description"].as<string>(); string molecule = r["pdbx_description"].as<string>();
cmpnd.push_back("MOLECULE: " + molecule); cmpnd.push_back("MOLECULE: " + molecule);
auto poly = db["entity_poly"].find(cif::Key("entity_id") == entityId); auto poly = db["entity_poly"].find(cif::Key("entity_id") == entityID);
if (not poly.empty()) if (not poly.empty())
{ {
string chains = poly.front()["pdbx_strand_id"].as<string>(); string chains = poly.front()["pdbx_strand_id"].as<string>();
...@@ -3834,7 +3831,7 @@ std::string GetPDBCOMPNDLine(cif::File& cifFile, int truncate_at) ...@@ -3834,7 +3831,7 @@ std::string GetPDBCOMPNDLine(cif::File& cifFile, int truncate_at)
if (not fragment.empty()) if (not fragment.empty())
cmpnd.push_back("FRAGMENT: " + fragment); cmpnd.push_back("FRAGMENT: " + fragment);
for (auto sr: db["entity_name_com"].find(cif::Key("entity_id") == entityId)) for (auto sr: db["entity_name_com"].find(cif::Key("entity_id") == entityID))
{ {
string syn = sr["name"].as<string>(); string syn = sr["name"].as<string>();
if (not syn.empty()) if (not syn.empty())
...@@ -3874,7 +3871,7 @@ std::string GetPDBSOURCELine(cif::File& cifFile, int truncate_at) ...@@ -3874,7 +3871,7 @@ std::string GetPDBSOURCELine(cif::File& cifFile, int truncate_at)
if (r["type"] != "polymer") if (r["type"] != "polymer")
continue; continue;
string entityId = r["id"].as<string>(); string entityID = r["id"].as<string>();
++molID; ++molID;
source.push_back("MOL_ID: " + to_string(molID)); source.push_back("MOL_ID: " + to_string(molID));
...@@ -3904,7 +3901,7 @@ std::string GetPDBSOURCELine(cif::File& cifFile, int truncate_at) ...@@ -3904,7 +3901,7 @@ std::string GetPDBSOURCELine(cif::File& cifFile, int truncate_at)
{ "details", "OTHER_DETAILS" } { "details", "OTHER_DETAILS" }
}; };
for (auto gr: gen.find(cif::Key("entity_id") == entityId)) for (auto gr: gen.find(cif::Key("entity_id") == entityID))
{ {
for (auto m: kGenSourceMapping) for (auto m: kGenSourceMapping)
{ {
...@@ -3929,7 +3926,7 @@ std::string GetPDBSOURCELine(cif::File& cifFile, int truncate_at) ...@@ -3929,7 +3926,7 @@ std::string GetPDBSOURCELine(cif::File& cifFile, int truncate_at)
{ "details", "OTHER_DETAILS" } { "details", "OTHER_DETAILS" }
}; };
for (auto nr: nat.find(cif::Key("entity_id") == entityId)) for (auto nr: nat.find(cif::Key("entity_id") == entityID))
{ {
for (auto m: kNatSourceMapping) for (auto m: kNatSourceMapping)
{ {
......
...@@ -930,12 +930,12 @@ void DictParser::linkItems() ...@@ -930,12 +930,12 @@ void DictParser::linkItems()
for (auto& kv: linkIndex) for (auto& kv: linkIndex)
{ {
ValidateLink link; ValidateLink link;
std::tie(link.mParentCategory, link.mChildCategory, link.mLinkGroupId) = kv.first; std::tie(link.mParentCategory, link.mChildCategory, link.mLinkGroupID) = kv.first;
std::tie(link.mParentKeys, link.mChildKeys) = linkKeys[kv.second]; std::tie(link.mParentKeys, link.mChildKeys) = linkKeys[kv.second];
// look up the label // look up the label
for (auto r: linkedGroup.find(cif::Key("category_id") == link.mChildCategory and cif::Key("link_group_id") == link.mLinkGroupId)) for (auto r: linkedGroup.find(cif::Key("category_id") == link.mChildCategory and cif::Key("link_group_id") == link.mLinkGroupID))
{ {
link.mLinkGroupLabel = r["label"].as<string>(); link.mLinkGroupLabel = r["label"].as<string>();
break; break;
......
...@@ -313,7 +313,7 @@ bool StructuresAreIsomeric(vector<CompoundAtom> atomsA, const vector<CompoundBon ...@@ -313,7 +313,7 @@ bool StructuresAreIsomeric(vector<CompoundAtom> atomsA, const vector<CompoundBon
Compound::Compound(const std::string& file, const std::string& id, Compound::Compound(const std::string& file, const std::string& id,
const std::string& name, const std::string& group) const std::string& name, const std::string& group)
: mId(id), mName(name), mGroup(group) : mID(id), mName(name), mGroup(group)
{ {
try try
{ {
...@@ -531,7 +531,7 @@ string Compound::type() const ...@@ -531,7 +531,7 @@ string Compound::type() const
// pyranose // pyranose
// saccharide // saccharide
if (cif::iequals(mId, "gly")) if (cif::iequals(mID, "gly"))
result = "peptide linking"; result = "peptide linking";
else if (cif::iequals(mGroup, "l-peptide") or cif::iequals(mGroup, "L-peptide linking") or cif::iequals(mGroup, "peptide")) else if (cif::iequals(mGroup, "l-peptide") or cif::iequals(mGroup, "L-peptide linking") or cif::iequals(mGroup, "peptide"))
result = "L-peptide linking"; result = "L-peptide linking";
...@@ -547,7 +547,7 @@ string Compound::type() const ...@@ -547,7 +547,7 @@ string Compound::type() const
bool Compound::isWater() const bool Compound::isWater() const
{ {
return mId == "HOH" or mId == "H2O"; return mID == "HOH" or mID == "H2O";
} }
bool Compound::isSugar() const bool Compound::isSugar() const
...@@ -555,20 +555,20 @@ bool Compound::isSugar() const ...@@ -555,20 +555,20 @@ bool Compound::isSugar() const
return cif::iequals(mGroup, "furanose") or cif::iequals(mGroup, "pyranose"); return cif::iequals(mGroup, "furanose") or cif::iequals(mGroup, "pyranose");
} }
CompoundAtom Compound::getAtomById(const string& atomId) const CompoundAtom Compound::getAtomByID(const string& atomID) const
{ {
CompoundAtom result = {}; CompoundAtom result = {};
for (auto& a: mAtoms) for (auto& a: mAtoms)
{ {
if (a.id == atomId) if (a.id == atomID)
{ {
result = a; result = a;
break; break;
} }
} }
if (result.id != atomId) if (result.id != atomID)
throw out_of_range("No atom " + atomId + " in Compound " + mId); throw out_of_range("No atom " + atomID + " in Compound " + mID);
return result; return result;
} }
...@@ -612,7 +612,7 @@ bool Compound::isIsomerOf(const Compound& c) const ...@@ -612,7 +612,7 @@ bool Compound::isIsomerOf(const Compound& c) const
for (;;) for (;;)
{ {
// easy tests first // easy tests first
if (mId == c.mId) if (mID == c.mID)
{ {
result = true; result = true;
break; break;
...@@ -694,11 +694,11 @@ vector<string> Compound::isomers() const ...@@ -694,11 +694,11 @@ vector<string> Compound::isomers() const
vector<string> result; vector<string> result;
auto& db = IsomerDB::instance(); auto& db = IsomerDB::instance();
if (db.count(mId)) if (db.count(mID))
{ {
result = db[mId]; result = db[mID];
auto i = find(result.begin(), result.end(), mId); auto i = find(result.begin(), result.end(), mID);
assert(i != result.end()); assert(i != result.end());
result.erase(i); result.erase(i);
...@@ -777,7 +777,7 @@ float Compound::chiralVolume(const string& centreID) const ...@@ -777,7 +777,7 @@ float Compound::chiralVolume(const string& centreID) const
Link::Link(cif::Datablock& db) Link::Link(cif::Datablock& db)
{ {
mId = db.getName(); mID = db.getName();
auto& linkBonds = db["chem_link_bond"]; auto& linkBonds = db["chem_link_bond"];
...@@ -801,7 +801,7 @@ Link::Link(cif::Datablock& db) ...@@ -801,7 +801,7 @@ Link::Link(cif::Datablock& db)
else else
{ {
if (cif::VERBOSE) if (cif::VERBOSE)
cerr << "Unimplemented chem_link_bond.type " << type << " in " << mId << endl; cerr << "Unimplemented chem_link_bond.type " << type << " in " << mID << endl;
b.type = singleBond; b.type = singleBond;
} }
...@@ -863,7 +863,7 @@ Link::Link(cif::Datablock& db) ...@@ -863,7 +863,7 @@ Link::Link(cif::Datablock& db)
else else
{ {
if (cif::VERBOSE) if (cif::VERBOSE)
cerr << "Unimplemented chem_link_chir.volume_sign " << volumeSign << " in " << mId << endl; cerr << "Unimplemented chem_link_chir.volume_sign " << volumeSign << " in " << mID << endl;
continue; continue;
} }
......
...@@ -19,7 +19,7 @@ namespace mmcif ...@@ -19,7 +19,7 @@ namespace mmcif
inline ostream& operator<<(ostream& os, const Atom& a) inline ostream& operator<<(ostream& os, const Atom& a)
{ {
os << a.labelAsymId() << ':' << a.labelSeqId() << '/' << a.labelAtomId(); os << a.labelAsymID() << ':' << a.labelSeqID() << '/' << a.labelAtomID();
return os; return os;
} }
...@@ -441,7 +441,7 @@ vector<Atom> DistanceMap::near(const Atom& a, float maxDistance) const ...@@ -441,7 +441,7 @@ vector<Atom> DistanceMap::near(const Atom& a, float maxDistance) const
continue; continue;
size_t ixb = mJA[i]; size_t ixb = mJA[i];
Atom b = structure.getAtomById(rIndex.at(ixb)); Atom b = structure.getAtomByID(rIndex.at(ixb));
if (rti > 0) if (rti > 0)
result.emplace_back(b.symmetryCopy(mD, mRtOrth.at(rti))); result.emplace_back(b.symmetryCopy(mD, mRtOrth.at(rti)));
......
...@@ -1166,14 +1166,14 @@ void Remark3Parser::storeCapture(const char* category, initializer_list<const ch ...@@ -1166,14 +1166,14 @@ void Remark3Parser::storeCapture(const char* category, initializer_list<const ch
} }
else if (iequals(category, "pdbx_refine_tls_group")) else if (iequals(category, "pdbx_refine_tls_group"))
{ {
string tlsGroupId; string tlsGroupID;
if (not mDb["pdbx_refine_tls"].empty()) if (not mDb["pdbx_refine_tls"].empty())
tlsGroupId = mDb["pdbx_refine_tls"].back()["id"].as<string>(); tlsGroupID = mDb["pdbx_refine_tls"].back()["id"].as<string>();
cat.emplace({ cat.emplace({
{ "pdbx_refine_id", mExpMethod }, { "pdbx_refine_id", mExpMethod },
{ "id", tlsGroupId }, { "id", tlsGroupID },
{ "refine_tls_id", tlsGroupId } { "refine_tls_id", tlsGroupID }
}); });
} }
else if (iequals(category, "pdbx_refine_tls")) else if (iequals(category, "pdbx_refine_tls"))
......
...@@ -8,9 +8,8 @@ ...@@ -8,9 +8,8 @@
#include "cif++/Config.h" #include "cif++/Config.h"
#include <numeric> #include <numeric>
#include <chrono>
#include <iomanip> #include <iomanip>
#include <future> #include <thread>
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string.hpp>
...@@ -164,22 +163,22 @@ struct Res ...@@ -164,22 +163,22 @@ struct Res
for (auto& a: mM.atoms()) for (auto& a: mM.atoms())
{ {
if (a.labelAtomId() == "CA") if (a.labelAtomID() == "CA")
{ {
mCAlpha = a.location(); mCAlpha = a.location();
ExtendBox(mCAlpha, kRadiusCA + 2 * kRadiusWater); ExtendBox(mCAlpha, kRadiusCA + 2 * kRadiusWater);
} }
else if (a.labelAtomId() == "C") else if (a.labelAtomID() == "C")
{ {
mC = a.location(); mC = a.location();
ExtendBox(mC, kRadiusC + 2 * kRadiusWater); ExtendBox(mC, kRadiusC + 2 * kRadiusWater);
} }
else if (a.labelAtomId() == "N") else if (a.labelAtomID() == "N")
{ {
mN = a.location(); mN = a.location();
ExtendBox(mN, kRadiusN + 2 * kRadiusWater); ExtendBox(mN, kRadiusN + 2 * kRadiusWater);
} }
else if (a.labelAtomId() == "O") else if (a.labelAtomID() == "O")
{ {
mO = a.location(); mO = a.location();
ExtendBox(mO, kRadiusO + 2 * kRadiusWater); ExtendBox(mO, kRadiusO + 2 * kRadiusWater);
...@@ -489,30 +488,6 @@ void CalculateAccessibilities(std::vector<Res>& inResidues, DSSP_Statistics& sta ...@@ -489,30 +488,6 @@ void CalculateAccessibilities(std::vector<Res>& inResidues, DSSP_Statistics& sta
for (auto& residue: inResidues) for (auto& residue: inResidues)
stats.accessibleSurface += residue.CalculateSurface(inResidues); stats.accessibleSurface += residue.CalculateSurface(inResidues);
// uint32_t nr_of_threads = boost::thread::hardware_concurrency();
// if (nr_of_threads <= 1)
// {
// foreach (MResidue* residue, inResidues)
// residue->CalculateSurface(inResidues);
// }
// else
// {
// MResidueQueue queue;
// boost::thread_group t;
// for (uint32 ti = 0; ti < nr_of_threads; ++ti)
// t.create_thread(boost::bind(&MProtein::CalculateAccessibility, this,
// boost::ref(queue), boost::ref(inResidues)));
// foreach (MResidue* residue, inResidues)
// queue.put(residue);
// queue.put(nullptr);
// t.join_all();
// }
} }
// -------------------------------------------------------------------- // --------------------------------------------------------------------
...@@ -1003,51 +978,6 @@ void CalculateAlphaHelices(std::vector<Res>& inResidues, DSSP_Statistics& stats, ...@@ -1003,51 +978,6 @@ void CalculateAlphaHelices(std::vector<Res>& inResidues, DSSP_Statistics& stats,
} }
} }
// // --------------------------------------------------------------------
// void CalculateSecondaryStructure(Structure& s)
// {
// auto& polymers = s.polymers();
// size_t nRes = accumulate(polymers.begin(), polymers.end(),
// 0.0, [](double s, auto& p) { return s + p.size(); });
// vector<Res> residues;
// residues.reserve(nRes);
// for (auto& p: polymers)
// {
// for (auto& m: p)
// residues.emplace_back(m);
// }
// auto fa = std::async(std::launch::async, std::bind(&CalculateAccessibilities, std::ref(residues)));
// for (size_t i = 0; i + 1 < residues.size(); ++i)
// {
// residues[i].mNext = &residues[i + 1];
// residues[i + 1].mPrev = &residues[i];
// residues[i + 1].assignHydrogen();
// }
// CalculateHBondEnergies(residues);
// CalculateBetaSheets(residues);
// CalculateAlphaHelices(residues);
// if (cif::VERBOSE)
// {
// for (auto& r: residues)
// {
// auto& m = r.mM;
// cout << m.asymID() << ':' << m.seqID() << '/' << m.compoundID() << '\t'
// << char(r.mSecondaryStructure)
// << endl;
// }
// }
// }
// -------------------------------------------------------------------- // --------------------------------------------------------------------
struct DSSPImpl struct DSSPImpl
...@@ -1069,37 +999,6 @@ struct DSSPImpl ...@@ -1069,37 +999,6 @@ struct DSSPImpl
// -------------------------------------------------------------------- // --------------------------------------------------------------------
std::ostream& operator<<(std::ostream& os, const std::chrono::duration<double>& t)
{
uint64_t s = static_cast<uint64_t>(std::trunc(t.count()));
if (s > 24 * 60 * 60)
{
uint32_t days = s / (24 * 60 * 60);
os << days << "d ";
s %= 24 * 60 * 60;
}
if (s > 60 * 60)
{
uint32_t hours = s / (60 * 60);
os << hours << "h ";
s %= 60 * 60;
}
if (s > 60)
{
uint32_t minutes = s / 60;
os << minutes << "m ";
s %= 60;
}
double ss = s + 1e-6 * (t.count() - s);
os << std::fixed << std::setprecision(1) << ss << 's';
return os;
}
DSSPImpl::DSSPImpl(const Structure& s) DSSPImpl::DSSPImpl(const Structure& s)
: mStructure(s) : mStructure(s)
, mPolymers(mStructure.polymers()) , mPolymers(mStructure.polymers())
...@@ -1144,7 +1043,7 @@ DSSPImpl::DSSPImpl(const Structure& s) ...@@ -1144,7 +1043,7 @@ DSSPImpl::DSSPImpl(const Structure& s)
mResidues[i + 1].assignHydrogen(); mResidues[i + 1].assignHydrogen();
} }
auto a = std::async(std::launch::async, &CalculateAccessibilities, std::ref(mResidues), std::ref(mStats)); std::thread ta(std::bind(&CalculateAccessibilities, std::ref(mResidues), std::ref(mStats)));
auto& db = s.getFile().data(); auto& db = s.getFile().data();
for (auto r: db["struct_conn"].find(cif::Key("conn_type_id") == "disulf")) for (auto r: db["struct_conn"].find(cif::Key("conn_type_id") == "disulf"))
...@@ -1207,9 +1106,8 @@ DSSPImpl::DSSPImpl(const Structure& s) ...@@ -1207,9 +1106,8 @@ DSSPImpl::DSSPImpl(const Structure& s)
mStats.nrOfSSBridges = mSSBonds.size(); mStats.nrOfSSBridges = mSSBonds.size();
mStats.nrOfIntraChainSSBridges = 0; mStats.nrOfIntraChainSSBridges = 0;
for (auto& ss: mSSBonds) for (const auto& [a, b]: mSSBonds)
{ {
const auto& [a, b] = ss;
if (a->mM.asymID() != b->mM.asymID()) if (a->mM.asymID() != b->mM.asymID())
++mStats.nrOfIntraChainSSBridges; ++mStats.nrOfIntraChainSSBridges;
} }
...@@ -1231,7 +1129,7 @@ DSSPImpl::DSSPImpl(const Structure& s) ...@@ -1231,7 +1129,7 @@ DSSPImpl::DSSPImpl(const Structure& s)
} }
} }
a.get(); ta.join();
} }
// -------------------------------------------------------------------- // --------------------------------------------------------------------
......
...@@ -286,10 +286,10 @@ struct AtomData ...@@ -286,10 +286,10 @@ struct AtomData
{ {
AtomData(Atom atom, float radius) AtomData(Atom atom, float radius)
: atom(atom) : atom(atom)
// , asymID(atom.authAsymId()) // , asymID(atom.authAsymID())
// , seqID(atom.property<string>("auth_seq_id")) // , seqID(atom.property<string>("auth_seq_id"))
, asymID(atom.labelAsymId()) , asymID(atom.labelAsymID())
, seqID(atom.labelSeqId()) , seqID(atom.labelSeqID())
, radius(radius) {} , radius(radius) {}
Atom atom; Atom atom;
...@@ -584,8 +584,8 @@ vector<ResidueStatistics> StatsCollector::collect() const ...@@ -584,8 +584,8 @@ vector<ResidueStatistics> StatsCollector::collect() const
if (atom.isWater()) if (atom.isWater())
continue; continue;
auto k = make_tuple(atom.labelAsymId(), atom.labelSeqId(), atom.labelCompId(), atom.authSeqId()); auto k = make_tuple(atom.labelAsymID(), atom.labelSeqID(), atom.labelCompID(), atom.authSeqID());
// auto k = make_tuple(atom.authAsymId(), atom.property<string>("auth_seq_id"), atom.authCompId()); // auto k = make_tuple(atom.authAsymID(), atom.property<string>("auth_seq_id"), atom.authCompID());
if (residues.empty() or residues.back() != k) if (residues.empty() or residues.back() != k)
{ {
...@@ -610,19 +610,19 @@ vector<ResidueStatistics> StatsCollector::collect(const string& asymID, int resF ...@@ -610,19 +610,19 @@ vector<ResidueStatistics> StatsCollector::collect(const string& asymID, int resF
if (authNameSpace) if (authNameSpace)
{ {
int authSeqID = stoi(atom.authSeqId()); int authSeqID = stoi(atom.authSeqID());
if (atom.authAsymId() != asymID or authSeqID < resFirst or authSeqID > resLast) if (atom.authAsymID() != asymID or authSeqID < resFirst or authSeqID > resLast)
continue; continue;
} }
else else
{ {
if (atom.labelAsymId() != asymID or atom.labelSeqId() < resFirst or atom.labelSeqId() > resLast) if (atom.labelAsymID() != asymID or atom.labelSeqID() < resFirst or atom.labelSeqID() > resLast)
continue; continue;
} }
auto k = make_tuple(atom.labelAsymId(), atom.labelSeqId(), atom.labelCompId(), atom.authSeqId()); auto k = make_tuple(atom.labelAsymID(), atom.labelSeqID(), atom.labelCompID(), atom.authSeqID());
// auto k = make_tuple(atom.authAsymId(), atom.property<string>("auth_seq_id"), atom.authCompId()); // auto k = make_tuple(atom.authAsymID(), atom.property<string>("auth_seq_id"), atom.authCompID());
if (residues.empty() or residues.back() != k) if (residues.empty() or residues.back() != k)
{ {
...@@ -710,7 +710,7 @@ vector<ResidueStatistics> StatsCollector::collect(const vector<tuple<string,int, ...@@ -710,7 +710,7 @@ vector<ResidueStatistics> StatsCollector::collect(const vector<tuple<string,int,
++n; ++n;
auto ci = find_if(atomData.begin(), atomData.end(), auto ci = find_if(atomData.begin(), atomData.end(),
[=](auto& d) { return d.asymID == asymID and d.seqID == seqID and d.atom.labelAtomId() == compAtom.id; }); [=](auto& d) { return d.asymID == asymID and d.seqID == seqID and d.atom.labelAtomID() == compAtom.id; });
if (ci == atomData.end()) if (ci == atomData.end())
{ {
...@@ -749,7 +749,7 @@ vector<ResidueStatistics> StatsCollector::collect(const vector<tuple<string,int, ...@@ -749,7 +749,7 @@ vector<ResidueStatistics> StatsCollector::collect(const vector<tuple<string,int,
continue; continue;
result.emplace_back(ResidueStatistics{d.asymID, d.seqID, "HOH", result.emplace_back(ResidueStatistics{d.asymID, d.seqID, "HOH",
atom.authSeqId(), atom.authSeqID(),
(d.sums.rfSums[0] / d.sums.rfSums[1]), // rsr (d.sums.rfSums[0] / d.sums.rfSums[1]), // rsr
d.sums.srg(), // srsr d.sums.srg(), // srsr
d.sums.cc(), // rsccs d.sums.cc(), // rsccs
...@@ -813,7 +813,7 @@ ResidueStatistics StatsCollector::collect(const vector<Atom>& atoms) const ...@@ -813,7 +813,7 @@ ResidueStatistics StatsCollector::collect(const vector<Atom>& atoms) const
++n; ++n;
auto ci = find_if(atomData.begin(), atomData.end(), auto ci = find_if(atomData.begin(), atomData.end(),
[=](auto& d) { return d.asymID == atom.labelAsymId() and d.seqID == atom.labelSeqId() and d.atom.labelAtomId() == atom.labelAtomId(); }); [=](auto& d) { return d.asymID == atom.labelAsymID() and d.seqID == atom.labelSeqID() and d.atom.labelAtomID() == atom.labelAtomID(); });
if (ci == atomData.end()) if (ci == atomData.end())
continue; continue;
......
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