[Chimera-users] multiple (redundant) distances in command line >file.txt

Eric Pettersen pett at cgl.ucsf.edu
Tue Aug 4 17:34:03 PDT 2015


Hi Olexandr.
	To continue past errors, you would have to use a true Python script rather than a Chimera command script.  Such a script wouldn't be very complicated though, something like this:

from chimera import runCommand
cmds = [
	"dist :540 at ca/pdbSegment=A :573 at ca/pdbSegment=A",
	"dist :453 at ca/pdbSegment=B :479 at ca/pdbSegment=B",
	"dist :695 at ca/pdbSegment=B :395 at ca/pdbSegment=A",
	"dist :2059 at ca/pdbSegment=B :1421 at ca/pdbSegment=B",
	"dist :426 at ca/pdbSegment=B :944 at ca/pdbSegment=B",
	"dist :2059 at ca/pdbSegment=B :1514 at ca/pdbSegment=D",
	"dist :2059 at ca/pdbSegment=B :1417 at ca/pdbSegment=B",
	"dist :1421 at ca/pdbSegment=B :2059 at ca/pdbSegment=B",
	"dist :421 at ca/pdbSegment=C :439 at ca/pdbSegment=C",
	"dist :453 at ca/pdbSegment=B :487 at ca/pdbSegment=B",
]
for cmd in cmds:
	try:
		runCommand(cmd)
	except:
		# ignore errors
		pass

You would put the above in a file whose name ends in ".py" (preserving the indentation, which matters in Python) and run it simply by opening the file with the "open" command.

--Eric

	Eric Pettersen
	UCSF Computer Graphics Lab

On Aug 4, 2015, at 5:44 AM, Olexandr Dybkov wrote:

> Dear UCSF Chimera team,
> 
> I am trying to measure and draw multiple distances by pasting into the command line respective commands. As outcome I would like to have:
> 1. the dashed lines between each pair of atoms that I am checking
> 2. the distances shown above/on the lines
> 3. a log or a file with all the distances checked (one line per each distance command I executed)
> 
> For example,
> dist :540 at ca/pdbSegment=A :573 at ca/pdbSegment=A
> dist :453 at ca/pdbSegment=B :479 at ca/pdbSegment=B
> dist :695 at ca/pdbSegment=B :395 at ca/pdbSegment=A
> dist :2059 at ca/pdbSegment=B :1421 at ca/pdbSegment=B
> dist :426 at ca/pdbSegment=B :944 at ca/pdbSegment=B
> dist :2059 at ca/pdbSegment=B :1514 at ca/pdbSegment=D
> dist :2059 at ca/pdbSegment=B :1417 at ca/pdbSegment=B
> dist :1421 at ca/pdbSegment=B :2059 at ca/pdbSegment=B
> dist :421 at ca/pdbSegment=C :439 at ca/pdbSegment=C
> dist :453 at ca/pdbSegment=B :487 at ca/pdbSegment=B
> and so on
> 
> Resulting in
> Distance between #50 LYS 540 CA and #50 LYS 573 CA: 13.0
> Distance between #35 LYS 453.B CA and #35 LYS 479.B CA: 22.7
> Distance between #35 LYS 695.B CA and #50 LYS 395 CA: 8.8
> Distance between #35 LYS 2059.B CA and #35 LYS 1421.B CA: 20.5
> Distance between #35 LYS 426.B CA and #35 LYS 944.B CA: 25.7
> Distance between #35 LYS 2059.B CA and #53 LYS 1514.T CA: 115.7
> Distance between #35 LYS 2059.B CA and #35 LYS 1417.B CA: 15.2
> Distance monitor already exists
> 
> That is, 8 out of  10 distances were checked. Since the 8th line was a swap of atom1 and atom2 of 4th, the Chimera Error window popped up and execution of further commands was stopped
> 
> Similarly, the execution is interrupted if:
> - one or both atoms are missing
> - one or both atoms are present in multiple copies
> - if such distance was checked already
> 
> Is there a way to ignore/skip this kind of check points and just report such cases in the log?
> I used to do this in pymol and the python script reported all distances (even redundant) and errors (atom 1 or/and atom 2 are missing) without stopping. At the end I had a txt file with exactly one line for each command. It would be nice to have the same functionality in UCSF Chimera as well.
> 
> Thank you very much for your help!
> 
> Kind regards,
> Olexandr
> 
> -- 
> -----------------------------------------------------------------
> Dr. Olexandr Dybkov
> 
> Max-Planck-Institute for Biophysical Chemistry
> Department of Cellular Biochemistry
> Am Fassberg 11
> 37077 Göttingen
> Germany
> Tel. ++49-551-201 1979
> Fax ++49-551-201 1197
> email: odybkov at gwdg.de
> ----------------------------------------------------------------
> 
> _______________________________________________
> Chimera-users mailing list
> Chimera-users at cgl.ucsf.edu
> http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users
> 





More information about the Chimera-users mailing list