SMILES from Chemical Structure

ChemAxon bd13b5bd77

05-07-2011 08:30:22

Dear Pranav,


preparing an short example to you ....


Viktor

ChemAxon bd13b5bd77

05-07-2011 10:07:15

         ChemAxon.NET.Base.View.IMoleculeEditorView editor = new ChemAxon.NET.Windows.Forms.MarvinEditorControl.MarvinSketchForm();
         editor.Title = "YOUR TITLE";
         if (editor.ShowAsDialog()) {
            var converter = new ChemAxon.NET.IKVM.Chemistry.MolConverter();
            var smiles = converter.ConvertToStringFormat(editor.MoleculeString, editor.MoleculeFormat, "SMILES");
            Console.WriteLine(smiles);
         }

User 430a6f7654

05-07-2011 10:21:56

Thanks for your reply.


Before writing this code, please let me know the dll which I need to add as reference in my Visual Studio project.


 


Thanks

ChemAxon bd13b5bd77

05-07-2011 11:00:44

ChemAxon.NET.* dlls please.

User 430a6f7654

05-07-2011 11:40:11

I have tried to run your code but I am getting the following error:


Error 1 The type 'System.Windows.Forms.Form' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. C:\WorkArea\ConsoleApplication2\ConsoleApplication2\Program.cs 14 13 ConsoleApplication2


 


Following are the dll I have refernced in .NET Console application:


ChemAxon.NET.Base.dll


ChemAxon.NET.dll


ChemAxon.NET.IKVM.dll


ChemAxon.NET.Windows.Forms.dll


 


Kindly explain me in detail what wrong I am doing

ChemAxon bd13b5bd77

05-07-2011 12:06:30

I think you should reference this assembly 'System.Windows.Forms.Form' as in the error message the .NET framework  reports to you.

User 430a6f7654

06-07-2011 03:45:59

Hi,


 


Thanks a lot for your quick help. The code is working for me. Now I want to fetch chemical name from the structure. Like if I draw Benzine ring and press ok, I should get its name.Please let me know how can I use the converter variable to get the name for structure drwan.


 


Thanks

ChemAxon bd13b5bd77

06-07-2011 08:40:04

         ChemAxon.NET.Base.View.IMoleculeEditorView editor = new ChemAxon.NET.Windows.Forms.MarvinEditorControl.MarvinSketchForm();
         editor.Title = "YOUR TITLE";
         if (editor.ShowAsDialog()) {
            var converter = new ChemAxon.NET.IKVM.Chemistry.MolConverter();
            var smiles = converter.ConvertToStringFormat(editor.MoleculeString, editor.MoleculeFormat, "SMILES");


            var source = new ChemAxon.NET.Base.Chemistry.MoleculeValueFormat(new ChemAxon.NET.Base.Marvin.Formats.MRVFormat(), editor.MoleculeString);
            var name = converter.ConvertToFormat(source, new ChemAxon.NET.Base.Marvin.Formats.IUPACNameFormat());
            Console.WriteLine(smiles);
            Console.WriteLine(name.Value.StringValue);
         }

User 430a6f7654

07-07-2011 07:03:55

Hi,


The code to fetch SMILES from the structured drawn is working fine for me. But can we tweak the code a bit to remove following limitation:


1) When ever I run the code at a button click event without closing the previous pop up window a new window opens. This opens multiple pop up window where as only one pop up window should be active at a time. I think we need to check here "editor.ShowAsDialog() " if the pop up window is aleady open.


2) The pop window needs to be always on top of the main aspx page. Sometimes the pop up window open but in minimized state. 


Kindly guide me how to remove above two limitations.


Thanks.


 

User 9c7da4ff36

31-08-2011 23:28:24

Hi All,


            Can anyone please help me writing the SMILE string for the DIYNE PE molecule , shown in the following link. I am pretty new in using SMILE string and don't know exactly how to do it. 


 


link for the formula/structure of DIYNE PE molecule :


 


http://avantilipids.com/index.php?option=com_content&view=article&id=1162&Itemid=181&catnumber=790145


 


Thanks in advance.


 


Regards,


 


Pritam 

ChemAxon 0e37943a96

01-09-2011 06:40:24

Hi Pritam,


please read the following sections from our User Guide:


Working with Structures - Open single structure file


Working with Structures - Convert to SMILES


Best regards,


Tamas.


 

User eea3b341a1

23-10-2013 20:13:05

Hello,


I tried to use the code provided in this thread to get the SMILES string from the MarvinSketchForm, however, ChemAxon.NET.IKVM.Chemistry.MolConverter() is not showing up in the object browser, the only available option is the JChemMolConverter.  I have a reference to C:\Program Files (x86)\ChemAxon\ChemAxon .NET 6.1.2.2\ChemAxon.Net.IKVM.dll, is this an incorrect version of the .dll or am I doing something else wrong?


Regards,


Jim

ChemAxon bd13b5bd77

23-10-2013 20:29:51

Hi Jim,


you do everything properly, but the APi has changed (improved) a little bit since then. The post was written in 2011 originally. The API loks better and simpler nowadays please check this code:


         ChemAxon.NET.Base.View.IMoleculeEditorView editor = new ChemAxon.NET.Windows.Forms.MarvinEditorControl.MarvinSketchForm();
         editor.Text = "YOUR TITLE";
         if (editor.ShowAsDialog() == ChemAxon.NET.Base.View.DialogResponse.OK) {
             var molecule = new ChemAxon.NET.IKVM.Chemistry.JChemMolecule(editor.MoleculeData);
             var name = molecule.Representations.Represent(ChemAxon.NET.Base.Chemistry.Formats.MoleculeFormat.NAME);
             Console.WriteLine(name.StringData);
         }


If you would like to get more detailed documentation about the API please check the development folder:


http://www.chemaxon.com/download.php?d=/data/download/jchem/devel


Next year (2014) we are planning to roll out a more setlled APi including the database parts, which is only missinig from our portfolio.


Thanks,
Viktor


 

ChemAxon bd13b5bd77

23-10-2013 21:25:47


 If you need SMILES instead of the name:



 



 



var smiles = molecule.Representations.Represent(ChemAxon.NET.Base.Chemistry.Formats.MoleculeFormat.SMILES);
Console.WriteLine(smiles.StringData);


you need to use the representation object of a molecule.