pKaTool/Ghosts/Chemical_shift.py
def calculateSpan(self, titGroupSpan):
		'''
		Calculates the CSP span coming from titGroups
		give in titGroupSpan.
		CSPs depend on the method used
		'''
		titGroupList = []
		for titGroup in titGroupSpan:
			titGroupList.append(titGroup[0])
		try:
			fd = open(self.pdbPath, 'r')
			lines = fd.readlines()
			fd.close()
		except IOError:
			print '\n\t\tFATAL: Cannot open %s file'%pdbCha 
			sys.exit(1)
		#
		#Print PDB files on low and high pH values
		#
		lineshighPH = []
		for line in lines:
			record = line[:6].strip()
			if record == 'ATOM':
				group = getTitGroupID(line)
				#change resName for the provided titGroupSpan
				if group in titGroupList:
					name = getResName(group)
					coordinates = getCoordinates(line)
					if (cha2neuAcid.has_key(name)) or (neu2chaAcid.has_key(name)):
						linehighPH = [line[:17] + name + line[20:]]
					elif cha2neuBase.has_key(name):
						linehighPH = [line[:17] + cha2neuBase[name] + line[20:]]
					else:
						linehighPH = [line]
				else:
					linehighPH = [line]
				
				lineshighPH += linehighPH
				
		pdb = os.path.split(self.pdb)[1]
		firstTitGroup = getResNum(titGroupList[0])
		pdbPath = self.pdbPath
		pdbPathNew =  pdbPath[:-4] + '_%d.pdb'%firstTitGroup
		fd = open(pdbPathNew ,'w')
		fd.writelines(lineshighPH)
		fd.close()
		#
		# Run PDB2PQR
		#
		pqrPath = '%s.pqr'%pdbPath[:-4]
		pqrPathNew = '%s.pqr'%pdbPathNew[:-4]
		self.callpdb2pqr(pdbPath, pdbPathNew, pqrPath, pqrPathNew)
		#
		# calculate span(CSPs)
		#
		if self.method == 'PBE':
			from CSP_pbe import CSP_apbs
			Y = CSP_apbs(pqrNeu=pqrPath, pqrCha=pqrPathNew, nucleus=self.nucleus, center = coordinates, sdiel=self.solvDiel, pdiel=self.protDiel,)
			deltaCSP = Y.getCSP_apbs()
		else:
			from CSP_explicit import CSP_coulomb
			Y = CSP_coulomb(pqrNeu=pqrPath, pqrCha=pqrPathNew, nucleus=self.nucleus, diel=self.protDiel)
			deltaCSP = Y.getCSP_coulomb()
			
		self.pdbPath = pdbPathNew
		return deltaCSP

		Calculates the CSP span coming from titGroups
		give in titGroupSpan.
		CSPs depend on the method used
		
Calculates the CSP span coming from titGroups
give in titGroupSpan.
CSPs depend on the method used
Calculates the CSP span coming from titGroups give in titGroupSpan . CSPs depend on the method used
def calculateSpan(self, titGroupSpan):
		titGroupList = []
		for titGroup in titGroupSpan:
			titGroupList.append(titGroup[0])
		try:
			fd = open(self.pdbPath, 'r')
			lines = fd.readlines()
			fd.close()
		except IOError:
			print '\n\t\tFATAL: Cannot open %s file'%pdbCha 
			sys.exit(1)
		Print PDB files on low and high pH values
		lineshighPH = []
		for line in lines:
			record = line[:6].strip()
			if record == 'ATOM':
				group = getTitGroupID(line)
				change resName for the provided titGroupSpan
				if group in titGroupList:
					name = getResName(group)
					coordinates = getCoordinates(line)
					if (cha2neuAcid.has_key(name)) or (neu2chaAcid.has_key(name)):
						linehighPH = [line[:17] + name + line[20:]]
					elif cha2neuBase.has_key(name):
						linehighPH = [line[:17] + cha2neuBase[name] + line[20:]]
					else:
						linehighPH = [line]
				else:
					linehighPH = [line]
				lineshighPH += linehighPH
		pdb = os.path.split(self.pdb)[1]
		firstTitGroup = getResNum(titGroupList[0])
		pdbPath = self.pdbPath
		pdbPathNew =  pdbPath[:-4] + '_%d.pdb'%firstTitGroup
		fd = open(pdbPathNew ,'w')
		fd.writelines(lineshighPH)
		fd.close()
		 Run PDB2PQR
		pqrPath = '%s.pqr'%pdbPath[:-4]
		pqrPathNew = '%s.pqr'%pdbPathNew[:-4]
		self.callpdb2pqr(pdbPath, pdbPathNew, pqrPath, pqrPathNew)
		 calculate span(CSPs)
		if self.method == 'PBE':
			from CSP_pbe import CSP_apbs
			Y = CSP_apbs(pqrNeu=pqrPath, pqrCha=pqrPathNew, nucleus=self.nucleus, center = coordinates, sdiel=self.solvDiel, pdiel=self.protDiel,)
			deltaCSP = Y.getCSP_apbs()
		else:
			from CSP_explicit import CSP_coulomb
			Y = CSP_coulomb(pqrNeu=pqrPath, pqrCha=pqrPathNew, nucleus=self.nucleus, diel=self.protDiel)
			deltaCSP = Y.getCSP_coulomb()
		self.pdbPath = pdbPathNew
		return deltaCSP
def calculateSpan ( self , titGroupSpan ) : titGroupList = [ ] for titGroup in titGroupSpan : titGroupList . append ( titGroup [ 0 ] ) try : fd = open ( self . pdbPath , 'r' ) lines = fd . readlines ( ) fd . close ( ) except IOError : print '\n\t\tFATAL: Cannot open %s file' % pdbCha sys . exit ( 1 ) lineshighPH = [ ] for line in lines : record = line [ : 6 ] . strip ( ) if record == 'ATOM' : group = getTitGroupID ( line ) if group in titGroupList : name = getResName ( group ) coordinates = getCoordinates ( line ) if ( cha2neuAcid . has_key ( name ) ) or ( neu2chaAcid . has_key ( name ) ) : linehighPH = [ line [ : 17 ] + name + line [ 20 : ] ] elif cha2neuBase . has_key ( name ) : linehighPH = [ line [ : 17 ] + cha2neuBase [ name ] + line [ 20 : ] ] else : linehighPH = [ line ] else : linehighPH = [ line ] lineshighPH += linehighPH pdb = os . path . split ( self . pdb ) [ 1 ] firstTitGroup = getResNum ( titGroupList [ 0 ] ) pdbPath = self . pdbPath pdbPathNew = pdbPath [ : - 4 ] + '_%d.pdb' % firstTitGroup fd = open ( pdbPathNew , 'w' ) fd . writelines ( lineshighPH ) fd . close ( ) pqrPath = '%s.pqr' % pdbPath [ : - 4 ] pqrPathNew = '%s.pqr' % pdbPathNew [ : - 4 ] self . callpdb2pqr ( pdbPath , pdbPathNew , pqrPath , pqrPathNew ) if self . method == 'PBE' : from CSP_pbe import CSP_apbs Y = CSP_apbs ( pqrNeu = pqrPath , pqrCha = pqrPathNew , nucleus = self . nucleus , center = coordinates , sdiel = self . solvDiel , pdiel = self . protDiel , ) deltaCSP = Y . getCSP_apbs ( ) else : from CSP_explicit import CSP_coulomb Y = CSP_coulomb ( pqrNeu = pqrPath , pqrCha = pqrPathNew , nucleus = self . nucleus , diel = self . protDiel ) deltaCSP = Y . getCSP_coulomb ( ) self . pdbPath = pdbPathNew return deltaCSP
Calculates the CSP span coming from titGroups
give in titGroupSpan.
Calculates the CSP span coming from titGroups give in titGroupSpan .
'''
		Calculates the CSP span coming from titGroups
		give in titGroupSpan.
		CSPs depend on the method used
		''' # #Print PDB files on low and high pH values # #change resName for the provided titGroupSpan # # Run PDB2PQR # # # calculate span(CSPs) #
self
titGroupSpan