SAMSON Forum
    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • SAMSON Connect
    • Get SAMSON

    Visualizing hydrogen atoms

    SAMSON
    2
    5
    1052
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • C
      Chris 1 last edited by

      Is it possible to only depict heteroatom H's (and hide C-H's)? in e.g. ball and stick visualizations. Thanks!

      1 Reply Last reply Reply Quote 0
      • Admin
        Admin last edited by

        Hi Chris,

        Here is the short answer. Copy-paste this expression in the Document view:

        (n.t a or n.t b) and not ((H l (n.t a and !a.het)) or (n.t b l (H l (n.t a and !a.het))))

        and press Enter. This will select all atoms and bonds, except the hydrogens that are linked to non-heteroatoms and their bonds:
        0_1646673229804_10aa8086-3654-4373-83fb-f2d8a6ad6e2f-image.png

        You can then apply a ball-and-stick model.

        Detailed explanation

        It's possible to do this using the Node Specification Language (NSL), by combining different operators.

        Let's do this step by step.

        Finding heteroatoms

        First, to select heteroatoms, you would use this NSL expression:

        atom.hetatm

        As everything in the NSL, there is a short version:

        a.het

        You can use this expression when searching atoms with the Find command (Ctrl / Cmd + F), or in the Document View.

        Here is what happens when typing a.het in the Document view for 6LU7 (after hydrogens have been added using Biology > Add H by res. type):
        0_1646670658373_3947e936-6e84-4a9e-8c9e-54d7e2797804-image.png

        After pressing Enter, the heteroatoms are selected:
        0_1646670683142_7ba7d38d-c1e4-426e-ae40-ead028f2711e-image.png

        Finding bonded hydrogens

        If you want to select the hydrogens linked to heteroatoms, you would use the linking operator:

        H linking atom.hetatm

        which matches all hydrogens covalently linked to heteroatoms.

        The short version is:

        H l a.het

        Here's what happens in this case:

        0_1646670956872_d2d250d6-b9cd-4670-8436-09b651c93283-image.png

        (Similarly, if you wanted to select hydrogens covalently linked to oxygens or nitrogens, you would use H l (O or N).)

        Finding bonds

        Now, the NSL query to find bonds is node.type bond (short version n.t b).

        If order to find the bonds which are involving heteratoms' hydrogens, we can thus use:

        node.type bond linking (H linking atom.hetatm)

        (short version n.t b l (H l a.het))

        Using this expression gives:
        0_1646671585288_be851324-3a04-46f6-889f-cb80fb46b7d4-image.png

        Finding heteroatoms' hydrogens and their bonds

        To select both the hydrogens and the relevant bonds, we use the or operator:

        (H linking atom.hetatm) or (node.type bond linking (H linking atom.hetatm))

        The short version is becoming more and more useful:

        (H l a.het) or (n.t b l (H l a.het))

        Finding hydrogens of non-heteroatoms, and their bonds

        Similarly, to find hydrogens of non-heteroatoms you would use:

        H linking (node.type atom and !atom.hetatm) (hydrogens linking atoms that are not heteroatoms)

        Short version: H l (n.t a and !a.het)

        And, to find bonds connected to these hydrogens, you would use:

        n.t b l (H l (n.t a and !a.het))

        0_1646672418014_3cdb6673-7546-488b-9023-9abe6065b368-image.png

        To find both hydrogens and bonds, you would thus use:

        (H l (n.t a and !a.het)) or (n.t b l (H l (n.t a and !a.het)))

        0_1646672490692_f26a0bcf-5d5b-43eb-bd07-b8c4943af173-image.png

        Finding all atoms and bonds, except non-heteroatoms' hydrogens and their bonds

        To select all atoms and bonds, you would use n.t a or n.t b.

        To select all atoms and bonds, except non-heteroatoms' hydrogens and their bonds, you would thus use:

        (n.t a or n.t b) and not ((H l (n.t a and !a.het)) or (n.t b l (H l (n.t a and !a.het))))

        0_1646673017886_72a03753-9d5e-43d5-931c-d2ad68b973e6-image.png

        1 Reply Last reply Reply Quote 1
        • C
          Chris 1 last edited by

          Thanks so much for the excellent tutorial! The Node Specification Language is a little above my pay grade (or at least I lack the time/patience to mess with it), but it looks like a great resource.

          1 Reply Last reply Reply Quote 0
          • Admin
            Admin last edited by

            If you have other advanced selections that you'd like to perform frequently, please let us know. We could turn them into menu commands.

            Note that it's possible to save a NSL expression as a filter, to reuse it easily. To do this, use the Find command (Ctrl / Cmd + F), enter your NSL expression, and click on the Save button to give a name to your expression:

            0_1646820508588_2c19789a-93c5-4535-962c-ecf04db67456-image.png

            Press OK to save the selection, then press OK again to select.

            You can then use this saved expression as a selection filter (top-left part of the viewport):
            0_1646820580106_946c63b2-7685-4afe-ac55-9a9a9ced50bc-image.png

            Then, you can easily redo the selection by clicking on Select all, or pressing Ctrl / Cmd + A.

            You can even perform finer selections using the mouse, and this will only select corresponding atoms:

            0_1646820653529_6eca20d1-aae9-4ea4-8f8f-7c324b1f3813-image.png

            0_1646820673457_acf878a2-237a-4f03-889a-42b8e6aa6353-image.png

            1 Reply Last reply Reply Quote 1
            • C
              Chris 1 last edited by

              Wonderful, thanks for the tip. It took a little adjustment for me to get familiar with Inspector to just show the new model without the C-H's, but this works well.

              1 Reply Last reply Reply Quote 0
              • First post
                Last post