本文整理汇总了Python中pymol.cmd.align函数的典型用法代码示例。如果您正苦于以下问题:Python align函数的具体用法?Python align怎么用?Python align使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了align函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: loadpair
def loadpair(file):
id = file.split('/')[-1][:4]
loadcenters(file,id+'nat')
loadcenters(file[:-17]+'_decoy_sasa_centers.pdb',id+'decoy')
d = id+'decoy'
n = id+'nat'
cmd.align(n,d)
示例2: testSaveRef
def testSaveRef(self, format):
# for rms_cur (not all formats save all identifiers)
m = -1
cmd.set('retain_order')
cmd.fragment('ala', 'm1')
cmd.copy('m2', 'm1')
cmd.copy('m3', 'm1')
cmd.rotate('y', 90, 'm2')
cmd.align('m3', 'm2')
# with ref=m3
with testing.mktemp('.' + format) as filename:
cmd.save(filename, 'm2', ref='m3')
cmd.load(filename, 'm4')
self.assertAlmostEqual(cmd.rms_cur('m4', 'm1', matchmaker=m), 0.00, delta=1e-2)
self.assertAlmostEqual(cmd.rms_cur('m4', 'm2', matchmaker=m), 1.87, delta=1e-2)
# without ref
with testing.mktemp('.' + format) as filename:
cmd.save(filename, 'm2')
cmd.load(filename, 'm5')
self.assertAlmostEqual(cmd.rms_cur('m5', 'm2', matchmaker=m), 0.00, delta=1e-2)
self.assertAlmostEqual(cmd.rms_cur('m5', 'm1', matchmaker=m), 1.87, delta=1e-2)
示例3: sewalign
def sewalign(first,second):
#hide waters
cmd.hide("(solvent and (all))")
#hide hydrogens
cmd.hide( 'sticks', 'elem H' )
cmd.hide( 'lines', 'elem H' )
#show cartoon
cmd.show("cartoon" ,"all")
#create duplicate of first
first_copy = first + "_copy"
cmd.copy(first_copy, first)
#select first 14 residues
cmd.select('node_9_selection', '(obj *_9_* and resi 1-14)')
cmd.select('node_12_selection', '(obj *_12_* and resi 1-14)')
cmd.select('node_15_selection', '(obj *_15_* and resi 1-14)')
alignment_1 = cmd.align(first, 'node_9_selection')
print alignment_1[0]
alignment_2 = cmd.align(second, 'node_12_selection')
print alignment_2[0]
alignment_3 = cmd.align(first_copy, 'node_15_selection')
print alignment_3[0]
示例4: revert
def revert(self):
v = cmd.get_view()
cmd.remove(self.rdes.obj+" and not chain A")
m = cmd.get_model(self.rdes.obj)
n = self.oldcrd
if not n:
cmd.create("tmp12345",self.rnat.sel())
cmd.align("tmp12345",self.rdes.sel())
n = cmd.get_model("tmp12345").atom
cmd.delete("tmp12345")
di,ni = 0,0
while m.atom[di].resi != str(self.rdes.resi): di += 1
dj = di
while m.atom[dj].resi == str(self.rdes.resi): dj += 1
if self.oldcrd: self.oldcrd = None
else: self.oldcrd = m.atom[di:dj]
m.atom = m.atom[:di] + n + m.atom[dj:]
for i in range(di,di+len(n)):
m.atom[i].resi = str(self.rdes.resi)
m.atom[i].chain = str(self.rdes.chain)
cmd.load_model(m,self.rdes.obj,1)
cmd.save("tmp.pdb",self.rdes.obj)
cmd.delete(self.rdes.obj)
cmd.load("tmp.pdb",self.rdes.obj,1)
cmd.show('car',self.rdes.obj)
cmd.show('lines')
redopent(self.rdes.obj)
cmd.set_view(v)
print "revert removing "+"".join(self.aas)+" from aas!"
self.aas = [getaa('A',self.rdes.resi,self.manager.d.obj)]
示例5: align_and_color
def align_and_color(moving, fixed, maximum=None, native_color="blue"):
if maximum == "0":
maximum = None
alignment_name = "alignment_" + moving
cmd.align(moving, fixed, object=alignment_name, cycles=0)
cmd.disable(alignment_name)
rmsd_b(moving + " & " + alignment_name, fixed + " & " + alignment_name)
cmd.color(native_color, fixed)
cmd.spectrum("b", "green_red", moving, 0, maximum)
示例6: testSaveAln
def testSaveAln(self):
cmd.fab('ACDEFGH', 'm1')
cmd.fab('ACDFGH', 'm2')
cmd.align('m1', 'm2', cycles=0, object='aln')
with testing.mktemp('.aln') as filename:
cmd.save(filename)
with open(filename) as handle:
lines = list(handle)
self.assertEqual(lines[0].split(), ['CLUSTAL'])
self.assertEqual(lines[1].split(), [])
self.assertEqual(lines[2].split(), ['m1', 'ACDEFGH'])
self.assertEqual(lines[3].split(), ['m2', 'ACD-FGH'])
示例7: loadPackingPDB
def loadPackingPDB(file,name=None,native=None):
"""
usage: loadPackingPDB <file> , [<name for object>]
loads a foo_packing.pdb file and colors it all pretty-like
creates two selections along with the loaded object called
NAMEcavities and NAMEprotein which are the heteratoms representing
holes and everything else, respectively. Names can get pretty long,
by pymol lets you do good stuff like "select NA*cav*", which will
match a selection called NAMEISREALLYLONGcavities.
"""
if name is None:
name = name = os.path.basename(file)
if name.endswith('.gz'):
name = name[:-3]
if name.endswith('.pdb'):
name = name[:-4]
if name.endswith('.'):
name = name[:-1]
if name.endswith("_packing"):
name = name[:-8]
zload(file,name)
cmd.hide('everything',name)
if native is not None:
cmd.align(name,native)
cmd.zoom(native)
useRosettaRadii()
cavselname = name+"cavities"
protselname = name+"protein"
cmd.select(cavselname, "resn CAV and b > 0.1 and %s"%(name) )
cmd.select(protselname,"(not resn CAV) and %s"%(name) )
useTempRadii(cavselname)
useOccColors(cavselname)
cmd.color("white",protselname)
cmd.show('spheres', cavselname )
cmd.show("cartoon",protselname)
cmd.show("lines",protselname)
cmd.select("none")
cmd.delete("sele*")
cmd.move('z',-50)
return name
示例8: showpack
def showpack(self):
print self.toggle['sph']
#cmd.hide('spheres','not '+self.manager.d.bupsel)
cmd.hide('spheres')
if self.toggle['sph']:
self.toggle['sph'] = False
return
fr = self.rnat.obj+" and name n+ca+c and resi %i-%i"%(self.rnat.resi-10,self.rnat.resi+10)
to = self.rdes.obj+" and name n+ca+c and resi %i-%i"%(self.rdes.resi-10,self.rdes.resi+10)
cmd.align(fr,to)
cmd.center(self.rdes.sel()+" or "+self.rnat.sel())
#cmd.show('sticks',self.rnat.sel())
cmd.show('spheres',"byres ((not "+self.rnat.obj+") within 6 of "+self.rdes.sel()+")")
self.toggle['sph'] = True
示例9: focus
def focus(self):
self.manager.m = self
if self.manager.prevm: cmd.hide('sticks',self.manager.prevm.rdes.sel())
if self.manager.prevm: cmd.color('green',self.manager.prevm.rdes.sel()+" and elem C")
fr = self.rnat.obj+" and name n+ca+c and resi %i-%i"%(self.rnat.resi-10,self.rnat.resi+10)
to = self.rdes.obj+" and name n+ca+c and resi %i-%i"%(self.rdes.resi-10,self.rdes.resi+10)
cmd.align(fr,to)
cmd.show('sticks',self.rdes.sel())
cmd.color('white',self.rdes.sel()+" and elem C")
cmd.center(self.rdes.sel())
v = list(cmd.get_view())
v[11] = -80.0
cmd.set_view(tuple(v))
cmd.clip('slab',50,self.rdes.sel())
示例10: testAlignMissingCoords
def testAlignMissingCoords(self):
filename = self.datafile('1t46-frag.pdb')
cmd.load(filename, 'm1')
cmd.remove('m1 & resi 600-605')
cmd.load(filename, 'm1', state=2)
cmd.load(filename, 'm2')
cmd.remove('m2 & resi 620-625')
cmd.load(filename, 'm2', state=2)
cmd.align('m1', 'm2', object='aln', mobile_state=1, target_state=1, cycles=0)
self.assertIn('aln', cmd.get_names())
示例11: testSaveAlnNucleic
def testSaveAlnNucleic(self):
cmd.load(self.datafile('1rna.cif'))
cmd.create('m1', 'chain A and not resi 6-7')
cmd.create('m2', 'chain B')
cmd.alter('m1 and resi 1', 'resn = "DT"') # mimic DNA
cmd.alter('m2 and resi 20', 'resn = "UNK"') # mimic nonstd residue
cmd.align('m1', 'm2', cycles=0, object='aln')
with testing.mktemp('.aln') as filename:
cmd.save(filename)
with open(filename) as handle:
lines = list(handle)
self.assertEqual(lines[0].split(), ['CLUSTAL'])
self.assertEqual(lines[1].split(), [])
self.assertEqual(lines[2].split(), ['m1', 'TUAUA--UAUAUAA'])
self.assertEqual(lines[3].split(), ['m2', 'UUAUA?AUAUAUAA'])
示例12: ie_build_file
def ie_build_file(fname, align='true', ortho='true', hide='true',
zoom='true', col='[0.5, 0.5, 0.5]', scale='1'):
if to_bool(ortho):
cmd.set('orthoscopic', 'true')
cmd.load(fname)
if to_bool(align):
object_list = cmd.get_names()
target = object_list.pop()
for obj in object_list:
cmd.align(obj, target)
if to_bool(hide):
cmd.hide('everything')
ie_build_all(col, scale)
if to_bool(zoom):
cmd.zoom()
示例13: prepare_data
def prepare_data(arg1):
cmd.load("%s_r_b.pdb" % arg1, zoom=0)
cmd.load("%s_l_b.pdb" % arg1, zoom=0)
cmd.load("%s_r_u.pdb" % arg1, zoom=0)
cmd.load("%s_l_u.pdb" % arg1, zoom=0)
save_surface("%s_r_b" % arg1)
save_surface("%s_l_b" % arg1)
save_surface("%s_r_u" % arg1)
save_surface("%s_l_u" % arg1)
cmd.align("%s_r_b" % arg1, "%s_r_u" % arg1, object="ra")
cmd.align("%s_l_b" % arg1, "%s_l_u" % arg1, object="la")
cmd.save("receptor.aln", "ra")
cmd.save("ligand.aln", "la")
示例14: sa
def sa(intra=False,rainbow=True):
"""
Superimpose all open models onto the first one.
This may not work well with selections.
Option intra can be set to True to enable intra_fit first, for working with multi-state (nmr) pdbs.
[Thanks to Kyle Beauchamp for this one]
"""
AllObj=cmd.get_names("all")
for x in AllObj:
print(AllObj[0],x)
if intra==True:
cmd.intra_fit(x)
if rainbow==True:
cmd.util.chainbow(x)
cmd.align(x,AllObj[0])
cmd.zoom()
示例15: getnative
def getnative():
v = cmd.get_view()
nats = []
for obj in cmd.get_object_list():
if len(obj) == 4:
nats.append(obj)
continue
pid = obj[:4]
if pid in nats:
continue
print "fetching native", pid
cmd.fetch(pid)
cmd.remove(pid + " and not chain A")
cmd.remove(pid + " and resn HOH")
cmd.align(pid, obj)
cmd.set_view(v)