diff --git a/modules/io/doc/mmcif.rst b/modules/io/doc/mmcif.rst index 9c4f0d5a5bd1d7ae612ed9ca086e8b474a6ec283..0d8f0e43e7bb450778e07bcee399a90e6a6aa0bd 100644 --- a/modules/io/doc/mmcif.rst +++ b/modules/io/doc/mmcif.rst @@ -17,7 +17,7 @@ Loading mmCIF Files Categories Available ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -The following categories of a mmCIF file are considered by the parser: +The following categories of a mmCIF file are considered by the reader: * ``atom_site``: Used to build the :class:`entity <ost.mol.EntityHandle>` * ``entity``: Involved in setting ChainTypes diff --git a/modules/io/pymod/__init__.py b/modules/io/pymod/__init__.py index 87e060687a8e590f87d5b198e90199f3cf1f7bf9..143fc2fe22545ec56667ba17602310b8626bce64 100644 --- a/modules/io/pymod/__init__.py +++ b/modules/io/pymod/__init__.py @@ -324,7 +324,7 @@ def LoadMMCIF(filename, restrict_chains="", fault_tolerant=None, calpha_only=Non try: ent = mol.CreateEntity() - reader = MMCifParser(filename, ent, prof) + reader = MMCifReader(filename, ent, prof) reader.read_seqres = seqres #if reader.HasNext(): reader.Parse() diff --git a/modules/io/pymod/export_mmcif_io.cc b/modules/io/pymod/export_mmcif_io.cc index 9034c8c16fe7d8c785e5579665b9afcac1ed0a04..1262328bff906df84c2c588f69b12b097e09bbc3 100644 --- a/modules/io/pymod/export_mmcif_io.cc +++ b/modules/io/pymod/export_mmcif_io.cc @@ -30,21 +30,21 @@ using namespace ost::mol; void export_mmcif_io() { - class_<MMCifParser, boost::noncopyable>("MMCifParser", init<const String&, EntityHandle&, const IOProfile&>()) - .def("Parse", &MMCifParser::Parse) - .def("SetRestrictChains", &MMCifParser::SetRestrictChains) - .def("SetReadCanonicalSeqRes", &MMCifParser::SetReadCanonicalSeqRes) - .def("GetSeqRes", &MMCifParser::GetSeqRes) - .def("GetInfo", make_function(&MMCifParser::GetInfo, + class_<MMCifReader, boost::noncopyable>("MMCifReader", init<const String&, EntityHandle&, const IOProfile&>()) + .def("Parse", &MMCifReader::Parse) + .def("SetRestrictChains", &MMCifReader::SetRestrictChains) + .def("SetReadCanonicalSeqRes", &MMCifReader::SetReadCanonicalSeqRes) + .def("GetSeqRes", &MMCifReader::GetSeqRes) + .def("GetInfo", make_function(&MMCifReader::GetInfo, return_value_policy<copy_const_reference>())) .add_property("restrict_chains", - make_function(&MMCifParser::GetRestrictChains, + make_function(&MMCifReader::GetRestrictChains, return_value_policy<copy_const_reference>()), - &MMCifParser::SetRestrictChains) - .add_property("seqres", &MMCifParser::GetSeqRes) - .add_property("read_seqres", &MMCifParser::GetReadSeqRes, - &MMCifParser::SetReadSeqRes) - .add_property("info", make_function(&MMCifParser::GetInfo, + &MMCifReader::SetRestrictChains) + .add_property("seqres", &MMCifReader::GetSeqRes) + .add_property("read_seqres", &MMCifReader::GetReadSeqRes, + &MMCifReader::SetReadSeqRes) + .add_property("info", make_function(&MMCifReader::GetInfo, return_value_policy<copy_const_reference>())) ; diff --git a/modules/io/src/mol/entity_io_mmcif_handler.cc b/modules/io/src/mol/entity_io_mmcif_handler.cc index 4d4d99777cb45970b113f9c337f428dfce7162ad..23e9ff3c52a1fd2652b1bbf7c1b7995eac487a11 100644 --- a/modules/io/src/mol/entity_io_mmcif_handler.cc +++ b/modules/io/src/mol/entity_io_mmcif_handler.cc @@ -52,7 +52,7 @@ void EntityIOMMCIFHandler::Export(const mol::EntityView& ent, void EntityIOMMCIFHandler::Import(mol::EntityHandle& ent, std::istream& stream) { - MMCifParser reader(stream,ent, + MMCifReader reader(stream,ent, IOProfileRegistry::Instance().GetDefault()); reader.Parse(); } @@ -66,7 +66,7 @@ void EntityIOMMCIFHandler::Import(mol::EntityHandle& ent, const boost::filesystem::path& loc) { std::string filename=loc.string(); - MMCifParser reader(filename, ent, + MMCifReader reader(filename, ent, IOProfileRegistry::Instance().GetDefault()); reader.Parse(); } diff --git a/modules/io/src/mol/mmcif_reader.cc b/modules/io/src/mol/mmcif_reader.cc index 68f971177e315727ce7edc79100d245cd2ed35f7..1e48f28d32585e3720cfec6ebb33faf3a94b34f2 100644 --- a/modules/io/src/mol/mmcif_reader.cc +++ b/modules/io/src/mol/mmcif_reader.cc @@ -30,21 +30,21 @@ namespace ost { namespace io { -MMCifParser::MMCifParser(std::istream& stream, mol::EntityHandle& ent_handle, +MMCifReader::MMCifReader(std::istream& stream, mol::EntityHandle& ent_handle, const IOProfile& profile): StarParser(stream, true), profile_(profile), ent_handle_(ent_handle) { this->Init(); } -MMCifParser::MMCifParser(const String& filename, mol::EntityHandle& ent_handle, +MMCifReader::MMCifReader(const String& filename, mol::EntityHandle& ent_handle, const IOProfile& profile): StarParser(filename, true), profile_(profile), ent_handle_(ent_handle) { this->Init(); } -void MMCifParser::Init() +void MMCifReader::Init() { warned_name_mismatch_ = false; category_ = DONT_KNOW; @@ -65,7 +65,7 @@ void MMCifParser::Init() info_ = MMCifInfo(); } -void MMCifParser::ClearState() +void MMCifReader::ClearState() { curr_chain_ = mol::ChainHandle(); curr_residue_ = mol::ResidueHandle(); @@ -84,12 +84,12 @@ void MMCifParser::ClearState() strand_list_.clear(); } -void MMCifParser::SetRestrictChains(const String& restrict_chains) +void MMCifReader::SetRestrictChains(const String& restrict_chains) { restrict_chains_ = restrict_chains; } -bool MMCifParser::IsValidPDBIdent(const StringRef& pdbid) +bool MMCifReader::IsValidPDBIdent(const StringRef& pdbid) { if (pdbid.length() == PDBID_LEN && isdigit(pdbid[0])) { return true; @@ -97,7 +97,7 @@ bool MMCifParser::IsValidPDBIdent(const StringRef& pdbid) return false; } -bool MMCifParser::OnBeginData(const StringRef& data_name) +bool MMCifReader::OnBeginData(const StringRef& data_name) { LOG_DEBUG("MCIFFReader: " << profile_); Profile profile_import("MMCifReader::OnBeginData"); @@ -115,7 +115,7 @@ bool MMCifParser::OnBeginData(const StringRef& data_name) return true; } -bool MMCifParser::OnBeginLoop(const StarLoopDesc& header) +bool MMCifReader::OnBeginLoop(const StarLoopDesc& header) { bool cat_available = false; category_ = DONT_KNOW; @@ -302,7 +302,7 @@ mol::ResNum to_res_num(int num, char ins_code) return mol::ResNum(num, ins_code==' ' ? '\0' : ins_code); } -bool MMCifParser::ParseAtomIdent(const std::vector<StringRef>& columns, +bool MMCifReader::ParseAtomIdent(const std::vector<StringRef>& columns, String& chain_name, StringRef& res_name, mol::ResNum& resnum, @@ -355,7 +355,7 @@ bool MMCifParser::ParseAtomIdent(const std::vector<StringRef>& columns, return true; } -void MMCifParser::ParseAndAddAtom(const std::vector<StringRef>& columns) +void MMCifReader::ParseAndAddAtom(const std::vector<StringRef>& columns) { mol::XCSEditor editor=ent_handle_.EditXCS(mol::BUFFERED_EDIT); // potbl char alt_loc=0; @@ -560,7 +560,7 @@ void MMCifParser::ParseAndAddAtom(const std::vector<StringRef>& columns) } -void MMCifParser::ParseEntity(const std::vector<StringRef>& columns) +void MMCifReader::ParseEntity(const std::vector<StringRef>& columns) { bool store = false; // is it worth storing this record? MMCifEntityDesc desc; @@ -587,7 +587,7 @@ void MMCifParser::ParseEntity(const std::vector<StringRef>& columns) } } -void MMCifParser::ParseEntityPoly(const std::vector<StringRef>& columns) +void MMCifReader::ParseEntityPoly(const std::vector<StringRef>& columns) { // we assume that the entity cat. ALWAYS comes before the entity_poly cat. // search entity @@ -650,7 +650,7 @@ void MMCifParser::ParseEntityPoly(const std::vector<StringRef>& columns) } } -String MMCifParser::ConvertSEQRES(const String& seqres, +String MMCifReader::ConvertSEQRES(const String& seqres, conop::CompoundLibPtr comp_lib) { String can_seqres; @@ -695,7 +695,7 @@ String MMCifParser::ConvertSEQRES(const String& seqres, return can_seqres; } -void MMCifParser::ParseCitation(const std::vector<StringRef>& columns) +void MMCifReader::ParseCitation(const std::vector<StringRef>& columns) { // create citation object MMCifInfoCitation cit = MMCifInfoCitation(); @@ -756,7 +756,7 @@ void MMCifParser::ParseCitation(const std::vector<StringRef>& columns) info_.AddCitation(cit); } -void MMCifParser::ParseCitationAuthor(const std::vector<StringRef>& columns) +void MMCifReader::ParseCitationAuthor(const std::vector<StringRef>& columns) { // get/ pack values MMCifCitationAuthorMap::iterator atm_it; @@ -806,12 +806,12 @@ void MMCifParser::ParseCitationAuthor(const std::vector<StringRef>& columns) } } -void MMCifParser::ParseExptl(const std::vector<StringRef>& columns) +void MMCifReader::ParseExptl(const std::vector<StringRef>& columns) { info_.SetMethod(columns[indices_[METHOD]].str()); } -void MMCifParser::ParseRefine(const std::vector<StringRef>& columns) +void MMCifReader::ParseRefine(const std::vector<StringRef>& columns) { StringRef col=columns[indices_[LS_D_RES_HIGH]]; if (col.size()!=1 || (col[0]!='?' && col[0]!='.')) { @@ -820,7 +820,7 @@ void MMCifParser::ParseRefine(const std::vector<StringRef>& columns) } } -void MMCifParser::ParsePdbxStructAssembly(const std::vector<StringRef>& columns) +void MMCifReader::ParsePdbxStructAssembly(const std::vector<StringRef>& columns) { if (indices_[PSA_DETAILS] != -1) { bu_origin_map_.insert(std::pair<String, @@ -833,7 +833,7 @@ void MMCifParser::ParsePdbxStructAssembly(const std::vector<StringRef>& columns) } } -void MMCifParser::StoreExpression(const char* l, const char* s, +void MMCifReader::StoreExpression(const char* l, const char* s, bool& is_range, int lborder, std::vector<String>& single_block) { @@ -855,7 +855,7 @@ void MMCifParser::StoreExpression(const char* l, const char* s, } } -void MMCifParser::StoreRange(const char*& l, const char* s, bool& is_range, +void MMCifReader::StoreRange(const char*& l, const char* s, bool& is_range, int& lborder, std::vector<String>& single_block) { if (is_range) { @@ -872,7 +872,7 @@ void MMCifParser::StoreRange(const char*& l, const char* s, bool& is_range, l = s+1; } -std::vector<std::vector<String> > MMCifParser::UnPackOperExperession(StringRef expression) +std::vector<std::vector<String> > MMCifReader::UnPackOperExperession(StringRef expression) { std::vector<std::vector<String> > unpacked; std::vector<String> single_block; @@ -929,7 +929,7 @@ std::vector<std::vector<String> > MMCifParser::UnPackOperExperession(StringRef e return unpacked; } -void MMCifParser::ParsePdbxStructAssemblyGen(const std::vector<StringRef>& columns) +void MMCifReader::ParsePdbxStructAssemblyGen(const std::vector<StringRef>& columns) { MMCifBioUAssembly assembly; assembly.biounit = MMCifInfoBioUnit(); @@ -948,7 +948,7 @@ void MMCifParser::ParsePdbxStructAssemblyGen(const std::vector<StringRef>& colum bu_assemblies_.push_back(assembly); } -void MMCifParser::ParsePdbxStructOperList(const std::vector<StringRef>& columns) +void MMCifReader::ParsePdbxStructOperList(const std::vector<StringRef>& columns) { MMCifInfoTransOpPtr op(new MMCifInfoTransOp); @@ -998,7 +998,7 @@ void MMCifParser::ParsePdbxStructOperList(const std::vector<StringRef>& columns) info_.AddOperation(op); } -void MMCifParser::ParseStruct(const std::vector<StringRef>& columns) +void MMCifReader::ParseStruct(const std::vector<StringRef>& columns) { MMCifInfoStructDetails details = MMCifInfoStructDetails(); @@ -1040,7 +1040,7 @@ void MMCifParser::ParseStruct(const std::vector<StringRef>& columns) info_.SetStructDetails(details); } -MMCifParser::MMCifSecStructElement MMCifParser::DetermineSecStructType( +MMCifReader::MMCifSecStructElement MMCifReader::DetermineSecStructType( const StringRef& type) const { if (type == StringRef("HELX_P", 6)) { @@ -1172,7 +1172,7 @@ MMCifParser::MMCifSecStructElement MMCifParser::DetermineSecStructType( this->GetCurrentLinenum())); } -void MMCifParser::ParseStructConf(const std::vector<StringRef>& columns) +void MMCifReader::ParseStructConf(const std::vector<StringRef>& columns) { StringRef chain_name; int s_res_num; @@ -1212,7 +1212,7 @@ void MMCifParser::ParseStructConf(const std::vector<StringRef>& columns) } } -void MMCifParser::ParseStructSheetRange(const std::vector<StringRef>& columns) +void MMCifReader::ParseStructSheetRange(const std::vector<StringRef>& columns) { StringRef chain_name; int s_res_num; @@ -1247,7 +1247,7 @@ void MMCifParser::ParseStructSheetRange(const std::vector<StringRef>& columns) } } -void MMCifParser::OnDataRow(const StarLoopDesc& header, +void MMCifReader::OnDataRow(const StarLoopDesc& header, const std::vector<StringRef>& columns) { switch(category_) { @@ -1311,7 +1311,7 @@ void MMCifParser::OnDataRow(const StarLoopDesc& header, } } -void MMCifParser::AssignSecStructure(mol::EntityHandle ent) +void MMCifReader::AssignSecStructure(mol::EntityHandle ent) { for (MMCifHSVector::const_iterator i=helix_list_.begin(), e=helix_list_.end(); i!=e; ++i) { @@ -1354,7 +1354,7 @@ void MMCifParser::AssignSecStructure(mol::EntityHandle ent) } } -void MMCifParser::OnEndData() +void MMCifReader::OnEndData() { mol::XCSEditor editor=ent_handle_.EditXCS(mol::BUFFERED_EDIT); diff --git a/modules/io/src/mol/mmcif_reader.hh b/modules/io/src/mol/mmcif_reader.hh index 3f6f974c26c6e6b68966597be5c1d1be7cc96de1..130da8ea93f23fbd1f801d021ad07f620e113fdf 100644 --- a/modules/io/src/mol/mmcif_reader.hh +++ b/modules/io/src/mol/mmcif_reader.hh @@ -16,8 +16,8 @@ // along with this library; if not, write to the Free Software Foundation, Inc., // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA //------------------------------------------------------------------------------ -#ifndef OST_MMCIF_PARSER_HH -#define OST_MMCIF_PARSER_HH +#ifndef OST_MMCIF_READER_HH +#define OST_MMCIF_READER_HH #include <map> @@ -39,7 +39,7 @@ namespace ost { namespace io { /// /// mmcif is an instance of the \link StarParser STAR format\endlink to store /// entries of the PDB. The following data categories should be covered by this -/// parser: +/// reader: /// /// \li atom_site /// \li entity @@ -54,21 +54,21 @@ namespace ost { namespace io { /// \li struct /// \li struct_conf /// \li struct_sheet_range -class DLLEXPORT_OST_IO MMCifParser : public StarParser { +class DLLEXPORT_OST_IO MMCifReader : public StarParser { public: - /// \brief create a MMCifParser + /// \brief create a MMCifReader /// /// \param stream input stream - MMCifParser(std::istream& stream, mol::EntityHandle& ent_handle, + MMCifReader(std::istream& stream, mol::EntityHandle& ent_handle, const IOProfile& profile); - /// \brief create a MMCifParser + /// \brief create a MMCifReader /// /// \param filename input file - MMCifParser(const String& filename, mol::EntityHandle& ent_handle, + MMCifReader(const String& filename, mol::EntityHandle& ent_handle, const IOProfile& profile); - /// \brief Initialise the parser. + /// \brief Initialise the reader. /// /// \param loc Location of the file void Init(); @@ -76,7 +76,7 @@ public: /// \brief Set up a fresh instance void ClearState(); - /// \brief Set names of restricted chains for the parser. + /// \brief Set names of restricted chains for the reader. /// /// \param restrict_chains chain name void SetRestrictChains(const String& restrict_chains); @@ -328,7 +328,7 @@ private: AUTH_SEQ_ID, ///< residue no. by author TYPE_SYMBOL, ///< chemical element CARTN_X, ///< Coordinates ||IMPORTANT: This 3 entries have to stay - CARTN_Y, ///< Coordinates ||together for the parser to work! + CARTN_Y, ///< Coordinates ||together for the reader to work! CARTN_Z, ///< Coordinates || OCCUPANCY, B_ISO_OR_EQUIV, diff --git a/modules/io/tests/test_mmcif_reader.cc b/modules/io/tests/test_mmcif_reader.cc index 2c1fcfee333719a3a922059ad186c60b42066014..be7e35400e2ee43b8811cfb79a7731ef544aceec 100644 --- a/modules/io/tests/test_mmcif_reader.cc +++ b/modules/io/tests/test_mmcif_reader.cc @@ -31,50 +31,50 @@ using namespace ost; using namespace ost::io; -class TestMMCifParserProtected : MMCifParser { +class TestMMCifReaderProtected : MMCifReader { public: - TestMMCifParserProtected(std::istream& stream, mol::EntityHandle& ent_handle): - MMCifParser(stream, ent_handle, IOProfile()) + TestMMCifReaderProtected(std::istream& stream, mol::EntityHandle& ent_handle): + MMCifReader(stream, ent_handle, IOProfile()) { } - TestMMCifParserProtected(std::istream& stream, mol::EntityHandle& ent_handle, + TestMMCifReaderProtected(std::istream& stream, mol::EntityHandle& ent_handle, const IOProfile& profile): - MMCifParser(stream, ent_handle, profile) + MMCifReader(stream, ent_handle, profile) { } - TestMMCifParserProtected(const String& filename, + TestMMCifReaderProtected(const String& filename, mol::EntityHandle& ent_handle): - MMCifParser(filename, ent_handle, IOProfile()) + MMCifReader(filename, ent_handle, IOProfile()) { } - using MMCifParser::OnBeginLoop; - using MMCifParser::OnEndData; - using MMCifParser::IsValidPDBIdent; - using MMCifParser::ParseAtomIdent; - using MMCifParser::ParseAndAddAtom; - using MMCifParser::ParseEntity; - using MMCifParser::ParseEntityPoly; - using MMCifParser::ParseCitation; - using MMCifParser::ParseRefine; - using MMCifParser::ParsePdbxStructAssemblyGen; - using MMCifParser::ParsePdbxStructAssembly; - using MMCifParser::ParsePdbxStructOperList; - using MMCifParser::ParseStruct; - using MMCifParser::ParseStructConf; - using MMCifParser::ParseStructSheetRange; - using MMCifParser::TryStoreIdx; - using MMCifParser::SetRestrictChains; - using MMCifParser::SetReadSeqRes; - using MMCifParser::SetReadCanonicalSeqRes; - using MMCifParser::ClearState; - using MMCifParser::ConvertSEQRES; - using MMCifParser::GetInfo; - using MMCifParser::DetermineSecStructType; - using MMCifParser::MMCifSecStructElement; - using MMCifParser::MMCIF_HELIX; - using MMCifParser::MMCIF_TURN; - using MMCifParser::MMCIF_STRAND; - using MMCifParser::SetAuthChainID; + using MMCifReader::OnBeginLoop; + using MMCifReader::OnEndData; + using MMCifReader::IsValidPDBIdent; + using MMCifReader::ParseAtomIdent; + using MMCifReader::ParseAndAddAtom; + using MMCifReader::ParseEntity; + using MMCifReader::ParseEntityPoly; + using MMCifReader::ParseCitation; + using MMCifReader::ParseRefine; + using MMCifReader::ParsePdbxStructAssemblyGen; + using MMCifReader::ParsePdbxStructAssembly; + using MMCifReader::ParsePdbxStructOperList; + using MMCifReader::ParseStruct; + using MMCifReader::ParseStructConf; + using MMCifReader::ParseStructSheetRange; + using MMCifReader::TryStoreIdx; + using MMCifReader::SetRestrictChains; + using MMCifReader::SetReadSeqRes; + using MMCifReader::SetReadCanonicalSeqRes; + using MMCifReader::ClearState; + using MMCifReader::ConvertSEQRES; + using MMCifReader::GetInfo; + using MMCifReader::DetermineSecStructType; + using MMCifReader::MMCifSecStructElement; + using MMCifReader::MMCIF_HELIX; + using MMCifReader::MMCIF_TURN; + using MMCifReader::MMCIF_STRAND; + using MMCifReader::SetAuthChainID; }; void SetAtomSiteHeader(StarLoopDesc* mmcif_h) @@ -104,7 +104,7 @@ BOOST_AUTO_TEST_CASE(mmcif_isvalidpdbident) // on changing the tests for a PDB id in mmcif files, extend this unit test BOOST_MESSAGE(" Running mmcif_isvalidpdbident tests..."); std::ifstream s("testfiles/mmcif/atom_site.mmcif"); - TestMMCifParserProtected tmmcif_p(s, eh); + TestMMCifReaderProtected tmmcif_p(s, eh); StringRef id = StringRef("1FOO", 4); BOOST_MESSAGE(" Testing valid id ('"+ id.str() +"')..."); BOOST_CHECK(tmmcif_p.IsValidPDBIdent(id)); @@ -125,7 +125,7 @@ BOOST_AUTO_TEST_CASE(mmcif_trystoreidx) BOOST_MESSAGE(" Running mmcif_trystoreidx tests..."); std::ifstream s("testfiles/mmcif/atom_site.mmcif"); - TestMMCifParserProtected tmmcif_p(s, eh, IOProfile()); + TestMMCifReaderProtected tmmcif_p(s, eh, IOProfile()); StarLoopDesc mmcif_h; mmcif_h.SetCategory(StringRef("Foo", 3)); // negative @@ -150,7 +150,7 @@ BOOST_AUTO_TEST_CASE(mmcif_convert_seqres) conop::Conopology::Instance().SetDefaultBuilder("RBB"); mol::EntityHandle eh=mol::CreateEntity(); - TestMMCifParserProtected tmmcif_p("testfiles/mmcif/atom_site.mmcif", eh); + TestMMCifReaderProtected tmmcif_p("testfiles/mmcif/atom_site.mmcif", eh); std::vector<StringRef> columns; StarLoopDesc tmmcif_h; BOOST_CHECK_EQUAL(tmmcif_p.ConvertSEQRES("A(MSE)Y", compound_lib), "AMY"); @@ -166,7 +166,7 @@ BOOST_AUTO_TEST_CASE(mmcif_onbeginloop) // add more tests on new mandatory items BOOST_MESSAGE(" Running mmcif_onbeginloop tests..."); std::ifstream s("testfiles/mmcif/atom_site.mmcif"); - MMCifParser mmcif_p(s, eh, IOProfile()); + MMCifReader mmcif_p(s, eh, IOProfile()); StarLoopDesc mmcif_h; BOOST_MESSAGE(" testing atom_site items..."); mmcif_h.SetCategory(StringRef("atom_site", 9)); @@ -228,7 +228,7 @@ BOOST_AUTO_TEST_CASE(mmcif_parse_models) BOOST_MESSAGE(" true positive test for models..."); { mol::EntityHandle eh = mol::CreateEntity(); - MMCifParser mmcif_p("testfiles/mmcif/model_truepos.mmcif", eh, profile); + MMCifReader mmcif_p("testfiles/mmcif/model_truepos.mmcif", eh, profile); BOOST_CHECK_NO_THROW(mmcif_p.Parse()); BOOST_REQUIRE_EQUAL(eh.GetChainCount(), 2); BOOST_REQUIRE_EQUAL(eh.GetResidueCount(), 2); @@ -240,7 +240,7 @@ BOOST_AUTO_TEST_CASE(mmcif_parse_models) BOOST_MESSAGE(" test absent atom_site.pdbx_PDB_model_num entry..."); { mol::EntityHandle eh = mol::CreateEntity(); - MMCifParser mmcif_p("testfiles/mmcif/atom_site.mmcif", eh, profile); + MMCifReader mmcif_p("testfiles/mmcif/atom_site.mmcif", eh, profile); BOOST_CHECK_NO_THROW(mmcif_p.Parse()); } BOOST_MESSAGE(" done."); @@ -248,13 +248,13 @@ BOOST_AUTO_TEST_CASE(mmcif_parse_models) BOOST_MESSAGE(" testing more than one atom_site block..."); { mol::EntityHandle eh = mol::CreateEntity(); - MMCifParser mmcif_p("testfiles/mmcif/model_multi_atom_site.mmcif", eh, + MMCifReader mmcif_p("testfiles/mmcif/model_multi_atom_site.mmcif", eh, profile); BOOST_CHECK_THROW(mmcif_p.Parse(), IOException); } { mol::EntityHandle eh = mol::CreateEntity(); - MMCifParser mmcif_p("testfiles/mmcif/model_multi_atom_site_inverted.mmcif", + MMCifReader mmcif_p("testfiles/mmcif/model_multi_atom_site_inverted.mmcif", eh, profile); BOOST_CHECK_THROW(mmcif_p.Parse(), IOException); } @@ -265,7 +265,7 @@ BOOST_AUTO_TEST_CASE(mmcif_parse_models) // build dummy header mol::EntityHandle eh = mol::CreateEntity(); StarLoopDesc tmmcif_h; - TestMMCifParserProtected tmmcif_p("testfiles/mmcif/atom_site.mmcif", eh); + TestMMCifReaderProtected tmmcif_p("testfiles/mmcif/atom_site.mmcif", eh); SetAtomSiteHeader(&tmmcif_h); tmmcif_p.OnBeginLoop(tmmcif_h); tmmcif_h.Add(StringRef("pdbx_PDB_model_num", 18)); @@ -285,7 +285,7 @@ BOOST_AUTO_TEST_CASE(mmcif_changing_label_entity_id) BOOST_MESSAGE(" true positive test..."); { mol::EntityHandle eh = mol::CreateEntity(); - MMCifParser mmcif_p("testfiles/mmcif/atom_site.mmcif", eh, profile); + MMCifReader mmcif_p("testfiles/mmcif/atom_site.mmcif", eh, profile); BOOST_CHECK_NO_THROW(mmcif_p.Parse()); } BOOST_MESSAGE(" done."); @@ -294,7 +294,7 @@ BOOST_AUTO_TEST_CASE(mmcif_changing_label_entity_id) BOOST_MESSAGE(" true negative test..."); { mol::EntityHandle eh = mol::CreateEntity(); - MMCifParser mmcif_p("testfiles/mmcif/changing_label_entity_id.mmcif", eh, + MMCifReader mmcif_p("testfiles/mmcif/changing_label_entity_id.mmcif", eh, profile); BOOST_CHECK_THROW(mmcif_p.Parse(), IOException); } @@ -309,7 +309,7 @@ BOOST_AUTO_TEST_CASE(mmcif_unknown_entity_type) mol::EntityHandle eh = mol::CreateEntity(); std::vector<StringRef> columns; - TestMMCifParserProtected tmmcif_p("testfiles/mmcif/atom_site.mmcif", eh); + TestMMCifReaderProtected tmmcif_p("testfiles/mmcif/atom_site.mmcif", eh); StarLoopDesc tmmcif_h; // build dummy header @@ -352,7 +352,7 @@ BOOST_AUTO_TEST_CASE(mmcif_entity_tests) BOOST_MESSAGE(" fetching chain type..."); { mol::EntityHandle eh = mol::CreateEntity(); - MMCifParser mmcif_p("testfiles/mmcif/atom_site.mmcif", eh, profile); + MMCifReader mmcif_p("testfiles/mmcif/atom_site.mmcif", eh, profile); mmcif_p.Parse(); ch = eh.FindChain("A"); BOOST_CHECK(ch.IsValid()); @@ -369,7 +369,7 @@ BOOST_AUTO_TEST_CASE(mmcif_entity_tests) BOOST_MESSAGE(" check missing entity description..."); { mol::EntityHandle eh = mol::CreateEntity(); - MMCifParser mmcif_p("testfiles/mmcif/model_truepos.mmcif", + MMCifReader mmcif_p("testfiles/mmcif/model_truepos.mmcif", eh, profile); mmcif_p.Parse(); @@ -384,7 +384,7 @@ BOOST_AUTO_TEST_CASE(mmcif_entity_tests) BOOST_MESSAGE(" fetch details..."); { mol::EntityHandle eh = mol::CreateEntity(); - MMCifParser mmcif_p("testfiles/mmcif/atom_site.mmcif", eh, profile); + MMCifReader mmcif_p("testfiles/mmcif/atom_site.mmcif", eh, profile); mmcif_p.Parse(); ch = eh.FindChain("A"); BOOST_CHECK(ch.IsValid()); @@ -404,7 +404,7 @@ BOOST_AUTO_TEST_CASE(mmcif_entity_poly_tests) StarLoopDesc tmmcif_h; mol::EntityHandle eh = mol::CreateEntity(); - MMCifParser mmcif_p("testfiles/mmcif/atom_site.mmcif", eh, profile); + MMCifReader mmcif_p("testfiles/mmcif/atom_site.mmcif", eh, profile); mmcif_p.SetReadSeqRes(true); mmcif_p.Parse(); @@ -417,7 +417,7 @@ BOOST_AUTO_TEST_CASE(mmcif_entity_poly_tests) { mol::EntityHandle eh = mol::CreateEntity(); std::vector<StringRef> columns; - TestMMCifParserProtected tmmcif_p("testfiles/mmcif/atom_site.mmcif", eh); + TestMMCifReaderProtected tmmcif_p("testfiles/mmcif/atom_site.mmcif", eh); tmmcif_h.SetCategory(StringRef("entity_poly", 11)); tmmcif_h.Add(StringRef("entity_id", 9)); @@ -429,7 +429,7 @@ BOOST_AUTO_TEST_CASE(mmcif_entity_poly_tests) BOOST_MESSAGE(" done."); BOOST_MESSAGE(" testing type recognition..."); { - TestMMCifParserProtected tmmcif_p("testfiles/mmcif/atom_site.mmcif", eh); + TestMMCifReaderProtected tmmcif_p("testfiles/mmcif/atom_site.mmcif", eh); std::vector<StringRef> columns; // create corresponding entity entry @@ -485,7 +485,7 @@ columns.push_back(StringRef("polydeoxyribonucleotide/polyribonucleotide hybrid", BOOST_MESSAGE(" done."); BOOST_MESSAGE(" testing pdbx_seq_one_letter_code reading..."); { - TestMMCifParserProtected tmmcif_p("testfiles/mmcif/atom_site.mmcif", eh); + TestMMCifReaderProtected tmmcif_p("testfiles/mmcif/atom_site.mmcif", eh); std::vector<StringRef> columns; tmmcif_h.Clear(); @@ -519,7 +519,7 @@ columns.push_back(StringRef("polydeoxyribonucleotide/polyribonucleotide hybrid", BOOST_MESSAGE(" done."); BOOST_MESSAGE(" testing pdbx_seq_one_letter_code_can reading..."); { - TestMMCifParserProtected tmmcif_p("testfiles/mmcif/atom_site.mmcif", eh); + TestMMCifReaderProtected tmmcif_p("testfiles/mmcif/atom_site.mmcif", eh); std::vector<StringRef> columns; tmmcif_h.Clear(); @@ -560,7 +560,7 @@ BOOST_AUTO_TEST_CASE(mmcif_citation_tests) BOOST_MESSAGE(" Running mmcif_citation_tests..."); //build dummy citation mol::EntityHandle eh; - TestMMCifParserProtected tmmcif_p("testfiles/mmcif/atom_site.mmcif", eh); + TestMMCifReaderProtected tmmcif_p("testfiles/mmcif/atom_site.mmcif", eh); StarLoopDesc tmmcif_h; std::vector<StringRef> columns; @@ -600,7 +600,7 @@ BOOST_AUTO_TEST_CASE(mmcif_citation_author_tests) mol::EntityHandle eh = mol::CreateEntity(); std::ifstream s("testfiles/mmcif/atom_site.mmcif"); IOProfile profile; - MMCifParser mmcif_p(s, eh, profile); + MMCifReader mmcif_p(s, eh, profile); BOOST_CHECK_NO_THROW(mmcif_p.Parse()); std::vector<String> authors = @@ -622,7 +622,7 @@ BOOST_AUTO_TEST_CASE(mmcif_refine_tests) mol::EntityHandle eh = mol::CreateEntity(); std::ifstream s("testfiles/mmcif/atom_site.mmcif"); IOProfile profile; - MMCifParser mmcif_p(s, eh, profile); + MMCifReader mmcif_p(s, eh, profile); BOOST_CHECK_NO_THROW(mmcif_p.Parse()); BOOST_CHECK_CLOSE(mmcif_p.GetInfo().GetResolution(), 2.0f, 0.001f); } @@ -630,7 +630,7 @@ BOOST_AUTO_TEST_CASE(mmcif_refine_tests) BOOST_MESSAGE(" capturing fishy data lines..."); { mol::EntityHandle eh; - TestMMCifParserProtected tmmcif_p("testfiles/mmcif/atom_site.mmcif", eh); + TestMMCifReaderProtected tmmcif_p("testfiles/mmcif/atom_site.mmcif", eh); StarLoopDesc tmmcif_h; std::vector<StringRef> columns; @@ -655,7 +655,7 @@ BOOST_AUTO_TEST_CASE(mmcif_biounit_tests) BOOST_MESSAGE(" Running mmcif_biounit_tests..."); //build dummy biounit mol::EntityHandle eh = mol::CreateEntity(); - TestMMCifParserProtected tmmcif_p("testfiles/mmcif/atom_site.mmcif", eh); + TestMMCifReaderProtected tmmcif_p("testfiles/mmcif/atom_site.mmcif", eh); StarLoopDesc tmmcif_h; std::vector<StringRef> columns; @@ -774,7 +774,7 @@ BOOST_AUTO_TEST_CASE(mmcif_struct_tests) BOOST_MESSAGE(" Running mmcif_struct_tests..."); mol::EntityHandle eh = mol::CreateEntity(); - TestMMCifParserProtected tmmcif_p("testfiles/mmcif/atom_site.mmcif", eh); + TestMMCifReaderProtected tmmcif_p("testfiles/mmcif/atom_site.mmcif", eh); StarLoopDesc tmmcif_h; std::vector<StringRef> columns; @@ -811,132 +811,132 @@ BOOST_AUTO_TEST_CASE(mmcif_struct_conf_tests) { BOOST_MESSAGE(" Running mmcif_struct_conf_tests..."); mol::EntityHandle eh = mol::CreateEntity(); - TestMMCifParserProtected tmmcif_p("testfiles/mmcif/atom_site.mmcif", eh); + TestMMCifReaderProtected tmmcif_p("testfiles/mmcif/atom_site.mmcif", eh); BOOST_MESSAGE(" testing type validation"); StringRef type = StringRef("HELX_P", 6); BOOST_CHECK(tmmcif_p.DetermineSecStructType(type) == - TestMMCifParserProtected::MMCIF_HELIX); + TestMMCifReaderProtected::MMCIF_HELIX); type = StringRef("HELX_OT_P", 9); BOOST_CHECK(tmmcif_p.DetermineSecStructType(type) == - TestMMCifParserProtected::MMCIF_HELIX); + TestMMCifReaderProtected::MMCIF_HELIX); type = StringRef("HELX_RH_P", 9); BOOST_CHECK(tmmcif_p.DetermineSecStructType(type) == - TestMMCifParserProtected::MMCIF_HELIX); + TestMMCifReaderProtected::MMCIF_HELIX); type = StringRef("HELX_RH_OT_P", 12); BOOST_CHECK(tmmcif_p.DetermineSecStructType(type) == - TestMMCifParserProtected::MMCIF_HELIX); + TestMMCifReaderProtected::MMCIF_HELIX); type = StringRef("HELX_RH_AL_P", 12); BOOST_CHECK(tmmcif_p.DetermineSecStructType(type) == - TestMMCifParserProtected::MMCIF_HELIX); + TestMMCifReaderProtected::MMCIF_HELIX); type = StringRef("HELX_RH_GA_P", 12); BOOST_CHECK(tmmcif_p.DetermineSecStructType(type) == - TestMMCifParserProtected::MMCIF_HELIX); + TestMMCifReaderProtected::MMCIF_HELIX); type = StringRef("HELX_RH_OM_P", 12); BOOST_CHECK(tmmcif_p.DetermineSecStructType(type) == - TestMMCifParserProtected::MMCIF_HELIX); + TestMMCifReaderProtected::MMCIF_HELIX); type = StringRef("HELX_RH_PI_P", 12); BOOST_CHECK(tmmcif_p.DetermineSecStructType(type) == - TestMMCifParserProtected::MMCIF_HELIX); + TestMMCifReaderProtected::MMCIF_HELIX); type = StringRef("HELX_RH_27_P", 12); BOOST_CHECK(tmmcif_p.DetermineSecStructType(type) == - TestMMCifParserProtected::MMCIF_HELIX); + TestMMCifReaderProtected::MMCIF_HELIX); type = StringRef("HELX_RH_3T_P", 12); BOOST_CHECK(tmmcif_p.DetermineSecStructType(type) == - TestMMCifParserProtected::MMCIF_HELIX); + TestMMCifReaderProtected::MMCIF_HELIX); type = StringRef("HELX_RH_PP_P", 12); BOOST_CHECK(tmmcif_p.DetermineSecStructType(type) == - TestMMCifParserProtected::MMCIF_HELIX); + TestMMCifReaderProtected::MMCIF_HELIX); type = StringRef("HELX_LH_P", 9); BOOST_CHECK(tmmcif_p.DetermineSecStructType(type) == - TestMMCifParserProtected::MMCIF_HELIX); + TestMMCifReaderProtected::MMCIF_HELIX); type = StringRef("HELX_LH_OT_P", 12); BOOST_CHECK(tmmcif_p.DetermineSecStructType(type) == - TestMMCifParserProtected::MMCIF_HELIX); + TestMMCifReaderProtected::MMCIF_HELIX); type = StringRef("HELX_LH_AL_P", 12); BOOST_CHECK(tmmcif_p.DetermineSecStructType(type) == - TestMMCifParserProtected::MMCIF_HELIX); + TestMMCifReaderProtected::MMCIF_HELIX); type = StringRef("HELX_LH_GA_P", 12); BOOST_CHECK(tmmcif_p.DetermineSecStructType(type) == - TestMMCifParserProtected::MMCIF_HELIX); + TestMMCifReaderProtected::MMCIF_HELIX); type = StringRef("HELX_LH_OM_P", 12); BOOST_CHECK(tmmcif_p.DetermineSecStructType(type) == - TestMMCifParserProtected::MMCIF_HELIX); + TestMMCifReaderProtected::MMCIF_HELIX); type = StringRef("HELX_LH_PI_P", 12); BOOST_CHECK(tmmcif_p.DetermineSecStructType(type) == - TestMMCifParserProtected::MMCIF_HELIX); + TestMMCifReaderProtected::MMCIF_HELIX); type = StringRef("HELX_LH_27_P", 12); BOOST_CHECK(tmmcif_p.DetermineSecStructType(type) == - TestMMCifParserProtected::MMCIF_HELIX); + TestMMCifReaderProtected::MMCIF_HELIX); type = StringRef("HELX_LH_3T_P", 12); BOOST_CHECK(tmmcif_p.DetermineSecStructType(type) == - TestMMCifParserProtected::MMCIF_HELIX); + TestMMCifReaderProtected::MMCIF_HELIX); type = StringRef("HELX_LH_PP_P", 12); BOOST_CHECK(tmmcif_p.DetermineSecStructType(type) == - TestMMCifParserProtected::MMCIF_HELIX); + TestMMCifReaderProtected::MMCIF_HELIX); type = StringRef("HELX_N", 6); BOOST_CHECK(tmmcif_p.DetermineSecStructType(type) == - TestMMCifParserProtected::MMCIF_HELIX); + TestMMCifReaderProtected::MMCIF_HELIX); type = StringRef("HELX_OT_N", 9); BOOST_CHECK(tmmcif_p.DetermineSecStructType(type) == - TestMMCifParserProtected::MMCIF_HELIX); + TestMMCifReaderProtected::MMCIF_HELIX); type = StringRef("HELX_RH_N", 9); BOOST_CHECK(tmmcif_p.DetermineSecStructType(type) == - TestMMCifParserProtected::MMCIF_HELIX); + TestMMCifReaderProtected::MMCIF_HELIX); type = StringRef("HELX_RH_OT_N", 12); BOOST_CHECK(tmmcif_p.DetermineSecStructType(type) == - TestMMCifParserProtected::MMCIF_HELIX); + TestMMCifReaderProtected::MMCIF_HELIX); type = StringRef("HELX_RH_A_N", 11); BOOST_CHECK(tmmcif_p.DetermineSecStructType(type) == - TestMMCifParserProtected::MMCIF_HELIX); + TestMMCifReaderProtected::MMCIF_HELIX); type = StringRef("HELX_RH_B_N", 11); BOOST_CHECK(tmmcif_p.DetermineSecStructType(type) == - TestMMCifParserProtected::MMCIF_HELIX); + TestMMCifReaderProtected::MMCIF_HELIX); type = StringRef("HELX_RH_Z_N", 11); BOOST_CHECK(tmmcif_p.DetermineSecStructType(type) == - TestMMCifParserProtected::MMCIF_HELIX); + TestMMCifReaderProtected::MMCIF_HELIX); type = StringRef("HELX_LH_N", 9); BOOST_CHECK(tmmcif_p.DetermineSecStructType(type) == - TestMMCifParserProtected::MMCIF_HELIX); + TestMMCifReaderProtected::MMCIF_HELIX); type = StringRef("HELX_LH_OT_N", 12); BOOST_CHECK(tmmcif_p.DetermineSecStructType(type) == - TestMMCifParserProtected::MMCIF_HELIX); + TestMMCifReaderProtected::MMCIF_HELIX); type = StringRef("HELX_LH_A_N", 11); BOOST_CHECK(tmmcif_p.DetermineSecStructType(type) == - TestMMCifParserProtected::MMCIF_HELIX); + TestMMCifReaderProtected::MMCIF_HELIX); type = StringRef("HELX_LH_B_N", 11); BOOST_CHECK(tmmcif_p.DetermineSecStructType(type) == - TestMMCifParserProtected::MMCIF_HELIX); + TestMMCifReaderProtected::MMCIF_HELIX); type = StringRef("HELX_LH_Z_N", 11); BOOST_CHECK(tmmcif_p.DetermineSecStructType(type) == - TestMMCifParserProtected::MMCIF_HELIX); + TestMMCifReaderProtected::MMCIF_HELIX); type = StringRef("TURN_P", 6); BOOST_CHECK(tmmcif_p.DetermineSecStructType(type) == - TestMMCifParserProtected::MMCIF_TURN); + TestMMCifReaderProtected::MMCIF_TURN); type = StringRef("TURN_OT_P", 9); BOOST_CHECK(tmmcif_p.DetermineSecStructType(type) == - TestMMCifParserProtected::MMCIF_TURN); + TestMMCifReaderProtected::MMCIF_TURN); type = StringRef("TURN_TY1_P", 10); BOOST_CHECK(tmmcif_p.DetermineSecStructType(type) == - TestMMCifParserProtected::MMCIF_TURN); + TestMMCifReaderProtected::MMCIF_TURN); type = StringRef("TURN_TY1P_P", 11); BOOST_CHECK(tmmcif_p.DetermineSecStructType(type) == - TestMMCifParserProtected::MMCIF_TURN); + TestMMCifReaderProtected::MMCIF_TURN); type = StringRef("TURN_TY2_P", 10); BOOST_CHECK(tmmcif_p.DetermineSecStructType(type) == - TestMMCifParserProtected::MMCIF_TURN); + TestMMCifReaderProtected::MMCIF_TURN); type = StringRef("TURN_TY2P_P", 11); BOOST_CHECK(tmmcif_p.DetermineSecStructType(type) == - TestMMCifParserProtected::MMCIF_TURN); + TestMMCifReaderProtected::MMCIF_TURN); type = StringRef("TURN_TY3_P", 10); BOOST_CHECK(tmmcif_p.DetermineSecStructType(type) == - TestMMCifParserProtected::MMCIF_TURN); + TestMMCifReaderProtected::MMCIF_TURN); type = StringRef("TURN_TY3P_P", 11); BOOST_CHECK(tmmcif_p.DetermineSecStructType(type) == - TestMMCifParserProtected::MMCIF_TURN); + TestMMCifReaderProtected::MMCIF_TURN); type = StringRef("STRN", 4); BOOST_CHECK(tmmcif_p.DetermineSecStructType(type) == - TestMMCifParserProtected::MMCIF_STRAND); + TestMMCifReaderProtected::MMCIF_STRAND); type = StringRef("Foo", 3); BOOST_CHECK_THROW(tmmcif_p.DetermineSecStructType(type), IOException); @@ -995,7 +995,7 @@ BOOST_AUTO_TEST_CASE(mmcif_struct_sheet_range_tests) { BOOST_MESSAGE(" Running mmcif_struct_sheet_range_tests..."); mol::EntityHandle eh = mol::CreateEntity(); - TestMMCifParserProtected tmmcif_p("testfiles/mmcif/atom_site.mmcif", eh); + TestMMCifReaderProtected tmmcif_p("testfiles/mmcif/atom_site.mmcif", eh); BOOST_MESSAGE(" testing auth_chain_id switch..."); StarLoopDesc tmmcif_h; @@ -1055,7 +1055,7 @@ BOOST_AUTO_TEST_CASE(mmcif_parseatomident) std::ifstream s("testfiles/mmcif/atom_site.mmcif"); IOProfile profile; StarLoopDesc tmmcif_h; - TestMMCifParserProtected tmmcif_p(s, eh, profile); + TestMMCifReaderProtected tmmcif_p(s, eh, profile); std::vector<StringRef> columns; String chain_name; StringRef res_name; @@ -1148,7 +1148,7 @@ BOOST_AUTO_TEST_CASE(mmcif_parseandaddatom) BOOST_MESSAGE(" Running mmcif_parseandaddatom tests..."); std::ifstream s("testfiles/mmcif/atom_site.mmcif"); - TestMMCifParserProtected tmmcif_p(s, eh, IOProfile()); + TestMMCifReaderProtected tmmcif_p(s, eh, IOProfile()); std::vector<StringRef> cols; //BOOST_MESSAGE(" testing short atom_site entry"); @@ -1163,7 +1163,7 @@ BOOST_AUTO_TEST_CASE(mmcif_testreader) mol::EntityHandle eh = mol::CreateEntity(); std::ifstream s("testfiles/mmcif/atom_site.mmcif"); IOProfile profile; - MMCifParser mmcif_p(s, eh, profile); + MMCifReader mmcif_p(s, eh, profile); mmcif_p.SetRestrictChains("A O C");