puzzle: How to select all residues not containing C-beta atoms?

13 views
Skip to first unread message

Oliver Beckstein

unread,
Apr 24, 2013, 12:37:06 PM4/24/13
to mdnalysis-...@googlegroups.com
Hi,

I have a purely academic question: how do I neatly select "all residues that do not contain a C-beta atom" using MDAnalysis?

For standard proteins these are the Gly.

The best I could come up with was "byres (name CA and not (around 1.7 name CB))" but that includes the fragile fudge of an estimated maximum bonding distance of ~1.7 Å between CA and CB (which is larger than the ~1.4 Å C-C I would have expected):

from MDAnalysis import Universe
from MDAnalysis.tests.datafiles import PSF, DCD
u = Universe(PSF, DCD)

sel = u.selectAtoms("byres (name CA and not (around 1.7 name CB))")
ref = u.selectAtoms("resname GLY")

sel.residues[:] == ref.residues[:]

#>>> True

Does anyone have any better ideas; the naive

u.selectAtoms("not name CA").residues

does not work because you pick up ALL other atoms (e.g. the N in Gly) and hence you get all residues.

(As a curious side observation: sel[:] == ref[:] returns False.)

Oliver

--
Oliver Beckstein * orbe...@gmx.net
skype: orbeckst * orbe...@gmail.com

Elizabeth Denning

unread,
Apr 24, 2013, 12:56:52 PM4/24/13
to mdnalysis-...@googlegroups.com
Hi Oliver,

why not just say "protein and not resname GLY" ?
Maybe I'm misunderstanding something subtle but that seems the easiest
way to me.

~Elizabeth
> --
> You received this message because you are subscribed to the Google
> Groups "MDnalysis discussion" group.
> To unsubscribe from this group and stop receiving emails from it,
> send an email to mdnalysis-discus...@googlegroups.com.
> To post to this group, send email to mdnalysis-...@googlegroups.com
> .
> Visit this group at http://groups.google.com/group/mdnalysis-discussion?hl=en
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Oliver Beckstein

unread,
Apr 24, 2013, 1:21:52 PM4/24/13
to mdnalysis-...@googlegroups.com
On 24 Apr, 2013, at 09:56, Elizabeth Denning wrote:

> Hi Oliver,
>
> why not just say "protein and not resname GLY" ?
> Maybe I'm misunderstanding something subtle but that seems the easiest way to me.

As I said it really is an academic question and is more about how expressibe is the selection syntax that we have.

(But maybe I want to apply this to strange residues or non-protein residues (e.g. all lipids that do not contain N) where I don't know the answer beforehand.)

Oliver

Naveen Michaud-Agrawal

unread,
Apr 24, 2013, 2:12:42 PM4/24/13
to mdnalysis-...@googlegroups.com
Unfortunately, I think you need disjunction on the level of residues, so you could do something like:

sel = u.selectAtoms("(byres name CA) and not (byres name CB)")

but that would give you the disjunction of those two sets of atoms. Does this work?:

sel = u.selectAtoms("byres ((byres name CA) and not (byres name CB))")

Naveen

-----------------------------------
Naveen Michaud-Agrawal

Naveen Michaud-Agrawal

unread,
Apr 24, 2013, 2:13:42 PM4/24/13
to mdnalysis-...@googlegroups.com
or maybe this:

u.selectAtoms("(byres name CA) and not (byres name CB)").residues
--
-----------------------------------
Naveen Michaud-Agrawal

Oliver Beckstein

unread,
Apr 24, 2013, 4:06:08 PM4/24/13
to mdnalysis-...@googlegroups.com
Hi Naveen,

both

u.selectAtoms("byres ((byres name CA) and not (byres name CB))")

u.selectAtoms("(byres name CA) and not (byres name CB)").residues

work. Good idea to do this at the residue level.

(Playing with the selections also compelled me to file Issue 135...)

Thanks,
Oliver

p.s.: see http://becksteinlab.physics.asu.edu/pages/courses/2013/SimBioNano/15/MDAnalysis/first_steps.html#exercises-2 for where your solution ended up...

Naveen Michaud-Agrawal

unread,
Apr 24, 2013, 4:35:31 PM4/24/13
to mdnalysis-...@googlegroups.com
By the way, exercise 1 on that page has a typo - 

"e.g. 150-160) are missing from the structure then the selection will simply give you residues 100-149 and 151-200"

should be

"e.g. 150-160) are missing from the structure then the selection will simply give you residues 100-149 and 161-200"

Also, you should make solutions hidden by default with the ability to click them open :)

I've attached a modified version of that html file - see what i did with exercise 2.1 and 2.2


On Wed, Apr 24, 2013 at 4:15 PM, Naveen Michaud-Agrawal <naveen.mic...@gmail.com> wrote:
Cool, glad to see MDAnalysis is still going strong! :)



--
-----------------------------------
Naveen Michaud-Agrawal
first_steps.html

Oliver Beckstein

unread,
Apr 24, 2013, 5:23:45 PM4/24/13
to mdnalysis-...@googlegroups.com
On 24 Apr, 2013, at 13:35, Naveen Michaud-Agrawal wrote:

> By the way, exercise 1 on that page has a typo -
>
> "e.g. 150-160) are missing from the structure then the selection will simply give you residues 100-149 and 151-200"
>
> should be
>
> "e.g. 150-160) are missing from the structure then the selection will simply give you residues 100-149 and 161-200"

Thanks, corrected.

>
> Also, you should make solutions hidden by default with the ability to click them open :)
>
> I've attached a modified version of that html file - see what i did with exercise 2.1 and 2.2

That's a very good idea – ideally implemented as a new role in sphinx :-). Maybe one could use some of the stuff mentioned in http://stackoverflow.com/questions/8151729/how-to-show-and-hide-code-in-sphinx-doc
Reply all
Reply to author
Forward
0 new messages