src/hg/lib/lsSnpPdbChimera.py 1.4
1.4 2009/05/13 19:05:17 markd
added prototype support for launching 3D structure browser on H1N1 predicted structures
Index: src/hg/lib/lsSnpPdbChimera.py
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/lib/lsSnpPdbChimera.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -b -B -U 1000000 -r1.3 -r1.4
--- src/hg/lib/lsSnpPdbChimera.py 5 Feb 2009 08:04:11 -0000 1.3
+++ src/hg/lib/lsSnpPdbChimera.py 13 May 2009 19:05:17 -0000 1.4
@@ -1,42 +1,46 @@
# if you are seeing this file as text in a web browser, you need to configure
# chimerax as a helper application.
# Python code for chimerax files to display proteins with SNPs annotated.
# Due scoping bug in exec coding from chimerax files (1.3 alpha release and
# earlier), can only have one function and must import into function's local
# namespace.
-def displayPdb(pdbId, snps):
- # snps is list of (snpId, chain, snpPos, [isPrimary])
+def displayPdb(pdbSpec, snps):
+ """pdbSpec can be a pdbId or a URL of a PDB format file.
+ snps is list of (snpId, chain, snpPos, [isPrimary])"""
from chimera import runCommand
from chimera.selection import OSLSelection
runCommand("close all")
- runCommand("open pdb:%s" % pdbId)
+ if pdbSpec.find("://") >= 0:
+ runCommand("open %s" % pdbSpec)
+ else:
+ runCommand("open pdb:%s" % pdbSpec)
# hide all models/sub-models, NMR will only show first model
runCommand("select #*:*.*")
runCommand("~display sel")
runCommand("~select")
# get model spec to use, testing for sub-models, as is the case with NMR
sel = OSLSelection("#0.1")
if len(sel.atoms()) > 0:
modelSpec = "#0.1"
else:
modelSpec = "#0"
caSpec = "%s:.*@CA" % modelSpec
# display ribbons
runCommand("ribbon %s" % caSpec)
runCommand("ribbackbone %s" % caSpec)
runCommand("focus %s" % caSpec)
for snp in snps:
(snpId, chain, snpPos) = snp[0:3]
if ((len(snp) > 3) and snp[3]):
color = "red"
else:
color = "gold"
spec = "%s:%s.%s@CA" % (modelSpec, snpPos, chain)
runCommand("color %s %s" % (color, spec))
runCommand("setattr r label \"%s\" %s" % (snpId, spec))