You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Zero-coverage control genes silently corrupt output with inf/NaN #11
When a BAM file has no reads covering one or more of the 20 housekeeping/control genes, the tool silently produces inf/NaN values in the output CSV with no warning.
Root cause
In sma.py, when H_ik[i,k] == 0 for any control gene, a chain of silent NumPy floating-point errors occurs:
H_ik[i,k] == 0.0
→ z_ik[i,k] = inf (line 124: c_ix_sum / 0.0)
→ zmean_k[k] = inf (line 127: sum of inf / n_bam)
→ theta_i[i] = nan (line 128-129: inf/inf = nan)
→ pi_ij[i,j] = nan (line 130-131: nan * anything = nan)
A single zero-coverage gene in a single sample corrupts all results for that sample. Furthermore, the inf values in z_ik leak into zmean_k, which is shared across all samples — so a single bad sample can degrade the statistics for every other sample in the batch.
Impact
The user gets no error or warning — just silent NaN in the CSV output
A single problematic BAM file can silently affect results for the entire batch
This is especially likely with downsampled or targeted sequencing data where some control gene regions may have no coverage
Expected behavior
Warn the user (to stderr) which samples have zero-coverage control genes and which genes are affected
Set results to NaN explicitly for affected samples
Exclude affected samples from shared statistics (zmean_k) so healthy samples are not corrupted
Activity
fix: handle zero-coverage control genes gracefully (#11)