Skip to content

Commit

Permalink
add setup.py
Browse files Browse the repository at this point in the history
  • Loading branch information
ficusss committed Jan 17, 2018
1 parent 7d96de0 commit 9002d49
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 0 deletions.
Empty file added README.rst
Empty file.
8 changes: 8 additions & 0 deletions pygmn/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# __init__.py

from normalizations import total_count_normalization
from normalizations import percentile_normalization
from normalizations import quartile_normalization
from normalizations import tmm_normalization

__version__ = "0.1"
6 changes: 6 additions & 0 deletions pygmn/normalizations.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from scipy.stats import rankdata
from utils import percentile

#===============================================================================

def total_count_normalization(matrix):
"""
Expand All @@ -20,6 +21,7 @@ def total_count_normalization(matrix):
"""
return matrix / matrix.sum(axis=0)

#===============================================================================

def percentile_normalization(matrix, p):
"""
Expand All @@ -39,6 +41,7 @@ def percentile_normalization(matrix, p):
"""
return matrix / percentile(matrix, p)

#===============================================================================

def quartile_normalization(matrix, q):
"""
Expand All @@ -63,6 +66,7 @@ def quartile_normalization(matrix, q):
assert q in d, 'Unexpected quartile for normalization: "' + str(q) + '"'
return percentile_normalization(matrix, d[q])

#===============================================================================

def tmm_normalization(matr, index_ref=None, trim_fold_change=0.3, trim_abs_expr=0.05):
"""
Expand Down Expand Up @@ -137,3 +141,5 @@ def log2_tmm(index_vec):
# calculation tmm_factor and normalization of input data
tmm_factor = 2 ** np.array([log2_tmm(i) for i in range(matrix.shape[1])])
return matr / tmm_factor

#===============================================================================
34 changes: 34 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# setup.py


PACKAGE = "pygmn"
NAME = "pygmn"
DESCRIPTION = "Package with methods for normalization matrices of genes expression."
AUTHOR = "Grigory Feoktistov"
AUTHOR_EMAIL = "[email protected]"
URL = "https://github.com/ficusss/PyGMNormalize"
VERSION = __import__(PACKAGE).__version__


setup(
name=NAME,
version=VERSION,
description=DESCRIPTION,
long_description=read("README.md"),
author=AUTHOR,
author_email=AUTHOR_EMAIL,
license="BSD",
url=URL,
packages=find_packages(exclude=["tests.*", "tests"]),
package_data=find_package_data(PACKAGE, only_in_packages=False),
classifiers=[
"Development Status :: 3 - Alpha",
"Environment :: Web Environment",
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Framework :: Django",
],
zip_safe=False,
)

0 comments on commit 9002d49

Please sign in to comment.