cdk / depict

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

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

Closed biotech7 closed 9 months ago

biotech7 commented 9 months 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 9 months 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