Skip to content

Commit

Permalink
Add Excel support and bump to 0.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
apcamargo committed Jul 24, 2019
1 parent dbdf92f commit 1227b3a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ usage: tspex [-h] [-l] [-d] [-t THRESHOLD] input_file output_file method
Compute gene tissue-specificity from an expression matrix and save the output.
positional arguments:
input_file Expression matrix file in the TSV or CSV formats.
input_file Expression matrix file in the TSV, CSV or Excel
formats.
output_file Output TSV file containing tissue-specificity values.
method Tissue-specificity metric. Allowed values are:
"counts", "tau", "gini", "simpson",
Expand Down
3 changes: 2 additions & 1 deletion docs/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ usage: tspex [-h] [-l] [-d] [-t THRESHOLD] input_file output_file method
Compute gene tissue-specificity from an expression matrix and save the output.
positional arguments:
input_file Expression matrix file in the TSV or CSV formats.
input_file Expression matrix file in the TSV, CSV or Excel
formats.
output_file Output TSV file containing tissue-specificity values.
method Tissue-specificity metric. Allowed values are:
"counts", "tau", "gini", "simpson",
Expand Down
8 changes: 4 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@

setup(
name='tspex',
version='0.5.1',
version='0.6.0',
packages=find_packages(),
license='GNU General Public License v3.0',
description='A Python package for calculating tissue-specificity metrics for gene expression.',
long_description=open('README.md').read(),
long_description_content_type='text/markdown',
install_requires=['matplotlib >= 2.2', 'numpy', 'pandas >= 0.23'],
python_requires= '>=3',
entry_points = {
install_requires=['matplotlib >= 2.2', 'numpy', 'pandas >= 0.23', 'xlrd >= 1.1.0'],
python_requires='>=3',
entry_points={
'console_scripts': ['tspex=tspex.cli:main'],
},
url='https://apcamargo.github.io/tspex/',
Expand Down
7 changes: 5 additions & 2 deletions tspex/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@
def tspex_cli(input_file, output_file, method, log, disable_transformation, threshold):
"""Compute gene tissue-specificity from a expression matrix file and save an output file."""
transform = not disable_transformation
expression_matrix = pd.read_csv(input_file, index_col=0, header=0, sep=None, engine='python')
if input_file.rsplit('.', 1)[1].lower() in ['xls', 'xlsx']:
expression_matrix = pd.read_excel(input_file, index_col=0, header=0)
else:
expression_matrix = pd.read_csv(input_file, index_col=0, header=0, sep=None, engine='python')
tissue_specificity = tspex.TissueSpecificity(
expression_matrix, method, log, transform=transform, threshold=threshold)
tissue_specificity.tissue_specificity.to_csv(output_file, sep='\t')
Expand All @@ -45,7 +48,7 @@ def main():
description='Compute gene tissue-specificity from an expression matrix and save the output.',
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('input_file',
help='Expression matrix file in the TSV or CSV formats.')
help='Expression matrix file in the TSV, CSV or Excel formats.')
parser.add_argument('output_file',
help='Output TSV file containing tissue-specificity values.')
parser.add_argument(
Expand Down

0 comments on commit 1227b3a

Please sign in to comment.