Skip to content

Commit 753fe25

Browse files
committed
add missing import, arguments related to cht_data
1 parent 03b15d1 commit 753fe25

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

CHT/cht_data.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import sys
22
import gzip
3-
3+
import os
44
import numpy as np
55

66
class TestSNP:
@@ -143,7 +143,8 @@ def open_input_files(in_filename):
143143

144144

145145

146-
def read_count_matrices(input_filename, shuffle=False, skip=0, min_counts=0, min_as_counts=0):
146+
def read_count_matrices(input_filename, shuffle=False, skip=0,
147+
min_counts=0, min_as_counts=0, sample=0):
147148
"""Given an input file that contains paths to input files for all individuals, and returns
148149
matrix of observed read counts, and matrix of expected read counts
149150
"""
@@ -210,12 +211,12 @@ def read_count_matrices(input_filename, shuffle=False, skip=0, min_counts=0, min
210211
sys.stderr.write("expect_matrix dimension: %s\n" % str(expected_matrix.shape))
211212

212213
nrow = count_matrix.shape[0]
213-
if (options.sample > 0) and (options.sample < count_matrix.shape):
214+
if (sample > 0) and (sample < count_matrix.shape):
214215
# randomly sample subset of rows without replacement
215-
sys.stderr.write("randomly sampling %d target regions\n" % options.sample)
216+
sys.stderr.write("randomly sampling %d target regions\n" % sample)
216217
samp_index = np.arange(nrow)
217218
np.random.shuffle(samp_index)
218-
samp_index = samp_index[:options.sample]
219+
samp_index = samp_index[:sample]
219220
count_matrix = count_matrix[samp_index,]
220221
expected_matrix = expected_matrix[samp_index,]
221222

CHT/fit_bnb_coefficients.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,8 @@ def main():
152152
shuffle=False,
153153
skip=options.skip,
154154
min_counts=options.min_counts,
155-
min_as_counts=options.min_as_counts)
155+
min_as_counts=options.min_as_counts,
156+
sample=options.sample)
156157

157158
gene_fits = [np.float64(0.005)] * count_matrix.shape[0]
158159
mean_fits = [np.float64(1)] * count_matrix.shape[0]

0 commit comments

Comments
 (0)