import csv


def load_norm_factor (settings, sample):
	""" Load edgeR normalization factors from file
	"""
	norm_facs = {}
	norm_fac_file = settings['None']['output_path']+'norm.factors.matrix.txt'
	data_reader = csv.reader(open(norm_fac_file, 'rU'), delimiter='\t')
	# Ignore the header
	next(data_reader)
	# Process each line
	for row in data_reader:
		if len(row) == 3:
			norm_facs[row[0]] = [float(row[1]), float(row[2])]
	return (norm_facs[sample][0]*norm_facs[sample][1])