obabel -Hinchi lists the options. Read option 'n' will do it.

obabel -:"InChI=1S/C2H6O/c1-2-3/h3H,2H2,1H3 Noel" -iinchi -osmi -an
CCO     Noel

More importantly, do not convert InChIs to SMILES without understanding the
caveats. InChI is not a storage format for chemical structures.

Regards,
Noel

On Fri, 7 Jul 2023 at 02:26, Francois Berenger <mli...@ligand.eu> wrote:

> Dear Sivani,
>
> Maybe, put all the identifiers in a new file using shell commands:
>
> $ obabel input.inchi -O output.smi
> $ cut -f2 input.inchi > input.names
>
> If the obabel conversion doesn't remove any line, it should be safe
> to use the following unix command:
>
> $ paste output.smi input.names > named_output.smi
>
> Regards,
> F.
>
> On 29/06/2023 23:23, Sivani Baskaran via OpenBabel-discuss wrote:
> > Hello,
> >
> > I am trying to generate a SMILES notation from standardized InChIs. I
> > have a long list of chemicals and would like to retain an identifier
> > in the output file like you do when parsing other conversions.
> >
> > I've tried a few different ways of doing this based on the
> > documentation, but the identifier is never included in the output
> > file.
> >
> > System/Version: Windows 11, CL Open Babel 3.1.1
> >
> > Goal: Convert an InChI file with InChI followed by the name or a
> > number of a chemical to a .smi file with the SMILES and the identifier
> > (name/integer) for a set of chemicals.
> >
> > Failed attempts:
> > * obabel "./substances.inchi" -O "./substances.SMI"
> > * obabel "./substances.inchi" -O "./substances.SMI" -n
> > * obabel -i inchi "./substances.inchi" -o smi -O "./substances.SMI"
> > * obabel -i inchi "./substances.inchi" -o smi -O "./substances.SMI" -n
> > * obabel -i inchi "./substances.inchi" -n -o smi -O "./substances.SMI"
> >
> > Contents of "substances.inchi" (also attached)
> > InChI=1S/C6H4ClNO2/c7-5-1-3-6(4-2-5)8(9)10/h1-4H        name
> > InChI=1S/C6H6N2O2/c7-5-1-3-6(4-2-5)8(9)10/h1-4H,7H2     another, name
> > InChI=1S/C6H5NO3/c8-6-3-1-5(2-4-6)7(9)10/h1-4,8H        3
> > InChI=1S/C6H5ClO2S/c7-5-1-3-6(4-2-5)10(8)9/h1-4H,(H,8,9)        name-2
> >
> > What I want the output to look like:
> > c1cc(ccc1Cl)N(=O)=O     name
> > c1cc(ccc1N)N(=O)=O      another, name
> > c1cc(ccc1N(=O)=O)O      3
> > c1cc(ccc1Cl)S(=O)O      name-2
> >
> > How can I ensure the output will also have the identifier without
> > resorting to having an individual InChI file for each chemical? Please
> > note, all my identifiers are integers, but for testing purposes I
> > included text string examples.
> >
> > Thanks,
> > Sivani
> > The confidentiality or integrity of this message can not be guaranteed
> > following transmission on the Internet. The addressee should be aware
> > of this before using the contents of this message.
> >
> > _______________________________________________
> > 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
>
_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

Reply via email to