util/calculate/molExport: how to set implicitH parameter?

User 5dcacda829

18-10-2016 12:48:30

hi,


i'm using the "util/calculate/molExport" endpoint to render png images. as parameters i pass the string "png:w400,h400,nosource,maxscale28,mono", and this works as expected.


but i did not find a way how to pass the "implicitH=off" parameter. how is this done?


thanks for any suggestions.

ChemAxon 13811e1703

19-10-2016 09:22:57

Hi Michael,

Here is the list of export options:
https://docs.chemaxon.com/display/docs/Image+Export+in+Marvin />
So adding H_off option should do the trick: "png:w400,h400,nosource,maxscale28,mono,H_off"


By the way there is a more suitable api for rendering images with the web services:

POST /rest-v0/util/calculate/jsonImage


{
"structure": "aspirin",
"parameters": {
"type": "png",
"height": 400,
"width": 400,
"scale": 28
},
"filterChain": [
{
"filter": "hydrogenizer",
"parameters": {
"method": "DEHYDROGENIZE"
}
}
]
}


(It does not support all advanced export features, so molExport might be better choice for you)


Regards,
Peter

User 5dcacda829

19-10-2016 09:41:04

thanks, haven't found that.

User 7005d88b29

30-01-2017 14:05:03

Hi,


i have a question depending the same API.


We make a substructure search and get a molecule with highlighted bonds. These bonds are red. I would like to change the color of these bonds. But when I use the parameter colors the background color changes.


It is possible to change the highlighted bonds color with a parameter?


e.g. like "png:w200,h200,maxscale28,H_hetero,setHitColor#3465A4"; 


 


Best Ann

ChemAxon 13811e1703

30-01-2017 15:23:17

Hi Ann,

Here is a sample request with advanced display options:


{
"searchOptions": {
"queryStructure": "CCCCCC"
},
"paging": {
"offset": 0,
"limit": 10
},
"display": {
"include": ["cd_id", "cd_structure"],
"parameters":{
"cd_structure-display": {
"include": ["image", "structureData"],
"parameters": {
"image": {"width":400, "returnImage": false},
"structureData": "smiles"
}
}
},
"displayMoleculeOptions": {
"hitColor": "cc3614"
}
}
}

"hitColor" parameters controls the highlighted segment color in hex color code. I hope you can assemble your request based on this.

Regards,
Peter 

User 7005d88b29

31-01-2017 08:41:32

Hi Peter, 


thank you for the quick answer.


It is a bit tricky as I need the binaryStructure which is offered if I use parameter = png but in this structure the cd_structure display parameter are not provided.


If I use the linke of the response instead of the binaryStructure I have to make another request to the webservices what I would like to avoid.


Best Ann

ChemAxon 13811e1703

31-01-2017 08:49:40

Hi Ann,

You can have the binary image back by setting "returnImage": true (or completely discarding that option, by default the binary image is returned)


Sorry for the confusion, I just tried to provide sample for useful parameters in that json.

Peter 

User 7005d88b29

31-01-2017 08:57:20

Hi Peter,


I tried it out but did not get any structure back.


Best Ann

ChemAxon 13811e1703

31-01-2017 17:17:41

Hi Ann,

Sorry, you wrote you are doing substructure search, my sample is working when you are doing a substucture search in the database on a JChem table url like here: 
https://restdemo.chemaxon.com/apidocs#advancedsearch  />
Table's url looks ike /rest-v0/data/sample/table/{tableName}/search

For doing highlighting on a single structure, you can use this:
POST /rest-v0/util/calculate/jsonImage


{
"structure": "aspirin",
"parameters": { // these are the parameters of the generated image
"width": 300
},
"filterChain": [
{
"filter": "highlight",
"parameters": {
"queryStructure": "C1=CC=CC=C1",
"displayOptions": {
"hitColor": "FF00FF"
}
}
}
]
}

The filter chain is doing highlighting on the target structure with the provided quey and color.

It is also possible to return also the structure in any format in a single request, so I can show you more examples if needed.

Peter 

User 7005d88b29

01-02-2017 09:22:26

Hi Peter,


thank you again. I thought it would be enough to commit the highlighted structure once. 


/calculate/jsonImage looks a lot better only that the highlighted part of the structure is the one I do not want to highlight and the automapping information is turned on.


/calculate/jsonImage",
           {

                structure  : $structure,

                #parameters : $flag_param,

                parameters :  {

                    type : "png",

                    width : $width,

                    height :; $height,

                    },

                filterChain : [{

                    filter : "highlight",

                    parameters : {

                        queryStructure   : $structure,

                        displayOptions : {

                            hitColor : "1D5D9F"

                        }

                    }

                },

                 filter : "reactionConverter",  //does not change anything

                 parameters : {

                    autoMappingStyle : "OFF"

              }

          }] }


Is there a possibility to turn the colors around?


Best Ann

ChemAxon 13811e1703

01-02-2017 10:15:40

Hi Ann,

I see...
"reactionConverter" filter cannot remove existing mapping from the input. Can you provide a sample reaction you are trying to display?

Also "highlighter" filter is doing a substructure search with the query and will highlight the first hit. What kind of other parameters can you imagine for that to work as expected?

"jsonImage" calculator is using the existing coloring in the structure to render it. Is it a possible solution for you to prepare the structure with the part already colored?

Regards,
Peter 

User 7005d88b29

01-02-2017 14:23:16

Hi Peter,


I think I start to understand ;-)


Yes I am doing a substructure search but at that point where I request the image it is no substructure search any more as I only need to convert the mol file into an image. In this molecule all information are already in (see attachement).


In the PNG/SVG the bonds are red (from molExport or jsonImage without any parameters).


When I send this mol file  to /jsonImage  with the highlighter I compare it with the queryStructure but now I compare it with itself.  As there are some highlight infomation in the molecule these are not recognized (I think). In my opinion that is the reason why the colors are exchanged. At that point I do not have the search information any more.


Best Ann