diff --git a/modules/io/src/mol/mmcif_info.cc b/modules/io/src/mol/mmcif_info.cc index 1fb5ee93dc7e56b3006ef58eb3220f622f69e027..62ea686e6f01b1f6c34af84e1226848d98448fcc 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 510365d4956668fcbdf817a6568c0ba457e877e8..bebccefa06b7be287af43198c297095bd2814287 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 7c5db68eea71478eaf58f90b5bd5106952a44939..a2b78b0544c0f2c9676c4f8065e0eba035a9953d 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."); }