Re: [Open Babel] Visual Studio 2015 C# Initialization Exception, .dll's are Obfuscated?

2018-06-06 Thread Noel O'Boyle
We need more details to help diagnose the problem. The best place to do
this is over in our issue tracker at http://github.com/openbabel/issues.
We'll need to know exactly what you did step by step, starting with what
exactly did you download, etc.

The problem could be anything unfortunately. This error message is
triggered by any mismatch of the .NET and native code. For example, you may
have used the 32-bit .NET dll with the .64 bit native dll. You may have an
old version of Open Babel installed, and there was a mismatch there. Etc,
etc. If you can take us through the steps one by one, we should be able to
get to the bottom of this.

We don't obfuscate anything, at least not intentionally. If there's
something amiss, let us know.

- Noel


On 4 June 2018 at 13:35, Leif Peterson  wrote:

> 1.   I loaded all the .dlls in the executable folder, and also
> Reference the OBDotNet.dll in the VS 2015 (C#) within the project, and am
> getting an exception
>
>
>
> Additional information: The type initializer for 
> 'OpenBabel.openbabel_csharpPINVOKE'
> threw an exception.
>
>
>
> Example code is below:
>
>
>
> using System;
>
> using System.Collections.Generic;
>
> using System.Linq;
>
> using System.Threading.Tasks;
>
> using System.Windows.Forms;
>
> using OpenBabel;
>
>
>
>
>
> namespace MyConsoleApplication
>
> {
>
> class Program
>
> {
>
> static void Main(string[] args)
>
> {
>
> OBConversion obconv = new OBConversion(); * //**ß** Exception
> thrown here.*
>
> obconv.SetInFormat("smi");
>
> OBMol mol = new OBMol();
>
> obconv.ReadString(mol, "CCC");
>
> double mowwt = mol.GetMolWt();
>
> var smowwt = mowwt.ToString();
>
> MessageBox.Show(smowwt);
>
> }
>
> }
>
> }
>
>
>
> 2.   It seems that the .dlls are obfuscated as well, so how open is
> OpenBabel?
>
>
>
> LP
>
> 
> --
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
>
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


[Open Babel] obfit question

2018-06-06 Thread John Michael Bruning
Hi,


I am trying to align 2 molecules with obfit based on a pharmacaphore. I am 
running it as:


obfit 'c2c(-[#7]-[#6](-c1cccnc1)=[#8])scn2' reference.sd moving.sd > aligned.sd


When I use obabel to convert from .sd to .png this is the ouput:


[cid:e20d815f-f6f0-443b-afe9-aa7201cfc086]

Am I incorrectly running obfit, or am I misinterpreting what obfit does? Thanks 
for any help!


Cheers,

 John




Cheers,

 John


***

John Bruning, Post-Doctoral Scholar

Stanford University, Glenn Lab

CCSR Building, #3110

***

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] obfit question

2018-06-06 Thread Geoffrey Hutchison
> Am I incorrectly running obfit, or am I misinterpreting what obfit does? 
> Thanks for any help!

You're mis-interpreting what obfit does. It operates in 3D coordinates. So what 
you're doing is okay - but if you then generate a PNG, you've thrown away the 
3D coordinates.

If you want to see if obfit is operating correctly, open the resulting file in 
PyMol or Avogadro or some similar 3D viewer.

If you want to highlight a SMARTS pattern in a depiction, you want something 
different:
http://open-babel.readthedocs.io/en/latest/Command-line_tools/Rosetta.html#align-the-depiction-using-a-fixed-substructure
 


Hope that helps,
-Geoff

---
Prof. Geoffrey Hutchison
Department of Chemistry
University of Pittsburgh
tel: (412) 648-0492
email: geo...@pitt.edu
twitter: @ghutchis
web: https://hutchison.chem.pitt.edu/

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] obfit question

2018-06-06 Thread John Michael Bruning
Ahhh, that makes sense. Thank you for the clarification!

Get Outlook for iOS

From: Geoffrey Hutchison 
Sent: Wednesday, June 6, 2018 5:55:40 PM
To: John Michael Bruning
Cc: openbabel-discuss@lists.sourceforge.net
Subject: Re: [Open Babel] obfit question

Am I incorrectly running obfit, or am I misinterpreting what obfit does? Thanks 
for any help!

You're mis-interpreting what obfit does. It operates in 3D coordinates. So what 
you're doing is okay - but if you then generate a PNG, you've thrown away the 
3D coordinates.

If you want to see if obfit is operating correctly, open the resulting file in 
PyMol or Avogadro or some similar 3D viewer.

If you want to highlight a SMARTS pattern in a depiction, you want something 
different:
http://open-babel.readthedocs.io/en/latest/Command-line_tools/Rosetta.html#align-the-depiction-using-a-fixed-substructure

Hope that helps,
-Geoff

---
Prof. Geoffrey Hutchison
Department of Chemistry
University of Pittsburgh
tel: (412) 648-0492
email: geo...@pitt.edu
twitter: @ghutchis
web: https://hutchison.chem.pitt.edu/

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] RESOLVED -- OpenBabel.openbabel_csharpPINVOKE Exception (error) in .NET

2018-06-06 Thread Noel O'Boyle
Thanks - very comprehensive. Hopefully this will be useful to point to for
future .NET users.

On 7 June 2018 at 01:06, Leif Peterson  wrote:

> RESOLVED.  I got .NET working by selecting “x64” in the Build option of
> .NET, because I originally installed the 64-bit version of the Windows
> GUI.  Basically, I learned that the following are required to get .NET
> working (C# or VB.NET) with the OBDotNet.dll assembly:
>
>
>
> 1). *Download* either the 32-bit (x86) or 64-bit (x64) version of the
> OpenBabel Windows GUI program and install, depending on what version of
> Windows 10 is installed on the machine (32-bit or 64-bit).
>
>
>
> 2). *Reference the .dll within the .NET Project:* Within the .NET
> Project, on the right panel under Solution Explorer, right-click on
> References, select Add ReferenceàBrowse, and then go to the folder:
>
>
>
> C:\Program Files\OpenBabel-2.4.1  (if 64-bit versions of Windows is being
> used.  FYI - version 2.4.1 of the 64-bit Windows GUI of OpenBabel was
> installed)
>
>
>
> C:\Program Files (x86)\OpenBabel-2.4.1  (if a 32-bit version of Windows is
> being. Users would need to install the 32-bit version of the Windows GUI of
> OpenBabel)
>
>
>
> Then, double-click on the file OBDotNet.dll, and the assembly will now be
> referenced inside the .NET project.
>
>
>
> 3). *Set the version of Windows to be used by the compiled project
> executable (projectname.exe): *Within .NET, select from the top menu
> ProjectàProjectName PropertiesàBuild, and set “Project target” to x64
> (for 64-bit) and x86 for 32-bit Windows.   Don’t use “Any CPU,” since this
> option is used when “Prefer 32-bit” is or is not checked.  This is a way to
> have the user’s Windows decide automatically whether your package should be
> installed in the 32-bit “C:\Program Files (x86)” folder or the 64-bit
> folder “C:\Program Files.  (To use OpenBabel’s .NET assembly, everything
> has to be married up regarding 32-bit or 64-bit, since there are two
> issues: (a) is 32-bit or 64-bit OpenBabel Windows GUI installed?, and (b)
> is the Windows 32-bit or 64-bit?  Thus, you don’t want your Windows or a
> user’s Windows that installs your distributed package deciding on its own
> what to do.
>
>
>
> 4). *Copy the OBDotNet.dll file* from folder C:\Program
> Files\OpenBabel-2.4.1  (where the 64-bit GUI program is installed) and
> paste into folder C:\...wherever the .NET project is …\OpenBabel\bin\Debug
> as well as C:\...wherever the .NET project is…\OpenBabel\bin\Release.
>
>
>
> 5). *Compile* the example code listed above, and the molecular weight of
> propane 44.0596 will appear in the popup-window.
>
>
>
> 6). *Run* the compiled executable file (assembly) by double-clicking
> OpenBabel.exe in folder \bin\Debug if the compile option was “Debug,” or in
> the \bin\Release folder if the “Release” option was used during compiling.
>
> The above should work for anyone experiencing the 
> 'OpenBabel.openbabel_csharpPINVOKE'
> error in windows when using .NET.   Usage of C# or VB.NET should not
> matter.   Obviously, use Visual Studio 2010, 2015, 2017, etc., and not
> Visual Studio 8 or earlier.   The Community version of VS is always free.
>
>
>
> ---
>
>
>
> *Sent:* Wednesday, June 6, 2018 8:49 AM
> *Subject:* Re: [Open Babel] Visual Studio 2015 C# Initialization
> Exception, .dll's are Obfuscated?
>
>
>
> We need more details to help diagnose the problem. The best place to do
> this is over in our issue tracker at http://github.com/openbabel/issues.
> We'll need to know exactly what you did step by step, starting with what
> exactly did you download, etc.
>
>
>
> The problem could be anything unfortunately. This error message is
> triggered by any mismatch of the .NET and native code. For example, you may
> have used the 32-bit .NET dll with the .64 bit native dll. You may have an
> old version of Open Babel installed, and there was a mismatch there. Etc,
> etc. If you can take us through the steps one by one, we should be able to
> get to the bottom of this.
>
>
>
> We don't obfuscate anything, at least not intentionally. If there's
> something amiss, let us know.
>
>
>
> ---
>
>
>
>
>
> On 4 June 2018 at 13:35
>
>
>
> I loaded all the .dlls in the executable folder, and also Reference the
> OBDotNet.dll in the VS 2015 (C#) within the project, and am getting an
> exception
>
>
>
> Additional information: The type initializer for 
> 'OpenBabel.openbabel_csharpPINVOKE'
> threw an exception.
>
>
>
> Example code is below:
>
>
>
> using System;
>
> using System.Collections.Generic;
>
> using SystemLinq;
>
> using System.Threading.Tasks;
>
> using System.Windows.Forms;
>
> using OpenBabel;
>
>
>
>
>
> namespace MyConsoleApplication
>
> {
>
> class Program
>
> {
>
> static void Main(string[] args)
>
> {
>
> OBConversion obconv = new OBConversion(); * //**ß** Exception
> thrown here*
>
> obconv.SetInF

Re: [Open Babel] obfit question

2018-06-06 Thread Noel O'Boyle
Just to add, if you wish to align two depictions it's possible via the
obabel executable:

$ obabel tmp.smi -s "[#6]Cl blue" -O tmp.svg --align "[#6]Cl"

Unfortunately, the align operation does not appear to work if not
outputting to an image:

$ obabel tmp.smi -O tmp.sdf  --align "[#6]Cl"
==
*** Open Babel Error  in OpenBabel::OBAlign::Align
  Cannot align the reference and target as they are of different size
1 molecule converted

...so you would have to do this programmatically via the API.

- Noel

On 7 June 2018 at 01:57, John Michael Bruning  wrote:

> Ahhh, that makes sense. Thank you for the clarification!
>
> Get Outlook for iOS 
> --
> *From:* Geoffrey Hutchison 
> *Sent:* Wednesday, June 6, 2018 5:55:40 PM
> *To:* John Michael Bruning
> *Cc:* openbabel-discuss@lists.sourceforge.net
> *Subject:* Re: [Open Babel] obfit question
>
>
> Am I incorrectly running obfit, or am I misinterpreting what obfit does?
> Thanks for any help!
>
>
> You're mis-interpreting what obfit does. It operates in 3D coordinates. So
> what you're doing is okay - but if you then generate a PNG, you've thrown
> away the 3D coordinates.
>
> If you want to see if obfit is operating correctly, open the resulting
> file in PyMol or Avogadro or some similar 3D viewer.
>
> If you want to highlight a SMARTS pattern in a depiction, you want
> something different:
> http://open-babel.readthedocs.io/en/latest/Command-line_
> tools/Rosetta.html#align-the-depiction-using-a-fixed-substructure
>
> Hope that helps,
> -Geoff
>
> ---
> Prof. Geoffrey Hutchison
> Department of Chemistry
> University of Pittsburgh
> tel: (412) 648-0492
> email: geo...@pitt.edu 
> twitter: @ghutchis
> web: https://hutchison.chem.pitt.edu/
>
>
> 
> --
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
>
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss