diff --git a/.codecov.yml b/.codecov.yml index 45ca8c31..8bf6c855 100644 --- a/.codecov.yml +++ b/.codecov.yml @@ -1,2 +1,4 @@ codecov: - branch: release \ No newline at end of file + branch: release +ignore: + - "*/tests/*” \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index a11eed8f..00000000 --- a/.travis.yml +++ /dev/null @@ -1,25 +0,0 @@ -language: python -python: - - 3.6 - - 3.7 - - 3.8 -install: - - pip install -r requirements.txt --no-cache-dir --upgrade - - pip install -r requirements-test.txt --no-cache-dir --upgrade - - pip install -r requirements-multiprocessing.txt --no-cache-dir - - python setup.py install -script: - - git clone https://github.com/simonsfoundation/kvsstcp - - export PYTHONPATH=$PYTHONPATH:$(pwd)/kvsstcp - - python -c "import os; print(repr(os.name))" - - python -c "import matplotlib as plt; print('imported matplotlib '+ str(plt.__version__))" - - python -c "import pandas as pd; print('imported pandas '+ str(pd.__version__))" - - python -c "import numpy as np; print('imported numpy '+ str(np.__version__))" - - python -c "import scipy as sp; print('imported scipy '+ str(sp.__version__))" - - python -c "import anndata as ad; print('imported anndata '+ str(ad.__version__))" - - coverage run --source=inferelator setup.py test -after_success: - - codecov -after_failure: - - pwd - - find . \ No newline at end of file diff --git a/docs/conf.py b/docs/conf.py index 09556691..f92e3a16 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -23,7 +23,7 @@ author = 'Chris Jackson' # The full version, including alpha/beta/rc tags -release = 'v0.5.5' +release = 'v0.5.6' # -- General configuration --------------------------------------------------- diff --git a/inferelator/postprocessing/f1_score.py b/inferelator/postprocessing/f1_score.py index 92269393..930cc0f2 100644 --- a/inferelator/postprocessing/f1_score.py +++ b/inferelator/postprocessing/f1_score.py @@ -4,8 +4,6 @@ from inferelator.postprocessing import (TARGET_COLUMN, REGULATOR_COLUMN, CONFIDENCE_COLUMN, F1_COLUMN, PRECISION_COLUMN, RECALL_COLUMN) -import matplotlib -matplotlib.use('pdf') import matplotlib.pyplot as plt diff --git a/inferelator/postprocessing/matthews_correlation.py b/inferelator/postprocessing/matthews_correlation.py index b610e7e6..1dfd9772 100644 --- a/inferelator/postprocessing/matthews_correlation.py +++ b/inferelator/postprocessing/matthews_correlation.py @@ -5,8 +5,6 @@ from inferelator.postprocessing import (TARGET_COLUMN, REGULATOR_COLUMN, CONFIDENCE_COLUMN, GOLD_STANDARD_COLUMN, MCC_COLUMN, TP, FP, TN, FN) -import matplotlib -matplotlib.use('pdf') import matplotlib.pyplot as plt diff --git a/inferelator/postprocessing/model_metrics.py b/inferelator/postprocessing/model_metrics.py index a4bafc9d..ec49f50e 100644 --- a/inferelator/postprocessing/model_metrics.py +++ b/inferelator/postprocessing/model_metrics.py @@ -8,8 +8,6 @@ from inferelator.utils import is_string import os -import matplotlib -matplotlib.use('pdf') import matplotlib.pyplot as plt @@ -84,36 +82,39 @@ def auc(self): def curve_dataframe(self): return self.filtered_data.loc[:, [CONFIDENCE_COLUMN, PRECISION_COLUMN, RECALL_COLUMN, MCC_COLUMN, F1_COLUMN]] - def output_curve_pdf(self, output_dir, file_name=None, dpi=300, figsize=(8, 10)): + def output_curve_pdf(self, output_dir, file_name=None, dpi=300, figsize=(8, 10), style_label='default'): file_name = self.curve_file_name if file_name is None else file_name # Create a figure - fig, axes = plt.subplots(nrows=2, ncols=2, figsize=figsize, constrained_layout=True) + with plt.style.context(style_label): + fig, axes = plt.subplots(nrows=2, ncols=2, figsize=figsize, constrained_layout=True) - # Draw the PR curve - RankSummaryPR.output_curve(self, ax=axes[0, 0]) + # Draw the PR curve + RankSummaryPR.output_curve(self, ax=axes[0, 0]) - # Add the cutoff at optimal MCC to the curve - _ocr = self.filtered_data.loc[self.filtered_data[CONFIDENCE_COLUMN] >= self.optconfmcc, RECALL_COLUMN].max() - _ocp = self.filtered_data.loc[self.filtered_data[CONFIDENCE_COLUMN] >= self.optconfmcc, PRECISION_COLUMN].min() - axes[0, 0].vlines(_ocr, 0, _ocp, colors='r', linestyles='dashed') + # Add the cutoff at optimal MCC to the curve + _ocr = self.filtered_data.loc[self.filtered_data[CONFIDENCE_COLUMN] >= self.optconfmcc, RECALL_COLUMN].max() + _ocp = self.filtered_data.loc[self.filtered_data[CONFIDENCE_COLUMN] >= self.optconfmcc, PRECISION_COLUMN].min() + axes[0, 0].vlines(_ocr, 0, _ocp, colors='r', linestyles='dashed') - # Draw the MCC curve - RankSummaryMCC.output_curve(self, ax=axes[0, 1]) + # Draw the MCC curve + RankSummaryMCC.output_curve(self, ax=axes[0, 1]) - # Draw the F1 curve - RankSummaryF1.output_curve(self, ax=axes[1, 0]) + # Draw the F1 curve + RankSummaryF1.output_curve(self, ax=axes[1, 0]) - # Draw the histogram - self.output_histogram_edges_conf(self.filtered_data[CONFIDENCE_COLUMN].values, ax=axes[1, 1]) + # Draw the histogram + self.output_histogram_edges_conf(self.filtered_data[CONFIDENCE_COLUMN].values, ax=axes[1, 1]) # If there's a file name set, make the output file if file_name is not None and output_dir is not None: # Save the plot and close self.save_figure(os.path.join(output_dir, file_name), fig, dpi=dpi) + plt.close(fig) + return None, None - plt.close(fig) + return fig, axes @staticmethod def output_histogram_edges_conf(conf, ax): diff --git a/inferelator/postprocessing/precision_recall.py b/inferelator/postprocessing/precision_recall.py index a4794e30..b6c3c506 100644 --- a/inferelator/postprocessing/precision_recall.py +++ b/inferelator/postprocessing/precision_recall.py @@ -8,8 +8,6 @@ from inferelator.postprocessing import (TARGET_COLUMN, REGULATOR_COLUMN, PRECISION_COLUMN, RECALL_COLUMN, CONFIDENCE_COLUMN, GOLD_STANDARD_COLUMN) -import matplotlib -matplotlib.use('pdf') import matplotlib.pyplot as plt @@ -168,4 +166,4 @@ def calculate_aupr(data): # using midpoint integration to calculate the area under the curve d_recall = np.diff(recall) m_precision = precision[:-1] + np.diff(precision) / 2 - return sum(d_recall * m_precision) \ No newline at end of file + return sum(d_recall * m_precision) diff --git a/requirements-test.txt b/requirements-test.txt index f3e94e85..1abb5515 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -1,4 +1,4 @@ coverage -nose +pytest bio-test-artifacts tables diff --git a/setup.py b/setup.py index 0dd12e14..611a001b 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from setuptools import setup, find_packages # Current Inferelator Version Number -version = "0.5.5" +version = "0.5.6" # Description from README.md @@ -37,8 +37,7 @@ zip_safe=False, install_requires=requires, python_requires=">=3.5", - tests_require=["coverage", "nose", "bio-test-artifacts", "tables"], - test_suite="nose.collector", + tests_require=["coverage", "pytest", "bio-test-artifacts", "tables"], classifiers=[ "Programming Language :: Python :: 3", "License :: OSI Approved :: BSD License",