From 5e9327688e3ec6b4c135bf045ce183c28271c145 Mon Sep 17 00:00:00 2001 From: Ino de Bruijn Date: Thu, 10 Sep 2015 17:22:40 -0400 Subject: [PATCH] Fix #12 0 cov in region with cov --- sufam/__main__.py | 3 +++ tests/test_validation.py | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/sufam/__main__.py b/sufam/__main__.py index 5f5aa12..3fb8767 100644 --- a/sufam/__main__.py +++ b/sufam/__main__.py @@ -97,6 +97,9 @@ def get_baseparser_extended_df(sample, bp_lines, ref, alt): columns=["sample"] + columns, dtype=np.object) bpdf[bpdf == ""] = None + # remove zero coverage rows + bpdf = bpdf[bpdf["cov"].astype(int) > 0] + if len(bpdf) == 0: return None diff --git a/tests/test_validation.py b/tests/test_validation.py index 0ca1572..e4181f3 100644 --- a/tests/test_validation.py +++ b/tests/test_validation.py @@ -106,3 +106,8 @@ def test_mpileup_test3(self): assert_equals("+", bpdf.most_common_indel_type.iloc[0]) assert_almost_equals(0.0139, float(bpdf.val_maf.iloc[0]), places=3) assert_almost_equals(0.0139, float(bpdf.most_common_al_maf.iloc[0]), places=3) + + def test_0cov_regionwithcov(self): + test = open(ospj(DATA_PATH, "mpileup_0cov_regionwithcov.tsv")).read() + bpdf = sufam.__main__.get_baseparser_extended_df("test", [mpileup_parser.parse(test)], "G", "GAA") + assert_equals(None, bpdf)