diff --git a/ncm.py b/ncm.py index 0bff27c..56c4d03 100644 --- a/ncm.py +++ b/ncm.py @@ -56,7 +56,9 @@ def pearson_def(x, y): xdiff2 += xdiff * xdiff ydiff2 += ydiff * ydiff - return diffprod / math.sqrt(xdiff2 * ydiff2) + sqrt_xdiff2_ydiff2 = math.sqrt(xdiff2 * ydiff2) + + return diffprod / sqrt_xdiff2_ydiff2 if sqrt_xdiff2_ydiff2 != 0.0 else 0.0 # createDataSet # base_dir : directory of files, bedFile: name of the bedFile @@ -251,7 +253,7 @@ def createDataSetFromList(base_list, bedFile): link = line.strip() f = open(link, "r") dbsnpf= open(bedFile,"r") - file = link[link.rindex("/")+1:] + file = os.path.basename(link) depth = dict() depth[file] = 0 real_count[file] = 0