---
description: >-
  Here we will analyze a lung microbiome OTU dataset from a Sze et al. COPD
  study using some of Mian's basic features.
---

# Tutorial

## Login&#x20;

Log into the demo account to access sample datasets: [https://mian.hli.ubc.ca/login](https://mian.hli.ubc.ca/login)

![](https://2045057293-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M32ms-dWLPjFImgSINF%2F-MNWgnVygY6U1hra-uyL%2F-MNWkQrmt4oDgk3uBFSh%2Fimage.png?alt=media\&token=97f56aa4-c5a7-4a33-b4e6-fb2c4d61fa84)

## Explore the Projects Dashboard&#x20;

Here we will analyze a lung microbiome data from a COPD study from Sze et al.

![](https://2045057293-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M32ms-dWLPjFImgSINF%2F-MNWgnVygY6U1hra-uyL%2F-MNWnv1LQq_CoZR1Wjrc%2Fimage.png?alt=media\&token=775516ea-16cd-4fa5-979f-a7725bdd176d)

## Composition

Let's start by examining the average phylum composition between the control and COPD samples. Go to Visualize > Barplot (Composition) and set the parameters as shown.&#x20;

![](https://2045057293-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M32ms-dWLPjFImgSINF%2F-MNWgnVygY6U1hra-uyL%2F-MNX8znV11ebiQliBAVh%2Fimage.png?alt=media\&token=4bfbb67a-684b-4187-a0cc-ccffba884cf2)

Notice that the Bacteroidetes look more enriched in the control samples so let's build a boxplot to examine this in more detail.&#x20;

![](https://2045057293-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M32ms-dWLPjFImgSINF%2F-MNWgnVygY6U1hra-uyL%2F-MNX8pra872YQYV9i7dS%2Fimage.png?alt=media\&token=d302834f-9f29-4a5a-ae25-ebdc95656047)

The boxplot shows that this difference is significant under the Wilcoxon Rank-Sum test.&#x20;

## Diversity

Next, let's look at the alpha diversity measures. Here, we'll compare species richness to the surface area measure, as proposed in the original paper. &#x20;

![](https://2045057293-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M32ms-dWLPjFImgSINF%2F-MNWgnVygY6U1hra-uyL%2F-MNX8CLNXTboHhkgsxW9%2Fimage.png?alt=media\&token=e978574a-17fe-4ad5-9983-4f00b4a54397)

Decreasing surface area appears to be correlated with decreasing species richness.&#x20;

What about beta diversity? Note that this tool might take a little bit longer to run because of the permutations. On especially large datasets, the tool might timeout due to resource sharing. If this happens, consider deploying a local instance using a larger host type.

![](https://2045057293-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M32ms-dWLPjFImgSINF%2F-MNWgnVygY6U1hra-uyL%2F-MNX9HbP4dVKq5nN57lI%2Fimage.png?alt=media\&token=26edca88-8906-415b-9fe1-b8c9b3e2d2ca)

Here, we see that there are significant differences between the COPD and control lung bacteria communities.

Because we can, let's also build a 3D PCA plot to visually see the population groupings between the COPD and control samples. Go ahead and rotate it!

![](https://2045057293-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M32ms-dWLPjFImgSINF%2F-MNWgnVygY6U1hra-uyL%2F-MNXAeQJ_sA0VldlcQw9%2Fimage.png?alt=media\&token=e769b134-b551-495e-b8d8-fee4578c0959)

## Saving and Sharing Your Work

Maybe you think the above PCA is a cool finding - we can take a snapshot of this view and save to our notebook. Just press the "Save Snapshot to Notebook" button at the top right. If we go to our notebook (accessible from our home dashboard), we'll see the following:

![](https://2045057293-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M32ms-dWLPjFImgSINF%2F-MNWgnVygY6U1hra-uyL%2F-MNXDFhbPyD7JFeVc0ac%2Fimage.png?alt=media\&token=ab15b337-5369-45a6-a74f-5314a240b589)

Your notebook keeps track of all the parameters you used so if you click "View Original Source", you'll get back to the original plot.&#x20;

You can also download or share your work. Try clicking on the "Share" button.&#x20;

![](https://2045057293-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M32ms-dWLPjFImgSINF%2F-MNWgnVygY6U1hra-uyL%2F-MNXDb5o0B9sfRco_MF_%2Fimage.png?alt=media\&token=1c2f2b2b-b0e9-4dea-bae5-34e3b36c6012)

You can share this unique link with others and they can open the exact same view and start exploring the data. You can disable access at any time.

## Selecting Important Features

Maybe now we want to look for important OTUs. Let's try to use Boruta feature selection to see what OTUs are picked up.

![](https://2045057293-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M32ms-dWLPjFImgSINF%2F-MNWgnVygY6U1hra-uyL%2F-MNXFQcAc5Nt33KdTfDs%2Fimage.png?alt=media\&token=3d073c3a-f581-4cee-b7e0-e74608d47295)

Clicking on any of the OTUs leads to the boxplot for further visualization. For instance, here, let's click on Otu0009.

![](https://2045057293-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M32ms-dWLPjFImgSINF%2F-MNWgnVygY6U1hra-uyL%2F-MNXFbB8sSbIgiaOul3E%2Fimage.png?alt=media\&token=1ae1790c-c861-4467-a547-2277f045c54a)

Here, indeed we see that Otu0009 is important as the control samples are highly enriched for Otu0009.

## Machine Learning

Could we build a classifier to predict COPD status? Let's find out by training a simple logistic regression model on the COPD data.

![](https://2045057293-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M32ms-dWLPjFImgSINF%2F-MNWgnVygY6U1hra-uyL%2F-MNXGGn82N4-LqErDmPv%2Fimage.png?alt=media\&token=15afdeb8-64b2-4576-a3b8-48e0a3845c2b)

We see that the model achieves 0.9375 test accuracy which indicates that the two groups can be distinguished quite easily by the model.

We can also try a deep learning model. However, the COPD data was quite small so it might be difficult to generalize - for this, let's try using the larger Coral dataset.

![](https://2045057293-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M32ms-dWLPjFImgSINF%2F-MNWgnVygY6U1hra-uyL%2F-MNXHALOoHP-Q008VBGW%2Fimage.png?alt=media\&token=ea623cb1-dfef-4f27-a1b1-9b57d7080bd7)

With a two-layer feed-forward neural network with dropout, we can achieve a 0.9711 test accuracy over about 30 epochs.&#x20;

## Conclusions

We explored our dataset from top to bottom. We visualized composition differences, analyzed intra- and inter-community diversity, automatically selected the important OTUs, and trained a few promising machine learning models.&#x20;

There are many other tools not covered here but are ready for you to use - happy exploring!

