diff --git a/modules/io/doc/mmcif.rst b/modules/io/doc/mmcif.rst index 03305a8813a58accf29e8a19a63272562fe1aeb4..b0467c62a2ce3a4a5c74d50e9bb84a148eab892e 100644 --- a/modules/io/doc/mmcif.rst +++ b/modules/io/doc/mmcif.rst @@ -34,6 +34,7 @@ The following categories of a mmCIF file are considered by the parser: :class:`MMCifInfoStructDetails`. * ``struct_conf``: Stores secondary structure information (practically helices) in the :class:`entity <ost.mol.EntityHandle>` +* ``struct_sheet_range`` Info Classes diff --git a/modules/io/src/mol/mmcif_reader.cc b/modules/io/src/mol/mmcif_reader.cc index 4050f96448496820b1f62b4df4e9e9896adc2ced..e1222db86c50d02de5fe78b78ce70c36deee6249 100644 --- a/modules/io/src/mol/mmcif_reader.cc +++ b/modules/io/src/mol/mmcif_reader.cc @@ -265,17 +265,17 @@ bool MMCifParser::OnBeginLoop(const StarLoopDesc& header) } else if (header.GetCategory() == "struct_conf") { category_ = STRUCT_CONF; // mandatory items - this->TryStoreIdx(BEG_LABEL_ASYM_ID, "beg_label_asym_id", header); - this->TryStoreIdx(BEG_LABEL_COMP_ID, "beg_label_comp_id", header); - this->TryStoreIdx(BEG_LABEL_SEQ_ID, "beg_label_seq_id", header); - this->TryStoreIdx(CONF_TYPE_ID, "conf_type_id", header); - this->TryStoreIdx(END_LABEL_ASYM_ID, "end_label_asym_id", header); - this->TryStoreIdx(END_LABEL_COMP_ID, "end_label_comp_id", header); - this->TryStoreIdx(END_LABEL_SEQ_ID, "end_label_seq_id", header); - this->TryStoreIdx(STRUCT_CONF_ID, "id", header); + this->TryStoreIdx(SC_BEG_LABEL_ASYM_ID, "beg_label_asym_id", header); + this->TryStoreIdx(SC_BEG_LABEL_COMP_ID, "beg_label_comp_id", header); + this->TryStoreIdx(SC_BEG_LABEL_SEQ_ID, "beg_label_seq_id", header); + this->TryStoreIdx(SC_CONF_TYPE_ID, "conf_type_id", header); + this->TryStoreIdx(SC_END_LABEL_ASYM_ID, "end_label_asym_id", header); + this->TryStoreIdx(SC_END_LABEL_COMP_ID, "end_label_comp_id", header); + this->TryStoreIdx(SC_END_LABEL_SEQ_ID, "end_label_seq_id", header); + this->TryStoreIdx(SC_ID, "id", header); // optional items - indices_[BEG_AUTH_ASYM_ID] = header.GetIndex("beg_auth_asym_id"); - indices_[END_AUTH_ASYM_ID] = header.GetIndex("end_auth_asym_id"); + indices_[SC_BEG_AUTH_ASYM_ID] = header.GetIndex("beg_auth_asym_id"); + indices_[SC_END_AUTH_ASYM_ID] = header.GetIndex("end_auth_asym_id"); cat_available = true; } category_counts_[category_]++; @@ -1163,20 +1163,20 @@ void MMCifParser::ParseStructConf(const std::vector<StringRef>& columns) int s_res_num; int e_res_num; // fetch start and end - s_res_num = this->TryGetInt(columns[indices_[BEG_LABEL_SEQ_ID]], + s_res_num = this->TryGetInt(columns[indices_[SC_BEG_LABEL_SEQ_ID]], "struct_conf.beg_label_seq_id"); - e_res_num = this->TryGetInt(columns[indices_[END_LABEL_SEQ_ID]], + e_res_num = this->TryGetInt(columns[indices_[SC_END_LABEL_SEQ_ID]], "struct_conf.end_label_seq_id"); if(auth_chain_id_) { - if (indices_[BEG_AUTH_ASYM_ID] != -1) { - chain_name = columns[indices_[BEG_AUTH_ASYM_ID]]; + if (indices_[SC_BEG_AUTH_ASYM_ID] != -1) { + chain_name = columns[indices_[SC_BEG_AUTH_ASYM_ID]]; } else { throw IOException(this->FormatDiagnostic(STAR_DIAG_ERROR, "Chain name by author requested but 'struct_conf.beg_auth_asym_id' is not set.", this->GetCurrentLinenum())); } } else { - chain_name = columns[indices_[BEG_LABEL_ASYM_ID]]; + chain_name = columns[indices_[SC_BEG_LABEL_ASYM_ID]]; } if (restrict_chains_.size() == 0 || @@ -1186,7 +1186,7 @@ void MMCifParser::ParseStructConf(const std::vector<StringRef>& columns) chain_name.str()}; MMCifSecStructElement type = - DetermineSecStructType(columns[indices_[CONF_TYPE_ID]]); + DetermineSecStructType(columns[indices_[SC_CONF_TYPE_ID]]); if (type == MMCIF_HELIX) { helix_list_.push_back(hse); } else if (type == MMCIF_STRAND) { diff --git a/modules/io/src/mol/mmcif_reader.hh b/modules/io/src/mol/mmcif_reader.hh index c8a8b5181cd1bbd0b519ff8ccc5a66518d3384cf..6005831d807f4f73c46408e9471c4275788b7fde 100644 --- a/modules/io/src/mol/mmcif_reader.hh +++ b/modules/io/src/mol/mmcif_reader.hh @@ -53,6 +53,7 @@ namespace ost { namespace io { /// \li pdbx_struct_oper_list /// \li struct /// \li struct_conf +/// \li struct_sheet_range class DLLEXPORT_OST_IO MMCifParser : public StarParser { public: /// \brief create a MMCifParser @@ -428,16 +429,16 @@ private: /// \enum items of the struct_conf category typedef enum { - BEG_AUTH_ASYM_ID, ///< Starting residue, points to atom_site.auth_asym_id - BEG_LABEL_ASYM_ID, ///< Starting residue, points to atom_site.label_asym_id - BEG_LABEL_COMP_ID, ///< Starting residue, points to atom_site.label_comp_id - BEG_LABEL_SEQ_ID, ///< Starting residue, points to atom_site.label_seq_id - CONF_TYPE_ID, ///< Pointer to struct_conf_type.id - END_AUTH_ASYM_ID, ///< Ending residue, points to atom_site.auth_asym_id - END_LABEL_ASYM_ID, ///< Ending residue, points to atom_site.label_asym_id - END_LABEL_COMP_ID, ///< Ending residue, points to atom_site.label_comp_id - END_LABEL_SEQ_ID, ///< Ending residue, points to atom_site.label_seq_id - STRUCT_CONF_ID, ///< Unique identifier + SC_BEG_AUTH_ASYM_ID, ///< Starting residue (atom_site.auth_asym_id) + SC_BEG_LABEL_ASYM_ID, ///< Starting residue (atom_site.label_asym_id) + SC_BEG_LABEL_COMP_ID, ///< Starting residue (atom_site.label_comp_id) + SC_BEG_LABEL_SEQ_ID, ///< Starting residue (atom_site.label_seq_id) + SC_CONF_TYPE_ID, ///< Pointer to struct_conf_type.id + SC_END_AUTH_ASYM_ID, ///< Ending residue, points to atom_site.auth_asym_id + SC_END_LABEL_ASYM_ID, ///< Ending residue, points to atom_site.label_asym_id + SC_END_LABEL_COMP_ID, ///< Ending residue, points to atom_site.label_comp_id + SC_END_LABEL_SEQ_ID, ///< Ending residue, points to atom_site.label_seq_id + SC_ID, ///< Unique identifier } StructConfItems; /// \enum categories of the mmcif format @@ -454,6 +455,7 @@ private: PDBX_STRUCT_OPER_LIST, STRUCT, STRUCT_CONF, + STRUCT_SHEET_RANGE, DONT_KNOW } MMCifCategory; diff --git a/modules/io/tests/test_mmcif_reader.cc b/modules/io/tests/test_mmcif_reader.cc index 667684c6e3ce223b41287ac9807b8ef0d1177aec..621a5856d436ea3188ac386818d761b145745fce 100644 --- a/modules/io/tests/test_mmcif_reader.cc +++ b/modules/io/tests/test_mmcif_reader.cc @@ -1136,13 +1136,9 @@ BOOST_AUTO_TEST_CASE(mmcif_testreader) // pick chains, iterate residues, check for correct sec.struct. ch = eh.FindChain("A"); rl = ch.GetResidueList(); - for (rs = rl.begin(); rs != rl.end(); ++rs) { - std::cout << "Foo " << (char)rs->GetSecStructure() << std::endl; - if (rs->GetSecStructure().IsExtended()) { - std::cout << "Bar" << std::endl; - } - //BOOST_CHECK_EQUAL(rs->GetSecStructure().IsHelical()); - } + BOOST_CHECK_EQUAL(rl[0].GetSecStructure().IsHelical(), true); + BOOST_CHECK_EQUAL(rl[1].GetSecStructure().IsHelical(), true); + BOOST_CHECK_EQUAL(rl[2].GetSecStructure().IsExtended(), true); BOOST_MESSAGE(" done."); BOOST_MESSAGE(" reading data fields which should not fail...");