Skip to content

Commit af9b49e

Browse files
committed
Fix n_bootstrap for LRT
1 parent 04476bd commit af9b49e

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

mixalime/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = '2.2.10'
1+
__version__ = '2.2.11'
22
import importlib
33

44
__min_reqs__ = [

mixalime/diff.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ def get_closest_param(params: dict, slc: float, model_name: str, compute_line=Fa
203203

204204
def lrt_test(counts: Tuple[tuple, np.ndarray, np.ndarray, np.ndarray],
205205
inst_params: dict, params: dict, skip_failures=False, max_sz=None, bad=1.0,
206-
param_mode='window'):
206+
param_mode='window', n_bootstrap=0):
207207
if not hasattr(lrt_test, '_cache'):
208208
lrt_test._cache = dict()
209209
snv, counts_a, counts_b, counts = counts
@@ -219,11 +219,11 @@ def lrt_test(counts: Tuple[tuple, np.ndarray, np.ndarray, np.ndarray],
219219
if allele == 'alt':
220220
counts_a = counts_a[:, (1, 0, 2)]; counts_b = counts_b[:, (1, 0, 2)]; counts = counts[:, (1, 0, 2)]
221221
try:
222-
ab_r, ab_logl = model.fit(counts, params[allele], False)
222+
ab_r, ab_logl = model.fit(counts, params[allele], False, n_bootstrap=n_bootstrap)
223223
ab_p = ab_r.x
224-
a_r, a_logl = model.fit(counts_a, params[allele], False)
224+
a_r, a_logl = model.fit(counts_a, params[allele], False, n_bootstrap=n_bootstrap)
225225
a_p = a_r.x
226-
b_r, b_logl = model.fit(counts_b, params[allele], False)
226+
b_r, b_logl = model.fit(counts_b, params[allele], False, n_bootstrap=n_bootstrap)
227227
b_p = b_r.x
228228
success = a_r.success & b_r.success & ab_r.success
229229
if not success and skip_failures:
@@ -350,7 +350,7 @@ def differential_test(name: str, group_a: List[str], group_b: List[str], mode='w
350350
cols = ['ref_pval', 'ref_p_ab', 'ref_p_a', 'ref_p_b',
351351
'alt_pval', 'alt_p_ab', 'alt_p_a', 'alt_p_b']
352352
test_fun = partial(lrt_test, inst_params=inst_params, params=params, skip_failures=False, bad=bad,
353-
param_mode=param_mode)
353+
param_mode=param_mode, n_bootstrap=n_bootstrap)
354354
else:
355355
cols = ['ref_pval', 'ref_p_a', 'ref_p_b', 'ref_std_a', 'ref_std_b',
356356
'alt_pval', 'alt_p_a', 'alt_p_b', 'alt_std_a', 'alt_std_b']

0 commit comments

Comments
 (0)