From e350a7e9e03f6cebb973d2420d506d644d293d05 Mon Sep 17 00:00:00 2001 From: Gabriel Studer <gabriel.studer@unibas.ch> Date: Thu, 4 Jan 2024 13:48:52 +0100 Subject: [PATCH] mmcif writer: cleanup --- modules/io/src/mol/mmcif_writer.cc | 41 +++++++++++++++--------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/modules/io/src/mol/mmcif_writer.cc b/modules/io/src/mol/mmcif_writer.cc index 3cfd364d3..35dd15c6b 100644 --- a/modules/io/src/mol/mmcif_writer.cc +++ b/modules/io/src/mol/mmcif_writer.cc @@ -470,6 +470,25 @@ namespace { } } + bool MatchEntity(const ost::mol::ResidueHandleList& res_list, + const ost::io::MMCifWriterEntity& info) { + // checks if the residue names in res_list are an exact match + // with mon_ids in info + std::vector<String> mon_ids; + for(auto res : res_list) { + mon_ids.push_back(res.GetName()); + } + return mon_ids == info.mon_ids; + } + + void AddAsym(const String& asym_chain_name, + ost::io::MMCifWriterEntity& info) { + // adds asym_chain_name to info under the assumption that mon_ids + // exactly match => just add a copy of mon_ids to asym_alns + info.asym_ids.push_back(asym_chain_name); + info.asym_alns.push_back(info.mon_ids); + } + bool MatchEntityResnum(const ost::mol::ResidueHandleList& res_list, const ost::io::MMCifWriterEntity& info, Real beyond_frac = 0.05) { @@ -521,25 +540,6 @@ namespace { } } - bool MatchEntity(const ost::mol::ResidueHandleList& res_list, - const ost::io::MMCifWriterEntity& info) { - // checks if the residue names in res_list are an exact match - // with mon_ids in info - std::vector<String> mon_ids; - for(auto res : res_list) { - mon_ids.push_back(res.GetName()); - } - return mon_ids == info.mon_ids; - } - - void AddAsym(const String& asym_chain_name, - ost::io::MMCifWriterEntity& info) { - // adds asym_chain_name to info under the assumption that mon_ids - // exactly match => just add a copy of mon_ids to asym_alns - info.asym_ids.push_back(asym_chain_name); - info.asym_alns.push_back(info.mon_ids); - } - void AddAsymResnum(const String& asym_chain_name, const ost::mol::ResidueHandleList& res_list, ost::io::MMCifWriterEntity& info) { @@ -729,7 +729,8 @@ namespace { const ost::mol::ResidueHandleList& res_list, bool resnum_alignment, std::vector<ost::io::MMCifWriterEntity>& entity_infos) { - + // use chem types in res_list to determine _entity.type and + // _entity_poly.type String type = GuessEntityType(res_list); bool is_poly = type == "polymer"; String poly_type = ""; -- GitLab