GithubHelp home page GithubHelp logo

jensengroup / propka Goto Github PK

View Code? Open in Web Editor NEW
238.0 18.0 58.0 826 KB

PROPKA predicts the pKa values of ionizable groups in proteins and protein-ligand complexes based in the 3D structure.

Home Page: http://propka.org

License: GNU Lesser General Public License v2.1

Python 100.00%

propka's Introduction

PROPKA 3

Tests codecov PyPI version RTD status

PROPKA predicts the pKa values of ionizable groups in proteins (version 3.0) and protein-ligand complexes (version 3.1 and later) based on the 3D structure.

For proteins without ligands, both version should produce the same result.

The method is described in the following papers, which you should cite in publications:

  • Sondergaard, Chresten R., Mats HM Olsson, Michal Rostkowski, and Jan H. Jensen. "Improved Treatment of Ligands and Coupling Effects in Empirical Calculation and Rationalization of pKa Values." Journal of Chemical Theory and Computation 7, no. 7 (2011): 2284-2295. doi:10.1021/ct200133y

  • Olsson, Mats HM, Chresten R. Sondergaard, Michal Rostkowski, and Jan H. Jensen. "PROPKA3: consistent treatment of internal and surface residues in empirical pKa predictions." Journal of Chemical Theory and Computation 7, no. 2 (2011): 525-537. doi:10.1021/ct100578z

PROPKA versions

The code in this repository is named PROPKA 3 and it is based on the original PROPKA 3.1 release (described in the papers above). It has undergone various changes, which is reflected in the version numbering. For instance, version 3.2 contains a number of API changes and code refactoring that introduce incompatibilities between the original 3.1 release and the more recent versions. In the future, we will increase the minor version number to indicate further changes to the code base (e.g., release 3.4 or 3.5). The major release number is not expected to change unless major changes to the underlying algorithms are implemented.

Requirements

PROPKA 3 requires Python 3.8 or higher. Additional requirements are specified in the requirements.txt file and automatically satisfied when installing with pip.

Installation

PROPKA can be installed on your own computer (as described below) or run from a web interface (please register first).

PIP-based installation

The easiest way to install PROPKA is via the PyPI archive with the command

pip install propka

This installation will install the propka Python module and the propka3 executable script. As always, a virtual environment (e.g., via virtualenv) is recommended when installing packages.

Source-based installation

The source code can be installed by cloning the repository or unpacking from a source code archive and running

pip install .

in the source directory. For the purposes of testing or development, you may prefer to install PROPKA as an editable module via PIP by running

pip install -e .

in the source directory.

Getting started

PROPKA can be used either as a module or via the installed script; i.e., either

propka3

or

python -m propka

works for invoking PROPKA.

A brief list of available options can be obtained by running PROPKA with no options:

propka3

A longer list of options and descriptions is available using the --help option:

propka3 --help

Most users run PROPKA by invoking the program with a PDB file as its argument; e.g.,

propka3 1hpx.pdb

Testing (for developers)

Please see tests/README.md for testing instructions. Please run these tests after making changes to the code and before pushing commits.

Additional documentation

Additional documentation can be found at https://propka.readthedocs.io/.

References / Citations

Please cite these references in publications:

  • Sondergaard, Chresten R., Mats HM Olsson, Michal Rostkowski, and Jan H. Jensen. "Improved Treatment of Ligands and Coupling Effects in Empirical Calculation and Rationalization of pKa Values." Journal of Chemical Theory and Computation 7, no. 7 (2011): 2284-2295.

  • Olsson, Mats HM, Chresten R. Sondergaard, Michal Rostkowski, and Jan H. Jensen. "PROPKA3: consistent treatment of internal and surface residues in empirical pKa predictions." Journal of Chemical Theory and Computation 7, no. 2 (2011): 525-537.

propka's People

Contributors

aunity avatar charnley avatar danny305 avatar ialibay avatar latrocinia avatar matvey83 avatar mbeachy avatar orbeckst avatar sobolevnrm avatar speleo3 avatar tonigi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

propka's Issues

KeyError

Hello,
I cloned the repo just now, followed the installation instructions and tried to run the program on a pdb file. This was the output:

Traceback (most recent call last): File "/home/myuser/.local/bin/propka31", line 11, in <module> load_entry_point('PROPKA==3.1.1', 'console_scripts', 'propka31')() File "/home/myuser/.local/lib/python3.6/site-packages/PROPKA-3.1.1-py3.6.egg/propka/run.py", line 18, in main File "/home/myuser/.local/lib/python3.6/site-packages/PROPKA-3.1.1-py3.6.egg/propka/molecular_container.py", line 52, in __init__ File "/home/myuser/.local/lib/python3.6/site-packages/PROPKA-3.1.1-py3.6.egg/propka/version.py", line 50, in setup_bonding_and_protonation File "/home/myuser/.local/lib/python3.6/site-packages/PROPKA-3.1.1-py3.6.egg/propka/calculations.py", line 17, in setup_bonding_and_protonation File "/home/myuser/.local/lib/python3.6/site-packages/PROPKA-3.1.1-py3.6.egg/propka/calculations.py", line 36, in setup_bonding File "/home/myuser/.local/lib/python3.6/site-packages/PROPKA-3.1.1-py3.6.egg/propka/bonds.py", line 44, in __init__ File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 1137, in resource_filename self, resource_name File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 1646, in get_resource_filename return self._extract_resource(manager, zip_path) File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 1667, in _extract_resource timestamp, size = self._get_date_and_size(self.zipinfo[zip_path]) KeyError: 'propka/protein_bonds.json'

I'm afraid I don't know what exactly is wrong here and I would appreciate any assistance!
I'm on Ubuntu 18.04 and python 3.6.7. If any more info is needed I'll be happy to provide it.

Best!

Replace \ with () for multi-line statements.

The amount of changes is a bit overwhelming for a review, so I'm afraid I can only make some general comments.

I see a lot of variable and method name changes, and even a config name change (max_intrinsic_pka_diff). I suppose PROPKA 3.1 API compatibility is not a goal of this refactoring, and this will become PROPKA 4.0 when refactoring is complete? If this is a conscious decision, then I see no issue with that.

For multi-line statements, I think PEP8 prefers parentheses around the expression instead of a backslash, if possible.

Python 3.5 supports str.format which is a bit more "modern" than %-formatted strings, and uses the same syntax like the Python 3.6 f-strings.

Originally posted by @speleo3 in #40 (comment)

Problems with attributes

Dear Prof. Dr. Jensen,

I am having problems trying to use the propka library in python 3.6. The errors I get are related with the attributes. Please, find them in the next:
module 'propka' has no attribute 'calculations'
module 'propka' has no attribute 'protonate'
I think it is because in python 3.6 the syntax for importing modules has changed.
Have you tested this library in python 3.6 or higher? There is an updated version?

Best,
Abraham

create release 3.2.0

First official release will be 3.2.0

  • Update repo URL in documentation
  • Merge PR #61
  • Change repo name
  • release files on GitHub
  • PyPi package

See PR #61 .

PROPKA changes chain names form " " to "A"

If the input structure has residues that have empty chains, the output shows chain "A" as their chain. This is especially problematic if the structure contains 2 residues that have the same number, yet one has an empty chain, and the other has a chain of "A".

We suggest using an underscore ("_") to represent an empty chain. This is convention within the Schrodinger software. This would be an easy fix. We can work on this and submit a pull request.

Thanks,

Matvey Adzhigirey
Schrodinger, Inc.

Fix cyclic import in PROPKA

propka\version.py:1:0: R0401: Cyclic import (propka.bonds -> propka.calculations) (cyclic-import)
propka\version.py:1:0: R0401: Cyclic import (propka.atom -> propka.group -> propka.ligand -> propka.calculations -> propka.protonate) (cyclic-import)
propka\version.py:1:0: R0401: Cyclic import (propka.conformation_container -> propka.coupled_groups -> propka.group -> propka.ligand_pka_values -> propka.pdb) (cyclic-import)
propka\version.py:1:0: R0401: Cyclic import (propka.atom -> propka.group -> propka.protonate) (cyclic-import)
propka\version.py:1:0: R0401: Cyclic import (propka.atom -> propka.group -> propka.ligand_pka_values -> propka.pdb) (cyclic-import)
propka\version.py:1:0: R0401: Cyclic import (propka.atom -> propka.group -> propka.ligand_pka_values -> propka.pdb -> propka.conformation_container -> propka.determinants -> propka.calculations -> propka.protonate) (cyclic-import)
propka\version.py:1:0: R0401: Cyclic import (propka.atom -> propka.group -> propka.ligand_pka_values -> propka.calculations -> propka.protonate) (cyclic-import)
propka\version.py:1:0: R0401: Cyclic import (propka.atom -> propka.group -> propka.ligand_pka_values -> propka.molecular_container -> propka.pdb) (cyclic-import)
propka\version.py:1:0: R0401: Cyclic import (propka.conformation_container -> propka.coupled_groups -> propka.group -> propka.ligand_pka_values -> propka.molecular_container) (cyclic-import)
propka\version.py:1:0: R0401: Cyclic import (propka.atom -> propka.group -> propka.ligand_pka_values -> propka.molecular_container -> propka.version -> propka.calculations -> propka.protonate) (cyclic-import)

basic documentation

At this stage probably the most impactful addition is going to be documentation. Issues #27 and #28 requested the old, defunct tutorials. However, these would be out of date anyway.

A first milestone would be

  • sphinx-based docs
  • hosted on readthedocs or poissonboltzmann.org (the latter can be done with gh-pages and CNAME)
  • overview page
  • installation (from README)
  • quickstart (apply to a PDB, what to look for in the output, key commandline options)
  • description of the propka3 command with its options
  • API docs generated from doc strings

If you agree to the general requirements, we can raise individual issues for the parts. Some require more work than others. At this stage, anything is better than nothing, so I would add docs as we go along and perhaps use small tasks here to involve additional contributors.

Getting error with PDB 1A6W

For some reason, I am getting an error with PDB 1A6W (unmodified from file downloaded from PDB). This could be on my end, but other proteins seem to working fine.

Thanks,
Matt

The relevant error message is included below:

File "/Users/matthewrobinson/bin/propka31", line 11, in
load_entry_point('PROPKA==3.1', 'console_scripts', 'propka31')()
File "/Users/matthewrobinson/.local/lib/python3.6/site-packages/PROPKA-3.1-py3.6.egg/propka/run.py", line 13, in main
File "/Users/matthewrobinson/.local/lib/python3.6/site-packages/PROPKA-3.1-py3.6.egg/propka/molecular_container.py", line 55, in init
File "/Users/matthewrobinson/.local/lib/python3.6/site-packages/PROPKA-3.1-py3.6.egg/propka/molecular_container.py", line 110, in extract_groups
File "/Users/matthewrobinson/.local/lib/python3.6/site-packages/PROPKA-3.1-py3.6.egg/propka/conformation_container.py", line 41, in extract_groups
File "/Users/matthewrobinson/.local/lib/python3.6/site-packages/PROPKA-3.1-py3.6.egg/propka/conformation_container.py", line 146, in setup_and_add_group
File "/Users/matthewrobinson/.local/lib/python3.6/site-packages/PROPKA-3.1-py3.6.egg/propka/conformation_container.py", line 155, in init_group
File "/Users/matthewrobinson/.local/lib/python3.6/site-packages/PROPKA-3.1-py3.6.egg/propka/group.py", line 356, in setup
File "/Users/matthewrobinson/.local/lib/python3.6/site-packages/PROPKA-3.1-py3.6.egg/propka/group.py", line 739, in setup_atoms
IndexError: list index out of range

run.single pdbfile argument ignored

Expected

Passing a file and some arguments to run.single should work:

i.e.

import propka.run as pk

mol = pk.single('4LYI.pdb', optargs=['--quiet'])

Actual behaviour

The above worked in 3.1, however moving to 3.2 this leads to a SystemExit caused by agparse.

Causes

From what I can tell, the following are causing this behaviour:

  1. single calls loadOptions whose argparse call expects an input_pdb entry.

  2. pdbfile is overwritten by the return value of options.filenames.pop(0)

pdbfile = options.filenames.pop(0)

Possible fix

One quick fix here would be to switch single to have a behaviour similar to what is done in:

def run_propka(options, pdb_path, tmp_path):
"""Run PROPKA software.
Args:
options: list of PROPKA options
pdb_path: path to PDB file
tmp_path: path for working directory
"""
options += [str(pdb_path)]
args = loadOptions(options)
try:
_LOGGER.warning(
"Working in tmpdir {0:s} because of PROPKA file output; "
"need to fix this.".format(str(tmp_path)))
cwd = Path.cwd()
os.chdir(tmp_path)
parameters = read_parameter_file(args.parameters, Parameters())
molecule = MolecularContainer(parameters, args)
molecule = read_molecule_file(str(pdb_path), molecule)
molecule.calculate_pka()
molecule.write_pka()
if args.generate_propka_input:
molecule.write_propka()
finally:
os.chdir(cwd)

Exception thrown when alternate location indicator is not 1, A or whitespace

Traceback (most recent call last):
File "/home/ryan/.local/bin/propka31", line 11, in
load_entry_point('PROPKA==3.1.0', 'console_scripts', 'propka31')()
File "/home/ryan/.local/lib/python3.6/site-packages/PROPKA-3.1.0-py3.6.egg/propka/run.py", line 13, in main
File "/home/ryan/.local/lib/python3.6/site-packages/PROPKA-3.1.0-py3.6.egg/propka/molecular_container.py", line 46, in init
File "/home/ryan/.local/lib/python3.6/site-packages/PROPKA-3.1.0-py3.6.egg/propka/molecular_container.py", line 88, in top_up_conformations
KeyError: '1A'

command line pdb generation

Hi,

I would like to know if it is possible to generate a final pdb (with all protonation and names corrected ) file using propka by command line.

Thank you

PROPKA does not report residue insertion codes

If the input structure has multiple residues with the same chain and number but different insertion codes, they look identical in the output file. Example structure with insertion codes is 1ETT, where there are 5 residues with residue number 186: PRO H:186, GLY H:186A, GLU H:186B, GLYH:186C, and LYS H:186D.

This fix would require a slight change to the PROPKA output format (*.pka). I suggest adding the insertion code (if any) after the residue number, like this:

LYS 186A H 0.00 XXX 0 X 0.00 XXX 0 X 0.04 GLU 186 H
GLU 186B H 0.00 XXX 0 X 0.00 XXX 0 X -0.25 LYS 185 H

If the residue has no insertion code, a space should be reported there (so that alignment for all rows is the same).

PROPKA==3.1.0' distribution was not found and is required by the application

Hello,

I just installed propka 3.1 (I never worked with gnu-linux before) and I get this message when I try to run the propka command with a pdb argument

samuel@samuel-UX305CA:~$ propka31 '/home/samuel/Downloads/2jfz_monom_reFH.pdb'
Traceback (most recent call last):
File "/usr/local/bin/propka31", line 6, in
from pkg_resources import load_entry_point
File "/usr/lib/python2.7/dist-packages/pkg_resources/init.py", line 3088, in
@_call_aside
File "/usr/lib/python2.7/dist-packages/pkg_resources/init.py", line 3072, in _call_aside
f(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/pkg_resources/init.py", line 3101, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/usr/lib/python2.7/dist-packages/pkg_resources/init.py", line 574, in _build_master
ws.require(requires)
File "/usr/lib/python2.7/dist-packages/pkg_resources/init.py", line 892, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/lib/python2.7/dist-packages/pkg_resources/init.py", line 778, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'PROPKA==3.1.0' distribution was not found and is required by the application

Do you know what could I do to make this work ?

Thanks

Sam

Update with str.format

The amount of changes is a bit overwhelming for a review, so I'm afraid I can only make some general comments.

I see a lot of variable and method name changes, and even a config name change (max_intrinsic_pka_diff). I suppose PROPKA 3.1 API compatibility is not a goal of this refactoring, and this will become PROPKA 4.0 when refactoring is complete? If this is a conscious decision, then I see no issue with that.

For multi-line statements, I think PEP8 prefers parentheses around the expression instead of a backslash, if possible.

Python 3.5 supports str.format which is a bit more "modern" than %-formatted strings, and uses the same syntax like the Python 3.6 f-strings.

Originally posted by @speleo3 in #40 (comment)

publish pip-installable releases

It would be extremely convenient if PROPKA 3.1 could be installed in the standard way for all python packages:

pip install propka

For this to work, you would need to

  1. build a release
  2. upload to PyPi

Something like the following typically works (after having registered)

python setup.py sdist bdist_egg bdist_wheel upload

I submitted PR #15 that should put setup.py in the right shape.

I am more than happy to help; I could create the package on PyPi and then transfer PyPi package ownership to anyone interested in the Jensen group (e.g., @matvey83 ).

As a side note: it would also be nice if a fresh GitHub release could be created whenever a new release is pushed to PyPi.

setup.py script ignores "--install-scripts"

Hi,
It appears the setup.py script ignores the "--install-scripts" switch and installs everything in the default directory (~/.local/lib/python2.7/site-packages).

I'm using Debian, Python 2.7.9.

De-lint the code

This code base uses many different style conventions that complicate integration with other codes.

PEP8 is beautiful.

PROPKA 3.1 Tutorial and user guid are not reachable.

Hi ,
I was trying to compute pKa using PROPKA source after closing the server,
but when calculating there was no tutorial or user guide were reachable to get to know how to use argument to change force filed and other options was availale on the server.

any idea where to get program documentation? Or auther contact

best,
maryam

Import fails

Hey,
For some reasons the import completely fails under Windows environment. (see below)
Any idea how to fix this?

PyMOL>import propka
Traceback (most recent call last):
File "C:\Program Files (x86)\PyMOL\PyMOL/modules\pymol\parser.py", line 260, in parse
exec(layer.com2+"\n",self.pymol_names,self.pymol_names)
File "", line 1, in
SyntaxError: future feature print_function is not defined (propka.py, line 119)

Thanks in advance!

problems with predicted pKa of glutamic acid

I use different version propka to predict pKa of protein(PDB ID: 1EQC) recently, and find something may be wrong with predicted pKa of glutamic acid(GLU27,GLU51,GLU188 and GLU372), when visualize the structure we don't think these residues should be protonated, but according to the predicted pKa, these residues will be added proton, and I have't find any papers support this. could you give me some advise? or cheak if it is error of the algorithm of propka?

Thank you!

Problems about the pKa prediction of two close ASP residues

I use propka3.0 to predict the protonation state of one structure (PDBID: 2g1n).

  1. When only considering the receptor (i.e. without the ligand), the result is ASP33, ASH221. But the added proton of ASH221 seems to be weird because the best state will be the proton shared with the other ASP residue.
    image2

  2. When considering the ligand, the result is ASH33, ASP221. The added proton could share with the other ASP residue. But the distance between the added proton and the proton of amino is only 1.208 angstroms!
    image1

Something maybe wrong. Could you please give me some advice?

Failure with Python 3.5

While trying tor reproduce #48 I ran into a different issue, possibly related to 3.5. I am checking now and will update the issue as I go along. (Possibly the new CI will also show problems #62).

However, 3.5 is not officially supported anymore so we could easily drop it from PROPKA 3.2.0, just needs changes in PR #61

Reproduce with

# I use a virtualenv
mkvirtualenv -p python3.5 propka    # use a virtualenv (old system with only py3.5)
pip install ipython numpy                  # not needed but useful for testing
git clone https://github.com/jensengroup/propka-3.1.git
pip install -v propka-3.1/

I will then test with

cd /tmp
curl https://files.rcsb.org/download//2bem.pdb.gz | gzip -dc > 2bem.pdb
propka31 2bem.pdb

... and I get the following error

Traceback (most recent call last):
  File "~/.virtualenvs/propka/lib/python3.5/site-packages/propka/input.py", line 27, in open_file_for_reading
    file_ = open(input_file, 'rt')
TypeError: invalid file: PosixPath('2bem.pdb')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "~/.virtualenvs/propka/bin/propka31", line 8, in <module>
    sys.exit(main())
  File "~/.virtualenvs/propka/lib/python3.5/site-packages/propka/run.py", line 21, in main
    my_molecule = read_molecule_file(pdbfile, my_molecule)
  File "~/.virtualenvs/propka/lib/python3.5/site-packages/propka/input.py", line 51, in read_molecule_file
    input_path, mol_container.version.parameters, mol_container)
  File "~/.virtualenvs/propka/lib/python3.5/site-packages/propka/input.py", line 288, in read_pdb
    for (name, atom) in lines:
  File "~/.virtualenvs/propka/lib/python3.5/site-packages/propka/input.py", line 127, in get_atom_lines_from_pdb
    lines = open_file_for_reading(pdb_file).readlines()
  File "~/.virtualenvs/propka/lib/python3.5/site-packages/propka/input.py", line 29, in open_file_for_reading
    raise IOError('Cannot find file {0:s}'.format(input_file))
TypeError: non-empty format string passed to object.__format__

Propka3.1 installation failure

I, guess, have installed propka, when I use it, I get the following error:

alejo@alejo:~/Desktop/Proyecto_UIS/Calculos/3NIR$ /home/alejo/.local/bin/propka31 3nir.pdb
Traceback (most recent call last):
File "/home/alejo/.local/bin/propka31", line 11, in
load_entry_point('PROPKA==3.1.1', 'console_scripts', 'propka31')()
File "/home/alejo/.local/lib/python3.8/site-packages/PROPKA-3.1.1-py3.8.egg/propka/run.py", line 14, in main
TypeError: loadOptions() missing 1 required positional argument: 'args'

And I do not understand how to solve it,
Any suggestion?

Thank you in advance,
David

Use logging instead of STDOUT?

I have written some analysis code that performs propka on every frame of a trajectory, and although it probably doesn't affect performance (much), it would be nice to be able to disable output to STDOUT so that my own progress indicators aren't drowned out by propka's output. This would probably be best implemented using the built-in logging module.

Need stable release for Homebrew

Hi,
I have made a homebrew formula of propka-3.1 for easy installation on macOS. I need a tagged stable release of this software since the homebrew has a versioning system. ( See also brewsci/homebrew-bio#655 )

I will appreciate your help with this situation.

Merge duplicate tests in PROPKA 3.1

Are these tests really duplicates?
python -m pytest runs one test and it passes.
Running python runtest.py produces one failure:

RUNNING 1HPX-warn
 ERR:
 Failed to execute PROPKA on 1HPX-warn
 See: 1HPX-warn.out
propka31.py: error: unrecognized arguments: --quiet

Originally posted by @speleo3 in #30 (comment)

Adding new residue to propka3.1 database

Hi,

I have a small question regarding the program Propka3.1, and I hope that you can help me with this.
I am inserting a novel residue in the program database, which is a retinal-lysine complex. Because this complex is "a bit" similar to lysine, I added the REL residue in the same way the LYS is added with the following exception: the charge in protonate.py and propka.cfg was set to 0.7 'REL-NZ':0.7. I also tested the charge 1.0 and 0.5. After changing the charge value, I recompiled the propka with

python setup.py install --user --install-scripts ~/bin

However, the pKa values of residues close to the NZ-part of REL (as well as the pka values of other residues) did not alter at all. It seems that propka does not see that I am modifying the charge. How can this be? Am I doing something wrong?

Best regards,
Dmitrii

Passing a stream no longer works

Related issues

Related to #57

Expected behaviour

In propka 3.1, passing a "Named Stream" i.e. a Stream-like object that also provides a mocked filename that can be read via pathlib.Path (see: MDAnalysis.lib.util.NamedStream) instead of a path of an input PDB file would work.

Example (based on https://github.com/Becksteinlab/propkatraj):

import propka.run as pk
import MDAnalysis as mda
from MDAnalysisTests.datafiles import PSF, DCD
u = mda.Universe(PSF, DCD)

pstream = pstream = mda.lib.util.NamedStream(StringIO(), 'input.pdb')
u.atoms.write(pstream)
pstream.reset()

mol = pk.single(pstream, optargs=['--quiet'])

Actual behaviour

As detailed in #82 using propka.run.single does not seem to currently work, however we would expect the following to work (it does not):

# based on test_basic_regression
from propka.parameters import Parameters
from propka.molecular_container import MolecularContainer
from propka.input import read_parameter_file, read_molecule_file
from propka.lib import loadOptions

options = ['--quiet']
options += [str(Path(pstream))]
args  = loadOptions(options)
parameters = read_parameter_file('propka.cfg', Parameters())
molecule = MolecularContainer(parameters, args)
molecule = read_molecule_file(pstream, molecule)
molecule.calculate_pka()

Causes

As far as I could tell, there are two main causes for this:

  1. read_pdb passes input_path instead of input_file:

propka/propka/input.py

Lines 55 to 56 in 01debbf

conformations, conformation_names = read_pdb(
input_path, mol_container.version.parameters, mol_container)

  1. open_file_for_reading does not work as expected.
  • At some point in #40, the attribute checks for file-like streams were removed, it's unclear if this was intentional.
  • Calling fseek(0) does not work. It's unclear to me as to what object this originally expected as most python file-like objects implement seek.

Possible fix

Switching fseek -> seek and input_path -> input_file fixes things and does not seem to cause any issues in the regression tests.

Concerns in calculate_folding_energy method in group class

I'm reading the source code of calculate_folding_energy method implemented in the group class. It looks like the Q_pro = math.log10(1+y) and Q_mod = math.log10(1+y) are not right. For example, assuming the pH equals to the self.pka_value, I would expect 50% of the ionizable group to be charged. Therefore, the Q_pro = 0.5. However, the existing code will give a value of 0.301. The correct implementation should be Q_pro = exp(-math.log10**(pH-pKa))/(1+exp(-math.log10**(pH-pKa))) according to equation 13a of this paper (https://www.ncbi.nlm.nih.gov/pubmed/29319301).

Zheng

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.