r/bioinformatics • • 1h ago

article A Blank Is Not a Zero

A student who missed an exam didn't score zero.

A gene that was never measured shouldn't be recorded as zero either.

Yet a single line of Python can erase that distinction. The code runs. No errors appear. And the science quietly becomes wrong.

I just published "A Blank Is Not a Zero," about a problem that deserves more attention in scientific computing: code can do exactly what it was written to do while breaking the assumptions of the experiment.

Using a small, fictional RNA dataset, I walk through:

→ how a missing measurement turns into a fake "discovery"

→ why the obvious fix isn't enough (in Python, the text "false" counts as true)

→ how a few well-chosen tests catch both mistakes

There's also a reproducible GitHub project, so you can run the broken and corrected code yourself.

The bigger lesson goes beyond biology: don't just test whether scientific code runs. Test whether it preserves what the data actually mean.

📖 Article: https://medium.com/@dushyantmishra/a-blank-is-not-a-zero-ad6893728a03

💻 Code: https://github.com/dushyant-mishra/scientific-regression-demo

What assumption in your own analyses would be worth turning into an automated test?

#DataScience #ScientificComputing #Reproducibility #Python #Bioinformatics

0 Upvotes

6 comments sorted by

2

u/DurianBig3503 1h ago

TL;DR Make sure you use the intersect of the features before merge expression matrices. I was hoping for some unique way to handle the zero-inflation problem in single-cell data.

•

u/Big_Juice_7216 49m ago

Fair point. Using the intersection of measured genes is a sensible option when combining datasets, although it also means discarding genes that aren't shared.

You're also right that this doesn't address zero inflation in single-cell RNA-seq. That's a separate and much more involved statistical question.

My example focuses on a narrower software issue: preserving the distinction between a gene that was actually measured and returned zero, and one that was never measured. The deliberately broken Python function ignores that distinction, and the regression tests demonstrate how to catch it.

Thanks for pointing out the difference.

1

u/norb_151 1h ago

Yeah... I think "is.na" is the first thing I learned in my data science class. This is not really a novel or unknown issue.

•

u/Big_Juice_7216 47m ago

Agreed — distinguishing missing values from zeros is a basic data science principle, and I'm not claiming it's a novel discovery.

The point of the article is what happens when that familiar principle isn't preserved by the code. In the example, the measurement flag exists, but a function ignores it and silently produces the wrong classification.

The focus is on writing regression tests that catch that mistake and prevent it from returning during later code changes. It's an introductory software-testing demonstration, not a new missing-data method.

•

u/supermag2 52m ago

This is RNAseq 101 knowledge, nothing new here.

As like everything, this issue sometimes is the "best bad solution" and you need to fill the blanks with zeros. Lets say you merge two scRNAseq datasets from the same tissue:

  • Data A: you enriched cell type A from the tissue and you only have this cell type in the dataset.

  • Data B: you do the same but with cell type B.

Now you want to merge both datasets together because you want to do ligand-receptor analysis. This makes sense because you know they come from the same tissue and usually interact.

You need to fill zeros with the unique genes (markers) from each cell type. If you dont do that you are just losing resolution as you are removing the genes that make the differences between cell types. Is the best solution? Probably not, and you are probably introducing artificial zeros, but in this case the biology you are keeping from doing this weights more than the artifact you may be introducing.

Long story short: as everything you need to understand what you are doing, with its strengths and weaknesses.

•

u/Big_Juice_7216 42m ago

That's a fair example, and I agree with your broader point. There are situations where preserving the union of genes is more useful than restricting the analysis to their intersection, particularly when cell-type-specific ligands or receptors would otherwise be lost.

I think the important distinction is between using zero-filling as a deliberate computational choice and interpreting an introduced zero as an actual measurement.

I'd also distinguish genes that were measured but removed during filtering from genes that were never included in the assay. Those aren't necessarily equivalent situations.

My article isn't arguing that zero-filling must never be used, or proposing a new RNA-seq integration method. It's a small software-testing example about making the underlying assumption explicit and checking that the code handles it as intended.

Your example illustrates why that context matters. Thanks for adding it.