diff --git a/modules/io/pymod/export_mmcif_io.cc b/modules/io/pymod/export_mmcif_io.cc index f9a575b5f0f85c44180e43ff34ddd12c8d414260..411750b9194a884052a542ba891550ff042c152a 100644 --- a/modules/io/pymod/export_mmcif_io.cc +++ b/modules/io/pymod/export_mmcif_io.cc @@ -84,14 +84,16 @@ void WrapStarWriterWrite(StarWriter& writer, const String& data_name, void WrapSetStructureHandle(MMCifWriter& writer, const ost::mol::EntityHandle& ent, - bool mmcif_conform) { - writer.SetStructure(ent, mmcif_conform); + bool mmcif_conform, + const std::vector<MMCifWriterEntity>& entity_info) { + writer.SetStructure(ent, mmcif_conform, entity_info); } void WrapSetStructureView(MMCifWriter& writer, const ost::mol::EntityView& ent, - bool mmcif_conform) { - writer.SetStructure(ent, mmcif_conform); + bool mmcif_conform, + const std::vector<MMCifWriterEntity>& entity_info) { + writer.SetStructure(ent, mmcif_conform, entity_info); } void export_mmcif_io() @@ -159,9 +161,15 @@ void export_mmcif_io() .add_property("asym_ids", &MMCifWriterEntity::asym_ids) ; + class_<std::vector<MMCifWriterEntity> >("MMCifWriterEntityList", init<>()) + .def(vector_indexing_suite<std::vector<MMCifWriterEntity> >()) + ; + class_<MMCifWriter, bases<StarWriter> >("MMCifWriter", init<>()) - .def("SetStructure", &WrapSetStructureHandle, (arg("ent"), arg("mmcif_conform")=true)) - .def("SetStructure", &WrapSetStructureView, (arg("ent"), arg("mmcif_conform")=true)) + .def("SetStructure", &WrapSetStructureHandle, (arg("ent"), arg("mmcif_conform")=true, + arg("entity_info")=std::vector<MMCifWriterEntity>())) + .def("SetStructure", &WrapSetStructureView, (arg("ent"), arg("mmcif_conform")=true, + arg("entity_info")=std::vector<MMCifWriterEntity>())) ; enum_<MMCifInfoCitation::MMCifInfoCType>("MMCifInfoCType") diff --git a/modules/io/src/mol/mmcif_writer.cc b/modules/io/src/mol/mmcif_writer.cc index 16cf083f6d73ef75fb27a469bb7ce1e177398660..a2b3ba02ec251c78ae715137e975a5e2fb2a325c 100644 --- a/modules/io/src/mol/mmcif_writer.cc +++ b/modules/io/src/mol/mmcif_writer.cc @@ -1461,18 +1461,21 @@ int MMCifWriterEntity::GetAsymIdx(const String& asym_id) const { } void MMCifWriter::SetStructure(const ost::mol::EntityHandle& ent, - bool mmcif_conform) { - + bool mmcif_conform, + const std::vector<MMCifWriterEntity>& entity_info) { this->Setup(); + entity_info_ = entity_info; ProcessEnt(ent, mmcif_conform, comp_info_, entity_info_, atom_site_, pdbx_poly_seq_scheme_); this->Finalize(); } void MMCifWriter::SetStructure(const ost::mol::EntityView& ent, - bool mmcif_conform) { + bool mmcif_conform, + const std::vector<MMCifWriterEntity>& entity_info) { this->Setup(); + entity_info_ = entity_info; ProcessEnt(ent, mmcif_conform, comp_info_, entity_info_, atom_site_, pdbx_poly_seq_scheme_); this->Finalize(); diff --git a/modules/io/src/mol/mmcif_writer.hh b/modules/io/src/mol/mmcif_writer.hh index 98c62c4be64dd423d5b58d9d51465cca2b4f6bbc..85b3f9a2a6caec5cb2167006cdab723e922dc668 100644 --- a/modules/io/src/mol/mmcif_writer.hh +++ b/modules/io/src/mol/mmcif_writer.hh @@ -41,6 +41,22 @@ struct MMCifWriterEntity { int GetAsymIdx(const String& asym_id) const; + bool operator==(const MMCifWriterEntity& rhs) const { + return (type == rhs.type) + && (poly_type == rhs.poly_type) + && (branch_type == rhs.branch_type) + && (asym_ids == rhs.asym_ids) + && (is_poly == rhs.is_poly) + && (mon_ids == rhs.mon_ids) + && (seq_olcs == rhs.seq_olcs) + && (seq_can_olcs == rhs.seq_can_olcs) + && (asym_alns == rhs.asym_alns); + } + + bool operator!=(const MMCifWriterEntity& rhs) const { + return !(*this == rhs); + } + // _entity.type String type; @@ -88,9 +104,11 @@ public: virtual ~MMCifWriter() { } - void SetStructure(const ost::mol::EntityHandle& ent, bool mmcif_conform=true); + void SetStructure(const ost::mol::EntityHandle& ent, bool mmcif_conform=true, + const std::vector<MMCifWriterEntity>& entity_info=std::vector<MMCifWriterEntity>()); - void SetStructure(const ost::mol::EntityView& ent, bool mmcif_conform=true); + void SetStructure(const ost::mol::EntityView& ent, bool mmcif_conform=true, + const std::vector<MMCifWriterEntity>& entity_info=std::vector<MMCifWriterEntity>()); private: