Skip to content

Commit

Permalink
Force calculate residuals even for low rank design matrices
Browse files Browse the repository at this point in the history
  • Loading branch information
vals committed Sep 21, 2018
1 parent 24e7568 commit c23b0d3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions NaiveDE/base.py
Expand Up @@ -20,6 +20,12 @@ def lr_tests(sample_info, expression_matrix, alt_model, null_model='~ 1', rcond=
beta_alt, res_alt, rank_alt, s_alt = np.linalg.lstsq(alt_design, expression_matrix.T, rcond=rcond)
beta_null, res_null, rank_null, s_null = np.linalg.lstsq(null_design, expression_matrix.T, rcond=rcond)

if res_alt.shape[0] == 0:
res_alt = np.sum(np.square(expression_matrix.T - alt_design.dot(beta_alt))).values

if res_null.shape[0] == 0:
res_null = np.sum(np.square(expression_matrix.T - null_design.dot(beta_null))).values

if genes is None:
genes = expression_matrix.index

Expand Down

0 comments on commit c23b0d3

Please sign in to comment.