Skip to content

Commit 1188f9c

Browse files
authored
Merge pull request #717 from macs3-project/fix/macs3/pvalue_stat
fix pvalue_stat issue that will cause nan result
2 parents 089d398 + 6c01cb8 commit 1188f9c

3 files changed

Lines changed: 784 additions & 388 deletions

File tree

MACS3/Signal/ScoreTrack.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# cython: language_level=3
22
# cython: profile=True
3-
# Time-stamp: <2025-11-16 13:00:03 Tao Liu>
3+
# Time-stamp: <2025-11-20 10:58:03 Tao Liu>
44

55
"""Scoring utilities for MACS3 signal tracks and peak callers.
66
@@ -414,6 +414,7 @@ def compute_pvalue(self):
414414
v: cnp.ndarray
415415
pos: cnp.ndarray
416416
ln: cython.long
417+
tmp_l: cython.long
417418
i: cython.long
418419
prev_pos: cython.long
419420
chrom: bytes
@@ -429,10 +430,11 @@ def compute_pvalue(self):
429430
v[i] = get_pscore(cython.cast(cython.int,
430431
(p[i] + self.pseudocount)),
431432
c[i] + self.pseudocount)
433+
tmp_l = pos[i] - prev_pos
432434
try:
433-
self.pvalue_stat[v[i]] += pos[i] - prev_pos
435+
self.pvalue_stat[v[i]] += tmp_l
434436
except Exception:
435-
self.pvalue_stat[v[i]] = pos[i] - prev_pos
437+
self.pvalue_stat[v[i]] = tmp_l
436438
prev_pos = pos[i]
437439

438440
self.scoring_method = ord('p')

0 commit comments

Comments
 (0)