From b567b39437e00efeee7168b98eec25fb695064d5 Mon Sep 17 00:00:00 2001 From: B13nch3n <stefan.bienert@me.com> Date: Tue, 21 Jul 2020 15:21:20 +0200 Subject: [PATCH] SCHWED-4848: Gather ChainHandles of branched entities --- modules/io/src/mol/mmcif_info.cc | 12 ++++++++++++ modules/io/src/mol/mmcif_info.hh | 5 ++++- modules/io/tests/test_mmcif_info.cc | 5 +++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/modules/io/src/mol/mmcif_info.cc b/modules/io/src/mol/mmcif_info.cc index 1fb5ee93d..62ea686e6 100644 --- a/modules/io/src/mol/mmcif_info.cc +++ b/modules/io/src/mol/mmcif_info.cc @@ -238,6 +238,18 @@ const std::vector<String> MMCifInfo::GetEntityBranchChainNames() const return chain_names; } +const mol::ChainHandleList MMCifInfo::GetEntityBranchChains() const +{ + std::vector<mol::ChainHandle> chains; + MMCifInfoEntityBranchLinkMap::const_iterator blm_it; + for (blm_it = entity_branches_.begin(); + blm_it != entity_branches_.end(); ++blm_it) { + chains.push_back(blm_it->second[0].GetAtom1().GetResidue().GetChain()); + } + + return chains; +} + void MMCifInfo::ConnectBranchLinks() { MMCifInfoEntityBranchLinkMap::iterator blm_it; diff --git a/modules/io/src/mol/mmcif_info.hh b/modules/io/src/mol/mmcif_info.hh index 510365d49..bebccefa0 100644 --- a/modules/io/src/mol/mmcif_info.hh +++ b/modules/io/src/mol/mmcif_info.hh @@ -1185,7 +1185,10 @@ public: /// const std::vector<String> GetEntityBranchChainNames() const; - //GetEntityBranchChains + /// \brief Get the all chains of branched entities. + /// +const mol::ChainHandleList GetEntityBranchChains() const; + //GetEntityBranchByChain /// \brief Connect all atoms listed as links for branched entities. diff --git a/modules/io/tests/test_mmcif_info.cc b/modules/io/tests/test_mmcif_info.cc index 7c5db68ee..a2b78b054 100644 --- a/modules/io/tests/test_mmcif_info.cc +++ b/modules/io/tests/test_mmcif_info.cc @@ -372,6 +372,11 @@ BOOST_AUTO_TEST_CASE(mmcif_info) BOOST_CHECK(chain_names[0] == "A"); BOOST_CHECK(chain_names[1] == "B"); + // check chain(handle) retrieval works + mol::ChainHandleList chains = info.GetEntityBranchChains(); + BOOST_CHECK(chains[0].GetName() == "A"); + BOOST_CHECK(chains[1].GetName() == "B"); + BOOST_TEST_MESSAGE(" done."); } -- GitLab