Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def appendBasicResidues(self, basic_residues, pka_residues):
"""
Creates and returns a list for base-backbone interactions
"""
basic_residue_list = lib.residueList("bases")
for residue in self.residues:
if residue.resName in basic_residue_list:
basic_residues.append(residue)
pka_residues.append(residue)
def setupReferenceLists(self):
"""
setup lists with references to residues and atoms needed to calculate pKa values
lists: residue_dictionary
NHlist
COlist
propka_residues
"""
# initializing empty dictionary
self.residue_dictionary = {}
for key in lib.residueList("propka1"):
self.residue_dictionary[key] = []
self.residue_dictionary['ION'] = []
for chain in self.chains:
# make list with N-H & C=O fragments
chain.appendToBackBoneLists(self.NHlist, self.COlist)
# setup the residue dictionary with references to all residues
chain.appendToResidueDictionary(self.residue_dictionary)
# residues with propka interactions,
# IMPORTANT, this list is assumed to be ordered according to resNumb to loop ver pairs
chain.appendPropkaResidues(self.propka_residues)
return
def getDeterminantSection(protein, verbose=False):
"""
prints out the pka-section of the result
"""
# getting the same order as in propka2.0
residue_list = lib.residueList("propka1")
str = "%s\n" % (getDeterminantsHeader())
# printing determinants
for chain in protein.chains:
for residue_type in residue_list:
for residue in chain.residues:
if residue.resName == residue_type:
str += "%s\n" % (residue.getDeterminantString())
# Add a warning in case of coupled residues
if protein.coupled_residues:
str += "%s\n" % (getTheLine())
str += " Residues that are found to be 'coupled', i.e. titrates together, has been marked by '*' in the above\n"
str += " section. Please rerun PropKa with the --display-coupled-residues option for detailed information.\n"
return str
def getSummarySection(protein, verbose=False):
"""
prints out the pka-section of the result
"""
# getting the same order as in propka2.0
residue_list = lib.residueList("propka1")
str = "%s\n" % (getSummaryHeader())
# printing pKa summary
for chain in protein.chains:
for residue_type in residue_list:
for residue in chain.residues:
if residue.resName == residue_type:
str += "%s\n" % (residue.getSummaryString())
return str
def printDeterminants(self):
"""
prints the resulting pKa values and determinants to stdout
"""
# Get same order as propka2.0
residue_list = lib.residueList("propka1")
for residue_type in residue_list:
for residue in self.residues:
if residue.resName == residue_type:
pka_print("%s" % (residue.getDeterminantString()))
def calculateAveragePKA(self, version=None, options=None):
"""
Calculates the pKa values of each configuration and averages them
"""
# initializing dictionaries for making averages, key = 'residue.label'
pkas = {}
Nmass = {}
Emass = {}
Nlocl = {}
Elocl = {}
determinants = {}
number_of_configurations = len(self.configurations)
# setting up list for 'propka1 pka residues'
pka_residues = []
for resName in lib.residueList("propka1"):
pka_residues.extend(self.residue_dictionary[resName])
# initializing dictionaries for making averages, key = 'configuration label'
for residue in pka_residues:
key = residue.label
pkas[key] = {}
Nmass[key] = {}
Emass[key] = {}
Nlocl[key] = {}
Elocl[key] = {}
# initializing dictionary for making averages, key = 'determinant.label'
determinants[key] = [{}, {}, {}]
# perform pKa calulation on each configuration and add pKa properties to dictionaries
for key in self.configurations:
self.setConfiguration(key=key, options=options)
self.calculateConfigurationPKA(version=version, options=options)