Skip to content
Snippets Groups Projects
Commit 5c031c57 authored by Tobias Schmidt's avatar Tobias Schmidt
Browse files

fix chainname bug in SDF writer

parent dbb3b160
Branches
Tags
No related merge requests found
......@@ -21,6 +21,7 @@
*/
#include "sdf_writer.hh"
#include <boost/regex.hpp>
namespace ost { namespace io {
......@@ -116,11 +117,19 @@ bool SDFWriter::VisitChain(const mol::ChainHandle& chain) {
atom_indices_.clear();
}
// remove chain number if added when reading from sdf file
String cname = chain.GetName();
if (cname.length()>6) {
boost::regex pattern = boost::regex("^[0-9]{5}_");
if (boost::regex_search(cname, pattern)) {
cname = cname.substr(6);
}
}
// print header lines
ostr_ << chain.GetName().substr(6) << std::endl;
ostr_ << cname << std::endl;
ostr_ << std::endl;
ostr_ << std::endl;
// print counts line
ostr_ << format("%3d") % chain.GetAtomCount()
<< format("%3d") % chain.GetBondCount()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment