Skip to content

Commit

Permalink
Switched from distutils to setuptools and added entrypoint and some s…
Browse files Browse the repository at this point in the history
…mall changes
  • Loading branch information
timeu committed Dec 2, 2014
1 parent a335544 commit e7f822a
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 24 deletions.
File renamed without changes.
4 changes: 2 additions & 2 deletions pygwas/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
__version__ = '0.1.0'
__updated__ = "20.8.2014"
__version__ = '0.1.1'
__updated__ = "01.12.2014"
__date__ = "20.8.2014"
9 changes: 9 additions & 0 deletions pygwas/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env python
"""The main entry point. Invoke as `pygwas' or `python -m pygwas'.
"""
import sys
from pygwas import main


if __name__ == '__main__':
sys.exit(main())
23 changes: 10 additions & 13 deletions pygwas/pygwas.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python
# coding: utf-8
"""
pygwas.pygwas
pygwas
~~~~~~~~~~~~~
The main module for running Genome Wide Association studies
Expand All @@ -10,9 +10,8 @@
:license: license_name, see LICENSE for more details
"""

from __init__ import __version__,__updated__,__date__
from argparse import ArgumentParser
from argparse import RawDescriptionHelpFormatter
from . import __version__,__updated__,__date__
import argparse
from core import kinship
from core import gwas
import logging, logging.config
Expand Down Expand Up @@ -56,7 +55,7 @@
log = logging.getLogger()

def get_parser(program_license,program_version_message):
parser = ArgumentParser(description=program_license, formatter_class=RawDescriptionHelpFormatter)
parser = argparse.ArgumentParser(description=program_license)
parser.add_argument("-t", "--transformation", dest="transformation", help="Apply a transformation to the data. Default[None]", choices=["log", "sqrt", "exp", "sqr", "arcsin_sqrt", "box_cox"])
parser.add_argument("-a", "--analysis_method", dest="analysis_method", help="analyis method to use",required=True,choices=["lm", "emma", "emmax", "kw", "ft", "emmax_anova", "lm_anova", "emmax_step", "lm_step","loc_glob_mm","amm"])
parser.add_argument("-g", "--genotype", dest="genotype", help="genotype dataset to be used in the GWAS analysis (run with option -l to display list of available genotype datasets)", required=True, type=int,metavar="INTEGER" )
Expand All @@ -71,11 +70,10 @@ def get_parser(program_license,program_version_message):

def main():
'''Command line options.'''
program_name = os.path.basename(sys.argv[0])
program_version = "v%s" % __version__
program_build_date = str(__updated__)
program_version_message = '%%(prog)s %s (%s)' % (program_version, program_build_date)
program_shortdesc = __import__('__main__').__doc__.split("\n")[1]
program_shortdesc = "The main module for running Genome Wide Association studies"
program_license = '''%s
Created by Ümit Seren on %s.
Expand All @@ -89,13 +87,12 @@ def main():
USAGE
''' % (program_shortdesc, str(__date__))

# Process arguments
parser = get_parser(program_license,program_version_message)
args = vars(parser.parse_args())
try:
# Process arguments
parser = get_parser(program_license,program_version_message)
args = parser.parse_args()
result = perform_gwas(args.file,args.analysis_method, args.genotype_folder,args.genotype,args.transformation,args.kinship)
result.save_as_hdf5(args.outputfile)
result = perform_gwas(args['file'],args['analysis_method'], args['genotype_folder'],args['genotype'],args['transformation'],args['kinship'])
result.save_as_hdf5(args['outputfile'])
return 0
except KeyboardInterrupt:
### handle keyboard interrupt ###
Expand Down
5 changes: 5 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[bdist_wheel]
# This flag says that the code is written to work on both Python 2 and Python
# 3. If at all possible, it is good practice to do this. If you cannot, you
# will need to generate wheels for each Python version that you support.
universal=1
47 changes: 38 additions & 9 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,47 @@
from distutils.core import setup
from setuptools import setup, find_packages # Always prefer setuptools over distutils
from codecs import open # To use a consistent encoding
from os import path
import pygwas

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

# Get the long description from the relevant file
with open(path.join(here, 'DESCRIPTION.rst'), encoding='utf-8') as f:
long_description = f.read()

setup(
name='PyGWAS',
version='0.1.0',
version=pygwas.__version__,
description='A GWAS library',
long_description=long_description,
url='https://github.com/pypa/pygwas',
author='Uemit Seren',
author_email='[email protected]',
packages=['pygwas','pygwas.core'],
url='http://pypi.python.org/pypi/pygwas/',
license='LICENSE.txt',
description='GWAS library',
long_description=open('README.txt').read(),
author_email='[email protected]',
license='MIT',
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'Topic :: Scientific/Engineering :: Bio-Informatics',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.2',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
],
keywords='GWAS',
packages=find_packages(exclude=['contrib', 'docs', 'tests*']),
install_requires=[
"numpy >=1.6.1",
"scipy >=0.13.0",
"h5py >=2.1.3",
],
entry_points={
'console_scripts': [
'pygwas=pygwas.__main__:main',
],
)
},
)

0 comments on commit e7f822a

Please sign in to comment.