10 Differential abundance testing for univariate data

This section covers basic univariate tests for two-group comparison, covering t-test, Wilcoxon test, and multiple testing. You can try out the suggested exercises in the hands-on session. These are followed by example solutions which we will cover in more detail in the class.

10.1 Load example data

The following example compares the abundance of a selected bug between two conditions. We assume that the data is already properly normalized.

Abundance Group
Sample-1 5 AAM
Sample-2 23 AFR
Sample-3 6 AFR
Sample-4 24 AFR
Sample-5 6 AFR
Sample-6 38 AFR

10.2 Visual comparison of two groups

Task: Compare the groups visually Tips: boxplot, density plot, histogram

Visualization of the absolute abundances is shown on the left. Let us try the log10 transformation. Now, the data contains many zeros and taking log10 will yield infinite values. Hence we choose the commonly used, although somewhat problematic, log10(1+x) transformation (right).

10.3 Statistical comparison of two groups

Task: Test whether abundance differences are statistically significant between the two groups Tips: t-test (t.test); Wilcoxon test (wilcox.test). Find information on how to use by typing help(t.test) or help(wilcox.test); or by looking for examples from the web.

The groups seem to differ. First, let us perform the t-test. This is based on Gaussian assumptions. Each group is expected to follow Gaussian distribution.

Significance p-value with t-test:

## [1] 0.02554997

According to this, the abundances is not significantly different between the two groups (at \(p<0.05\) level).

10.4 Investigate assumptions of the t-test

Task: Assess whether the abundance data is Gaussian or log-normal within each group You can use for instance histogram (hist) or density plots (plot(density())).

Now let us investigate the Gaussian assumption of the t-test in more detail. Let us try another visualization; the density plot.

Apparently, the data is not even approximately Gaussian distributed. In such cases, a common procedure is to use non-parametric tests. These do not make assumptions of the data distribution but instead compare the ordering of the samples.

So, let us look at the significance p-value with Wilcoxon test (log10 data):

## [1] 0.02979053

But since the test is non-parametric, we can as well use the original absolute abundances; thelog transformation does not change sample ordering on which the Wilcoxon test is based.

Let us verify that the absolute abundances yield the same p-value for Wilcoxon test:

## [1] 0.02979053

10.5 Compare results between parametric and non-parametric tests

Let us compare how much the results would differ in the whole data between t-test (parametric) and Wilcoxon test (non-parametric).To remove non-varying taxa that would demand extra scripting, let us for demonstration purposes now focus on core taxa that are observed in more than 20% of the samples with more than 3 reads.

Compare the distribution of raw and adjusteed p-values.

Now compare these adjusted p-values between t-test and Wilcoxon test. Let us also highlight the p = 0.05 intervals.