Commit f02ea91b by Maarten L. Hekkelman

label and auth seq id, some improvements

parent 6768a501
...@@ -76,6 +76,8 @@ class Atom ...@@ -76,6 +76,8 @@ class Atom
bool getAnisoU(float anisou[6]) const; bool getAnisoU(float anisou[6]) const;
int charge() const;
void moveTo(const Point &p); void moveTo(const Point &p);
const Compound &comp() const; const Compound &comp() const;
...@@ -488,6 +490,48 @@ class Polymer : public std::vector<Monomer> ...@@ -488,6 +490,48 @@ class Polymer : public std::vector<Monomer>
}; };
// -------------------------------------------------------------------- // --------------------------------------------------------------------
// Sugar and Branch, to describe glycosylation sites
class Branch;
class Sugar : public Residue
{
public:
Sugar(const Branch &branch, const std::string &compoundID,
const std::string &asymID, int authSeqID);
int num() const { return std::stoi(mAuthSeqID); }
std::string name() const;
// Sugar &
private:
const Branch &mBranch;
};
class Branch : public std::vector<Sugar>
{
public:
Branch(Structure &structure, const std::string &asymID);
std::string name() const;
float weight() const;
std::string asymID() const { return mAsymID; }
Structure &structure() { return *mStructure; }
const Structure &structure() const { return *mStructure; }
Sugar &getSugarByNum(int nr);
const Sugar &getSugarByNum(int nr) const;
private:
friend Sugar;
Structure *mStructure;
std::string mAsymID;
};
// --------------------------------------------------------------------
// file is a reference to the data stored in e.g. the cif file. // file is a reference to the data stored in e.g. the cif file.
// This object is not copyable. // This object is not copyable.
...@@ -513,9 +557,9 @@ class File : public cif::File ...@@ -513,9 +557,9 @@ class File : public cif::File
void save(const std::filesystem::path &p) override; void save(const std::filesystem::path &p) override;
void load(std::istream &is) override; void load(std::istream &is) override;
using cif::File::save;
using cif::File::load; using cif::File::load;
using cif::File::save;
cif::Datablock &data() { return front(); } cif::Datablock &data() { return front(); }
}; };
...@@ -558,9 +602,17 @@ class Structure ...@@ -558,9 +602,17 @@ class Structure
const std::list<Polymer> &polymers() const { return mPolymers; } const std::list<Polymer> &polymers() const { return mPolymers; }
std::list<Polymer> &polymers() { return mPolymers; } std::list<Polymer> &polymers() { return mPolymers; }
const std::vector<Residue> &nonPolymers() const { return mNonPolymers; } Polymer &getPolymerByAsymID(const std::string &asymID);
const std::vector<Residue> &branchResidues() const { return mBranchResidues; } const Polymer &getPolymerByAsymID(const std::string &asymID) const;
const std::list<Branch> &branches() const { return mBranches; }
std::list<Branch> &branches() { return mBranches; }
Branch &getBranchByAsymID(const std::string &asymID);
const Branch &getBranchByAsymID(const std::string &asymID) const;
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;
...@@ -642,6 +694,9 @@ class Structure ...@@ -642,6 +694,9 @@ class Structure
/// \return The newly create asym ID /// \return The newly create asym ID
std::string createNonpoly(const std::string &entity_id, std::vector<std::vector<cif::Item>> &atom_info); std::string createNonpoly(const std::string &entity_id, std::vector<std::vector<cif::Item>> &atom_info);
/// \brief Create a new (sugar) branch with one first NAG containing atoms \a nag_atoms
Branch& createBranch(std::vector<std::vector<cif::Item>> &nag_atoms);
/// \brief Remove a residue, can be monomer or nonpoly /// \brief Remove a residue, can be monomer or nonpoly
/// ///
/// \param asym_id The asym ID /// \param asym_id The asym ID
...@@ -665,7 +720,6 @@ class Structure ...@@ -665,7 +720,6 @@ class Structure
void translateRotateAndTranslate(Point t1, Quaternion q, Point t2); void translateRotateAndTranslate(Point t1, Quaternion q, Point t2);
const std::vector<Residue> &getNonPolymers() const { return mNonPolymers; } const std::vector<Residue> &getNonPolymers() const { return mNonPolymers; }
const std::vector<Residue> &getBranchResidues() const { return mBranchResidues; }
void cleanupEmptyCategories(); void cleanupEmptyCategories();
...@@ -688,6 +742,8 @@ class Structure ...@@ -688,6 +742,8 @@ class Structure
std::string insertCompound(const std::string &compoundID, bool isEntity); std::string insertCompound(const std::string &compoundID, bool isEntity);
std::string createEntityForBranch(Branch &branch);
void loadData(); void loadData();
void updateAtomIndex(); void updateAtomIndex();
...@@ -698,7 +754,8 @@ class Structure ...@@ -698,7 +754,8 @@ class Structure
AtomView mAtoms; AtomView mAtoms;
std::vector<size_t> mAtomIndex; std::vector<size_t> mAtomIndex;
std::list<Polymer> mPolymers; std::list<Polymer> mPolymers;
std::vector<Residue> mNonPolymers, mBranchResidues; std::list<Branch> mBranches;
std::vector<Residue> mNonPolymers;
}; };
} // namespace mmcif } // namespace mmcif
...@@ -613,20 +613,12 @@ bool operator==(const cif::Datablock &dbA, const cif::Datablock &dbB) ...@@ -613,20 +613,12 @@ bool operator==(const cif::Datablock &dbA, const cif::Datablock &dbB)
int d = nA.compare(nB); int d = nA.compare(nB);
if (d > 0) if (d > 0)
{ {
auto cat = dbB.get(*catB_i); missingA.push_back(*catB_i);
if (cat == nullptr)
missingA.push_back(*catB_i);
++catB_i; ++catB_i;
} }
else if (d < 0) else if (d < 0)
{ {
auto cat = dbA.get(*catA_i); missingB.push_back(*catA_i);
if (cat == nullptr)
missingB.push_back(*catA_i);
++catA_i; ++catA_i;
} }
else else
......
...@@ -118,6 +118,17 @@ HETATM C CHD . ? -4.342 36.262 -3.536 1.00 8.00 ? ...@@ -118,6 +118,17 @@ HETATM C CHD . ? -4.342 36.262 -3.536 1.00 8.00 ?
auto expected = R"( auto expected = R"(
data_TEST data_TEST
#
_pdbx_nonpoly_scheme.asym_id A
_pdbx_nonpoly_scheme.ndb_seq_num 1
_pdbx_nonpoly_scheme.entity_id 1
_pdbx_nonpoly_scheme.mon_id HEM
_pdbx_nonpoly_scheme.pdb_seq_num 0
_pdbx_nonpoly_scheme.auth_seq_num 0
_pdbx_nonpoly_scheme.pdb_mon_id HEM
_pdbx_nonpoly_scheme.auth_mon_id HEM
_pdbx_nonpoly_scheme.pdb_strand_id A
_pdbx_nonpoly_scheme.pdb_ins_code .
# #
loop_ loop_
_atom_site.id _atom_site.id
...@@ -141,10 +152,10 @@ _atom_site.auth_seq_id ...@@ -141,10 +152,10 @@ _atom_site.auth_seq_id
_atom_site.auth_comp_id _atom_site.auth_comp_id
_atom_site.auth_atom_id _atom_site.auth_atom_id
_atom_site.pdbx_PDB_model_num _atom_site.pdbx_PDB_model_num
1 A ? A CHA HEM 1 . C HETATM ? -5.248 39.769 -0.250 1.00 7.67 ? ? HEM CHA 1 1 A ? A CHA HEM 1 . C HETATM ? -5.248 39.769 -0.250 1.00 7.67 ? 1 HEM CHA 1
2 A ? A CHB HEM 1 . C HETATM ? -3.774 36.790 3.280 1.00 7.05 ? ? HEM CHB 1 2 A ? A CHB HEM 1 . C HETATM ? -3.774 36.790 3.280 1.00 7.05 ? 1 HEM CHB 1
3 A ? A CHC HEM 1 . C HETATM ? -2.879 33.328 0.013 1.00 7.69 ? ? HEM CHC 1 3 A ? A CHC HEM 1 . C HETATM ? -2.879 33.328 0.013 1.00 7.69 ? 1 HEM CHC 1
4 A ? A CHD HEM 1 . C HETATM ? -4.342 36.262 -3.536 1.00 8.00 ? ? HEM CHD 1 4 A ? A CHD HEM 1 . C HETATM ? -4.342 36.262 -3.536 1.00 8.00 ? 1 HEM CHD 1
# #
_chem_comp.id HEM _chem_comp.id HEM
_chem_comp.type NON-POLYMER _chem_comp.type NON-POLYMER
......
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