From 2909939323069d7cd0d8308610d3a3a98a50810c Mon Sep 17 00:00:00 2001 From: a-slide Date: Tue, 20 Oct 2020 14:01:10 +0100 Subject: [PATCH 1/2] Quick fix for https://github.com/a-slide/pycoMeth/issues/36 --- pycoMeth/Meth_Comp.py | 53 ++++++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/pycoMeth/Meth_Comp.py b/pycoMeth/Meth_Comp.py index 8b544cf..555aabb 100644 --- a/pycoMeth/Meth_Comp.py +++ b/pycoMeth/Meth_Comp.py @@ -356,32 +356,33 @@ def multitest_adjust(self): pvalue_list.append(res["pvalue"]) # Adjust values - adj_pvalue_list = multipletests( - pvals = pvalue_list, - alpha = self.pvalue_threshold, - method = self.pvalue_adj_method)[1] - - # add adjusted values to appropriate category - for i, adj_pvalue in zip(pvalue_idx, adj_pvalue_list): - - # Fix and categorize p-values - if adj_pvalue is np.nan or adj_pvalue is None or adj_pvalue>1 or adj_pvalue<0: - adj_pvalue = 1.0 - comment="Non-significant pvalue" - - elif adj_pvalue <= self.pvalue_threshold: - # Correct very low pvalues to minimal float size - if adj_pvalue == 0: - adj_pvalue = self.min_pval - # update counter if pval is still significant after adjustment - comment = "Significant pvalue" - else: - comment= "Non-significant pvalue" - - # update counters and update comment and adj pavalue - self.counter[comment]+=1 - self.res_list[i]["comment"] = comment - self.res_list[i]["adj_pvalue"] = adj_pvalue + if pvalue_list: + adj_pvalue_list = multipletests( + pvals = pvalue_list, + alpha = self.pvalue_threshold, + method = self.pvalue_adj_method)[1] + + # add adjusted values to appropriate category + for i, adj_pvalue in zip(pvalue_idx, adj_pvalue_list): + + # Fix and categorize p-values + if adj_pvalue is np.nan or adj_pvalue is None or adj_pvalue>1 or adj_pvalue<0: + adj_pvalue = 1.0 + comment="Non-significant pvalue" + + elif adj_pvalue <= self.pvalue_threshold: + # Correct very low pvalues to minimal float size + if adj_pvalue == 0: + adj_pvalue = self.min_pval + # update counter if pval is still significant after adjustment + comment = "Significant pvalue" + else: + comment= "Non-significant pvalue" + + # update counters and update comment and adj pavalue + self.counter[comment]+=1 + self.res_list[i]["comment"] = comment + self.res_list[i]["adj_pvalue"] = adj_pvalue #~~~~~~~~~~~~~~~~~~~~~~~~~~~Comp_Writer HELPER CLASS~~~~~~~~~~~~~~~~~~~~~~~~~~~# class Comp_Writer(): From 7a1d22f810ca35db988f80e01e5c7f7501b4193b Mon Sep 17 00:00:00 2001 From: a-slide Date: Tue, 20 Oct 2020 14:02:36 +0100 Subject: [PATCH 2/2] Bump up version --- meta.yaml | 2 +- pycoMeth/__init__.py | 2 +- setup.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/meta.yaml b/meta.yaml index bf16dbb..48c6618 100644 --- a/meta.yaml +++ b/meta.yaml @@ -1,4 +1,4 @@ -{% set version = "0.4.22" %} +{% set version = "0.4.23" %} {% set name = "pycoMeth" %} package: diff --git a/pycoMeth/__init__.py b/pycoMeth/__init__.py index 45cdd85..76e47b6 100755 --- a/pycoMeth/__init__.py +++ b/pycoMeth/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- # Define self package variable -__version__ = "0.4.22" +__version__ = "0.4.23" __description__ = 'DNA methylation analysis downstream to Nanopolish for Oxford Nanopore DNA sequencing datasets' diff --git a/setup.py b/setup.py index 6df4464..abab6e8 100755 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ # Define package info name = "pycoMeth" -version = "0.4.22" +version = "0.4.23" description = "DNA methylation analysis downstream to Nanopolish for Oxford Nanopore DNA sequencing datasets" with open("README.md", "r") as fh: long_description = fh.read()