Relative Abundance Data: A Practical How-To
In this article
Relative abundance data turns raw counts into proportions so you can compare samples fairly. Instead of asking "how many of this microbe (or gene, or species) are there?", you ask "what share of the total does it make up?" — and you calculate that by dividing each count by the sample's total, then usually multiplying by 100 to get a percentage. The catch is the constraint built into the word "relative": every value is expressed as a fraction of a whole that is fixed at 100%. That single fact drives almost every step below, because your analysis has to respect the fact that an increase in one category forces a decrease somewhere else.
The workflow that follows assumes you have a table of counts (samples as rows, taxa or features as columns, integer read counts in the cells) and a tool that can handle compositional data — R, Python, a spreadsheet, or a dedicated microbiome/omics platform. Nothing here requires a specific package, but the steps name the operations rather than a single button so they translate across tools.
What You'll Need
- A count table with samples in rows and features (taxa, genes, ASVs, OTUs) in columns, with integer values. Keep a separate metadata file describing each sample if you plan to compare groups.
- A verified mapping between sample IDs and column headers — mismatches are the most common source of silent errors.
- A spreadsheet program (Excel, Google Sheets, LibreOffice) for quick checks, or R/Python for anything larger than a few dozen samples.
- Your raw counts backed up untouched before any transformation. Never edit the original file in place.
- An awareness of your sequencing depth per sample, so you can decide whether to filter, rarefy, or proceed with relative values directly.
- Statistical tools that handle compositionality — a compositional data package, or log-ratio methods — if you intend to do hypothesis testing rather than just description.
Step-by-Step
- Inspect the count table first. Open it and check for obvious problems: negative numbers, blanks, duplicated sample IDs, and columns that are entirely zero. Decide whether zero-count features should be dropped. A feature present in only one or two samples carries almost no information and can distort later steps.
- Verify the row totals. Sum each sample's counts across all features. These totals (library size or sequencing depth) should be positive and roughly consistent. A sample with a drastically lower total may be under-sequenced or partially failed; note it before transforming anything, because relative abundance will rescale it to 100% and hide the shortfall.
- Filter low-quality or irrelevant features. If you have a taxonomy table, remove non-target reads (host DNA, chloroplast, mitochondria, unassigned taxa) before normalising. Filtering after normalisation is a mistake, because removing rows afterwards breaks the 100% sum you just created.
- Convert counts to relative abundance. For each cell, divide the count by that row's total. In a spreadsheet, put the total in a helper column and use a formula like
=B2/$H2for the first cell, then fill across. Lock the total cell with a dollar sign so it does not drift as you copy. Multiply by 100 if you prefer percentages. In R this issweep(counts, 1, rowSums(counts), "/"); in Python,df.div(df.sum(axis=1), axis=0). - Check that every row now sums to 1 (or 100). This is your proof that the transformation worked. If a row sums to 1.3 or 0.7, a total was misaligned or a cell was excluded from the sum — find and fix it before going further.
- Do your comparison or visualisation. Stacked bar charts, heatmaps, and boxplots of relative abundance all read naturally with this data. When plotting a stacked bar, order features by mean abundance so the dominant taxa sit at the bottom and the chart is comparable across samples.
- Transform again before statistical testing. If you plan to run tests or models, use a log-ratio transformation on the proportions — centred log-ratio (CLR) is the standard choice — rather than testing raw percentages. This is the step most people skip, and skipping it makes many test results unreliable.
- Record what you did. Save the normalisation formula or script, note which features were filtered, and keep the intermediate files. A reviewer or a future you will want to reproduce the exact table.
Common Mistakes
Treating relative abundance like a count. Running a t-test or a linear model directly on proportions produces spurious results, because the values are constrained to sum to one — a change in one taxon is mechanically correlated with changes in all the others. Use log-ratio methods for inference.
Comparing a percentage to a percentage across samples with different depths. \"Taxon X rose from 10% to 20%\" does not mean it doubled in absolute terms. If the second sample was sequenced twice as deeply, the real count might be unchanged. Always keep the row totals on hand and report them alongside the relative values.
Filtering after normalising. This is the single most common mechanical error. Remove unwanted features first, then normalise. Doing it in the reverse order leaves rows that no longer sum to 1.
Misaligned row totals in a spreadsheet. Copying a formula without locking the total reference shifts the denominator as you drag across columns. The row-sum check in step 5 catches this, but only if you actually do it.
Interpreting rare-value differences as biological signal. A taxon at 0.01% versus 0.02% looks like a doubling but is well inside typical sequencing noise. Set a minimum abundance or prevalence threshold and state it in your methods.
Forgetting the zeros. Log-ratio transforms cannot take a logarithm of zero. Use a zero-replacement method appropriate to your package before transforming.
Tips
Keep both the count table and the relative table forever — the count table is your ground truth and the relative table is your presentation layer. When sharing results, include the per-sample totals in a supplementary table so readers can reconstruct absolute values if they wish. Use consistent rounding (two or three significant figures) across every table and figure; mixing two-decimal and four-decimal values makes differences look larger than they are. If you use a spreadsheet, freeze the header row and apply a number format rather than manually typing rounded values. When visualising, group features into higher taxonomic ranks for broad comparisons and use feature level detail only where you have a specific question. Finally, write down your filtering thresholds and normalisation method in the figure legends, not only in a separate log — readers look at the figure first.
Troubleshooting
Rows do not sum to 1. Check for a total that is off by one row (the classic drag-down error), a text value stored as a string that is being ignored by the sum, or a column excluded from the total range. Recompute the totals from scratch rather than patching the formula.
One sample dominates every chart. This may be real, but also check for a depth outlier. If one sample has far fewer reads than the rest, its relative values are noisier. Consider reporting the totals or excluding it, and say why.
Everything sums correctly but statistics look bizarre. You probably tested the proportions directly. Re-run with log-ratio transformed values and zero replacement applied.
Counts contain fractional values. Some pipelines output estimated abundances already. Confirm what your table represents before dividing again — applying a relative transform to an already-relative table destroys the meaning. Worth a check before any downstream step.
Results change every time you re-run. Normalisation is deterministic unless rarefaction or a random seed is involved. If numbers shift, something random is happening; fix the seed and document it.
If that did not work
Start over from the untouched raw counts and follow the order strictly: filter, then total, then divide, then verify, then transform for testing. Most problems resolve when the sequence is enforced, because each later step depends on the earlier one being clean.
Frequently Asked Questions
Should I rarefy before computing relative abundance?
Not necessarily. Relative abundance normalises by division, which does not require equal depths. Rarefaction is a separate choice about how you handle uneven sampling effort; if you use it, do it on the counts before the relative step and state it.
Why does my relative table sum to 100 and not the original total?
That is the definition of relative abundance. The information about original depth is deliberately discarded in the proportions, which is why you must retain the count table separately.
Can relative abundances be added across samples?
Not meaningfully as raw percentages. Averaging percentages across samples gives each sample equal weight regardless of depth. Weight by counts if you need a pooled figure, or report the mean with the spread and the per-sample totals.
What is a compositional data transform?
Any transformation that handles the fixed-sum constraint, most commonly the centred log-ratio, which divides each value by the geometric mean of the row and takes logarithms. Apply it before statistical testing, not before visualisation of proportions.
Do I need to remove zero counts first?
Only for log-based transforms. For plain percentage tables, zeros are fine. For CLR and related methods, replace zeros using the routine your package provides.