Skip to content

Commit

Permalink
update normalization
Browse files Browse the repository at this point in the history
  • Loading branch information
bchen4 committed Nov 2, 2016
1 parent 3a668a5 commit a2d075f
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions sgrsea/normalization.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,16 @@ def norm(infile,method):
num[num < 0] = 0
if method == "upperquantile":
norm_factor = num.apply(percentile(75),axis=0).astype(float)
smooth_factor = float(norm_factor.mean())
if method == "median":
norm_factor = num.apply(percentile(50),axis=0).astype(float)
smooth_factor = float(norm_factor.mean())
elif method in ["cpm","total"]:
norm_factor = num.apply(np.sum,axis=0).astype(float)
if method == "cpm":
smooth_factor = 10**6 * 1.0
elif method == "total":
smooth_factor = float(norm_factor.mean())
logging.debug(norm_factor)
logging.debug(smooth_factor)
if method == "cpm":
smooth_factor = 10**6 * 1.0
else:
smooth_factor = float(norm_factor.mean())
#logging.debug(norm_factor)
#logging.debug(smooth_factor)
num_norm = num.div(norm_factor/float(smooth_factor),axis="columns")
num_norm = num_norm.applymap(lambda x: x+1)
#num_norm = num_norm.applymap(around)
Expand Down

0 comments on commit a2d075f

Please sign in to comment.