Skip to content

Commit

Permalink
add missing import, arguments related to cht_data
Browse files Browse the repository at this point in the history
  • Loading branch information
gmcvicker committed Sep 4, 2016
1 parent 03b15d1 commit 753fe25
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
11 changes: 6 additions & 5 deletions CHT/cht_data.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import sys
import gzip

import os
import numpy as np

class TestSNP:
Expand Down Expand Up @@ -143,7 +143,8 @@ def open_input_files(in_filename):



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

nrow = count_matrix.shape[0]
if (options.sample > 0) and (options.sample < count_matrix.shape):
if (sample > 0) and (sample < count_matrix.shape):
# randomly sample subset of rows without replacement
sys.stderr.write("randomly sampling %d target regions\n" % options.sample)
sys.stderr.write("randomly sampling %d target regions\n" % sample)
samp_index = np.arange(nrow)
np.random.shuffle(samp_index)
samp_index = samp_index[:options.sample]
samp_index = samp_index[:sample]
count_matrix = count_matrix[samp_index,]
expected_matrix = expected_matrix[samp_index,]

Expand Down
3 changes: 2 additions & 1 deletion CHT/fit_bnb_coefficients.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ def main():
shuffle=False,
skip=options.skip,
min_counts=options.min_counts,
min_as_counts=options.min_as_counts)
min_as_counts=options.min_as_counts,
sample=options.sample)

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

0 comments on commit 753fe25

Please sign in to comment.