cdk / depict

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

feature request: generating multiple molecue structures within one image #75

Closed biotech7 closed 1 year ago

biotech7 commented 1 year ago

Hi,John, based on multiple extended smiles like: "CN1C=NC2=C1C(=O)N(C(=O)N2C)C caffeine.CN1C=NC2=C1C(=O)N(C(=O)N2C)C caffeine.CN1C=NC2=C1C(=O)N(C(=O)N2C)C caffeine" to generate multiple structures in one image , which contain title informations look like followiing. is it applicabale?

depict
johnmay commented 1 year ago

This is possible using the CDK depict Java API but I would prefer to not add this to the front end since you can do it with more flexibility with HTML/JS/CSS.

Here is it using the API BTW

IChemObjectBuilder builder = SilentChemObjectBuilder.getInstance();
SmilesParser smipar = new SmilesParser(builder);
List<IAtomContainer> molecules = new ArrayList<>();
molecules.add(smipar.parseSmiles("CN1C=NC2=C1C(=O)N(C(=O)N2C)C caffeine"));
molecules.add(smipar.parseSmiles("CN1C=NC2=C1C(=O)N(C(=O)N2C)C caffeine"));
molecules.add(smipar.parseSmiles("CN1C=NC2=C1C(=O)N(C(=O)N2C)C caffeine"));
new DepictionGenerator().withMolTitle()
                        .depict(molecules, 1, 3)
                        .writeTo("/tmp/tmp.svg");

tmp