OK, I dug into the source
code<https://github.com/rdkit/rdkit/blob/d41752d558bf7200ab67b98cdd9e37f1bdd378de/Code/GraphMol/MolDraw2D/MolDraw2DUtils.cpp>
and it seems bondLineWidth simply can't be set:
void updateDrawerParamsFromJSON(MolDraw2D &drawer, const std::string &json) {
if (json == "") {
return;
}
std::istringstream ss;
ss.str(json);
MolDrawOptions &opts = drawer.drawOptions();
boost::property_tree::ptree pt;
boost::property_tree::read_json(ss, pt);
PT_OPT_GET(atomLabelDeuteriumTritium);
PT_OPT_GET(dummiesAreAttachments);
PT_OPT_GET(circleAtoms);
PT_OPT_GET(continuousHighlight);
PT_OPT_GET(flagCloseContactsDist);
PT_OPT_GET(includeAtomTags);
PT_OPT_GET(clearBackground);
PT_OPT_GET(legendFontSize);
PT_OPT_GET(multipleBondOffset);
PT_OPT_GET(padding);
PT_OPT_GET(additionalAtomLabelPadding);
get_colour_option(&pt, "highlightColour", opts.highlightColour);
get_colour_option(&pt, "backgroundColour", opts.backgroundColour);
get_colour_option(&pt, "legendColour", opts.legendColour);
if (pt.find("atomLabels") != pt.not_found()) {
BOOST_FOREACH (boost::property_tree::ptree::value_type const &item,
pt.get_child("atomLabels")) {
opts.atomLabels[boost::lexical_cast<int>(item.first)] =
item.second.get_value<std::string>();
}
}
}
legendFontSize indeed works. I was using a setting I had from python (0.5)
which got silently ignored. But with a proper value in points size I assume it
works.
So I suggest to add the bondLineWidth as option to above method.
Best Regards,
Thomas
________________________________
Von: Thomas Strunz <[email protected]>
Gesendet: Donnerstag, 13. Februar 2020 09:09
An: [email protected] <[email protected]>
Betreff: [Rdkit-discuss] RDKit Cartridge mol_to_svg parameters
Hi All,
started to play around with the rdkit cartridge and I was wondering how to
correctly use the mol_to_svg function.
On rdkit homepage I only found this:
mol_to_svg(mol,string default ‘’,int default 250, int default 200, string
default ‘’) : returns an SVG with a drawing
of the molecule. The optional parameters are a string to use as the legend, the
width of the image, the height of the image,
and a JSON with additional rendering parameters. (available from the 2016_09
release)
The interesting part are the rendering parameters. Is there a list of them and
some examples of this function?
I tried stuff like below:
mol_to_svg(mol, 'Test', 150, 100, '{"bondLineWidth": 1, "legendFontSize": 0.5}')
There is no error but the "JSON" options are not applied. The image always
looks the same with for my taste too thick bonds.
Best Regards,
Thomas
_______________________________________________
Rdkit-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss