from pymol import cmd
from average3d import avgStates
#from average_OLD import avgStates
cmd.set('orthoscopic',1)
cmd.set('all_states',1)
#mypdb='test1'
mypdb='1T3V'
cmd.load(mypdb+'.pdb',mypdb)
cmd.hide('everything',mypdb)
cmd.show('lines',mypdb)
cmd.show('spheres','%s and name CA'%mypdb)
#cmd.alter('%s and name CA'%mypdb,'vdw=0.5')
cmd.alter(mypdb,'vdw=0.5')
cmd.rebuild(mypdb,'spheres')
#EX1 # EXAMPLE 1:
#EX1 # Avg just the CA positions for states 1-->2 without fitting structures, and
#EX1 # give a descriptive name to the new object:
#EX1 avgStates(mypdb,'name CA',1,2,'nofit_1to2','no')
#EX1 # cartoon of the averaging:
#EX1 cmd.cartoon('putty','nofit_1to2 and name CA')
#EX1 cmd.show('cartoon','nofit_1to2 and name CA')
#EX1 cmd.spectrum('b','blue_white_red','nofit_1to2 and name CA')
#EX2 # EXAMPLE 2:
#EX2 # Avg just the CA positions for states 2-->10 without fitting structures, and
#EX2 # accept a default name for the new avg'd object (default verbosity is quiet):
#EX2 avgStates(mypdb,'',2,10,'','no')
#EX3 # EXAMPLE 3:
#EX3 # Avg just the CA positions for all but the first frame (2-->last), with
#EX3 # fitting of structures, a descriptive name for new averaged object, and
#EX3 # verbose output (the final '1'):
#EX3 avgStates(mypdb,'name CA',2,0,'yesfit_ALL','yes',1)
#EX3 # cartoon of the averaging:
#EX3 cmd.cartoon('putty','yesfit_ALL and name CA')
#EX3 cmd.show('cartoon','yesfit_ALL and name CA')
#EX3 cmd.spectrum('b','blue_white_red','yesfit_ALL and name CA')
#EX4 # EXAMPLE 4:
#EX4 # Avg just the CA positions for all but the first frame (2-->last), with
#EX4 # fitting of structures, a descriptive name for new averaged object, and
#EX4 # verbose output (the penultimate '1'), and calculation of PAIRWISE RMSDs:
#EX4 avgStates(mypdb,'name CA and resi 10-50',2,5,'yesfit_ALL','yes',1,1)
#EX4 # cartoon of the averaging:
#EX4 cmd.cartoon('putty','yesfit_ALL and name CA')
#EX4 cmd.show('cartoon','yesfit_ALL and name CA')
#EX4 cmd.spectrum('b','blue_white_red','yesfit_ALL and name CA')
# EXAMPLE 5:
# Avg just the CA positions for all frames (1-->last), with fitting of structures,
# a descriptive name for new averaged object, verbose output (the penultimate '1'),
# with calculation of pairwise RMSDs, and with writing of date to files (last '1'):
avgStates(mypdb,'name CA',1,0,'yesfit_ALL','yes',1,1,1)
# cartoon of the averaging:
cmd.cartoon('putty','yesfit_ALL and name CA')
cmd.show('cartoon','yesfit_ALL and name CA')
cmd.spectrum('b','blue_white_red','yesfit_ALL and name CA')
#cmd.quit()