File size: 724 Bytes
e3814d7 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | # This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
# --------------------------------------------------------
# a script to help read norm file.
# --------------------------------------------------------
import numpy as np
def read_singlechromosome_norm(external_norm_file, n, cell_line, replace_nan = True):
CHR_norm_File = external_norm_file
CHR_norm_File = CHR_norm_File.replace('#(CHR)', 'chr'+str(n))
CHR_norm_File = CHR_norm_File.replace('#(CELLLINE)', cell_line)
raw = open(CHR_norm_File, 'r').readlines()
norm = np.array(list(map(float, raw)))
if replace_nan:
norm[np.isnan(norm)] = 1
return norm
|