wald_test() with greater/less/lessAbs turns NaN LFCs into stat=0.0, pvalue=0.5
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 82/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- numpy, python
- 领域
- bioinformatics, data
调研方向
从 glm.py 第242–259行附近的 wald_test() 开始,检查 greater、less 和 lessAbs 分支。使用 issue 中全零基因的示例重现问题,然后添加或运行一个有针对性的测试,确认这些备择假设对应的统计量和 p 值为 NaN。回归问题得到覆盖且返回预期的 NaN 值后,即完成。
由索引模型根据 Issue 内容生成。
描述
In glm.py:242-259, wald_test() uses np.fmax/np.fmin (which ignore NaNs) instead of np.maximum/np.minimum. For any gene with LFC = NaN (e.g., an all-zero gene), alt_hypothesis in {"greater", "less", "lessAbs"} returns stat = 0.0 and pvalue = 0.5 instead of NaN (greaterAbs returns NaN via np.sign).
Related: #572, #515.
Source line numbers refer to commit e1eefef.
Reproduction
import numpy as np
import pandas as pd
from pydeseq2.dds import DeseqDataSet
from pydeseq2.ds import DeseqStats
rng = np.random.default_rng(0)
counts = pd.DataFrame(
rng.negative_binomial(5, 0.05, (6, 20)),
index=[f"s{i}" for i in range(6)],
columns=[f"g{i}" for i in range(20)],
)
counts["g1"] = 0 # all-zero gene -> LFC=NaN
meta = pd.DataFrame({"condition": ["KO"] * 3 + ["WT"] * 3}, index=counts.index)
dds = DeseqDataSet(counts=counts, metadata=meta, design="~condition",
fit_type="mean", n_cpus=1, quiet=True)
dds.deseq2()
ds = DeseqStats(dds, contrast=["condition", "WT", "KO"],
alt_hypothesis="greater", lfc_null=1.0, n_cpus=1, quiet=True)
ds.summary()
print(ds.results_df.loc["g1", ["log2FoldChange", "lfcSE", "stat", "pvalue"]])
Expected: stat = NaN and pvalue = NaN (using np.maximum/np.minimum).
Actual, with PyDESeq2 main@e1eefef (also reproduces on v0.7.0, and identically for less and lessAbs):
log2FoldChange NaN
lfcSE NaN
stat 0.0
pvalue 0.5
Name: g1, dtype: float64
Versions
pydeseq2: 0.7.0 (main@e1eefef)
python: 3.12.14
numpy: 2.5.5
pandas: 3.1.2
scipy: 1.18.1
- 主要语言
- Python
- 星标
- 770
- 派生
- 98
- 平均合并
- 19 小时 55 分钟
- 30 天内合并 PR
- 45
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
scverse/PyDESeq2 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
`lowess` returns 0 for points of an exact fit after robustness iterations可能重新可做 @aviralgarg05 于 15 天前认领,目前没有进行中的 PR。 未关闭bug
难度 2/5 1-3 小时 新手友好度 74/100
scverse/PyDESeq2#520 · 1 条评论 ·
维护者通常 1 天内回复
-
`irls_solver` does not enforce `min_beta` when IRLS converges, and documents `max_beta`'s default as -30可能重新可做 @aviralgarg05 于 15 天前认领,目前没有进行中的 PR。 未关闭bug
难度 2/5 1-3 小时 新手友好度 85/100
scverse/PyDESeq2#521 · 1 条评论 ·
维护者通常 1 天内回复
-
`MAP_dispersions` of refitted genes keep the value from before outlier replacement可能重新可做 @aviralgarg05 于 15 天前认领,目前没有进行中的 PR。 未关闭bug
难度 2/5 1-3 小时 新手友好度 75/100
scverse/PyDESeq2#519 · 1 条评论 ·
维护者通常 1 天内回复
-
`prior_LFC_var` is squared in the Wald test's ridge可能重新可做 关联的 PR 已关闭且未合并。 未关闭bug
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
相似的 Issue
-
Make the "%" unit spacing the same in the web and in A10可能已有人在做 @kragent66-glitch 今天认领。 未关闭bug good first issue
难度 2/5 1-3 小时 新手友好度 74/100
maiychrus25/OpenTea-DX-OS#226 · 1 条评论 ·
-
ci severity: low
难度 2/5 1-3 小时 新手友好度 78/100
TMHSDigital/Spackle#205 ·
维护者通常 1 天内回复
-
pkg:lgm type:chore upstream-gaussx
难度 2/5 1-3 小时 新手友好度 76/100
jejjohnson/pyrox#610 ·
维护者通常 1 天内回复
-
changelog investigate
难度 2/5 1-3 小时 新手友好度 62/100
ramnes/notion-sdk-py#523 ·
-
feature-request
难度 2/5 1-3 小时 新手友好度 78/100
open-telemetry/opentelemetry-python#5994 ·
维护者通常 2 天内回复