Skip to content
This repository was archived by the owner on Oct 21, 2025. It is now read-only.

Commit dbd5a74

Browse files
fixed bug in ttest logfcs
1 parent 89d15c5 commit dbd5a74

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

diffxpy/testing/base.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -739,12 +739,12 @@ def __init__(self, data, grouping, gene_ids):
739739
pval[idx_tt] = stats.t_test_raw(x0=x0[:, idx_tt], x1=x1[:, idx_tt])
740740
self._pval = pval
741741

742+
mean_x0 = np.mean(x0, axis=0)
743+
mean_x0 = mean_x0.clip(np.nextafter(0, 1), np.inf)
742744
mean_x1 = np.mean(x1, axis=0)
743745
mean_x1 = mean_x1.clip(np.nextafter(0, 1), np.inf)
744-
mean_x2 = np.mean(x1, axis=0)
745-
mean_x2 = mean_x2.clip(np.nextafter(0, 1), np.inf)
746746

747-
self._logfc = np.log(mean_x1) - np.log(mean_x2).data
747+
self._logfc = np.log(mean_x1) - np.log(mean_x0).data
748748
# Return 0 if LFC was non-zero and variances are zero,
749749
# this causes division by zero in the test statistic. This
750750
# is a highly significant result if one believes the variance estimate.

0 commit comments

Comments
 (0)