Skip to content
Snippets Groups Projects
Commit 46265513 authored by B13nch3n's avatar B13nch3n
Browse files

SCHWED-4849: Allow to get branched entity information for a specific chain

parent 882d4467
No related branches found
No related tags found
No related merge requests found
......@@ -52,7 +52,8 @@ The following categories of a mmCIF file are considered by the reader:
(mmCIF dictionary version >= 5) used to fill :class:`MMCifInfoRevisions`
* ``pdbx_entity_branch`` and ``pdbx_entity_branch_link`` used for
:class:`MMCifInfoEntityBranchLink`, a list of links is available by
:meth:`~MMCifInfo.GetEntityBranchLinks`
:meth:`~MMCifInfo.GetEntityBranchLinks` and
:meth:`~MMCifInfo.GetEntityBranchByChain`
Notes:
......@@ -313,6 +314,18 @@ of the annotation available.
information is available by the stored
:class:`AtomHandles <ost.mol.AtomHandle>` of each entry.
:returns: :class:`list` of :class:`MMCifInfoEntityBranchLink`
.. method:: GetEntityBranchByChain(chain_name)
Get bond information for chains with branched entities. Returns all
:class:`MMCifInfoEntityBranchLink` objects in one list if chain is a
branched entity, an empty list otherwise.
:param chain_name: Chain name to check for branch links
:type chain_name: :class:`str`
:returns: :class:`list` of :class:`MMCifInfoEntityBranchLink`
.. method:: AddEntityBranchLink(chain_name, atom1, atom2, bond_order)
Add bond information for a branched entity.
......@@ -327,7 +340,19 @@ of the annotation available.
:type bond_order: :class:`int`
:returns: Nothing
.. method:: ConnectBranchLinks()
.. method:: GetEntityBranchChainNames
Get a list of chain names which contain branched entities.
:returns: :class:`list` of :class:`str`
.. method:: GetEntityBranchChains
Get a list of chains which contain branched entities.
:returns: :class:`list` of :class:`~ost.mol.ChainHandle`
.. method:: ConnectBranchLinks
Establish all bonds stored for branched entities.
......@@ -1246,18 +1271,6 @@ of the annotation available.
:type editor: :class:`~ost.mol.XCSEditor`
:returns: Nothing
.. method:: GetEntityBranchChainNames
Get a list of chain names which contain branched entities.
:returns: :class:`list` of :class:`str`
.. method:: GetEntityBranchChains
Get a list of chains which contain branched entities.
:returns: :class:`list` of :class:`~ost.mol.ChainHandle`
.. method:: GetAtom1
See :attr:`atom1`
......@@ -1286,7 +1299,7 @@ of the annotation available.
.. LocalWords: SPRSDE pdb func autofunction exptl attr pdbx oper conf spr dif
.. LocalWords: biounits biounit uniprot UNP seqs AddMMCifPDBChainTr cif asym
.. LocalWords: auth GetMMCifPDBChainTr AddPDBCMMCifhainTr GetPDBMMCifChainTr
.. LocalWords: GetRevisions AddRevision SetRevisionsDateOriginal GetSize
.. LocalWords: GetRevisions AddRevision SetRevisionsDateOriginal GetSize str
.. LocalWords: GetNum num GetStatus GetLastDate GetFirstRelease storable
.. LocalWords: cas isbn pubmed asu seqres conop casp COMPND OBSLTE LoadMMCIF
.. LocalWords: SetChainList MMCifInfoTransOp ChainTypes MMCifInfoStructRef
......@@ -1295,3 +1308,4 @@ of the annotation available.
.. LocalWords: chainintervalls GetChainIntervalList GetMethodDetails GetAtom
.. LocalWords: GetOperationsIntervalList SetMethodDetails oligosaccharides
.. LocalWords: SetAtom GetBondOrder SetBondOrder MMCifInfoEntityBranchLink
.. LocalWords: GetEntityBranchByChain param
......@@ -413,6 +413,7 @@ void export_mmcif_io()
.def("GetRevisions", &MMCifInfo::GetRevisions)
.def("AddEntityBranchLink", &MMCifInfo::AddEntityBranchLink)
.def("GetEntityBranchLinks", &MMCifInfo::GetEntityBranchLinks)
.def("GetEntityBranchByChain", &MMCifInfo::GetEntityBranchByChain)
.def("ConnectBranchLinks", &MMCifInfo::ConnectBranchLinks)
.def("GetEntityBranchChainNames", &WrapGetNames)
.def("GetEntityBranchChains", &MMCifInfo::GetEntityBranchChains)
......
......@@ -227,6 +227,18 @@ const std::vector<MMCifInfoEntityBranchLink> MMCifInfo::GetEntityBranchLinks() c
return all_links;
}
const std::vector<MMCifInfoEntityBranchLink> MMCifInfo::GetEntityBranchByChain(
const String& chain_name) const
{
// search the requested chain
MMCifInfoEntityBranchLinkMap::const_iterator blm_it =
entity_branches_.find(chain_name);
if (blm_it != entity_branches_.end()) {
return blm_it->second;
}
return std::vector<MMCifInfoEntityBranchLink>();
}
const std::vector<String> MMCifInfo::GetEntityBranchChainNames() const
{
std::vector<String> chain_names;
......
......@@ -1181,15 +1181,19 @@ public:
///
const std::vector<MMCifInfoEntityBranchLink> GetEntityBranchLinks() const;
/// \brief Check if a chain is a branched entity and return it
///
/// \param chain_name Name of the chain to check
const std::vector<MMCifInfoEntityBranchLink> GetEntityBranchByChain(
const String& chain_name) const;
/// \brief Get the names of all chains of branched entities.
///
const std::vector<String> GetEntityBranchChainNames() const;
/// \brief Get the all chains of branched entities.
///
const mol::ChainHandleList GetEntityBranchChains() const;
//GetEntityBranchByChain
const mol::ChainHandleList GetEntityBranchChains() const;
/// \brief Connect all atoms listed as links for branched entities.
///
......
......@@ -631,7 +631,8 @@ private:
/// \brief Get an iterator for MMCifEntityDescMap by finding an element or
/// inserting a new one into the map.
MMCifEntityDescMap::iterator GetEntityDescMapIterator(const String&);
/// \param entity_id ID of the entity to talk to
MMCifEntityDescMap::iterator GetEntityDescMapIterator(const String& entity_id);
/// \struct assembly information
typedef struct {
......
......@@ -306,6 +306,12 @@ class TestMMCifInfo(unittest.TestCase):
self.assertEqual(chains[0].name, 'A')
self.assertEqual(chains[1].name, 'B')
blinks = info.GetEntityBranchByChain('B')
self.assertEqual(len(blinks), 1)
self.assertEqual(blinks[0].atom1.qualified_name, "B.NAG2.C1")
blinks = info.GetEntityBranchByChain('C')
self.assertEqual(len(blinks), 0)
if __name__== '__main__':
from ost import testutils
testutils.RunTests()
......
......@@ -377,6 +377,13 @@ BOOST_AUTO_TEST_CASE(mmcif_info)
BOOST_CHECK(chains[0].GetName() == "A");
BOOST_CHECK(chains[1].GetName() == "B");
// check retrieval of links by chain name
std::vector<MMCifInfoEntityBranchLink> cblinks =
info.GetEntityBranchByChain("A");
BOOST_CHECK(cblinks.size() == 1);
cblinks = info.GetEntityBranchByChain("C");
BOOST_CHECK(cblinks.size() == 0);
BOOST_TEST_MESSAGE(" done.");
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment