Bug: camera raises IndexError with 3-column design and non-unit contrast
Version: latest (pip)
Description:
Calling camera with a 3-column design matrix and a contrast vector of length 3 raises an IndexError inside _camera_default.
Minimal reproducible example:
import numpy as np
import edgepython as ep
counts = np.random.poisson(lam=10, size=(1000, 9))
group = np.array(['U'] * 3 + ['D'] * 3 + ['L'] * 3)
design = np.column_stack([
np.ones(9),
(group == 'D').astype(float),
(group == 'L').astype(float)
])
y = ep.make_dgelist(counts=counts, group=group)
y = ep.calc_norm_factors(y)
y = ep.estimate_disp(y, design=design)
index = {'set1': list(range(50))}
res = ep.camera(y, index=index, design=design, contrast=np.array([0, 0.5, 0.5]))
Traceback:
File .../edgepython/gene_sets.py:295, in _camera_default
if R_reduced[p - 1, p - 1] < 0:
IndexError: index 2 is out of bounds for axis 0 with size 1
Root cause (suspected):
In _camera_default, the design matrix appears to be reduced to a single column before the QR decomposition, so R_reduced is 1×1. With a 3-column design, p-1 = 2 is then out of bounds.
Expected behavior:
camera should handle a multi-column design with a non-unit contrast vector, consistent with the behavior of camera.DGEList in edgeR.
Bug:
cameraraisesIndexErrorwith 3-column design and non-unit contrastVersion: latest (pip)
Description:
Calling
camerawith a 3-column design matrix and a contrast vector of length 3 raises anIndexErrorinside_camera_default.Minimal reproducible example:
Traceback:
Root cause (suspected):
In
_camera_default, the design matrix appears to be reduced to a single column before the QR decomposition, soR_reducedis 1×1. With a 3-column design,p-1 = 2is then out of bounds.Expected behavior:
camerashould handle a multi-column design with a non-unit contrast vector, consistent with the behavior ofcamera.DGEListin edgeR.