cdk / depict

SMILES Depiction Generator
GNU Lesser General Public License v2.1
54 stars 14 forks source link

Is it possible to set the font of the substituent independently #22

Closed miracle1111111 closed 4 years ago

miracle1111111 commented 4 years ago

image Hello, there is a question recently that is very troublesome. Is it possible to set the font of the substituent separately, because the default substituent is italic, and the substituent I want to generate is a normal font. In addition, can the number in the upper right corner of the substituent be placed in the lower right corner? I don’t know where to set it. thank you very much

johnmay commented 4 years ago

No it's not an option. The reason it is italic is because people use labels other than R, for example W, Y and even B. Using italics allows us to visually distinguish these from tungsten, yttrium and boron.

image

Note if you want an abbreviation, e.g. -CO2H these will be plain font. We could add option for it but what is the use case, just you don't like it?

miracle1111111 commented 4 years ago

image image

Thank you very much for your reply. I want to generate the same picture as the literature, because in the literature, the substituents are plain fonts. The superscripts of substituents in the literature are sometimes in the lower right corner. image As you mentioned, the chemical structure pictures generated by the CDK for the above CONH2, CH3, etc. are all expanded, and I don’t know how to generate this. I really want to know how to solve these problems. thank you very much.

johnmay commented 4 years ago

You can use Abbreviations API to contract functional groups.

Why do you want to generate the same picture as in the literature? Even including the ; on the R2 label and the bent ketone bond? The super/subscript is purely a stylistic and not something I think is useful to control in CDK atm - these types of details are more akin to a sketcher (e.g. ChemDraw)

miracle1111111 commented 4 years ago

Thank you for your reply. Not including the ; I added it by mistake. Because I want to generate the same picture as the literature to train the model, so the effect is better. Finally, I want to change by modifying the source code, but in the source code, I did not find where the settings for the substitute font are

johnmay commented 4 years ago

Okay - since this is a 1 off case I think it's best if you change your local version. You need to modify: StandardAtomGenerator.generatePseudoSymbol()

johnmay commented 4 years ago

I've add the following option:

depictgen = depictgen.withParam(StandardGenerator.PseudoFontStyle.class,
                                                          Font.PLAIN);

to configure this. The superscript vs subscript I've left for now.

miracle1111111 commented 4 years ago

I have learned a lot, thank you very much.

------------------ 原始邮件 ------------------ 发件人: "cdk/depict" <notifications@github.com>; 发送时间: 2020年7月20日(星期一) 下午5:25 收件人: "cdk/depict"<depict@noreply.github.com>; 抄送: "Miracle"<541766011@qq.com>;"Author"<author@noreply.github.com>; 主题: Re: [cdk/depict] Is it possible to set the font of the substituent independently (#22)

I've add the following option: depictgen = depictgen.withParam(StandardGenerator.PseudoFontStyle.class, Font.PLAIN);
to configure this. The superscript vs subscript I've left for now.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.