Skip to content

Commit

Permalink
Merge pull request #53 from NelleV/adding_test
Browse files Browse the repository at this point in the history
TST Does the bias and normalized matrix match for LOIC?
  • Loading branch information
NelleV committed Dec 16, 2018
2 parents 9fed2e7 + 8e817d5 commit 9c68d04
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion iced/normalization/tests/test_normalization.py
Expand Up @@ -31,9 +31,17 @@ def test_ICE_normalization_cancer():
profile = np.ones(n)
profile[:10] = 0
profile[50:] = 2
normed_X = ICE_normalization(X, eps=1e-10, counts_profile=profile)
normed_X, bias = ICE_normalization(X, eps=1e-10, counts_profile=profile,
output_bias=True)
assert not np.all(np.isnan(normed_X))

normed_X[np.isnan(normed_X)] = 0
mask = np.isnan(bias).flatten()
bias[np.isnan(bias)] = 1
normed_from_bias_X = X / (bias.T * bias)
normed_from_bias_X[mask] = 0
normed_from_bias_X[:, mask] = 0
assert_array_almost_equal(normed_X, normed_from_bias_X, 6)
inferred_profile = normed_X.sum(axis=0)
inferred_profile /= inferred_profile.max()
assert_array_almost_equal(inferred_profile, profile / profile.max())
Expand Down

0 comments on commit 9c68d04

Please sign in to comment.