Re: [Rdkit-discuss] atom indexing
Open-Source Cheminformatics and Machine Learning
Brought to you by:
glandrum
|
From: Ling C. <lin...@gm...> - 2023-06-20 05:09:37
|
Great to know, many thanks Greg!
Ling
Greg Landrum <gre...@gm...> 於 2023年6月19日週一 下午9:53寫道:
> Hi Ling,
>
> On Mon, Jun 19, 2023 at 3:03 AM Ling Chan <lin...@gm...> wrote:
>
>>
>> I got some questions about atom indexing. Just wonder if you could help
>> me?
>>
>> 1. In m3=Chem.CombineMols(m1,m2) , is it guaranteed that the atom
>> indices in m3 is equivalent to the indices in m1 followed by the indices in
>> m2?
>>
>> Yes
>
>>
>> 1. If I construct an editable mol from m1, is it that the atomic
>> indices in the editable mol is equivalent to that in m1? And when I convert
>> the editable mol back, suppose the atom indexing is also preserved?
>> 2.
>>
>> Yes
>
>>
>> 1. Same as #2, but for an RWMol instead of an editable mol.
>>
>> Yes
>
>>
>> 1. If I delete an "F" atom from an editable mol, is there a way to
>> mark the atom in the new mol that was originally bonded to the "F"? I mean,
>> if I get its atomic index before the deletion, suppose it won't be
>> preserved.
>>
>> You can set a property on the neighboring atom with something like:
> atom.SetProp("F_Neighbor","1")
>
>>
>> 1. Similar to #4, but for DeleteSubstructs.
>>
>> Same answer: you can always use SetProp
>
>
>> Alternatively, if there is a way to mark atoms, I don't need the atom
>> indices anyway.
>>
>
> As mentioned, SetProp is great for this. Note that using the property
> interface is slower than just relying on the indexing remaining the same,
> which you can do in the first two cases.
>
> best regards,
> -greg
>
>
|