Marvinjs Add/Remove implicit H

User e563474d4f

28-08-2016 21:12:17

Dear Sir/Madam,


 


how do I programatically click button "Add/Remove implicit H" and check if implicit H is shown?


I want a reaction like "[C:1](-[H:2])(-[H:3])=[C:4](-[H:5])-[C:6](-[H:7])(-[H:8])-[O:9]-[c:10]1(-[H:11])[c:12](-[H:13])[c:14](-[H:15])[c:16](-[H:17])[c:18](-[H:19])[c:20]1-[H:21].[H:22]>>[O:23](-[H:24])-[c:25]1(-[H:26])[c:27](-[H:28])[c:29](-[H:30])[c:31](-[H:32])[c:33](-[H:34])[c:35]1(-[H:36])-[C:37](-[H:38])(-[H:39])-[C:40](-[H:41])=[C:42](-[H:43])-[H:44]" to have H hidden when importing it (programmatically).


Please note, that the numbers in the presented SMILES are crucial (they represent atom-atom mapping), but I do not care about H - H mapping.


 


I am using MarvinJS v16.4.18


 


Yours,


Krzysztof

ChemAxon 76c88f5366

29-08-2016 11:43:37

Hi Krzysztof,


For adding/removing explicit Hydrogen atoms, you need to call JChem Web Services Hydrogenizer service with your structure, then set (import) the response mrv to the editor. 


Here you can find more information about extending Marvin JS functionalities with web services: 
https://marvinjs-demo.chemaxon.com/latest/docs/dev/webservices.html  />


Here you can try the web service in JChem Web Services API documentation (the relevant part starts with 8.7. Hydrogenize/Dehydrogenize Structure): 
https://restdemo.chemaxon.com/apidocs/#hydrogenizer


If you would like to hide the implicit Hydrogens, you can do this manually, in View settings dialog by setting "Implicit H " or  via Marvin JS API, calling setDisplaySettings() function with parameter: {"implicitHydrogen": "OFF"} .


(See the documentation of Marvin JS API, here:
https://marvinjs-demo.chemaxon.com/latest/jsdoc.html />
Here you can find our online examples:
https://marvinjs-demo.chemaxon.com/latest/examples/index.html .)




If you need more information, please do not hesitate to contact us here or send us an email to [email protected]


Best regards,
Eszter 

User e563474d4f

07-11-2016 18:51:19

Dear Eszter,


I have tried using it, but it doesn't work.


I have a reaction:



[C:1](-[H])(-[H])=[C:2](-[H])-[C:3](-[H])(-[H])-[O:4]-[c:5]1(-[H])[c:6](-[H])[c:7](-[H])[c:8](-[H])[c:9](-[H])[c:10]1-[H].[H]>>[O:4](-[H])-[c:5]1(-[H])[c:6](-[H])[c:7](-[H])[c:8](-[H])[c:9](-[H])[c:10]1(-[H])-[C:1](-[H])(-[H])-[C:2](-[H])=[C:3](-[H])-[H]



Dehydrogenizer gives me



<?xml version="1.0" encoding="UTF-8"?>
    <cml xmlns="http://www.chemaxon.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.chemaxon.com/marvin/schema/mrvSchema_16_02_15.xsd" version="ChemAxon file format v16.02.15, generated by v16.4.18.0">
        <MDocument>
            <MChemicalStruct>
                <reaction>
                    <arrow type="DEFAULT" x1="0.0" y1="0.0" x2="0.0" y2="0.0"></arrow>
                    <reactantList>
                        <molecule molID="m1">
                            <atomArray atomID="a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18 a19 a20" elementType="C H C H C H H O C H C H C H C H C H C H" mrvMap="1 0 2 0 3 0 0 4 5 0 6 0 7 0 8 0 9 0 10 0"></atomArray>
                            <bondArray>
                                <bond id="b1" atomRefs2="a1 a2" order="1"></bond>
                                <bond id="b2" atomRefs2="a1 a3" order="2"></bond>
                                <bond id="b3" atomRefs2="a3 a4" order="1"></bond>
                                <bond id="b4" atomRefs2="a3 a5" order="1"></bond>
                                <bond id="b5" atomRefs2="a5 a6" order="1"></bond>
                                <bond id="b6" atomRefs2="a5 a7" order="1"></bond>
                                <bond id="b7" atomRefs2="a5 a8" order="1"></bond>
                                <bond id="b8" atomRefs2="a8 a9" order="1"></bond>
                                <bond id="b9" atomRefs2="a9 a10" order="1"></bond>
                                <bond id="b10" atomRefs2="a9 a11" order="A"></bond>
                                <bond id="b11" atomRefs2="a11 a12" order="1"></bond>
                                <bond id="b12" atomRefs2="a11 a13" order="A"></bond>
                                <bond id="b13" atomRefs2="a13 a14" order="1"></bond>
                                <bond id="b14" atomRefs2="a13 a15" order="A"></bond>
                                <bond id="b15" atomRefs2="a15 a16" order="1"></bond>
                                <bond id="b16" atomRefs2="a15 a17" order="A"></bond>
                                <bond id="b17" atomRefs2="a17 a18" order="1"></bond>
                                <bond id="b18" atomRefs2="a17 a19" order="A"></bond>
                                <bond id="b19" atomRefs2="a9 a19" order="A"></bond>
                                <bond id="b20" atomRefs2="a19 a20" order="1"></bond>
                            </bondArray>
                        </molecule>
                        <molecule molID="m2">
                            <atomArray atomID="a1" elementType="H" radical="monovalent"></atomArray>
                            <bondArray></bondArray>
                        </molecule>
                    </reactantList>
                    <productList>
                        <molecule molID="m3">
                            <atomArray atomID="a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18 a19 a20 a21 a22" elementType="O H C H C H C H C H C H C H C H H C H C H H" mrvMap="4 0 5 0 6 0 7 0 8 0 9 0 10 0 1 0 0 2 0 3 0 0"></atomArray>
                            <bondArray>
                                <bond id="b1" atomRefs2="a1 a2" order="1"></bond>
                                <bond id="b2" atomRefs2="a1 a3" order="1"></bond>
                                <bond id="b3" atomRefs2="a3 a4" order="1"></bond>
                                <bond id="b4" atomRefs2="a3 a5" order="A"></bond>
                                <bond id="b5" atomRefs2="a5 a6" order="1"></bond>
                                <bond id="b6" atomRefs2="a5 a7" order="A"></bond>
                                <bond id="b7" atomRefs2="a7 a8" order="1"></bond>
                                <bond id="b8" atomRefs2="a7 a9" order="A"></bond>
                                <bond id="b9" atomRefs2="a9 a10" order="1"></bond>
                                <bond id="b10" atomRefs2="a9 a11" order="A"></bond>
                                <bond id="b11" atomRefs2="a11 a12" order="1"></bond>
                                <bond id="b12" atomRefs2="a11 a13" order="A"></bond>
                                <bond id="b13" atomRefs2="a3 a13" order="A"></bond>
                                <bond id="b14" atomRefs2="a13 a14" order="1"></bond>
                                <bond id="b15" atomRefs2="a13 a15" order="1"></bond>
                                <bond id="b16" atomRefs2="a15 a16" order="1"></bond>
                                <bond id="b17" atomRefs2="a15 a17" order="1"></bond>
                                <bond id="b18" atomRefs2="a15 a18" order="1"></bond>
                                <bond id="b19" atomRefs2="a18 a19" order="1"></bond>
                                <bond id="b20" atomRefs2="a18 a20" order="2">
                                    <bondStereo convention="MDL" conventionValue="3"></bondStereo>
                                </bond>
                                <bond id="b21" atomRefs2="a20 a21" order="1"></bond>
                                <bond id="b22" atomRefs2="a20 a22" order="1"></bond>
                            </bondArray>
                        </molecule>
                    </productList>
                </reaction>
            </MChemicalStruct>
        </MDocument>
    </cml>



which still has hydrogens (they disappear when I click "add/remove explicit H"


 


Moreover, after the procedure both substrates and products are on the same side of reaction arrow, like shown in attachment.


How do I solve this problem?


Regards,


Krzysztof

ChemAxon 76c88f5366

08-11-2016 16:58:39

Hi Krzysztof,


Please try the following :


1. Convert your smiles into MRV format with MolExport web service call (You can try this in JChem Web Services API examples 8.1 Simple Format Conversion part).


2. Try to call Hydrogenize web service with the following in the body (You can try this in JChem Web Services API examples 8.7 Hydrogenize/Dehydrogenize Structure part):


{


"structure":"MRV source that you converted from your SMILES in the 1. section",


"parameters":{


"method":"DEHYDROGENIZE"


}



This should give you an MRV which contains no explicitly defined Hydrogen if you import the response MRV into Marvin JS.


Did this work for you? If not, we will need more details about how you called the web service, and your workflow.


Regards,
Eszter


  



User e563474d4f

08-11-2016 17:12:34

Dear Eszter,


thank you very much for your response. I find it very helpful and it does all I need, however when I call dehydrogenizer with this data:



{
    "structure": '<?xml version="1.0" encoding="UTF-8"?><cml xmlns="http://www.chemaxon.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.chemaxon.com/marvin/schema/mrvSchema_16_02_15.xsd" version="ChemAxon file format v16.02.15, generated by v16.4.18.0">
<MDocument><MChemicalStruct><reaction><arrow type="DEFAULT" x1="-1.092183977158525" y1="-0.10763951676132633" x2="2.8891368264355677" y2="-0.10763951676132633"></arrow><reactantList><molecule molID="m1"><atomArray atomID="a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18 a19 a20 a21" elementType="C H H C H C H H O C H C H C H C H C H C H" mrvMap="1 0 0 2 0 3 0 0 4 5 0 6 0 7 0 8 0 9 0 10 0" lonePair="0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0" x2="-11.71471648731214 -11.714716487312137 -13.048395609140176 -10.381037365484104 -9.047358243656069 -10.381037365484108 -11.918431929221862 -11.227281191713152 -9.047358243656074 -9.047358243656076 -10.38103736548411 -7.713679121828037 -6.380000000000001 -7.713679121828041 -6.380000000000006 -9.047358243656078 -9.04735824365608 -10.381037365484111 -11.714716487312149 -10.381037365484111 -11.92103736548411" y2="3.850000000000004 5.390000000000003 3.0800000000000063 3.080000000000001 3.8500000000000005 1.54 1.4504569634778708 0.25334877042408 0.7699999999999991 -0.7700000000000009 8.881784197001252E-16 -1.540000000000005 -0.7700000000000071 -3.080000000000005 -3.850000000000007 -3.8500000000000028 -5.390000000000003 -3.080000000000001 -3.8499999999999996 -1.540000000000001 -1.5400000000000003"></atomArray><bondArray><bond id="b1" atomRefs2="a1 a2" order="1"></bond><bond id="b2" atomRefs2="a1 a3" order="1"></bond><bond id="b3" atomRefs2="a1 a4" order="2"></bond><bond id="b4" atomRefs2="a4 a5" order="1"></bond><bond id="b5" atomRefs2="a4 a6" order="1"></bond><bond id="b6" atomRefs2="a6 a7" order="1"></bond><bond id="b7" atomRefs2="a6 a8" order="1"></bond><bond id="b8" atomRefs2="a6 a9" order="1"></bond><bond id="b9" atomRefs2="a9 a10" order="1"></bond><bond id="b10" atomRefs2="a10 a11" order="1"></bond><bond id="b11" atomRefs2="a10 a12" order="A"></bond><bond id="b12" atomRefs2="a10 a20" order="A"></bond><bond id="b13" atomRefs2="a12 a13" order="1"></bond><bond id="b14" atomRefs2="a12 a14" order="A"></bond><bond id="b15" atomRefs2="a14 a15" order="1"></bond><bond id="b16" atomRefs2="a14 a16" order="A"></bond><bond id="b17" atomRefs2="a16 a17" order="1"></bond><bond id="b18" atomRefs2="a16 a18" order="A"></bond><bond id="b19" atomRefs2="a18 a19" order="1"></bond><bond id="b20" atomRefs2="a18 a20" order="A"></bond><bond id="b21" atomRefs2="a20 a21" order="1"></bond></bondArray></molecule><molecule molID="m2"><atomArray atomID="a1" elementType="H" radical="monovalent" x2="-3.08" y2="-0.2855330602903843"></atomArray><bondArray></bondArray></molecule></reactantList><productList><molecule molID="m3"><atomArray atomID="a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18 a19 a20 a21 a22" elementType="O H C H C H C H C H C H C H C H H C H C H H" mrvMap="4 0 5 0 6 0 7 0 8 0 9 0 10 0 1 0 0 2 0 3 0 0" lonePair="2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0" x2="10.174716487312141 11.508395609140178 10.17471648731214 8.841037365484105 11.508395609140177 12.842074730968214 11.508395609140173 12.842074730968209 10.174716487312137 10.174716487312136 8.841037365484102 7.507358243656066 8.841037365484103 10.17471648731214 7.507358243656069 5.9699636799183144 6.661114417427027 7.5073582436560695 8.27735824365607 6.173679121828035 6.173679121828035 4.839999999999999" y2="1.9250000000000003 2.6949999999999976 0.38500000000000023 1.155000000000002 -0.3850000000000038 0.384999999999994 -1.9250000000000038 -2.695000000000006 -2.6950000000000016 -4.235000000000001 -1.9249999999999994 -2.6949999999999985 -0.3849999999999998 -1.1550000000000002 0.3850000000000007 0.2954569634778692 -0.9016512295759207 1.9250000000000007 3.2586791218280355 2.695000000000001 4.235000000000001 1.925000000000003"></atomArray><bondArray><bond id="b1" atomRefs2="a1 a2" order="1"></bond><bond id="b2" atomRefs2="a1 a3" order="1"></bond><bond id="b3" atomRefs2="a3 a4" order="1"></bond><bond id="b4" atomRefs2="a3 a5" order="A"></bond><bond id="b5" atomRefs2="a3 a13" order="A"></bond><bond id="b6" atomRefs2="a5 a6" order="1"></bond><bond id="b7" atomRefs2="a5 a7" order="A"></bond><bond id="b8" atomRefs2="a7 a8" order="1"></bond><bond id="b9" atomRefs2="a7 a9" order="A"></bond><bond id="b10" atomRefs2="a9 a10" order="1"></bond><bond id="b11" atomRefs2="a9 a11" order="A"></bond><bond id="b12" atomRefs2="a11 a12" order="1"></bond><bond id="b13" atomRefs2="a11 a13" order="A"></bond><bond id="b14" atomRefs2="a13 a14" order="1"></bond><bond id="b15" atomRefs2="a13 a15" order="1"></bond><bond id="b16" atomRefs2="a15 a16" order="1"></bond><bond id="b17" atomRefs2="a15 a17" order="1"></bond><bond id="b18" atomRefs2="a15 a18" order="1"></bond><bond id="b19" atomRefs2="a18 a19" order="1"></bond><bond id="b20" atomRefs2="a18 a20" order="2"></bond><bond id="b21" atomRefs2="a20 a21" order="1"></bond><bond id="b22" atomRefs2="a20 a22" order="1"></bond></bondArray></molecule></productList></reaction></MChemicalStruct><MElectronContainer id="o2" occupation="0 0" radical="0"><MElectron atomRefs="m1.a9" difLoc="0.0 0.0 0.0"></MElectron><MElectron atomRefs="m1.a9" difLoc="0.0 0.0 0.0"></MElectron></MElectronContainer><MElectronContainer id="o3" occupation="0" radical="1"><MElectron atomRefs="m2.a1" difLoc="0.0 0.0 0.0"></MElectron></MElectronContainer><MElectronContainer id="o4" occupation="0 0" radical="0"><MElectron atomRefs="m3.a1" difLoc="0.0 0.0 0.0"></MElectron><MElectron atomRefs="m3.a1" difLoc="0.0 0.0 0.0"></MElectron></MElectronContainer></MDocument>
</cml>',
    "parameters": {
        "method": "DEHYDROGENIZE"
    }
}


 



I recieve this output (for how MarvinJS draws it, see the attachment):



<?xml version="1.0" encoding="UTF-8"?>
    <cml xmlns="http://www.chemaxon.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.chemaxon.com/marvin/schema/mrvSchema_16_02_15.xsd" version="ChemAxon file format v16.02.15, generated by v16.4.18.0">
        <MDocument>
            <MChemicalStruct>
                <reaction>
                    <arrow type="DEFAULT" x1="-1.092183977158525" y1="-0.10763951676132633" x2="2.8891368264355677" y2="-0.10763951676132633"></arrow>
                    <reactantList>
                        <molecule molID="m1">
                            <atomArray atomID="a1 a2 a3 a4 a5 a6 a7 a8 a9 a10" elementType="C C C O C C C C C C" mrvMap="1 2 3 4 5 6 7 8 9 10" lonePair="0 0 0 2 0 0 0 0 0 0" x2="-11.71471648731214 -10.381037365484104 -10.381037365484108 -9.047358243656074 -9.047358243656076 -7.713679121828037 -7.713679121828041 -9.047358243656078 -10.381037365484111 -10.381037365484111" y2="3.850000000000004 3.080000000000001 1.54 0.7699999999999991 -0.7700000000000009 -1.540000000000005 -3.080000000000005 -3.8500000000000028 -3.080000000000001 -1.540000000000001"></atomArray>
                            <bondArray>
                                <bond id="b1" atomRefs2="a1 a2" order="2"></bond>
                                <bond id="b2" atomRefs2="a2 a3" order="1"></bond>
                                <bond id="b3" atomRefs2="a3 a4" order="1"></bond>
                                <bond id="b4" atomRefs2="a4 a5" order="1"></bond>
                                <bond id="b5" atomRefs2="a5 a6" order="A"></bond>
                                <bond id="b6" atomRefs2="a5 a10" order="A"></bond>
                                <bond id="b7" atomRefs2="a6 a7" order="A"></bond>
                                <bond id="b8" atomRefs2="a7 a8" order="A"></bond>
                                <bond id="b9" atomRefs2="a8 a9" order="A"></bond>
                                <bond id="b10" atomRefs2="a9 a10" order="A"></bond>
                            </bondArray>
                        </molecule>
                        <molecule molID="m2">
                            <atomArray atomID="" elementType="" x2="" y2=""></atomArray>
                            <bondArray></bondArray>
                        </molecule>
                    </reactantList>
                    <productList>
                        <molecule molID="m3">
                            <atomArray atomID="a1 a2 a3 a4 a5 a6 a7 a8 a9 a10" elementType="O C C C C C C C C C" mrvMap="4 5 6 7 8 9 10 1 2 3" lonePair="2 0 0 0 0 0 0 0 0 0" x2="10.174716487312141 10.17471648731214 11.508395609140177 11.508395609140173 10.174716487312137 8.841037365484102 8.841037365484103 7.507358243656069 7.5073582436560695 6.173679121828035" y2="1.9250000000000003 0.38500000000000023 -0.3850000000000038 -1.9250000000000038 -2.6950000000000016 -1.9249999999999994 -0.3849999999999998 0.3850000000000007 1.9250000000000007 2.695000000000001"></atomArray>
                            <bondArray>
                                <bond id="b1" atomRefs2="a1 a2" order="1"></bond>
                                <bond id="b2" atomRefs2="a2 a3" order="A"></bond>
                                <bond id="b3" atomRefs2="a2 a7" order="A"></bond>
                                <bond id="b4" atomRefs2="a3 a4" order="A"></bond>
                                <bond id="b5" atomRefs2="a4 a5" order="A"></bond>
                                <bond id="b6" atomRefs2="a5 a6" order="A"></bond>
                                <bond id="b7" atomRefs2="a6 a7" order="A"></bond>
                                <bond id="b8" atomRefs2="a7 a8" order="1"></bond>
                                <bond id="b9" atomRefs2="a8 a9" order="1"></bond>
                                <bond id="b10" atomRefs2="a9 a10" order="2"></bond>
                            </bondArray>
                        </molecule>
                    </productList>
                </reaction>
            </MChemicalStruct>
            <MElectronContainer id="o2" occupation="0 0" radical="0">
                <MElectron atomRefs="m1.a4" difLoc="0.0 0.0 0.0"></MElectron>
                <MElectron atomRefs="m1.a4" difLoc="0.0 0.0 0.0"></MElectron>
            </MElectronContainer>
            <MElectronContainer id="o3" occupation="0 0" radical="0">
                <MElectron atomRefs="m3.a1" difLoc="0.0 0.0 0.0"></MElectron>
                <MElectron atomRefs="m3.a1" difLoc="0.0 0.0 0.0"></MElectron>
            </MElectronContainer>
        </MDocument>
    </cml>


 



As you can see in the picture there is a floating '+' sign. How do I remove it before showing the output to the user?


 


Regards,


Krzysztof

ChemAxon f052bdfe3c

09-11-2016 10:48:25

Hello Krysztof,


Unfortunately, we cannot solve this problem currently. Is there any way that you could check the original SMILES string with a script and remove the H or H2 if it is a stand alone molecule?


Best regards,


Efi

User e563474d4f

09-11-2016 11:45:16

Hi Efi,


 


thank you for your answer. I can do it with a script, a few regex substitutions should do the trick.


 


Thank you very much for your help,


Regards,


Krzysztof