Hi Ling,

On Thu, Aug 1, 2013 at 2:56 AM, S.L. Chan <slch...@yahoo.com> wrote:

> Hello folks,
>
> In a way this is a continuation of a previous discussion.
>
> My question is: so is there a simple way to obtain the original
> indexing with all hydrogen atoms included? Do I have to write
> my own function?
>

I guess this means that you want the hydrogens to not be removed from the
molecule?
If so, you just need to tell the RDKit not to remove the Hs.

>From a mol file this is a single extra argument:
In [3]: m = Chem.MolFromMolFile('hmol.mol',removeHs=False)

In [4]: m.Debug()
Atoms:
0 6 C chg: 0  deg: 4 exp: 4 imp: 0 hyb: 4 arom?: 0 chi: 0
1 6 C chg: 0  deg: 4 exp: 4 imp: 0 hyb: 4 arom?: 0 chi: 0
 2 1 H chg: 0  deg: 1 exp: 1 imp: 0 hyb: 1 arom?: 0 chi: 0
3 1 H chg: 0  deg: 1 exp: 1 imp: 0 hyb: 1 arom?: 0 chi: 0
 4 1 H chg: 0  deg: 1 exp: 1 imp: 0 hyb: 1 arom?: 0 chi: 0
5 1 H chg: 0  deg: 1 exp: 1 imp: 0 hyb: 1 arom?: 0 chi: 0
 6 1 H chg: 0  deg: 1 exp: 1 imp: 0 hyb: 1 arom?: 0 chi: 0
7 8 O chg: 0  deg: 2 exp: 2 imp: 0 hyb: 4 arom?: 0 chi: 0
 8 1 H chg: 0  deg: 1 exp: 1 imp: 0 hyb: 1 arom?: 0 chi: 0
Bonds:
0 0->1 order: 1 conj?: 0 aromatic?: 0
 1 0->2 order: 1 conj?: 0 aromatic?: 0
2 0->3 order: 1 conj?: 0 aromatic?: 0
3 0->4 order: 1 conj?: 0 aromatic?: 0
 4 1->5 order: 1 conj?: 0 aromatic?: 0
5 1->6 order: 1 conj?: 0 aromatic?: 0
6 1->7 order: 1 conj?: 0 aromatic?: 0
 7 7->8 order: 1 conj?: 0 aromatic?: 0

but you can also do it from SMILES if you need to:

In [6]: m = Chem.MolFromSmiles('[H]C([H])([H])O[H]',sanitize=False)

In [7]: Chem.SanitizeMol(m)
Out[7]: rdkit.Chem.rdmolops.SanitizeFlags.SANITIZE_NONE

In [8]: m.Debug()
Atoms:
0 1 H chg: 0  deg: 1 exp: 1 imp: 0 hyb: 1 arom?: 0 chi: 0
 1 6 C chg: 0  deg: 4 exp: 4 imp: 0 hyb: 4 arom?: 0 chi: 0
2 1 H chg: 0  deg: 1 exp: 1 imp: 0 hyb: 1 arom?: 0 chi: 0
 3 1 H chg: 0  deg: 1 exp: 1 imp: 0 hyb: 1 arom?: 0 chi: 0
4 8 O chg: 0  deg: 2 exp: 2 imp: 0 hyb: 4 arom?: 0 chi: 0
 5 1 H chg: 0  deg: 1 exp: 1 imp: 0 hyb: 1 arom?: 0 chi: 0
Bonds:
0 0->1 order: 1 conj?: 0 aromatic?: 0
 1 1->2 order: 1 conj?: 0 aromatic?: 0
2 1->3 order: 1 conj?: 0 aromatic?: 0
3 1->4 order: 1 conj?: 0 aromatic?: 0
 4 4->5 order: 1 conj?: 0 aromatic?: 0

Does that help?
-greg
------------------------------------------------------------------------------
Get your SQL database under version control now!
Version control is standard for application code, but databases havent 
caught up. So what steps can you take to put your SQL databases under 
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to