示例#1
0
文件: py_rmsd.py 项目: jksr/beta
import numpy as np
import sys
import os
sys.path.append(os.path.abspath(os.path.dirname(__file__))+'/../../../pyscripts/')
import bbtmio
import bbtmequs
import typeutils
from typeutils import * 
import equtils
import bbtmml


codes = [ '1BXW', '1FEP', '1I78', '1K24', '1KMO', '1NQE', '1P4T' ]

for code in codes:
	deformedcoords = bbtmio.get_ball_coords( bbtmio.read_ball_file(code+'.balls.deformed') )
	reconstructedcoords = bbtmio.get_ball_coords( bbtmio.read_ball_file(code+'.balls.reconstruct') )
	disp = deformedcoords - reconstructedcoords
	rmsd = np.mean(np.square(np.linalg.norm(disp, axis=1))) ** 0.5
	print code, rmsd

示例#2
0
文件: preprocess.py 项目: jksr/beta2
		print( '\tFile '+pdbcode+'_origin.balls and .sticks exist. Nothing changed.\n' )
	else:
		os.system('exec/barrel.out '+pdbfn[:-4]+'.bbin')
		print( '\tFile '+pdbcode+'_origin.balls and .sticks written.\n' )
	ball_data = bbtmio.read_ball_file(ball_ori_fn)
	# temporary file, register for cleaning
	files_to_clean.append(ball_ori_fn)

	################################################
	# recenter balls
	print( '\tRecentering the coordinate matrix in balls file' )
	ball_fn = pdbfn[:-4]+'.balls'
	if os.path.isfile(ball_fn) and not args['overwrite']:
		print( '\tFile '+pdbcode+'.balls exists. Nothing changed.\n' )
	else:
		ball_coord_mat = bbtmio.recenter_coord_mat( bbtmio.get_ball_coords(ball_data), bbin_data)
		ball_data = bbtmio.set_ball_coords(ball_data, ball_coord_mat)
		bbtmio.write_ball_file(ball_data, ball_fn)
		print( '\tFile '+pdbcode+'.balls written.\n' )
	ball_data = bbtmio.read_ball_file(ball_fn)

	################################################
	# recenter pdb balls file
	print( '\tPreparing recentered and aligned pdb balls file' )
	ball_pdb_fn = pdbfn[:-4]+'_pdb.balls'
	if os.path.isfile(ball_pdb_fn) and not args['overwrite']:
		print( '\tFile '+pdbcode+'_pdb.balls exists. Nothing changed.\n' )
	else:
		ball_coord_mat = bbtmio.get_ball_coords( ball_data )
		pdbball_data = bbtmio.read_ball_file(ball_ori_fn)
		# recenter
示例#3
0
文件: test.py 项目: jksr/beta
	ks2 = np.array( [ 2.49441195, 0.65856546, 0.86605534, 0.79412971, 2.91011336, 1.71480196, 0.68283227] )
	ks3 = np.array( [ 1.31824322, 0.88899824, 0.9253788 , 0.72740754, 2.81697644, 0.66983903, 0.36771102] )
	ks = np.mean(np.vstack((ks1,ks2,ks3)), axis=0)
	@classmethod
	def get_k(cls, btype, a1type, a2type):
		return 100 if btype=='SP' else 100000000 * np.dot( cls.kta.get_assign_vec(a1type, a2type, btype), cls.ks )





for coden in testset:
	ses = bbtmdsm.StiffnessEquSys('../../../data/testdata/'+coden+'.balls.ideallarge.ext', '../../../data/testdata/'+coden+'.sticks.ideallarge.ext', testkassigner )
	ses.solve()
	u =  ses.u.reshape(ses.u.shape[0]/3, 3)
	ideallargecoords = bbtmio.get_ball_coords( bbtmio.read_ball_file('../../../data/testdata/'+coden+'.balls.ideallarge') )
	pdbcoords = bbtmio.get_ball_coords( bbtmio.read_ball_file('../../../data/'+coden+'_pdb.balls') )

	afteru = ideallargecoords + u



	newafteru = bbtmio.recenter_coord_mat(afteru, bbtmio.read_bbin_file('../../../data/'+coden+'.bbin'))

	bbtmio.write_ball_file( bbtmio.set_ball_coords( bbtmio.read_ball_file('../../../data/testdata/'+coden+'.balls.ideallarge'), newafteru ), coden+'.balls.au')

	dummy,newpdbcoords = bbtmio.align_coordmat(pdbcoords, newafteru)
	disp = newafteru - newpdbcoords
	rmsd = np.mean(np.square(np.linalg.norm(disp, axis=1))) ** 0.5
	print coden, disp.shape[0], rmsd
	#sys.exit(0)
示例#4
0
codes = [ '1K24' ]

# generated deformed balls file
for code in codes:
	extballfn = datapath+'testdata/'+code+'.balls.ideallarge.ext'
	extstickfn = datapath+code+'.sticks.ext'
	pdbfn = datapath+code+'.pdb'

	#memsec = equtils.wimley_section_divide(equtils.opm_mempos(pdbfn, extballfn))
	memsec = equtils.uni_section_divide(equtils.opm_mempos(pdbfn, extballfn))

	f = equtils.ForceGen.get_force_vector( extballfn,memsec )
	equsys = bbtmequs.StiffnessEquSys(extballfn, extstickfn, f, TestKAssigner )
	equsys.solve()
	disp = equsys.result['u'].reshape(equsys.result['u'].shape[0]/3, 3)

	ballfn = datapath+'testdata/'+code+'.balls.ideallarge'
	balldat = bbtmio.read_ball_file(ballfn)
	ballcoords = bbtmio.get_ball_coords(balldat)
	# rec means after reconstruction
	recballcoords = ballcoords + disp
	recballdat = bbtmio.set_ball_coords(balldat, recballcoords)
	recballfn = code+'.balls.reconstruct'
	bbtmio.write_ball_file(recballdat, recballfn)

	dispfn = code+'.displacement.reconstruct'
	bbtmio.write_displacement_file(ballcoords, recballcoords, dispfn)



示例#5
0
文件: py_rmsd.py 项目: jksr/beta
import numpy as np
import sys
import os
sys.path.append(os.path.abspath(os.path.dirname(__file__))+'/../../../pyscripts/')
import bbtmio
import bbtmequs
import typeutils
from typeutils import * 
import equtils
import bbtmml


datapath = '../../../data/'
codes = [ '1BXW', '1FEP', '1I78', '1K24']
#codes = [ '1BXW', '1FEP', '1I78', '1K24', '1KMO', '1NQE', '1P4T' ]

for code in codes:
	deformedcoords = bbtmio.get_ball_coords( bbtmio.read_ball_file(datapath+code+'_pdb.balls') )
	reconstructedcoords = bbtmio.get_ball_coords( bbtmio.read_ball_file(code+'.balls.reconstruct') )
	disp = deformedcoords - reconstructedcoords
	rmsd = np.mean(np.square(np.linalg.norm(disp, axis=1))) ** 0.5
	print code, rmsd