Maybe try this:

convert the SDF file to SMILES.

$ obabel input.sdf -O output.smi

Then, add the names in the SMILES file with some unix commands (provided you have the list of names in the same order than the molecules in your SDF file,
then convert back to SDF).
Note that this will loose the 3D coordinates, if you have them in the input SDF file.

Then, back to sdf:

$ obabel output_w_names.smi -O input_w_names.sdf

I think I have done something like this in the past,
and openbabel was placing the name as the first line in each
SDF block (which is what I expect, and is more useful
than a name property with I don't know what tag someone gave it,
and tag name always changing depending on which software generated the SDF file)...

Regards,
F.

On 16/04/2020 03:13, Bennion, Brian via OpenBabel-discuss wrote:
More context.  I have 500K ligands in a single sdf file.  The names
for each ligand was found after the sdf file was created.  I would
like to either replace the label at the top with the appropriate title
or add to a property value.  Unfortunately, I and others at LLNL have
never been able to compile python bindings to obabel.
I am not familiar with pybabel but can look at it.
Due to the source of the sdf files RDKit chokes on about 50% of them
so manipulation is not easy there.

Brian


-----Original Message-----
From: openbabel-discuss-requ...@lists.sourceforge.net
<openbabel-discuss-requ...@lists.sourceforge.net>
Sent: Tuesday, April 14, 2020 6:55 AM
To: openbabel-discuss@lists.sourceforge.net
Subject: OpenBabel-discuss Digest, Vol 167, Issue 10

Send OpenBabel-discuss mailing list submissions to
        openbabel-discuss@lists.sourceforge.net

To subscribe or unsubscribe via the World Wide Web, visit
        https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
or, via email, send a message with subject or body 'help' to
        openbabel-discuss-requ...@lists.sourceforge.net

You can reach the person managing the list at
        openbabel-discuss-ow...@lists.sourceforge.net

When replying, please edit your Subject line so it is more specific
than "Re: Contents of OpenBabel-discuss digest..."


Today's Topics:

   1. Re: Operating on multi molecule sdf files (Geoffrey Hutchison)
   2. Structure size scaling in 2D depiction (Bakary N'tji Diallo)


----------------------------------------------------------------------

Message: 1
Date: Tue, 14 Apr 2020 09:53:59 -0400
From: Geoffrey Hutchison <geoff.hutchi...@gmail.com>
To: "Bennion, Brian" <benni...@llnl.gov>
Cc: "openbabel-discuss@lists.sourceforge.net"
        <openbabel-discuss@lists.sourceforge.net>
Subject: Re: [Open Babel] Operating on multi molecule sdf files
Message-ID: <ed95515b-3d5f-48a4-89eb-dad0a2adf...@gmail.com>
Content-Type: text/plain; charset="utf-8"

After reading the docs I think that adding individual properties to individual molecules in a multi molecule sdf files is probably not possible? I have an sdf file with 500k molecules and I would like to add a little unique identifier that isn?t a supported descriptor to each molecule and then write out the altered sdf file.

Personally,  I'd do this with a quick Python script, since a Pybel
molecule has a data property:
https://open-babel.readthedocs.io/en/latest/UseTheLibrary/Python_PybelAPI.html#pybel.Molecule.data
<https://open-babel.readthedocs.io/en/latest/UseTheLibrary/Python_PybelAPI.html#pybel.Molecule.data>

-Geoff

-------------- next part --------------
An HTML attachment was scrubbed...

------------------------------

Message: 2
Date: Mon, 13 Apr 2020 21:07:56 +0200
From: "Bakary N'tji Diallo" <diallobaka...@gmail.com>
To: "openbabel-discuss@lists.sourceforge.net mailinglist"
        <openbabel-discuss@lists.sourceforge.net>
Subject: [Open Babel] Structure size scaling in 2D depiction
Message-ID:
        <CABWhgwRcq0kT1451K=JUeiH8=bu1xjo+qwsjkoj6hpjfwyg...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

Dear all,

I have the following depiction for a structure file. As you can see
the first compound is scaled up.

[image: image.png]
Is there way to maintain a uniform structure size.
I am using the following command: "obabel structure.smi -O out.svg -xC -xe -d"

Thanks
Best regards
--

Bakary N?tji DIALLO

PhD Student (Bioinformatics) <http://linkedin.com/in/bakarydiallo>,
Research Unit in Bioinformatics (RUBi) <https://rubi.ru.ac.za/>

Mail: diallobaka...@gmail.com |  Skype: diallobakary4

Tel:  +27798233845 | +223 74 56 57 22 | +223 97 39 77 14
-------------- next part --------------
An HTML attachment was scrubbed...
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 33868 bytes
Desc: not available

------------------------------



------------------------------

Subject: Digest Footer

_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


------------------------------

End of OpenBabel-discuss Digest, Vol 167, Issue 10
**************************************************


_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

Reply via email to