Here is another observation on this problem of lost charges during SDF to
SMILES. The first metal ion always retains the correct charge. All the
other metal ions lose their charge. Does this ring any bells? Thanks ...
this problem is holding up a major project.
Here's the example. Notice that the [Pb] atom is first in the SDF but last
in the SMILES. It's the only one that retains its charge.
echo "
OpenBabel05171208312D
4 0 0 0 0 0 0 0 0 0999 V2000
0.0000 0.0000 0.0000 Pb 0 2 0 0 0 15 0 0 0 0 0 0
0.0000 0.0000 0.0000 Mo 0 6 0 0 0 15 0 0 0 0 0 0
0.0000 0.0000 0.0000 Fe 0 2 0 0 0 15 0 0 0 0 0 0
0.0000 0.0000 0.0000 Cu 0 6 0 0 0 15 0 0 0 0 0 0
M CHG 4 1 2 2 -2 3 2 4 -2
M END
$$$$
" | babel -i sdf -o can
[Fe].[Cu].[Mo].[Pb+2]
Note that if you do SDF-to-SDF, it doesn't lose the charge.
Thanks,
Craig
On Wed, May 16, 2012 at 4:44 PM, Craig James <cja...@emolecules.com> wrote:
> Here's another problem in 2.3.x that's not in 2.2.x. I realize these are
> bogus molecules, but it illustrates a serious problem.
>
> $ echo "[Fe+2][Fe-2].[Fe+2].[Fe-2]" | babel -i smi -o can
> [Fe-2][Fe+2].[Fe-2].[Fe+2]
>
> Everything looks good -- charges are maintained. Now go through the SDF
> format:
>
> $ echo "[Fe+2][Fe-2].[Fe+2].[Fe-2]" | babel -i smi -o sdf | babel -i sdf
> -o can
> [Fe+2][Fe].[Fe].[Fe]
>
> Not so good -- charges are dropped. Where is the problem? It turns out
> the SDF is correct:
>
> $ echo "[Fe+2][Fe-2].[Fe+2].[Fe-2]" | babel -i smi -o sdf
>
> OpenBabel05161216052D
>
> 4 1 0 0 0 0 0 0 0 0999 V2000
> 0.0000 0.0000 0.0000 Fe 0 2 0 0 0 0 0 0 0 0 0 0
> 0.0000 0.0000 0.0000 Fe 0 6 0 0 0 0 0 0 0 0 0 0
> 0.0000 0.0000 0.0000 Fe 0 2 0 0 0 15 0 0 0 0 0 0
> 0.0000 0.0000 0.0000 Fe 0 6 0 0 0 15 0 0 0 0 0 0
> 1 2 1 0 0 0 0
> M CHG 4 1 2 2 -2 3 2 4 -2
> M END
> $$$$
>
> The charges are all properly marked in the atom block and in the M CHG
> line. And the "15" in atoms 3 and 4 means "zero valence" which is right.
> Yet the SMILES is wrong.
>
> It turns out this same thing happens if you use atom->SetFormalCharge().
> It sometimes works and sometimes doesn't.
>
> Note that it works correctly in OpenBabel 2.2.x:
>
> $ echo "[Fe+2][Fe-2].[Fe+2].[Fe-2]" | babel -i smi -o sdf | babel -i sdf
> -o can
> [Fe-2].[Fe-2][Fe+2].[Fe+2]
>
> Anyone have any idea what changed, either in the OpenBabel internals or
> the SMILES generator, that would affect the way charges are interpreted?
>
> Craig
>
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss