Skip to content

Commit

Permalink
v.0.9.2: add dependencies to setup.py, expand installation instructio…
Browse files Browse the repository at this point in the history
…ns in README, version sync between setup.py and __init__.py, test-1 reorganization
  • Loading branch information
luponzo86 committed Jun 12, 2019
1 parent 5b98b2f commit eb130ea
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 40 deletions.
22 changes: 17 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,31 @@
# Rhapsody
Python program, based on ProDy, for pathogenicity prediction of human missense variants.

## Install using pip
## Install latest published version using pip
Rhapsody is published on [PyPI](https://pypi.org/). To install Rhapsody, please use pip in the terminal:
```console
$ pip install -U prody-rhapsody
```

## Install from source
Rhapsody is written in pure Python so no local compilation is needed. To install from the source, you can download or clone Rhapsody to your prefered location (e.g. `path/to/rhapsody/`), and then add that location to `PYTHONPATH` environmental variable. For example, on Linux you can add the following line to your `~/.bashrc`:
Rhapsody is written in pure Python so no local compilation is needed.

To install all needed dependencies, we strongly suggest to use Conda and create a new environment with:
```console
conda create -n rhapsody python=3 numpy scikit-learn requests pyparsing
conda activate rhapsody
pip install biopython prody
```
EXPORT PYTHONPATH="path/to/rhapsody/:$PYTHONPATH"

After cloning/forking the Rhapsody repository, you can permanently add the repository path to the conda environment with:
```console
conda develop path/to/local/repository
```

If you are running on Windows, please follow this tutorial:
If not using Conda, you can manually install all dependencies and then add the repository location to the `PYTHONPATH` environmental variable. For example, on Linux simply add the following line to your `~/.bashrc`:
```
export PYTHONPATH="path/to/local/repository/:$PYTHONPATH"
```

[How to add to the PYTHONPATH in Windows, so it finds my modules/packages? - stackoverflow](https://stackoverflow.com/a/4855685)
If you are running on Windows, please follow this [tutorial](https://stackoverflow.com/a/4855685).

1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.9.2
9 changes: 6 additions & 3 deletions rhapsody/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
__version__ = '0.9.1'
from os import path

here = path.abspath(path.dirname(__file__))
with open(path.join(here, '../VERSION'), encoding='utf-8') as f:
__version__ = f.read()

__release__ = __version__

__all__ = []
Expand Down Expand Up @@ -38,5 +43,3 @@
from . import figures
from .figures import *
__all__.extend(figures.__all__)


49 changes: 30 additions & 19 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,29 +1,34 @@
"""Python program, based on Prody, for pathogenicity prediction of human missense variants.
See:
https://github.com/prody/rhapsody
"""Python program, based on Prody, for pathogenicity prediction of human
missense variants. See: https://github.com/prody/rhapsody
"""

from setuptools import setup, find_packages
from os import path
from io import open

here = path.abspath(path.dirname(__file__))

with open(path.join(here, 'VERSION'), encoding='utf-8') as f:
version = f.read()
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
long_description = f.read()

setup(
name='prody-rhapsody',
version='0.9.1',
description='Python program, based on ProDy, for pathogenicity prediction of human missense variants.',
long_description=long_description,
long_description_content_type='text/markdown',
version=version,
packages=find_packages(exclude=['contrib', 'docs', 'tests']),
python_requires='>=3.5, <4',
install_requires=['requests', 'numpy', 'scikit-learn',
'biopython', 'pyparsing', 'prody'],
description="""Python program, based on ProDy, for pathogenicity prediction
of human missense variants.""",
long_description=long_description,
long_description_content_type='text/markdown',
url='https://github.com/prody/rhapsody',
author='Luca Ponzoni',
author_email='[email protected]',
author='Luca Ponzoni',
author_email='[email protected]',
platforms=['Windows', 'MacOS X', 'POSIX'],
license='GPL',
classifiers=[
classifiers=[
'Development Status :: 4 - Beta',

'Intended Audience :: End Users/Desktop',
Expand All @@ -40,13 +45,19 @@
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
],
keywords='SAV missense variant protein dynamics',
packages=find_packages(exclude=['contrib', 'docs', 'tests']),
python_requires='>=3.5, <4',
install_requires=['prody', 'numpy', 'biopython', 'sklearn'],

project_urls={
'Bug Reports': 'https://github.com/luponzo86/rhapsody/issues',
keywords='SAV missense variant protein dynamics',
project_urls={
'Bug Reports': 'https://github.com/prody/rhapsody/issues',
'Source': 'https://github.com/prody/rhapsody/',
},
)
)

'''
Publish to PyPI with:
$ rm -rf prody_rhapsody.egg-info/ build/ dist/
$ python setup.py sdist bdist_wheel
$ twine check dist/*
$ twine upload dist/*
'''
1 change: 1 addition & 0 deletions test/test-1/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
workspace/
37 changes: 24 additions & 13 deletions test/test-1/test-1.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,30 @@
import numpy as np
import sys

sys.path.append('../../')
import os
import numpy as np
import prody as pd

# check if rhapsody can be imported correctly
from rhapsody import *
sys.path.append('../../')
import rhapsody as rd

# set folders
pathRhapsodyFolder('./data')
pathEVmutationFolder('./data')
from prody import pathPDBFolder
pathPDBFolder('./data')
if not os.path.isdir('workspace'):
os.mkdir('workspace')
old_rhaps_dir = rd.pathRhapsodyFolder()
old_EVmut_dir = rd.pathEVmutationFolder()
old_prody_dir = pd.pathPDBFolder()[0]
rd.pathRhapsodyFolder('./workspace')
rd.pathEVmutationFolder('./data')
pd.pathPDBFolder('./data')

# test cases
test_SAVs = [
'O00294 496 A T', # "good" SAV where all features are well-defined
'O00238 31 R H' # "bad" SAV with no PDB structure (but does have Pfam domain)
'O00294 496 A T', # "good" SAV where all features are well-defined
'O00238 31 R H' # "bad" SAV with no PDB structure (but has Pfam domain)
]

# initialize a rhapsody object
rh = Rhapsody()
rh = rd.Rhapsody()

# import precomputed PolyPhen-2 output file
rh.importPolyPhen2output('data/pph2-full.txt')
Expand All @@ -29,13 +34,19 @@

# true labels must be set prior to exporting training data
true_labels = {
'O00294 496 A T': 1,
'O00238 31 R H': 0
'O00294 496 A T': 1,
'O00238 31 R H': 0
}
rh.setTrueLabels(true_labels)

# compute all features
m = rh.exportTrainingData()
os.rename('rhapsody-Uniprot2PDB.txt', 'workspace/rhapsody-Uniprot2PDB.txt')

# restore previous settings
rd.pathRhapsodyFolder(old_rhaps_dir)
rd.pathEVmutationFolder(old_EVmut_dir)
pd.pathPDBFolder(old_prody_dir)

# final check
precomp_feats = np.load('data/precomputed_features.npy')
Expand Down

0 comments on commit eb130ea

Please sign in to comment.