diff --git a/modules/io/doc/mmcif.rst b/modules/io/doc/mmcif.rst index b8c63d9dedf7b0184ca835713de65b4ea5116f35..0a6520a477378154df9096003133ff5d906cf43c 100644 --- a/modules/io/doc/mmcif.rst +++ b/modules/io/doc/mmcif.rst @@ -501,6 +501,13 @@ of the annotation available. Also available as :meth:`GetDetails`. May also be modified by :meth:`SetDetails`. + .. attribute:: method_details + + Details about the method used to determine this biological assembly. + + Also available as :meth:`GetMethodDetails`. May also be modified by + :meth:`SetMethodDetails`. + .. attribute:: chains Chains involved in this bio unit. If not provided, resembles an empty list. @@ -552,6 +559,14 @@ of the annotation available. See :attr:`details` + .. method:: GetMethodDetails() + + See :attr:`method_details` + + .. method:: SetMethodDetails(details) + + See :attr:`method_details` + .. method:: GetChainList() See :attr:`chains` @@ -997,5 +1012,5 @@ of the annotation available. .. LocalWords: SetChainList MMCifInfoTransOp ChainTypes MMCifInfoStructRef .. LocalWords: MMCifInfoRevisions bool difs MMCifInfoStructRefSeqDif rnum .. LocalWords: SetDateOriginal GetDateOriginal yyyy operationsintervalls -.. LocalWords: chainintervalls GetChainIntervalList -.. LocalWords: GetOperationsIntervalList +.. LocalWords: chainintervalls GetChainIntervalList GetMethodDetails +.. LocalWords: GetOperationsIntervalList SetMethodDetails diff --git a/modules/io/pymod/export_mmcif_io.cc b/modules/io/pymod/export_mmcif_io.cc index 9a21bdb1af003bdaa33406e7f7e98754f8a606ea..d3213357183cf73841d9d1386e612b6e0828ca40 100644 --- a/modules/io/pymod/export_mmcif_io.cc +++ b/modules/io/pymod/export_mmcif_io.cc @@ -184,6 +184,8 @@ void export_mmcif_io() class_<MMCifInfoBioUnit>("MMCifInfoBioUnit", init<>()) .def("SetDetails", &MMCifInfoBioUnit::SetDetails) .def("GetDetails", &MMCifInfoBioUnit::GetDetails) + .def("SetMethodDetails", &MMCifInfoBioUnit::SetMethodDetails) + .def("GetMethodDetails", &MMCifInfoBioUnit::GetMethodDetails) .def("AddChain", &MMCifInfoBioUnit::AddChain) .def("SetChainList", &MMCifInfoBioUnit::SetChainList) .def("GetChainList", make_function(&MMCifInfoBioUnit::GetChainList, @@ -201,6 +203,8 @@ void export_mmcif_io() .def("GetID", &MMCifInfoBioUnit::GetID) .add_property("details", &MMCifInfoBioUnit::GetDetails, &MMCifInfoBioUnit::SetDetails) + .add_property("method_details", &MMCifInfoBioUnit::GetMethodDetails, + &MMCifInfoBioUnit::SetMethodDetails) .add_property("chains", make_function(&MMCifInfoBioUnit::GetChainList, return_value_policy<copy_const_reference>())) .add_property("chainintervalls", make_function( diff --git a/modules/io/src/mol/mmcif_info.hh b/modules/io/src/mol/mmcif_info.hh index 52a44aedc1baf2dcea4255f4a4980eeaec03570f..593fed6f2b70e25c777454bd3e8d95db8554ef56 100644 --- a/modules/io/src/mol/mmcif_info.hh +++ b/modules/io/src/mol/mmcif_info.hh @@ -264,6 +264,17 @@ public: /// \return details String GetDetails() const { return details_; } + /// \brief Set method details + /// + /// \param method details + void SetMethodDetails(String method_details) { + method_details_ = method_details; + } + /// \brief Get method details + /// + /// \return method details + String GetMethodDetails() const { return method_details_; } + /// \brief Add a chain name /// /// \param chain chain name @@ -360,6 +371,7 @@ public: private: String id_; ///< pdbx_struct_assembly.id String details_; ///< pdbx_struct_assembly.details + String method_details_; ///< pdbx_struct_assembly.method_details std::vector<String> chains_; ///< all chains of this this assembly std::vector<std::pair<int, int> > tr_chains_; //< chains of a transformation std::vector<std::vector<MMCifInfoTransOpPtr> > operations_; diff --git a/modules/io/src/mol/mmcif_reader.cc b/modules/io/src/mol/mmcif_reader.cc index cd21e62a1318d4b93f77c8f3fb2d1d4a57f2c4cc..52cd7e1ae82f20b47834bfe69862097fd9d0dfd9 100644 --- a/modules/io/src/mol/mmcif_reader.cc +++ b/modules/io/src/mol/mmcif_reader.cc @@ -224,7 +224,7 @@ bool MMCifReader::OnBeginLoop(const StarLoopDesc& header) this->TryStoreIdx(PSA_ID, "id", header); // optional indices_[PSA_DETAILS] = header.GetIndex("details"); - //indices_[METHOD_DETAILS] = header.GetIndex("method_details"); + indices_[METHOD_DETAILS] = header.GetIndex("method_details"); cat_available = true; } else if (header.GetCategory() == "pdbx_struct_assembly_gen") { category_ = PDBX_STRUCT_ASSEMBLY_GEN; @@ -870,15 +870,22 @@ void MMCifReader::ParseRefine(const std::vector<StringRef>& columns) void MMCifReader::ParsePdbxStructAssembly(const std::vector<StringRef>& columns) { + MMCifPSAEntry psa; + if (indices_[PSA_DETAILS] != -1) { - bu_origin_map_.insert(std::pair<String, - String>(columns[indices_[PSA_ID]].str(), - columns[indices_[PSA_DETAILS]].str())); + psa.details = columns[indices_[PSA_DETAILS]].str(); } else { - bu_origin_map_.insert(std::pair<String, - String>(columns[indices_[PSA_ID]].str(), - "?")); + psa.details = "?"; } + + if (indices_[METHOD_DETAILS] != -1) { + psa.method_details = columns[indices_[METHOD_DETAILS]].str(); + } else { + psa.method_details = "?"; + } + + bu_origin_map_.insert(std::pair<String, + MMCifPSAEntry>(columns[indices_[PSA_ID]].str(), psa)); } void MMCifReader::StoreExpression(const char* l, const char* s, @@ -1614,7 +1621,7 @@ void MMCifReader::OnEndData() std::vector<std::vector<String> >::const_iterator aol_it; std::vector<String>::const_iterator aob_it; std::vector<MMCifInfoTransOpPtr> operation_list; - std::map<String, String>::const_iterator buom_it; + std::map<String, MMCifPSAEntry>::const_iterator buom_it; std::vector<MMCifInfoTransOpPtr> operations = info_.GetOperations(); info_.SetStructRefs(struct_refs_); std::vector<MMCifInfoTransOpPtr>::const_iterator buop_it; @@ -1631,7 +1638,8 @@ void MMCifReader::OnEndData() bua_it->biounit_id + "' found as requested by pdbx_struct_assembly_gen.")); } - biounit.SetDetails(buom_it->second); + biounit.SetDetails(buom_it->second.details); + biounit.SetMethodDetails(buom_it->second.method_details); biounit.SetID(buom_it->first); biounit.SetChainList(bua_it->chains); diff --git a/modules/io/src/mol/mmcif_reader.hh b/modules/io/src/mol/mmcif_reader.hh index d91cf340355be48f58664a4ada5e02966365e931..15cc727ad76d4a86b2952970bbfb3c4321fbb733 100644 --- a/modules/io/src/mol/mmcif_reader.hh +++ b/modules/io/src/mol/mmcif_reader.hh @@ -578,6 +578,13 @@ private: } MMCifHSEntry; typedef std::vector<MMCifHSEntry> MMCifHSVector; + /// \struct store pdbx_struct_assembly info + typedef struct { + String details; + String method_details; + } MMCifPSAEntry; + typedef std::map<String, MMCifPSAEntry> MMCifPSAMap; + // members MMCifCategory category_; int category_counts_[DONT_KNOW+1]; ///< overall no. of atom_site loops @@ -605,10 +612,10 @@ private: MMCifInfo info_; ///< info container MMCifCitationAuthorMap authors_map_; MMCifBioUAssemblyVector bu_assemblies_; - std::map<String, String> bu_origin_map_; ///< pdbx_struct_assembly.details + MMCifPSAMap bu_origin_map_; ///< pdbx_struct_assembly MMCifHSVector helix_list_; ///< for storing struct_conf sec.struct. data MMCifHSVector strand_list_; ///< for storing struct_conf sec.struct. data - MMCifInfoStructRefs struct_refs_; + MMCifInfoStructRefs struct_refs_; }; }} diff --git a/modules/io/tests/test_io_mmcif.py b/modules/io/tests/test_io_mmcif.py index 4b64aa554988b298d3b8fd75a47d6f74f1d0dca0..3c1a0ec23399f210b61a038ef7e98cb16545cde2 100644 --- a/modules/io/tests/test_io_mmcif.py +++ b/modules/io/tests/test_io_mmcif.py @@ -68,7 +68,11 @@ class TestMMCifInfo(unittest.TestCase): def test_mmcifinfo_biounit(self): b = io.MMCifInfoBioUnit() b.SetDetails('Details') + b.SetMethodDetails('MethodDetails') self.assertEquals(b.GetDetails(), 'Details') + self.assertEquals(b.GetMethodDetails(), 'MethodDetails') + b.method_details = 'AttrMethodDetails' + self.assertEquals(b.method_details, 'AttrMethodDetails') b.AddChain('A') b.AddChain('B') cl = b.GetChainList() diff --git a/modules/io/tests/test_mmcif_info.cc b/modules/io/tests/test_mmcif_info.cc index 4b204a2a5bb018bdeef2413ca8e4ed8b06a84c99..69f369a4dc96546e784551e7cae13783b1a3ef9b 100644 --- a/modules/io/tests/test_mmcif_info.cc +++ b/modules/io/tests/test_mmcif_info.cc @@ -109,11 +109,13 @@ BOOST_AUTO_TEST_CASE(mmcif_info_biounit) MMCifInfoBioUnit bu = MMCifInfoBioUnit(); bu.SetDetails("author_defined_assembly"); + bu.SetMethodDetails("PISA"); bu.SetID("1"); bu.AddChain("B"); bu.AddChain("A"); BOOST_CHECK(bu.GetDetails() == "author_defined_assembly"); + BOOST_CHECK(bu.GetMethodDetails() == "PISA"); BOOST_CHECK(bu.GetChainList().back() == "A"); std::vector<std::pair<int, int> > tr = bu.GetChainIntervalList(); BOOST_CHECK(tr[0].first == 0); diff --git a/modules/io/tests/test_mmcif_reader.cc b/modules/io/tests/test_mmcif_reader.cc index 0b9e94b5868815cb514d48c6a710711b49cf63c9..6f6866622c49c5a6e2f0259339e3c6b5508f4024 100644 --- a/modules/io/tests/test_mmcif_reader.cc +++ b/modules/io/tests/test_mmcif_reader.cc @@ -1266,6 +1266,7 @@ BOOST_AUTO_TEST_CASE(mmcif_testreader) BOOST_CHECK(mmcif_p.GetInfo().GetMethod().str() == "Deep-fry"); BOOST_CHECK(mmcif_p.GetInfo().GetBioUnits().back().GetDetails() == "author_defined_assembly"); + BOOST_CHECK(mmcif_p.GetInfo().GetBioUnits().back().GetMethodDetails() == "?"); BOOST_CHECK(mmcif_p.GetInfo().GetBioUnits().back().GetID() == "2"); BOOST_CHECK(mmcif_p.GetInfo().GetBioUnits().back().GetChainList().back() == "F");