How to use the pdb2pqr.propka30.Source.lib function in pdb2pqr

To help you get started, we’ve selected a few pdb2pqr examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Electrostatics / apbs-pdb2pqr / pdb2pqr / propka30 / Source / vector_algebra.py View on Github external
def __init__(self, atom1=0, atom2=0):
        self.vectors = []
        self.keys = []

        # store vectors for all configurations of atoms
        if atom1 != 0:
            self.keys = lib.get_sorted_configurations(atom1.configurations.keys())
            if atom2 != 0:
                keys2 = lib.get_sorted_configurations(atom2.configurations.keys())
                if self.keys != keys2:
                    pka_print("ERROR: Inequivalent configurations for atoms, please correct your pdbfile to single configuration")
                    pka_print("%s\n%s" % (atom1, atom2))
                    exit(8)
                    #raise 'Cannot make multi vector: Atomic configurations mismatch for\n   %s\n   %s\n'%(atom1,atom2)
            for key in self.keys:
                atom1.setConfiguration(key)
                if atom2 != 0:
                    atom2.setConfiguration(key)
                v = vector(atom1=atom1, atom2=atom2)
                self.vectors.append(v)
                # pka_print(key,v)
        return
github Electrostatics / apbs-pdb2pqr / pdb2pqr / propka30 / Source / residue.py View on Github external
#
#   Very Fast Prediction and Rationalization of pKa Values for Protein-Ligand Complexes
#   Delphine C. Bas, David M. Rogers and Jan H. Jensen
#   PROTEINS: Structure, Function, and Bioinformatics 73:765-783 (2008)
#
#   PROPKA3: Consistent Treatment of Internal and Surface Residues in Empirical pKa predictions
#   Mats H.M. Olsson, Chresten R. Sondergard, Michal Rostkowski, and Jan H. Jensen
#   Journal of Chemical Theory and Computation, 7, 525-537 (2011)
# -------------------------------------------------------------------------------------------------------
from sys import exit
import string
import math
import copy
from . import lib
from .pdb import Atom
pka_print = lib.pka_print


class Residue:
    """
        Residue class - contains atoms and properties of the residue
    """

    def __init__(self, atoms, resName=None, resNumb=None, chainID=None, resInfo=None, options=None):
        """
        Constructer of the residue object.
        """
        self.label = None
        self.atoms = []
        if chainID == None:
            self.chainID = atoms[0].chainID
        else:
github Electrostatics / apbs-pdb2pqr / pdb2pqr / propka30 / Source / protein.py View on Github external
def makeBackBoneInteractionList(self):
        """ 
        making a nice 'object' to make the acid/base interactions nice and easy to loop over in 'determinants'
        backbone_interactions = [[acids, NH], [bases, CO]]
        """
        backbone_interactions = []
        # --- ACIDS ---
        residues = []
        for resName in lib.residueList("acids"):
            residues.extend(self.residue_dictionary[resName])
        backbone_interactions.append([residues, self.NHlist])
        # --- BASES ---
        residues = []
        # famous propka2.0 exceptions
        for resName in ["HIS"]:
            residues.extend(self.residue_dictionary[resName])
        backbone_interactions.append([residues, self.COlist])

        return backbone_interactions
github Electrostatics / apbs-pdb2pqr / pdb2pqr / propka30 / Source / residue.py View on Github external
def setResidueInformation(self, resInfo=None):
        """
        set residue information based on resName - it is set here since it is a convenience thing
        """
        # resType - determines interaction parameters
        if self.resName in resInfo['resType']:
            self.resType = resInfo['resType'][self.resName]

        # Q - group charge
        if self.resName in resInfo['Q']:
            self.Q = resInfo['Q'][self.resName]
        else:
            self.Q = 0.00

        # type - 'amino-acid' / 'ion' / 'ligand' / 'N-terminus' / 'C-terminus'
        if self.resName in lib.residueList("standard"):
            self.type = "amino-acid"
        elif self.resName in resInfo['type']:
            self.type = resInfo['type'][self.resName]

        # pKa_mod - model or water pKa value
        if self.resName in resInfo['pKa']:
            self.pKa_mod = resInfo['pKa'][self.resName]
            self.pKa_pro = resInfo['pKa'][self.resName]
        else:
            self.pKa_mod = resInfo['pKa']['default']
            self.pKa_pro = resInfo['pKa']['default']
github Electrostatics / apbs-pdb2pqr / pdb2pqr / propka30 / Source / chain.py View on Github external
def calculateFoldingEnergy(self, pH=None, reference=None, options=None):
        """
        Calculates the folding energy given the correct pKa values; given
        pKa values calculated for the entire protein 'all chains' will give 
        the total folding energy partitioned to chains, not chain folding 
        energies.
        """
        propka1_residue_labels = lib.residueList("propka1")
        dG = 0.00
        for residue in self.residues:
            if residue.resName in propka1_residue_labels:
                ddG = residue.calculateFoldingEnergy(pH=pH, reference=reference, options=options)
                dG += ddG
                # print "%s %6.2lf" % (residue.label, ddG)

        return dG
github Electrostatics / apbs-pdb2pqr / pdb2pqr / propka30 / Source / protein.py View on Github external
#   Mats H.M. Olsson, Chresten R. Sondergard, Michal Rostkowski, and Jan H. Jensen
#   Journal of Chemical Theory and Computation, 7, 525-537 (2011)
# -------------------------------------------------------------------------------------------------------
from . import pdb
from .chain import Chain
from . import calculator as calculate
from . import coupled_residues
from . import output
from . import determinants
import math
from sys import exit
import os
import time
import string
from . import lib
pka_print = lib.pka_print
#import debug


class Protein:
    """
        Protein class - contains chains and protein properties
    """

    def __init__(self, atoms=None, pdbfile=None, name=None, options=None):
        """
        constructer of the protein object.
        """
        self.name = None     # name of this protein
        self.chains = []       # array of chains
        self.atoms = atoms    # dictionary of atom objects, i.e. atoms[chainID][resLabel]
        self.property = {}       # a dictionary that will hold protein properties such as e.g. pI, folding-profile etc.
github Electrostatics / apbs-pdb2pqr / pdb2pqr / propka30 / Source / pdb.py View on Github external
def makeResidueLabel(self):
        """
        making a key = residue.label in readPDB()
        """
        return lib.makeResidueLabel(self.resName, self.resNumb, self.chainID)
github Electrostatics / apbs-pdb2pqr / pdb2pqr / propka30 / Source / mutate.py View on Github external
def extractMutationLabel(generic_mutation):
    """
    extracts a mutation-label string from a mutation, e.g. ["2vuj::A:N25R/A:S27T/A:N181D"] -> "N25R/S27T/N181D"
    """
    if isinstance(generic_mutation, str):
        mutations = [generic_mutation]
    elif isinstance(generic_mutation, list):
        mutations = generic_mutation
    elif isinstance(generic_mutation, dict):
        """ do nothing """

    label = ""
    if isinstance(generic_mutation, dict):
        for key in generic_mutation.keys():
            code1, resName = lib.convertResidueCode(resName=key[:3])
            code2, resName = lib.convertResidueCode(resName=generic_mutation[key]['label'][:3])
            label += "/%s%d%s" % (code1, int(key[3:7]), code2)
    else:
        for mutation in mutations:
            pdbcode, mutation_string = splitStringMutationInTwo(mutation)
            single_mutations = splitIntoSingleMutations(mutation_string)
            for single_mutation in single_mutations:
                chainID1, chainID2, gotcha = splitSingleMutation(single_mutation)
                label += "/%s" % (gotcha)

    return label[1:]
github Electrostatics / apbs-pdb2pqr / pdb2pqr / propka30 / Source / protein.py View on Github external
def setupConfigurationKeys(self, options=None):
        """ 
        sets protein configuration keys and makes sure there is an available key on each residue
        """
        available_keys = []
        # collecting all configuration keys in this protein
        for chain in self.chains:
            for key in chain.configurations:
                if key not in available_keys:
                    available_keys.append(key)

        # sort configuration keys
        self.configurations = lib.sortConfigurationKeys(available_keys)

        # enforcing all atoms to have each residue configuration, and setting default configuration
        for chain in self.chains:
            chain.fillUnknownConfigurations(keys=self.configurations, options=options)

        return
github Electrostatics / apbs-pdb2pqr / pdb2pqr / propka30 / propka.py View on Github external
def main():
    """
    Simple main that creates the proteins, calculates pKa values, and prints pKa files
    """

    # loading options, flaggs and arguments
    options, pdbfiles = lib.loadOptions()

    for pdbfile in pdbfiles:
        # creating protein object
        myProtein = Protein(pdbfile=pdbfile, options=options)

        # calculating pKa values for ionizable residues
        myProtein.calculatePKA(options=options)
        # printing pka file
        myProtein.writePKA(options=options)