Skip to content

Commit

Permalink
Write first draft of metagenomic tutorial
Browse files Browse the repository at this point in the history
  • Loading branch information
RiboRings committed Oct 2, 2024
1 parent bd90d0d commit 82ce776
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 2 deletions.
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: iSEEtree
Version: 0.99.6
Version: 0.99.7
Authors@R:
c(person(given = "Giulio", family = "Benedetti", role = c("aut", "cre"),
email = "[email protected]",
Expand Down Expand Up @@ -38,6 +38,7 @@ Imports:
Suggests:
BiocStyle,
knitr,
MGnifyR,
RefManageR,
remotes,
rmarkdown,
Expand Down
2 changes: 1 addition & 1 deletion man/iSEE.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

93 changes: 93 additions & 0 deletions vignettes/metagenomic_data.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
---
title: "Metagenomic Data"
author:
- name: Giulio Benedetti
affiliation: University of Turku
email: [email protected]
date: "`r BiocStyle::doc_date()`"
package: "`r BiocStyle::pkg_ver('iSEEtree')`"
output:
BiocStyle::html_document:
toc_float: true
vignette: >
%\VignetteIndexEntry{Metagenomic Data}
%\VignetteEncoding{UTF-8}
%\VignetteEngine{knitr::rmarkdown}
bibliography: references.bib
runtime: shiny
---

```{r}
# Import packages
library(iSEEtree)
library(mia)
library(MGnifyR)
library(scater)
```

```{r}
# Instantiate mgnify client
mg <- MgnifyClient(useCache = TRUE)
```

```{r}
# Fetch sample accession numbers
samples <- searchAnalysis(mg,
accession = "MGYS00002504",
type = "studies")
```


```{r}
# Fetch samples as TreeSE
tse <- getResult(mg, samples,
get.taxa = TRUE,
get.func = FALSE)
```

```{r}
# Transform counts to relabundance
tse <- transformAssay(tse,
method = "relabundance",
assay.type = "counts")
# Transform relabundance to CLR
tse <- transformAssay(tse,
method = "clr",
assay.type = "relabundance",
pseudocount = TRUE)
# Standardise CLR
tse <- transformAssay(tse,
method = "standardize",
assay.type = "clr",
MARGIN = "features",
name = "clr-z")
```

```{r}
# Estimate alpha diversity
tse <- addAlpha(tse,
index = c("coverage_diversity", "shannon_diversity"),
assay.type = "relabundance")
# Estimate beta diversity
tse <- runMDS(tse,
FUN = vegan::vegdist,
method = "bray",
assay.type = "relabundance")
```

```{r}
# Remove long variables
colData(tse)$study_attributes.study.abstract <- NULL
colData(tse)$sample_sample.desc <- NULL
```

```{r}
# Launch app
if (interactive()) {
iSEE(tse)
}
```

Empty file added vignettes/references.bib
Empty file.

0 comments on commit 82ce776

Please sign in to comment.