Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions ncm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down