Hi Thomas,

I've never used the RDKit cartridge, so have not come across mol_to_svg()
before.  In the more general case, you can change the bond line width with
something like:
    drawer = rdMolDraw2D.MolDraw2DSVG(200, 200)
    drawer.drawOptions().bondLineWidth = 10
It may be that you don't have this level of control in the cartridge in
which case I have no workaround in the short term.

However, thanks to the generosity of MedChemica, I am currently working on
improvements to the drawing code, and have added some extra options to
drawOptions() that will need interpreting in updateDrawerParamsFromJSON.
Whilst doing this, I'll make sure it picks up all the other possibilities
in the drawOptions() function as well.  In fact, your post was very timely
as this function was one I hadn't seen before, so now I know I need to look
at it!  If all goes ideally, this may be in the 2020.03 release, if not it
should be in 2020.09 and of course will be available in the development
version as soon as my pull request is accepted, should it be so.

Cheers,
Dave


On Thu, Feb 13, 2020 at 8:47 AM Thomas Strunz <beginn...@hotmail.de> wrote:

> 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 <beginn...@hotmail.de>
> *Gesendet:* Donnerstag, 13. Februar 2020 09:09
> *An:* rdkit-discuss@lists.sourceforge.net <
> rdkit-discuss@lists.sourceforge.net>
> *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
> Rdkit-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>


-- 
David Cosgrove
Freelance computational chemistry and chemoinformatics developer
http://cozchemix.co.uk
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to