예제 #1
0
파일: EqUtils.py 프로젝트: jksr/beta2
def opm_mempos(pdbfn, ballfn):
	""" get membrane position from opmdb pdb file """
	geo_data = bbtmio.read_geo_file(pdbfn[:-3]+'geo')
	# an anchor used to find out the offset. ithas no meaning
	base_res_id = geo_data['startingSNs'][0]
	opmstruct = bbtmio.read_pdb_file(pdbfn[:-8]+'opmdb/'+pdbfn[-8:])
	opmchain = opmstruct[0][ bbtmio.guess_chain_id(opmstruct, geo_data) ]
	for res in opmchain:
		if res.get_id()[1] == base_res_id:
			opm_base_z = res['CA'].get_coord()[2]
			break
	ball_data = bbtmio.read_ball_file(ballfn)
	my_base_z = ball_data['COORDZ'][0]
	# offset from my ball coords to opm pdb coords
	my_z_offset = opm_base_z - my_base_z
	# get the last chain, then the first res, then the first atom, and then the coord
	# 	just get the absolute value since membrane thickness is symetric in opm pdb file
	opm_half_thickness = abs( opmstruct[0].get_list()[-1].get_list()[0].get_list()[0].get_coord()[2] )
	# my extracellular membrane position
	my_extra_z = opm_half_thickness - my_z_offset
	# my periplasm membrane position
	my_peri_z = -opm_half_thickness - my_z_offset
	return my_z_offset, my_extra_z, my_peri_z
예제 #2
0
파일: preprocess.py 프로젝트: jksr/beta2
		'--overwrite', required=False, default=False, action='store_true',
		help='Overwrite the exisiting files')
parser.add_argument(
		'--trim', required=False, default=False, action='store_true',
		help='chop off the parts of the barrel out of the membrane')
# parse arguments
args = vars(parser.parse_args())


files_to_clean = []

for pdbfn in glob.glob(args['src']):

	pdbcode = pdbfn[-8:-4]
	print( 'Processing ' + pdbcode )
	structure = bbtmio.read_pdb_file(pdbfn)

	print( '\tPreparing bbin file' )
	# check geo file
	geofn = pdbfn[:-4]+'.geo'
	if not os.path.isfile( geofn ):
		print( '\tFile '+pdbcode+'.geo not found. ' +pdbcode+ ' ignored\n' )
		continue

	################################################
	# write bbin file
	bbinfn = pdbfn[:-4]+'.bbin'
	if os.path.isfile(bbinfn) and not args['overwrite']:
		print( '\tFile '+pdbcode+'.bbin exists. Nothing changed.\n' )
	else:
		bbtmio.write_bbin_file(pdbfn, geofn)