depict icon indicating copy to clipboard operation
depict copied to clipboard

Atom Mapping and Colour Map at the same time?

Open schymane opened this issue 7 years ago • 9 comments

Would it be possible to display atom mapping and colour map at the same time? I have had a few tries but haven't found a workaround yet, I would like to combine e.g.: http://simolecule.com/cdkdepict/depict/cow/svg?smi=[CH3%3A9]CH%3A8[c%3A7]1[cH%3A11][cH%3A12][cH%3A13][cH%3A14][cH%3A15]1.CH2%3A3[CH2%3A2][Cl%3A1]%3E[Al%2B3].[Cl-].[Cl-].[Cl-].C(Cl)Cl%3E[CH3%3A9]CH%3A8[c%3A7]1[cH%3A11][cH%3A12]c%3A13C%3A5[CH2%3A4][CH2%3A3][CH2%3A2][Cl%3A1]%20%7Cf%3A2.3.4.5%7C%20Friedel-Crafts%20acylation%20[3.10.1]&abbr=off&hdisp=bridgehead&showtitle=false&zoom=1.3&annotate=mapidx and http://simolecule.com/cdkdepict/depict/cow/svg?smi=[CH3%3A9]CH%3A8[c%3A7]1[cH%3A11][cH%3A12][cH%3A13][cH%3A14][cH%3A15]1.CH2%3A3[CH2%3A2][Cl%3A1]%3E[Al%2B3].[Cl-].[Cl-].[Cl-].C(Cl)Cl%3E[CH3%3A9]CH%3A8[c%3A7]1[cH%3A11][cH%3A12]c%3A13C%3A5[CH2%3A4][CH2%3A3][CH2%3A2][Cl%3A1]%20%7Cf%3A2.3.4.5%7C%20Friedel-Crafts%20acylation%20[3.10.1]&abbr=off&hdisp=bridgehead&showtitle=false&zoom=1.3&annotate=colmap

We have some great use cases. Thanks!

schymane avatar Oct 22 '17 10:10 schymane

Possible in code but via the web-service at the moment. I can make the annotate parameter take a list e.g. annotate=colmap,atommap etc. Things get crowded very quickly though.

What's the use-case?

johnmay avatar Oct 28 '17 15:10 johnmay

I bet it will get crowded, we'd like to us this to simplify metabolic reactions where we have atom maps, by reducing the chains and other "substructures" down to R groups - we can display e.g. numbered Rs in the CDK but not e.g. in ChemAxon, where they become *s. We're playing around with the possibilities of how we can index parts of "uncertain structures" that aren't reacting, the colour helps visually track what is going where in the reaction but we need the atom maps too - hence the combination would be cool. It's early days, we're playing around with how we could implement this in code and the ability to edit the SMILES live in the web interface and see what happens is incredibly useful .. pre-coding once we have the concept sorted... because I don't actually have the SMILES, I'm making them "live" and we're trying to figure out what will work so we can create them systematically ... if you see what I mean ...

I have a couple of examples but the URLs are going crazy with copy paste and I can't rescue the SMILES out of them (I have the originals on a different device ... can send if needed) ... here's at least one of the pictures...

image

schymane avatar Oct 28 '17 18:10 schymane

we can display e.g. numbered Rs in the CDK but not e.g. in ChemAxon, where they become *s

Erm.. that doesn't sound right? How are you putting the R groups in...

c1ccccc1* |$;;;;;;R1$|

Is how it should be done the same in both ChemAxon and CDK (they did it first). I do have a debug function that dumps unrecognized text from bracket atoms in to pseudo-atoms but this is non-standard and should not be used e.g. c1ccccc1[R1] BAD.

Also you can put the substituents in there... I don't support this fully mainly because CDK likes to have separate objects (e.g. there is an RGroupQuery instance) whereas I would just represent everything in a single mol type.

c1ccccc1 |$R1;;;;;;$,RG:_R1={CC |$;;_AP1$|},{CCC* |$;;;_AP1$|}|

Have some prototype code to display that

johnmay avatar Oct 28 '17 21:10 johnmay

Is that supported in the reaction SMILES as well? I couldn't find a way. The content in the |...| was missing in the examples I was sent... I will have to chase that up with the data source... The group definition was only in the mol file.

schymane avatar Oct 29 '17 05:10 schymane

Yes you can use it in reactions too. It's CXSMILES export option from ChemAxon.

johnmay avatar Oct 29 '17 07:10 johnmay

I don't have ChemAxon so can't try the export directly and I also have a lot of structures from literature that I'm trying to represent correctly where I don't necessarily even have mol files to start as, in the end, I need the SMILES that works properly for the CDK, not a mol. I tried a few CxSMILES that display well individually and couldn't get any of them to work with a reaction. If I start with one of your examples: CCO.[CH3:1]C:2[OH:4]>[H+]>CC[O:4]C:2[CH3:1].O Ethyl esterification [1.7.3] image

Then I modify the CCO and reactant to contain an R group: *CO |$R1;;$| test *C[O:4]C:2[CH3:1] |$R1;;;;;$| test2

These display fine by themselves image

but the reaction doesn't - everything after the first reactant ends up in the title (or nothing displays) no matter what combination of spacing I try. What am I missing?

*CO |$R1;;$|.[CH3:1]C:2[OH:4]>[H+]>*C[O:4]C:2[CH3:1] |$R1;;;;;$|.O Ethyl esterification with R group image

schymane avatar Oct 29 '17 10:10 schymane

No you put it all in the title, this ensure backwards compatability:

OC[*].[CH3:1][C:2]([OH:4])=[O:3]>[H+]>[CH3:1][C:2](=[O:3])[O:4]C[*].O |$;;_R1;;;;;;;;;;;_R1;$| Ethyl esterification [1.7.3]

https://www.chemaxon.com/marvin-archive/latest/help/formats/cxsmiles-doc.html

johnmay avatar Oct 29 '17 10:10 johnmay

ahha, without _ it looks better ... so you have to count atoms over the whole reaction ... I see ... OC[*].[CH3:1][C:2]([OH:4])=[O:3]>[H+]>[CH3:1][C:2](=[O:3])[O:4]C[*].O |$;;R1;;;;;;;;;;;R1;$| Ethyl esterification [1.7.3] or even OC*.[CH3:1][C:2]([OH:4])=[O:3]>[H+]>[CH3:1][C:2](=[O:3])[O:4]C*.O |$;;R1;;;;;;;;;;;R1;$| Ethyl esterification [1.7.3] (because the original SMILES don't have the * in square brackets?)

schymane avatar Oct 29 '17 11:10 schymane

But to return to the original issue ... if I want to combine atom mapping AND colour mapping in R:

m2 <- parse.smiles("[CH3:1]C:2[OH:4]")[[1]] dep2 <- get.depictor(annotate="mapidx") img <- view.image.2d(m2,dep2) plot(1:10, 1:10, pch=19) rasterImage(img, 2,2,8,10)

Looks good: image

But I can't get the colmap - presumably because I need the reaction (a single SMILES also doesn't display colmap in depict):

dep3 <- get.depictor(annotate="colmap") img <- view.image.2d(m2,dep3) plot(1:10, 1:10, pch=19) rasterImage(img, 2,2,8,10)

image

But if I try to parse reaction SMILES that display in Depict I get null ... what option am I missing here? @rajarshi ?

m3 <- parse.smiles("CCO.[CH3:1]C:2[OH:4]>[H+]>CC[O:4]C:2[CH3:1].O Ethyl esterification [1.7.3]")[[1]] m3

NULL

Without title the same:

m3 <- parse.smiles("CCO.[CH3:1]C:2[OH:4]>[H+]>CC[O:4]C:2[CH3:1].O")[[1]] m3

NULL

Would adjusting "annotate" to take a list be the right way, or rather a new option that just combines colmap and mapidx? I guess a list would let users pick and choose...

image

schymane avatar Oct 29 '17 11:10 schymane