File: MAE-curatedMetagenomicData.Rmd

package info (click to toggle)
r-bioc-multiassayexperiment 1.32.0%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,028 kB
  • sloc: makefile: 2
file content (75 lines) | stat: -rw-r--r-- 1,907 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
---
title: "Making use of curatedMetagenomicData"
author: "Levi Waldron"
date: "1/11/2017"
output: html_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE, eval = FALSE)
```

# Fetch from `curatedMetagenomicData`

Download the data as an `ExpressionSet` list:

```{r, cache=FALSE}
library(curatedMetagenomicData)
esetlist <- list(taxa = ZellerG_2014.metaphlan_bugs_list.stool()[, 1:10],
                 pathways = ZellerG_2014.pathabundance_relab.stool())
## species and strain-level taxa only:
esetlist$taxa <- esetlist$taxa[grep("s__", rownames(esetlist$taxa)), ]
## eliminate taxa-specific pathway contributions (only total pathway abundances):
esetlist$pathways <- esetlist$pathways[grep("g__", 
                                  rownames(esetlist$pathways), invert=TRUE), ]
```

Create the `MultiAssayExperiment`:

```{r}
library(MultiAssayExperiment)
cmd <- MultiAssayExperiment(experiments=esetlist, 
    colData=colData(as(esetlist[[2]], "SummarizedExperiment")))
cmd
rownames(cmd)
```

## CCA with omicade4

```{r}
library(omicade4)
cmdsub <- cmd[, cmd$disease %in% c("adenoma", "CRC", "healthy"), ]
##Get rid of rows that are all zero:
cmdsub <- cmdsub[lapply(assays(cmdsub), function(exper) rowSums(exper) > 0), ]

mcoin <- mcia(assay(cmdsub))
plot(mcoin, phenovec=cmdsub$disease, sample.lab=FALSE)
```

## iClusterPlus

Error, "system is computationally singular"
```{r, eval=FALSE}
library(iClusterPlus)
datasets = assay(cmdsub)
datasets = lapply(datasets, t)
iclus = iCluster(datasets=datasets, k=5, lambda=c(0.2, 0.2))
plotiCluster(fit=iclus, label=cmdsub$disease)
```

## sparse CCA

```{r}
library(PMA)
cmd2 <- mergeReplicates(intersectColumns(cmd))
## ERROR: some columns have SD = 0
mycca <- PMA::CCA(x=t(assay(cmd2, 1)), z=t(assay(cmd2, 2)))
mycca
```

# Others to try
```{r, eval=FALSE}
library(made4)
library(MCIA)
# library(Rtopper)  # gene set analysis
```