Hi Ling,

  this can be a workaround if RDKit does not have a built-in function to extract a submolecule by atom ids. You may assign atom property labels to these atoms and then looping over atoms in EditableMol remove those ones which do not have this property assigned.

Kind regards,
Pavel.

On 02/04/2021 02:30, Ling Chan wrote:
Yes, Kangway, that was what I first tried, as mentioned in the first post. I did not have any problem with obtaining the primary fragments (applying all cuts) . Just that I have not yet figured out how to obtain the secondary fragments, either from recombining the primary fragments, or from fragmenting from the initial molecule (by not applying all cuts).

Chuang, Kangway <kangway.chu...@ucsf.edu <mailto:kangway.chu...@ucsf.edu>> 於 2021年4月1日週四 下午5:20寫道:

    Hi Ling,

    I think I've run into something similar before, have you tried
    using FragmentOnBonds followed by Chem.GetMolFrags? GetMolFrags
    lets you toggle a few things (e.g. (bool)asMols=False [,
    (bool)sanitizeFrags=True) to provide some workarounds with
    sanitization.

    Best,
    Kangway
    ------------------------------------------------------------------------
    *From:* Ling Chan <lingtrek...@gmail.com
    <mailto:lingtrek...@gmail.com>>
    *Sent:* Thursday, April 1, 2021 5:08 PM
    *To:* Mark Mackey <m...@cresset-group.com
    <mailto:m...@cresset-group.com>>
    *Cc:* RDKit <rdkit-discuss@lists.sourceforge.net
    <mailto:rdkit-discuss@lists.sourceforge.net>>
    *Subject:* Re: [Rdkit-discuss] rejoining pairs of fragments after
    fragmenting a molecule
    >> /I did manage to achieve what I want by going
    through Chem.MolFragmentToSmiles and then convert the Smiles back
    to a Mol. But is there a neater way?/

    Oops, I wrote too soon. Actually I did not achieve what I want.
    The conversion from the smiles from Chem.MolFragmentToSmiles
    sometimes crashes, because of Sanitization problem.


    Ling Chan <lingtrek...@gmail.com <mailto:lingtrek...@gmail.com>> 於
    2021年4月1日週四 下午4:11寫道:

        Thank you Mark for your suggestion. It sounds good and I gave
        it a try. However, this leads to another question that may
        sound dumb.

        I have the atom indices of a fragment. For example, the
        fragment comes from atoms [3,4,5,9,10,11,14] of the original
        molecule. How can I extract this fragment from the molecule? 
        I tried

        (1) using EditableMol and deleting atoms one by one using
        RemoveAtom. But this does not work since the atom numbering
        changes after each deletion.
        (2) going through FragmentOnBonds. But the output of
        FragmentOnBonds have the atom indices reshuffled so I cannot
        directly use my index list to fish out my fragment.

        I did manage to achieve what I want by going
        through Chem.MolFragmentToSmiles and then convert the Smiles
        back to a Mol. But is there a neater way? Basically, is there
        a Chem.MolFragmentToMol function?

        Thank you again.

        Ling


        Mark Mackey <m...@cresset-group.com
        <mailto:m...@cresset-group.com>> 於 2021年4月1日週四
        上午1:58寫道:

            Hi Ling,

            Having done something similar (but not in RDKit), I would
            suggest a different algorithm. I think that fragmenting
            the molecule first and then stitching the bits together is
            always going to be very complicated. Instead, just
            fragment the molecule in the ways that you want:

            - Find the set B of all breakable bonds according to your
            rules. I’m assuming here that B contains only acyclic bonds.

            - To get all of the pairwise pieces, for each element b of
            B break all bonds in B _except_ b. Keep the fragment
            containing b, and clean up.

            - To get all of the triplets, for each tuple (b1, b2) in
            B, break all bonds in B except b1 and b2. Keep the
            fragment containing b1 only if it also contains b2.

            Regards,

            Mark

            **

            *-- *

            *Mark Mackey*

            *Chief Scientific Officer*

            *Cresset*

            New Cambridge House, Bassingbourn Road, Litlington,
            Cambridgeshire, SG8 0SS, UK

            tel: +44 (0)1223 858890    mobile: +44 (0)7595
            099165    fax: +44 (0)1223 853667

            email:_m...@cresset-group.com
            <mailto:m...@cresset-group.com>_web:www.cresset-group.com
            
<https://urldefense.com/v3/__http://www.cresset-group.com/__;!!LQC6Cpwp!_TcJCf-sigb7LDzkbKrsrFcW9tvIZeaipJYFoxrlJcJu_i7ISOrtBw_r-FiTOxLSLc3HOA$>
            skype: mark_cresset

            *From:*Ling Chan <lingtrek...@gmail.com
            <mailto:lingtrek...@gmail.com>>
            *Sent:* 31 March 2021 20:56
            *To:* RDKit <rdkit-discuss@lists.sourceforge.net
            <mailto:rdkit-discuss@lists.sourceforge.net>>
            *Subject:* [Rdkit-discuss] rejoining pairs of fragments
            after fragmenting a molecule

            Dear Colleagues,

            I am trying to do something that I think is quite simple,
            but I have not figured out a simple way. Don't know if I
            am missing something. I am sure that ultimately I can
            figure it out, but I wonder if there is a good way.

            I fragmented a molecule with some rules, using
            FragmentOnBonds. I did get a list of primary fragments.

            I wish to recombine pairs (and triplets, but no bigger) of
            these primary fragments, but only if the resulting
            fragment is part of the original molecule. I.e. I want to
            undo some of the cuttings. (FragmentOnSomeBonds does not
            help, since you cannot ensure that the resulting fragments
            consist only of pairs of primary fragments.)

            What is the best way to do this? The following is what I
            am trying.

            I see that you can mark the original cut points using the
            dummyLabels argument in FragmentOnBonds. So I converted
            the primary fragments to smiles. I looked for the two
            sides of the original cut point and substituted the two
            dummyLables to [2H] and [3H]. I then tried to rejoin the
            fragments using a reaction string
            "[*:1][2H].[*:2][3H]>>[*:1][*:2]". Unfortunately the
            ReactionFromSmarts function does not accept this string.
            So I'll have to use Smarts search to look for [2H] and
            [3H], then create an editable molecule from the two
            primary fragments, look for neighbours of [2H] and [3H],
            add a bond, then delete the atoms [2H] and [3H], then
            sanitize.

            Thank you for your ideas.

            Ling


            This email has been sent from Cresset BioMolecular
            Discovery Limited, registered in England and Wales,
            Company Number: 04151475. The information in this email
            and any attachments are confidential and may be
            privileged. It is intended solely for the addressee and
            access to this email by anyone else is unauthorised. If an
            addressing or transmission error has misdirected this
            email, please notify the author by replying to this email.
            If you are not the intended recipient you must not use,
            disclose, distribute, store or copy the information in any
            medium. Although this e-mail and any attachments are
            believed to be free from any virus or other defect which
            might affect any system into which they are opened or
            received, it is the responsibility of the recipient to
            check that they are virus-free and that they will in no
            way affect systems and data. No responsibility is accepted
            by Cresset BioMolecular Discovery Limited for any loss or
            damage arising in any way from their receipt, opening or
            use. Privacy notice
            
<https://urldefense.com/v3/__https://www.cresset-group.com/privacy/__;!!LQC6Cpwp!_TcJCf-sigb7LDzkbKrsrFcW9tvIZeaipJYFoxrlJcJu_i7ISOrtBw_r-FiTOxJWf9Hoxw$>



_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to