Am 09.08.15 um 18:45 schrieb Eric Martz:
> Some PDB files have alternate locations (altlocs) for some atoms. Each
> atom that has altlocs is marked with an altloc identifier, typically A
> and B.
>
> In some cases, {%A}.count does not equal {%B}.count.
> For example, in *1ab9*:
>
> {%A}.count is 45
> {%B}.count is 38
>
> *How can I select the atoms in {%A} that have no corresponding atoms in
> {%B}? *
The following user-defined function should do the job. As parameter you 
provide an atom set (e.g. "{*}" for all atoms) and the altLoc id.
In addition to the selection it does also print an overview on the 
altLoc distribution as a hash dump.
It needs a Jmol version near 14.3.14 because it makes use of the latest 
multi-level hash syntax options.

----- altLoc Selection Function -------------
function selectUniqueAltloc(atom_set, altloc_id) {
   var altloc_list = {};
   var result_list = [];
   var altloc_atoms = select(x; {@atom_set}; x.altloc!="");

   for (var altloc_atom IN altloc_atoms) {
     var atom_key = altloc_atom.atomname + "_" + altloc_atom.group + "_" 
+  altloc_atom.resno + altloc_atom.insertion + ":" +  altloc_atom.chain 
+ "-" + altloc_atom.modelindex;
     if (altloc_list[atom_key].type != "hash") {
       altloc_list[atom_key] = {};
     }
     altloc_list[atom_key]..[altloc_atom.altloc] = altloc_atom;
   }

   print " ==== altLoc overview ======";
   print altloc_list;
   for (var atom_key in altloc_list) {
     if (altloc_list[atom_key].keys.size == 1) {
       if (altloc_list[atom_key]..[altloc_id] != "") {
         result_list.push(altloc_list[atom_key]..[altloc_id]);
       }
     }
   }
   select result_list;
}
-----------------------------------------------

The function calls for the two questions would look like this:

selectUniqueAltloc({*}, "A");
selectUniqueAltloc({*}, "B");

Regards,
Rolf

------------------------------------------------------------------------------
_______________________________________________
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users

Reply via email to