Technical Support Forum Index
Technical Support Forum
Access ChemAxon scientists and developers here. For registration and login issues contact website support.

Support Ticket System is replacing forum

This forum was converted into a searchable archive. You cannot add posts here any more. For support please use our new Ticket System.

Create your first ticket
util/calculate/molExport: how to set implicitH parameter?
To watch this topic for replies  Register (enables digests) or give email address:
This topic is locked: you cannot edit posts or make replies.
Display posts from previous:   
    View previous topic :: View next topic    
Author Message
Michael

Joined: 18 Jan 2013
Posts: 4

View user's profile

Back to top
Link to postPosted: Tue Oct 18, 2016 1:48 pmPost subject: util/calculate/molExport: how to set implicitH parameter? Reply with quote

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.

Péter
ChemAxon personnel
Joined: 31 Aug 2012
Posts: 110

View user's profile

Back to top
Link to postPosted: Wed Oct 19, 2016 10:22 amPost subject: Reply with quote

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

Michael

Joined: 18 Jan 2013
Posts: 4

View user's profile

Back to top
Link to postPosted: Wed Oct 19, 2016 10:41 amPost subject: Reply with quote

thanks, haven't found that.

ann

Joined: 10 Nov 2016
Posts: 5

View user's profile

Back to top
Link to postPosted: Mon Jan 30, 2017 3:05 pmPost subject: setHitColor Reply with quote

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

Péter
ChemAxon personnel
Joined: 31 Aug 2012
Posts: 110

View user's profile

Back to top
Link to postPosted: Mon Jan 30, 2017 4:23 pmPost subject: Reply with quote

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 

ann

Joined: 10 Nov 2016
Posts: 5

View user's profile

Back to top
Link to postPosted: Tue Jan 31, 2017 9:41 amPost subject: Reply with quote

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

Péter
ChemAxon personnel
Joined: 31 Aug 2012
Posts: 110

View user's profile

Back to top
Link to postPosted: Tue Jan 31, 2017 9:49 amPost subject: Reply with quote

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 

ann

Joined: 10 Nov 2016
Posts: 5

View user's profile

Back to top
Link to postPosted: Tue Jan 31, 2017 9:57 amPost subject: Reply with quote

Hi Peter,

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

Best Ann




 Filename: jchem.png    Filesize: 106.02 KB    Viewed: 12881 Time(s)
 Description:  
jchem.png
Péter
ChemAxon personnel
Joined: 31 Aug 2012
Posts: 110

View user's profile

Back to top
Link to postPosted: Tue Jan 31, 2017 6:17 pmPost subject: Reply with quote

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 
ann

Joined: 10 Nov 2016
Posts: 5

View user's profile

Back to top
Link to postPosted: Wed Feb 01, 2017 10:22 amPost subject: Reply with quote

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

Péter
ChemAxon personnel
Joined: 31 Aug 2012
Posts: 110

View user's profile

Back to top
Link to postPosted: Wed Feb 01, 2017 11:15 amPost subject: Reply with quote

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 

ann

Joined: 10 Nov 2016
Posts: 5

View user's profile

Back to top
Link to postPosted: Wed Feb 01, 2017 3:23 pmPost subject: Reply with quote

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




 Filename: highlight.mol    Filesize: 1.28 KB    Downloaded: 57 Time(s)
 Description:  
This topic is locked: you cannot edit posts or make replies.
Page 1 of 1


To watch this topic for replies   Register (enables digests) or give email address  
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum