From: Axel Kohlmeyer (akohlmey_at_gmail.com)
Date: Tue Jan 13 2015 - 10:54:08 CST

On Tue, Jan 13, 2015 at 12:25 AM, John Stone <johns_at_ks.uiuc.edu> wrote:
> Brian,
> Whatever is going amiss that caused your email truncation
> seems to have occured twice in a row now. Let's see if this reply makes
> it through unscathed or not, and then we can work on the selection issue.
>
> Cheers,
> John Stone
>
> On Tue, Jan 13, 2015 at 05:12:58AM +0000, Bennion, Brian wrote:
>> Hello All, I am not sure why my last email was truncated after the first
>> sentence. The text below was want was sent to me and cc'ed to the vmd-l
>> list.
>>
>> ---------------------------------------------------------------------------
>>
>> From: Bennion, Brian
>> Sent: Monday, January 12, 2015 4:57 PM
>> To: vmd-l_at_ks.uiuc.edu
>> Subject: atomselection by wildcard and distance exclusion
>> Hello All,
>>
>> After working on this for far too long I need to know what I am doing
>> wrong.
>>
>> I have a pdb file that contains a protein and a docked ligand. I want to
>> select one or more oxygen atoms on the ligand that is not bound to a
>> carbon. My ligand has oxygen atoms bound to nitrogen, hydrogen, and/or
>> hydrogen.
>>
>> There are two possible procedures one might explore to make the
>> atomselection.
>>
>> One might look at all the oxygen atoms and get a list of index values for
>> each atom that is returned in the lists from the atomselect0 getbonds
>> command and check for whether it is a carbon or not.
>> This might be called the analytical solution because if you iterate enough
>> you should get an atomselection that contains an oxygen atom that does not
>> have any bonds with a carbon atom.
>> Honestly I got lost in the foreach recursive searches.

i don't understand this. this sounds like bad program design. i don't
see how you would need recursions or explicit nested loops at all and
i would expect that only a single loop is required.

you create a selection of the oxygen atoms for your ligand and
retrieve the respective bondlist.
then you create an empty list for storing the indices of matching
oxygen atoms and loop over the oxygens and their bonds.
within that loop you create an atom selection for just the atoms that
the specific oxygen is bound to from the bondlist entry, retrieve the
element names and check if a carbon is present or not via lsearch and
add the oxygen index to the result list or not accordingly. rinse and
repeat. done.

axel.

p.s.: this is off the top of my head and untested, but you might get the idea:

set ligox [atomselect top {resname LIG and name "O.*"}]
set oxidx [$ligox list]
set oxbnd [$ligox getbonds]
set oxnoc {}
foreach idx $oxidx bnd $oxbnd {
  set sel [atomselect top "index $bnd"]
  set el [$sel get element]
  if {[llength [lsearch -exact $bnd C]] == 0} {
    lappend oxnoc $idx
  }
  $sel delete
}

>>
>> Second is a numerical approach that uses a distance constraint to
>> eliminate the selection of oxygen atoms that have other atoms within 1.5
>> angstrom.
>> I concentrated on this approach and obviously need to learn something
>> because my selection text is not returning what I expect to be the correct
>> result. Obviously it is just doing what I told it to do.
>>
>> One ligand molecule has 3 oxygen atoms. One oxygen is bound to two carbon
>> atoms with bond distances of <1.45A. One oxygen double bonded to a carbon
>> and the final oxygen atom is bound to a nitrogen and hydrogen atom.
>>
>> I want to eliminate all oxygen atoms bound to carbon:
>> set oxime [atomselect top "resname LIG and name \"O.*\" and same residue
>> as not within 1.5 of name \"C.*\" "]
>>
>> The command returns three oxygen atoms.
>> My logic is flawed in the selection text.
>> Any pointers to fix this?
>>
>> Thank you
>> Brian Bennion
>
> --
> NIH Center for Macromolecular Modeling and Bioinformatics
> Beckman Institute for Advanced Science and Technology
> University of Illinois, 405 N. Mathews Ave, Urbana, IL 61801
> http://www.ks.uiuc.edu/~johns/ Phone: 217-244-3349
> http://www.ks.uiuc.edu/Research/vmd/
>

-- 
Dr. Axel Kohlmeyer  akohlmey_at_gmail.com  http://goo.gl/1wk0
College of Science & Technology, Temple University, Philadelphia PA, USA
International Centre for Theoretical Physics, Trieste. Italy.