[Chimera-users] command line clustering (how to select a subSection?)

Laura Morris lcmorris at uga.edu
Fri Jun 4 11:22:25 PDT 2021


Hi Eric,

First of all, thanks for your help so far. If you can take a look at the next problem, I would appreciate it.

I think the string suggestion worked for what I asked, but it appears there's another issue with the script. I realize I'm using code that's > 10 yrs old (and things change) but if you (or someone) know what's not right about this next section this would help me not have to recode NMRCLUST from scratch (which is tempting, but not preferable). OR, if someone knows where NMRCLUST might be available, I'd be happy to download it.

If I don't change anything in the original script, it runs fine (using all heavy atoms presumably). When I change the value of subSelection (given Eric's example string), it runs through the RMSD portion (I think, I get 250 groups of "Running ksdssp" comments, like below). Then it appears to get hung up in the function _getAtoms

I am running basically what is referred to in the original (2010) posting, namely:
chimera --nogui 3c4s.test.pdb cluster.py

The 3c4s.test.pdb is 250 frames from an AMBER md run (just for testing this). The script cluster.py is the same as the one posed from 2010, with the exception of changing subSelection (to subSelection = "@CA" in this case). My Chimera version is "chimera candidate version 1.15 (build 42258) 2020-12-18 05:17:29 UTC" (in case that matters at all).

[portion of code from cluster.py referred to by output of running script]
def _getAtoms(m, subSelection):
     if not subSelection:
         #atoms = m.sortedAtoms()
         atoms = m.atoms
     else:
        osl = '%s%s' % (m.oslIdent(), subSelection)
         s = selection.OSLSelection(osl)
         wanted = s.vertices(asDict=True)
         #atoms = [ a for a in m.sortedAtoms() if a in wanted ]
         atoms = [ a for a in m.atoms if a in wanted ]
     return atoms


[end of the output from running script]
Computing secondary structure assignments...
Computed secondary structure assignments (see reply log)
Model 0.250 (3c4s.test.pdb) has no secondary structure assignments. Running ksdssp.

Computing secondary structure assignments...
Computed secondary structure assignments (see reply log)
Compiling cluster.py...
Compiling cluster.py succeeded
Executing cluster.py...
Computing distance matrix
    0.02: created distance matrix

Traceback (most recent call last):
  File "/opt/UCSF/Chimera64-1.15rc/share/chimeraInit.py", line 760, in init
    chimera.openModels.open(a, prefixableType=1)
  File "/opt/UCSF/Chimera64-1.15rc/share/chimera/__init__.py", line 1960, in open
    models = func(filename, *args, **kw)
  File "/opt/UCSF/Chimera64-1.15rc/share/chimera/__init__.py", line 1330, in _openPython
    loadFunc(sandboxName, fileName, f)
  File "cluster.py", line 113, in <module>
    main()
  File "cluster.py", line 12, in main
    clusterInfo = _cluster(modelList, subSelection)
  File "cluster.py", line 23, in _cluster
    for m in modelList ]
  File "cluster.py", line 100, in _getAtoms
    s = selection.OSLSelection(osl)
NameError: global name 'selection' is not defined

Error while processing cluster.py:
NameError: global name 'selection' is not defined

  File "cluster.py", line 100, in _getAtoms
    s = selection.OSLSelection(osl)

See reply log for Python traceback.




Laura


-----

Laura C. Morris

Scientific Computing Professional

Edison & Prestegard Labs

Complex Carbohydrate Research Center

706-542-6286 (lab 1075)


________________________________
From: Eric Pettersen <pett at cgl.ucsf.edu>
Sent: Friday, June 4, 2021 11:36 AM
To: Laura Morris <lcmorris at uga.edu>
Cc: chimera-users at cgl.ucsf.edu <chimera-users at cgl.ucsf.edu>
Subject: Re: [Chimera-users] command line clustering (how to select a subSection?)

[EXTERNAL SENDER - PROCEED CAUTIOUSLY]

Hi Laura,
Looking at the code from that mail, the subSelection is just a string with the atom spec you want, but without the model number part.  So for carbon alphas it would be "@CA".  For the example you gave it would be ":3-55 at CA".

--Eric

Eric Pettersen
UCSF Computer Graphics Lab


On Jun 4, 2021, at 8:07 AM, Laura Morris via Chimera-users <chimera-users at cgl.ucsf.edu<mailto:chimera-users at cgl.ucsf.edu>> wrote:

Recently I've been clustering in Chimera but running into memory limitations on my system. I'd like to do the clustering on a computer with more RAM, but I need to be able to do this using only the command line. I found an old post (http://plato.cgl.ucsf.edu/pipermail/chimera-users/2010-May/005166.html) that includes an example script to do the clustering, but I don't know how to change the subSection to the residues and atoms I want. Here's the portion of relevant code:


def main():
    import chimera
    modelList = chimera.openModels.list(modelTypes=[chimera.Molecule])
    subSelection = None # Change this to CAs or  heavy atoms
    clusterInfo = _cluster(modelList, subSelection)
    saveReps(clusterInfo, "reps.pdb") # Change file name if needed

The "Change this to CAs or heavy atoms" is exactly what I want to do, but I have no idea how to do it. If this were command line in Chimera, I'd use something like "select #0:3-55 at CA". I know there's a "runCommand" function that can be included (using "from chimera import runCommand"). Is this used in some way to set subSelection, and if so, how?

Any help is appreciated.

Regards,

Laura

-----
Laura C. Morris
Scientific Computing Professional
Edison & Prestegard Labs
Complex Carbohydrate Research Center
706-542-6286 (lab 1075)

_______________________________________________
Chimera-users mailing list: Chimera-users at cgl.ucsf.edu<mailto:Chimera-users at cgl.ucsf.edu>
Manage subscription: https://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-users/attachments/20210604/0a9e1193/attachment.html>


More information about the Chimera-users mailing list